@graupl/graupl 1.0.0-beta.10 → 1.0.0-beta.12

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 (480) hide show
  1. package/dist/js/accordion.js +5 -0
  2. package/dist/js/accordion.js.map +1 -0
  3. package/dist/js/alert.js +5 -0
  4. package/dist/js/alert.js.map +1 -0
  5. package/dist/js/carousel.js +5 -0
  6. package/dist/js/carousel.js.map +1 -0
  7. package/dist/js/component/accordion.cjs.js +5 -0
  8. package/dist/js/component/accordion.cjs.js.map +1 -0
  9. package/dist/js/component/accordion.es.js +5 -0
  10. package/dist/js/component/accordion.es.js.map +1 -0
  11. package/dist/js/component/accordion.iife.js +5 -0
  12. package/dist/js/component/accordion.iife.js.map +1 -0
  13. package/dist/js/component/alert.cjs.js +5 -0
  14. package/dist/js/component/alert.cjs.js.map +1 -0
  15. package/dist/js/component/alert.es.js +5 -0
  16. package/dist/js/component/alert.es.js.map +1 -0
  17. package/dist/js/component/alert.iife.js +5 -0
  18. package/dist/js/component/alert.iife.js.map +1 -0
  19. package/dist/js/component/carousel.cjs.js +5 -0
  20. package/dist/js/component/carousel.cjs.js.map +1 -0
  21. package/dist/js/component/carousel.es.js +5 -0
  22. package/dist/js/component/carousel.es.js.map +1 -0
  23. package/dist/js/component/carousel.iife.js +5 -0
  24. package/dist/js/component/carousel.iife.js.map +1 -0
  25. package/dist/js/generator/accordion.cjs.js +5 -0
  26. package/dist/js/generator/accordion.cjs.js.map +1 -0
  27. package/dist/js/generator/accordion.es.js +5 -0
  28. package/dist/js/generator/accordion.es.js.map +1 -0
  29. package/dist/js/generator/accordion.iife.js +5 -0
  30. package/dist/js/generator/accordion.iife.js.map +1 -0
  31. package/dist/js/generator/alert.cjs.js +5 -0
  32. package/dist/js/generator/alert.cjs.js.map +1 -0
  33. package/dist/js/generator/alert.es.js +5 -0
  34. package/dist/js/generator/alert.es.js.map +1 -0
  35. package/dist/js/generator/alert.iife.js +5 -0
  36. package/dist/js/generator/alert.iife.js.map +1 -0
  37. package/dist/js/generator/carousel.cjs.js +5 -0
  38. package/dist/js/generator/carousel.cjs.js.map +1 -0
  39. package/dist/js/generator/carousel.es.js +5 -0
  40. package/dist/js/generator/carousel.es.js.map +1 -0
  41. package/dist/js/generator/carousel.iife.js +5 -0
  42. package/dist/js/generator/carousel.iife.js.map +1 -0
  43. package/dist/js/generator/navigation.cjs.js +3 -0
  44. package/dist/js/generator/navigation.cjs.js.map +1 -0
  45. package/dist/js/generator/navigation.es.js +3 -0
  46. package/dist/js/generator/navigation.es.js.map +1 -0
  47. package/dist/js/generator/navigation.iife.js +3 -0
  48. package/dist/js/generator/navigation.iife.js.map +1 -0
  49. package/dist/js/graupl.js +9 -0
  50. package/dist/js/graupl.js.map +1 -0
  51. package/dist/js/navigation.js +3 -0
  52. package/dist/js/navigation.js.map +1 -0
  53. package/package.json +24 -14
  54. package/.browserslistrc +0 -3
  55. package/.czrc +0 -3
  56. package/.devcontainer/devcontainer.json +0 -221
  57. package/.editorconfig +0 -13
  58. package/.env +0 -3
  59. package/.github/CODE_OF_CONDUCT.md +0 -73
  60. package/.github/COMMIT_CONVENTION.md +0 -17
  61. package/.github/CONTRIBUTING.md +0 -86
  62. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -30
  63. package/.github/ISSUE_TEMPLATE/documentation.md +0 -20
  64. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  65. package/.github/SECURITY.md +0 -26
  66. package/.github/dependabot.yml +0 -17
  67. package/.github/pull_request_template.md +0 -5
  68. package/.github/workflows/codeql-analysis.yml +0 -71
  69. package/.github/workflows/docs.yml +0 -66
  70. package/.github/workflows/prerelease.yml +0 -125
  71. package/.github/workflows/release.yml +0 -111
  72. package/.github/workflows/test.yml +0 -78
  73. package/.husky/commit-msg +0 -3
  74. package/.husky/pre-commit +0 -4
  75. package/.prettierignore +0 -12
  76. package/.stylelintignore +0 -9
  77. package/.versionrc.cjs +0 -73
  78. package/.vscode/settings.json +0 -10
  79. package/CHANGELOG.md +0 -559
  80. package/build.js +0 -9
  81. package/combine-at-rules.cjs +0 -61
  82. package/commitlint.config.js +0 -5
  83. package/container/.env +0 -26
  84. package/container/build/app.dockerfile +0 -41
  85. package/container/docker-compose.yml +0 -27
  86. package/dist/js/graupl.cjs.js +0 -7
  87. package/dist/js/graupl.esm.js +0 -2561
  88. package/dist/js/graupl.iife.js +0 -7
  89. package/docs/.vitepress/config.js +0 -108
  90. package/docs/.vitepress/theme/custom.scss +0 -35
  91. package/docs/.vitepress/theme/index.js +0 -4
  92. package/docs/compiling-graupl.md +0 -57
  93. package/docs/components/alert.md +0 -130
  94. package/docs/components/button.md +0 -84
  95. package/docs/components/card.md +0 -369
  96. package/docs/components/index.md +0 -1
  97. package/docs/components/inputgroup.md +0 -159
  98. package/docs/components/menu.md +0 -326
  99. package/docs/components/navigation.md +0 -158
  100. package/docs/content.md +0 -237
  101. package/docs/defaults.md +0 -121
  102. package/docs/forms.md +0 -79
  103. package/docs/functions.md +0 -9
  104. package/docs/getting-started.md +0 -1
  105. package/docs/index.md +0 -1
  106. package/docs/introduction.md +0 -25
  107. package/docs/layout.md +0 -200
  108. package/docs/mixins.md +0 -47
  109. package/docs/state.md +0 -67
  110. package/docs/theme.md +0 -258
  111. package/docs/utilities/alignment.md +0 -411
  112. package/docs/utilities/background.md +0 -192
  113. package/docs/utilities/border.md +0 -268
  114. package/docs/utilities/color.md +0 -348
  115. package/docs/utilities/container.md +0 -3
  116. package/docs/utilities/display.md +0 -3
  117. package/docs/utilities/flex.md +0 -3
  118. package/docs/utilities/gradient.md +0 -3
  119. package/docs/utilities/height.md +0 -3
  120. package/docs/utilities/inset.md +0 -3
  121. package/docs/utilities/justification.md +0 -3
  122. package/docs/utilities/list.md +0 -3
  123. package/docs/utilities/order.md +0 -3
  124. package/docs/utilities/position.md +0 -3
  125. package/docs/utilities/ratio.md +0 -3
  126. package/docs/utilities/responsive-classes.md +0 -3
  127. package/docs/utilities/spacing.md +0 -3
  128. package/docs/utilities/typography.md +0 -3
  129. package/docs/utilities/visibility.md +0 -3
  130. package/docs/utilities/visually-hidden.md +0 -3
  131. package/docs/utilities/width.md +0 -3
  132. package/docs/utilities/z-index.md +0 -3
  133. package/docs/utilities.md +0 -357
  134. package/eslint.config.js +0 -74
  135. package/favicon.ico +0 -0
  136. package/index.html +0 -1214
  137. package/index.js +0 -12
  138. package/lint-staged.config.js +0 -6
  139. package/logo.svg +0 -296
  140. package/packages/core/build.js +0 -9
  141. package/packages/core/dist/css/base/button.css +0 -2
  142. package/packages/core/dist/css/base/button.css.map +0 -1
  143. package/packages/core/dist/css/base/form.css +0 -2
  144. package/packages/core/dist/css/base/form.css.map +0 -1
  145. package/packages/core/dist/css/base/link.css +0 -2
  146. package/packages/core/dist/css/base/link.css.map +0 -1
  147. package/packages/core/dist/css/base/table.css +0 -2
  148. package/packages/core/dist/css/base/table.css.map +0 -1
  149. package/packages/core/dist/css/base.css +0 -2
  150. package/packages/core/dist/css/base.css.map +0 -1
  151. package/packages/core/dist/css/component/accordion.css +0 -5
  152. package/packages/core/dist/css/component/accordion.css.map +0 -1
  153. package/packages/core/dist/css/component/alert.css +0 -2
  154. package/packages/core/dist/css/component/alert.css.map +0 -1
  155. package/packages/core/dist/css/component/card.css +0 -2
  156. package/packages/core/dist/css/component/card.css.map +0 -1
  157. package/packages/core/dist/css/component/carousel.css +0 -2
  158. package/packages/core/dist/css/component/carousel.css.map +0 -1
  159. package/packages/core/dist/css/component/input-group.css +0 -2
  160. package/packages/core/dist/css/component/input-group.css.map +0 -1
  161. package/packages/core/dist/css/component/list.css +0 -2
  162. package/packages/core/dist/css/component/list.css.map +0 -1
  163. package/packages/core/dist/css/component/menu.css +0 -2
  164. package/packages/core/dist/css/component/menu.css.map +0 -1
  165. package/packages/core/dist/css/component/navigation.css +0 -2
  166. package/packages/core/dist/css/component/navigation.css.map +0 -1
  167. package/packages/core/dist/css/component.css +0 -5
  168. package/packages/core/dist/css/component.css.map +0 -1
  169. package/packages/core/dist/css/graupl.css +0 -5
  170. package/packages/core/dist/css/graupl.css.map +0 -1
  171. package/packages/core/dist/css/init.css +0 -2
  172. package/packages/core/dist/css/init.css.map +0 -1
  173. package/packages/core/dist/css/layout/columns.css +0 -2
  174. package/packages/core/dist/css/layout/columns.css.map +0 -1
  175. package/packages/core/dist/css/layout/container.css +0 -2
  176. package/packages/core/dist/css/layout/container.css.map +0 -1
  177. package/packages/core/dist/css/layout/flex-columns.css +0 -2
  178. package/packages/core/dist/css/layout/flex-columns.css.map +0 -1
  179. package/packages/core/dist/css/layout.css +0 -5
  180. package/packages/core/dist/css/layout.css.map +0 -1
  181. package/packages/core/dist/css/normalize.css +0 -2
  182. package/packages/core/dist/css/normalize.css.map +0 -1
  183. package/packages/core/dist/css/state/focus.css +0 -2
  184. package/packages/core/dist/css/state/focus.css.map +0 -1
  185. package/packages/core/dist/css/state.css +0 -2
  186. package/packages/core/dist/css/state.css.map +0 -1
  187. package/packages/core/dist/css/theme/color.css +0 -2
  188. package/packages/core/dist/css/theme/color.css.map +0 -1
  189. package/packages/core/dist/css/theme/typography.css +0 -2
  190. package/packages/core/dist/css/theme/typography.css.map +0 -1
  191. package/packages/core/dist/css/theme.css +0 -2
  192. package/packages/core/dist/css/theme.css.map +0 -1
  193. package/packages/core/dist/css/utilities/alignment.css +0 -2
  194. package/packages/core/dist/css/utilities/alignment.css.map +0 -1
  195. package/packages/core/dist/css/utilities/background.css +0 -2
  196. package/packages/core/dist/css/utilities/background.css.map +0 -1
  197. package/packages/core/dist/css/utilities/border.css +0 -2
  198. package/packages/core/dist/css/utilities/border.css.map +0 -1
  199. package/packages/core/dist/css/utilities/color.css +0 -2
  200. package/packages/core/dist/css/utilities/color.css.map +0 -1
  201. package/packages/core/dist/css/utilities/container.css +0 -2
  202. package/packages/core/dist/css/utilities/container.css.map +0 -1
  203. package/packages/core/dist/css/utilities/display.css +0 -2
  204. package/packages/core/dist/css/utilities/display.css.map +0 -1
  205. package/packages/core/dist/css/utilities/flex.css +0 -2
  206. package/packages/core/dist/css/utilities/flex.css.map +0 -1
  207. package/packages/core/dist/css/utilities/gradient.css +0 -2
  208. package/packages/core/dist/css/utilities/gradient.css.map +0 -1
  209. package/packages/core/dist/css/utilities/height.css +0 -2
  210. package/packages/core/dist/css/utilities/height.css.map +0 -1
  211. package/packages/core/dist/css/utilities/inset.css +0 -2
  212. package/packages/core/dist/css/utilities/inset.css.map +0 -1
  213. package/packages/core/dist/css/utilities/justification.css +0 -2
  214. package/packages/core/dist/css/utilities/justification.css.map +0 -1
  215. package/packages/core/dist/css/utilities/list.css +0 -2
  216. package/packages/core/dist/css/utilities/list.css.map +0 -1
  217. package/packages/core/dist/css/utilities/order.css +0 -2
  218. package/packages/core/dist/css/utilities/order.css.map +0 -1
  219. package/packages/core/dist/css/utilities/position.css +0 -2
  220. package/packages/core/dist/css/utilities/position.css.map +0 -1
  221. package/packages/core/dist/css/utilities/ratio.css +0 -2
  222. package/packages/core/dist/css/utilities/ratio.css.map +0 -1
  223. package/packages/core/dist/css/utilities/spacing.css +0 -2
  224. package/packages/core/dist/css/utilities/spacing.css.map +0 -1
  225. package/packages/core/dist/css/utilities/typography.css +0 -2
  226. package/packages/core/dist/css/utilities/typography.css.map +0 -1
  227. package/packages/core/dist/css/utilities/visibility.css +0 -2
  228. package/packages/core/dist/css/utilities/visibility.css.map +0 -1
  229. package/packages/core/dist/css/utilities/visually-hidden.css +0 -2
  230. package/packages/core/dist/css/utilities/visually-hidden.css.map +0 -1
  231. package/packages/core/dist/css/utilities/width.css +0 -2
  232. package/packages/core/dist/css/utilities/width.css.map +0 -1
  233. package/packages/core/dist/css/utilities/z-index.css +0 -2
  234. package/packages/core/dist/css/utilities/z-index.css.map +0 -1
  235. package/packages/core/dist/css/utilities.css +0 -2
  236. package/packages/core/dist/css/utilities.css.map +0 -1
  237. package/packages/core/package.json +0 -58
  238. package/packages/core/scss/base/button.scss +0 -3
  239. package/packages/core/scss/base/form.scss +0 -3
  240. package/packages/core/scss/base/link.scss +0 -3
  241. package/packages/core/scss/base/table.scss +0 -3
  242. package/packages/core/scss/base.scss +0 -3
  243. package/packages/core/scss/component/accordion.scss +0 -3
  244. package/packages/core/scss/component/alert.scss +0 -3
  245. package/packages/core/scss/component/card.scss +0 -3
  246. package/packages/core/scss/component/carousel.scss +0 -3
  247. package/packages/core/scss/component/input-group.scss +0 -3
  248. package/packages/core/scss/component/list.scss +0 -3
  249. package/packages/core/scss/component/menu.scss +0 -3
  250. package/packages/core/scss/component/navigation.scss +0 -3
  251. package/packages/core/scss/component.scss +0 -3
  252. package/packages/core/scss/graupl.scss +0 -3
  253. package/packages/core/scss/init.scss +0 -3
  254. package/packages/core/scss/layout/columns.scss +0 -3
  255. package/packages/core/scss/layout/container.scss +0 -3
  256. package/packages/core/scss/layout/flex-columns.scss +0 -3
  257. package/packages/core/scss/layout.scss +0 -3
  258. package/packages/core/scss/normalize.scss +0 -3
  259. package/packages/core/scss/state/focus.scss +0 -3
  260. package/packages/core/scss/state.scss +0 -3
  261. package/packages/core/scss/theme/color.scss +0 -3
  262. package/packages/core/scss/theme/typography.scss +0 -3
  263. package/packages/core/scss/theme.scss +0 -3
  264. package/packages/core/scss/utilities/alignment.scss +0 -3
  265. package/packages/core/scss/utilities/background.scss +0 -3
  266. package/packages/core/scss/utilities/border.scss +0 -3
  267. package/packages/core/scss/utilities/color.scss +0 -3
  268. package/packages/core/scss/utilities/container.scss +0 -3
  269. package/packages/core/scss/utilities/display.scss +0 -3
  270. package/packages/core/scss/utilities/flex.scss +0 -3
  271. package/packages/core/scss/utilities/gradient.scss +0 -3
  272. package/packages/core/scss/utilities/height.scss +0 -3
  273. package/packages/core/scss/utilities/inset.scss +0 -3
  274. package/packages/core/scss/utilities/justification.scss +0 -3
  275. package/packages/core/scss/utilities/list.scss +0 -3
  276. package/packages/core/scss/utilities/order.scss +0 -3
  277. package/packages/core/scss/utilities/position.scss +0 -3
  278. package/packages/core/scss/utilities/ratio.scss +0 -3
  279. package/packages/core/scss/utilities/spacing.scss +0 -3
  280. package/packages/core/scss/utilities/typography.scss +0 -3
  281. package/packages/core/scss/utilities/visibility.scss +0 -3
  282. package/packages/core/scss/utilities/visually-hidden.scss +0 -3
  283. package/packages/core/scss/utilities/width.scss +0 -3
  284. package/packages/core/scss/utilities/z-index.scss +0 -3
  285. package/packages/core/scss/utilities.scss +0 -3
  286. package/packages/core/src/js/accordion/Accordion.js +0 -1163
  287. package/packages/core/src/js/accordion/AccordionItem.js +0 -496
  288. package/packages/core/src/js/accordion/index.js +0 -10
  289. package/packages/core/src/js/alert/Alert.js +0 -581
  290. package/packages/core/src/js/alert/index.js +0 -11
  291. package/packages/core/src/js/carousel/Carousel.js +0 -1427
  292. package/packages/core/src/js/carousel/index.js +0 -10
  293. package/packages/core/src/js/domHelpers.js +0 -37
  294. package/packages/core/src/js/eventHandlers.js +0 -39
  295. package/packages/core/src/js/navigation/index.js +0 -36
  296. package/packages/core/src/js/storage.js +0 -106
  297. package/packages/core/src/js/validate.js +0 -225
  298. package/packages/core/src/scss/_defaults.scss +0 -184
  299. package/packages/core/src/scss/_index.scss +0 -15
  300. package/packages/core/src/scss/_init.scss +0 -6
  301. package/packages/core/src/scss/_normalize.scss +0 -197
  302. package/packages/core/src/scss/_variables.scss +0 -95
  303. package/packages/core/src/scss/base/_index.scss +0 -6
  304. package/packages/core/src/scss/base/button/_defaults.scss +0 -49
  305. package/packages/core/src/scss/base/button/_index.scss +0 -206
  306. package/packages/core/src/scss/base/button/_mixins.scss +0 -104
  307. package/packages/core/src/scss/base/button/_variables.scss +0 -252
  308. package/packages/core/src/scss/base/form/_defaults.scss +0 -24
  309. package/packages/core/src/scss/base/form/_index.scss +0 -227
  310. package/packages/core/src/scss/base/form/_variables.scss +0 -245
  311. package/packages/core/src/scss/base/link/_defaults.scss +0 -35
  312. package/packages/core/src/scss/base/link/_index.scss +0 -245
  313. package/packages/core/src/scss/base/link/_variables.scss +0 -370
  314. package/packages/core/src/scss/base/table/_defaults.scss +0 -68
  315. package/packages/core/src/scss/base/table/_index.scss +0 -314
  316. package/packages/core/src/scss/base/table/_variables.scss +0 -309
  317. package/packages/core/src/scss/component/_index.scss +0 -10
  318. package/packages/core/src/scss/component/accordion/_defaults.scss +0 -40
  319. package/packages/core/src/scss/component/accordion/_index.scss +0 -198
  320. package/packages/core/src/scss/component/accordion/_variables.scss +0 -356
  321. package/packages/core/src/scss/component/alert/_defaults.scss +0 -49
  322. package/packages/core/src/scss/component/alert/_index.scss +0 -119
  323. package/packages/core/src/scss/component/alert/_variables.scss +0 -200
  324. package/packages/core/src/scss/component/card/_defaults.scss +0 -32
  325. package/packages/core/src/scss/component/card/_index.scss +0 -212
  326. package/packages/core/src/scss/component/card/_variables.scss +0 -216
  327. package/packages/core/src/scss/component/carousel/_defaults.scss +0 -43
  328. package/packages/core/src/scss/component/carousel/_index.scss +0 -192
  329. package/packages/core/src/scss/component/carousel/_variables.scss +0 -104
  330. package/packages/core/src/scss/component/input-group/_defaults.scss +0 -30
  331. package/packages/core/src/scss/component/input-group/_index.scss +0 -47
  332. package/packages/core/src/scss/component/input-group/_variables.scss +0 -66
  333. package/packages/core/src/scss/component/list/_defaults.scss +0 -15
  334. package/packages/core/src/scss/component/list/_index.scss +0 -52
  335. package/packages/core/src/scss/component/list/_variables.scss +0 -236
  336. package/packages/core/src/scss/component/menu/_defaults.scss +0 -57
  337. package/packages/core/src/scss/component/menu/_index.scss +0 -308
  338. package/packages/core/src/scss/component/menu/_variables.scss +0 -642
  339. package/packages/core/src/scss/component/navigation/_defaults.scss +0 -23
  340. package/packages/core/src/scss/component/navigation/_index.scss +0 -190
  341. package/packages/core/src/scss/component/navigation/_variables.scss +0 -290
  342. package/packages/core/src/scss/functions/_container.scss +0 -38
  343. package/packages/core/src/scss/functions/_important.scss +0 -36
  344. package/packages/core/src/scss/functions/_screen.scss +0 -38
  345. package/packages/core/src/scss/functions/_theme.scss +0 -39
  346. package/packages/core/src/scss/functions/_utility.scss +0 -28
  347. package/packages/core/src/scss/layout/_index.scss +0 -5
  348. package/packages/core/src/scss/layout/columns/_defaults.scss +0 -24
  349. package/packages/core/src/scss/layout/columns/_index.scss +0 -137
  350. package/packages/core/src/scss/layout/columns/_variables.scss +0 -55
  351. package/packages/core/src/scss/layout/container/_defaults.scss +0 -35
  352. package/packages/core/src/scss/layout/container/_index.scss +0 -628
  353. package/packages/core/src/scss/layout/container/_variables.scss +0 -114
  354. package/packages/core/src/scss/layout/flex-columns/_defaults.scss +0 -28
  355. package/packages/core/src/scss/layout/flex-columns/_index.scss +0 -184
  356. package/packages/core/src/scss/layout/flex-columns/_variables.scss +0 -30
  357. package/packages/core/src/scss/mixins/_animation.scss +0 -15
  358. package/packages/core/src/scss/mixins/_container.scss +0 -80
  359. package/packages/core/src/scss/mixins/_layer.scss +0 -16
  360. package/packages/core/src/scss/mixins/_screen.scss +0 -77
  361. package/packages/core/src/scss/mixins/_state.scss +0 -18
  362. package/packages/core/src/scss/mixins/_theme.scss +0 -15
  363. package/packages/core/src/scss/mixins/_utility.scss +0 -185
  364. package/packages/core/src/scss/mixins/_visually-hidden.scss +0 -30
  365. package/packages/core/src/scss/state/_index.scss +0 -3
  366. package/packages/core/src/scss/state/focus/_defaults.scss +0 -9
  367. package/packages/core/src/scss/state/focus/_index.scss +0 -42
  368. package/packages/core/src/scss/state/focus/_mixins.scss +0 -13
  369. package/packages/core/src/scss/state/focus/_variables.scss +0 -50
  370. package/packages/core/src/scss/theme/_index.scss +0 -4
  371. package/packages/core/src/scss/theme/color/_defaults.scss +0 -143
  372. package/packages/core/src/scss/theme/color/_index.scss +0 -42
  373. package/packages/core/src/scss/theme/color/_variables.scss +0 -133
  374. package/packages/core/src/scss/theme/typography/_defaults.scss +0 -54
  375. package/packages/core/src/scss/theme/typography/_index.scss +0 -120
  376. package/packages/core/src/scss/theme/typography/_variables.scss +0 -248
  377. package/packages/core/src/scss/utilities/_index.scss +0 -23
  378. package/packages/core/src/scss/utilities/_template/_defaults.scss +0 -41
  379. package/packages/core/src/scss/utilities/_template/_index.scss +0 -171
  380. package/packages/core/src/scss/utilities/_template/_variables.scss +0 -6
  381. package/packages/core/src/scss/utilities/alignment/_defaults.scss +0 -76
  382. package/packages/core/src/scss/utilities/alignment/_index.scss +0 -336
  383. package/packages/core/src/scss/utilities/alignment/_variables.scss +0 -6
  384. package/packages/core/src/scss/utilities/background/_defaults.scss +0 -122
  385. package/packages/core/src/scss/utilities/background/_index.scss +0 -634
  386. package/packages/core/src/scss/utilities/background/_variables.scss +0 -6
  387. package/packages/core/src/scss/utilities/border/_defaults.scss +0 -73
  388. package/packages/core/src/scss/utilities/border/_index.scss +0 -558
  389. package/packages/core/src/scss/utilities/border/_variables.scss +0 -6
  390. package/packages/core/src/scss/utilities/color/_defaults.scss +0 -49
  391. package/packages/core/src/scss/utilities/color/_index.scss +0 -469
  392. package/packages/core/src/scss/utilities/color/_variables.scss +0 -6
  393. package/packages/core/src/scss/utilities/container/_defaults.scss +0 -40
  394. package/packages/core/src/scss/utilities/container/_index.scss +0 -174
  395. package/packages/core/src/scss/utilities/container/_variables.scss +0 -6
  396. package/packages/core/src/scss/utilities/display/_defaults.scss +0 -47
  397. package/packages/core/src/scss/utilities/display/_index.scss +0 -184
  398. package/packages/core/src/scss/utilities/display/_variables.scss +0 -6
  399. package/packages/core/src/scss/utilities/flex/_defaults.scss +0 -99
  400. package/packages/core/src/scss/utilities/flex/_index.scss +0 -486
  401. package/packages/core/src/scss/utilities/flex/_variables.scss +0 -6
  402. package/packages/core/src/scss/utilities/gradient/_defaults.scss +0 -70
  403. package/packages/core/src/scss/utilities/gradient/_index.scss +0 -696
  404. package/packages/core/src/scss/utilities/gradient/_variables.scss +0 -29
  405. package/packages/core/src/scss/utilities/height/_defaults.scss +0 -54
  406. package/packages/core/src/scss/utilities/height/_index.scss +0 -525
  407. package/packages/core/src/scss/utilities/height/_variables.scss +0 -6
  408. package/packages/core/src/scss/utilities/inset/_defaults.scss +0 -55
  409. package/packages/core/src/scss/utilities/inset/_index.scss +0 -258
  410. package/packages/core/src/scss/utilities/inset/_variables.scss +0 -6
  411. package/packages/core/src/scss/utilities/justification/_defaults.scss +0 -73
  412. package/packages/core/src/scss/utilities/justification/_index.scss +0 -333
  413. package/packages/core/src/scss/utilities/justification/_variables.scss +0 -6
  414. package/packages/core/src/scss/utilities/list/_defaults.scss +0 -53
  415. package/packages/core/src/scss/utilities/list/_index.scss +0 -253
  416. package/packages/core/src/scss/utilities/list/_variables.scss +0 -6
  417. package/packages/core/src/scss/utilities/order/_defaults.scss +0 -36
  418. package/packages/core/src/scss/utilities/order/_index.scss +0 -246
  419. package/packages/core/src/scss/utilities/order/_variables.scss +0 -6
  420. package/packages/core/src/scss/utilities/position/_defaults.scss +0 -41
  421. package/packages/core/src/scss/utilities/position/_index.scss +0 -178
  422. package/packages/core/src/scss/utilities/position/_variables.scss +0 -6
  423. package/packages/core/src/scss/utilities/ratio/_defaults.scss +0 -42
  424. package/packages/core/src/scss/utilities/ratio/_index.scss +0 -188
  425. package/packages/core/src/scss/utilities/ratio/_variables.scss +0 -9
  426. package/packages/core/src/scss/utilities/spacing/_defaults.scss +0 -64
  427. package/packages/core/src/scss/utilities/spacing/_index.scss +0 -970
  428. package/packages/core/src/scss/utilities/spacing/_variables.scss +0 -6
  429. package/packages/core/src/scss/utilities/typography/_defaults.scss +0 -58
  430. package/packages/core/src/scss/utilities/typography/_index.scss +0 -1089
  431. package/packages/core/src/scss/utilities/typography/_variables.scss +0 -6
  432. package/packages/core/src/scss/utilities/visibility/_defaults.scss +0 -39
  433. package/packages/core/src/scss/utilities/visibility/_index.scss +0 -173
  434. package/packages/core/src/scss/utilities/visibility/_variables.scss +0 -6
  435. package/packages/core/src/scss/utilities/visually-hidden/_defaults.scss +0 -29
  436. package/packages/core/src/scss/utilities/visually-hidden/_index.scss +0 -189
  437. package/packages/core/src/scss/utilities/visually-hidden/_variables.scss +0 -6
  438. package/packages/core/src/scss/utilities/width/_defaults.scss +0 -54
  439. package/packages/core/src/scss/utilities/width/_index.scss +0 -525
  440. package/packages/core/src/scss/utilities/width/_variables.scss +0 -6
  441. package/packages/core/src/scss/utilities/z-index/_defaults.scss +0 -40
  442. package/packages/core/src/scss/utilities/z-index/_index.scss +0 -173
  443. package/packages/core/src/scss/utilities/z-index/_variables.scss +0 -6
  444. package/packages/core/vite.config.js +0 -28
  445. package/packages/icons/dist/css/base/button.css +0 -2
  446. package/packages/icons/dist/css/base/button.css.map +0 -1
  447. package/packages/icons/dist/css/base/link.css +0 -2
  448. package/packages/icons/dist/css/base/link.css.map +0 -1
  449. package/packages/icons/dist/css/base.css +0 -2
  450. package/packages/icons/dist/css/base.css.map +0 -1
  451. package/packages/icons/dist/css/component/icon.css +0 -2
  452. package/packages/icons/dist/css/component/icon.css.map +0 -1
  453. package/packages/icons/dist/css/component.css +0 -2
  454. package/packages/icons/dist/css/component.css.map +0 -1
  455. package/packages/icons/dist/css/icon.css +0 -2
  456. package/packages/icons/dist/css/icon.css.map +0 -1
  457. package/packages/icons/package.json +0 -48
  458. package/packages/icons/scss/base/button.scss +0 -3
  459. package/packages/icons/scss/base/link.scss +0 -3
  460. package/packages/icons/scss/base.scss +0 -3
  461. package/packages/icons/scss/component/icon.scss +0 -3
  462. package/packages/icons/scss/component.scss +0 -3
  463. package/packages/icons/scss/icon.scss +0 -3
  464. package/packages/icons/src/scss/_index.scss +0 -4
  465. package/packages/icons/src/scss/base/_index.scss +0 -4
  466. package/packages/icons/src/scss/base/button/_defaults.scss +0 -7
  467. package/packages/icons/src/scss/base/button/_index.scss +0 -58
  468. package/packages/icons/src/scss/base/button/_variables.scss +0 -7
  469. package/packages/icons/src/scss/base/link/_defaults.scss +0 -7
  470. package/packages/icons/src/scss/base/link/_index.scss +0 -58
  471. package/packages/icons/src/scss/base/link/_variables.scss +0 -7
  472. package/packages/icons/src/scss/component/_index.scss +0 -3
  473. package/packages/icons/src/scss/component/icon/_defaults.scss +0 -30
  474. package/packages/icons/src/scss/component/icon/_index.scss +0 -60
  475. package/packages/icons/src/scss/component/icon/_mixins.scss +0 -62
  476. package/packages/icons/src/scss/component/icon/_variables.scss +0 -24
  477. package/postcss.config.cjs +0 -11
  478. package/prettier.config.js +0 -16
  479. package/stylelint.config.js +0 -22
  480. package/vite.config.js +0 -28
@@ -0,0 +1,5 @@
1
+ function l(t,s){try{if(typeof s!="object"){const i=typeof s;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${i}" given.`)}for(const i in s)if(!(s[i]instanceof t)){const e=typeof s[i];throw new TypeError(`${i} must be an instance of ${t.name}. "${e}" given.`)}return{status:!0,error:null}}catch(i){return{status:!1,error:i}}}function r(t,s){try{if(typeof s!="object"){const i=typeof s;throw new TypeError(`Values given to isValidType() must be inside of an object. "${i}" given.`)}for(const i in s){const e=typeof s[i];if(e!==t)throw new TypeError(`${i} must be a ${t}. "${e}" given.`)}return{status:!0,error:null}}catch(i){return{status:!1,error:i}}}function C(t){try{if(typeof t!="object"){const s=typeof t;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${s}" given.`)}for(const s in t)try{if(t[s]===null)throw new Error;document.querySelector(t[s])}catch{throw new TypeError(`${s} must be a valid query selector. "${t[s]}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function h(t){try{if(typeof t!="object"||Array.isArray(t)){const s=typeof t;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${s}" given.`)}for(const s in t){const i=typeof t[s];if(i!=="string")if(Array.isArray(t[s]))t[s].forEach(e=>{if(typeof e!="string")throw new TypeError(`${s} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${s} must be a string or an array of strings. "${i}" given.`);else{const e={};e[s]=t[s],C(e)}}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function o(t,s){t===""||t.length===0||(typeof t=="string"?s.classList.add(t):s.classList.add(...t))}function a(t,s){t===""||t.length===0||(typeof t=="string"?s.classList.remove(t):s.classList.remove(...t))}function d(t){try{const s=t.key||t.keyCode,i={Enter:s==="Enter"||s===13,Space:s===" "||s==="Spacebar"||s===32,Escape:s==="Escape"||s==="Esc"||s===27,ArrowUp:s==="ArrowUp"||s==="Up"||s===38,ArrowRight:s==="ArrowRight"||s==="Right"||s===39,ArrowDown:s==="ArrowDown"||s==="Down"||s===40,ArrowLeft:s==="ArrowLeft"||s==="Left"||s===37,Home:s==="Home"||s===36,End:s==="End"||s===35,Tab:s==="Tab"||s===9};return Object.keys(i).find(e=>i[e]===!0)||""}catch{return""}}function _(t){t.preventDefault(),t.stopPropagation()}function g(t=null){window.Graupl=window.Graupl||{},r("string",{type:t})&&(window.Graupl[t]=window.Graupl[t]||{})}function y(t=null){return r("string",{type:t})?window.Graupl[t]:window.Graupl}function p(t,s={}){r("string",{type:t})&&r("object",{data:s})&&(window.Graupl[t]=s)}function E(t){r("string",{type:t})&&(window.Graupl[t]={})}function T(t,s,i){r("string",{type:t,key:s})&&(window.Graupl[t][s]=i)}function b(t,s){return r("string",{type:t,key:s})?window.Graupl[t][s]:null}function k(t,s){r("string",{type:t,key:s})&&delete window.Graupl[t][s]}var f={initializeStorage:g,getStorage:y,setStorage:p,clearStorage:E,pushToStorage:T,getFromStorage:b,removeFromStorage:k},A=class{_dom={alert:null,controller:null};_hidden=!1;_showClass="";_hideClass="";_transitionClass="";_transitionTimer=150;_key="";_errors=[];_showEvent=new CustomEvent("grauplAlertShow",{bubbles:!0,detail:{alert:this}});_hideEvent=new CustomEvent("grauplAlertHide",{bubbles:!0,detail:{alert:this}});constructor({alertElement:t,controllerElement:s=null,showClass:i="show",hideClass:e="hide",transitionClass:n="transitioning",transitionTimer:u=150,isHidden:c=!1,key:m=null,initialize:w=!1}){this._dom.alert=t,this._dom.controller=s,this._showClass=i||"",this._hideClass=e||"",this._transitionClass=n||"",this._transitionTimer=u,this._hidden=c,this._key=m||"",w&&this.initialize()}initialize(){try{if(!this._validate())throw new Error(`Graupl Alert: cannot initialize alert. The following errors have been found:
2
+ - ${this.errors.join(`
3
+ - `)}`);this._generateKey(),this._setIds(),this._handleClick(),this._handleKeydown(),this._handleKeyup(),f.initializeStorage("alerts"),f.pushToStorage("alerts",this.dom.alert.id,this)}catch(t){console.error(t)}}get dom(){return this._dom}get showClass(){return this._showClass}get hideClass(){return this._hideClass}get transitionClass(){return this._transitionClass}get transitionTimer(){return this._transitionTimer}get key(){return this._key}set showClass(t){h({showClass:t}),this._showClass!==t&&(this._showClass=t)}set hideClass(t){h({hideClass:t}),this._hideClass!==t&&(this._hideClass=t)}set transitionClass(t){h({transitionClass:t}),this._transitionClass!==t&&(this._transitionClass=t)}set transitionTimer(t){r("number",{transitionTimer:t}),this._transitionTimer!==t&&(this._transitionTimer=t)}set key(t){r("string",{value:t}),this._key!==t&&(this._key=t)}_validate(){let t=!0,s;if(this._dom.controller!==null?s=l(HTMLElement,{alertElement:this._dom.alert,controllerElement:this._dom.controller}):s=l(HTMLElement,{alertElement:this._dom.alert}),s.status||(this._errors.push(s.message),t=!1),this._showClass!==""){const n=h({showClass:this._showClass});n.status||(this._errors.push(n.message),t=!1)}if(this._hideClass!==""){const n=h({hideClass:this._hideClass});n.status||(this._errors.push(n.message),t=!1)}if(this._transitionClass!==""){const n=h({transitionClass:this._transitionClass});n.status||(this._errors.push(n.message),t=!1)}const i=r("number",{transitionTimer:this._transitionTimer});i.status||(this._errors.push(i.message),t=!1);const e=r("boolean",{isHidden:this._hidden});return e.status||(this._errors.push(e.message),t=!1),t}_generateKey(t=!1){(this.key===""||t)&&(this.key=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10))}_setIds(){this.dom.alert.id=this.dom.alert.id||`alert-${this.key}`,this.dom.controller.id=this.dom.controller.id||`alert-controller-${this.key}`}show(t=!0){this._hidden&&(this.transitionClass!==""?(o(this.transitionClass,this.dom.alert),requestAnimationFrame(()=>{this.hideClass!==""&&a(this.hideClass,this.dom.alert),requestAnimationFrame(()=>{this.showClass!==""&&o(this.showClass,this.dom.alert),requestAnimationFrame(()=>{a(this.transitionClass,this.dom.alert)})})})):(this.showClass!==""&&o(this.showClass,this.dom.alert),this.hideClass!==""&&a(this.hideClass,this.dom.alert)),this._hidden=!1,t&&this.dom.alert.dispatchEvent(this._hideEvent))}hide(t=!0){this._hidden||(this.transitionClass!==""?(o(this.transitionClass,this.dom.alert),requestAnimationFrame(()=>{this.showClass!==""&&a(this.showClass,this.dom.alert),requestAnimationFrame(()=>{this.transitionTimer>0?setTimeout(()=>{this.hideClass!==""&&o(this.hideClass,this.dom.alert),requestAnimationFrame(()=>{a(this.transitionClass,this.dom.alert)})},this.transitionTimer):(this.hideClass!==""&&o(this.hideClass,this.dom.alert),requestAnimationFrame(()=>{a(this.transitionClass,this.dom.alert)}))})})):(this.hideClass!==""&&o(this.hideClass,this.dom.alert),this.showClass!==""&&a(this.showClass,this.dom.alert)),this._hidden=!0,t&&this.dom.alert.dispatchEvent(this._hideEvent))}_handleClick(){this.dom.controller!==null&&this.dom.controller.addEventListener("pointerup",()=>this.hide())}_handleKeydown(){this.dom.controller!==null&&this.dom.controller.addEventListener("keydown",t=>{const s=d(t);(s==="Space"||s==="Enter")&&_(t)})}_handleKeyup(){this.dom.controller!==null&&this.dom.controller.addEventListener("keyup",t=>{const s=d(t);(s==="Space"||s==="Enter")&&this.hide()})}},S=A;export{S as default};
4
+
5
+ //# sourceMappingURL=alert.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.es.js","names":["isValidInstance","contructor","elements","elementsType","TypeError","key","elementType","name","status","error","isValidType","type","values","valuesType","valueType","isQuerySelector","Error","document","querySelector","isValidClassList","Array","isArray","forEach","value","obj","isTag","tagName","HTMLElement","tag","toLowerCase","check","addClass","className","element","length","classList","add","removeClass","remove","keyPress","event","key","keyCode","keys","Enter","Space","Escape","ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End","Tab","Object","find","preventEvent","preventDefault","stopPropagation","isValidType","initializeStorage","type","window","Graupl","getStorage","setStorage","data","clearStorage","pushToStorage","key","value","getFromStorage","removeFromStorage","isValidClassList","isValidInstance","isValidType","addClass","removeClass","keyPress","preventEvent","storage","Alert","_dom","alert","controller","_hidden","_showClass","_hideClass","_transitionClass","_transitionTimer","_key","_errors","_showEvent","CustomEvent","bubbles","detail","_hideEvent","constructor","alertElement","controllerElement","showClass","hideClass","transitionClass","transitionTimer","isHidden","key","initialize","_validate","Error","errors","join","_generateKey","_setIds","_handleClick","_handleKeydown","_handleKeyup","initializeStorage","pushToStorage","dom","id","error","console","value","check","htmlElementChecks","HTMLElement","status","push","message","showClassCheck","hideClassCheck","transitionClassCheck","transitionTimerCheck","hiddenCheck","regenerate","Math","random","toString","replace","substring","show","emit","requestAnimationFrame","dispatchEvent","hide","setTimeout","addEventListener","event"],"sources":["../../../packages/core/src/js/validate.js","../../../packages/core/src/js/domHelpers.js","../../../packages/core/src/js/eventHandlers.js","../../../packages/core/src/js/storage.js","../../../packages/core/src/js/alert/Alert.js"],"sourcesContent":["/**\n * Check to see if the provided elements have a specific contructor.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking instanceof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {object} contructor - The constructor to check for.\n * @param {object} elements - The element(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidInstance(contructor, elements) {\n try {\n if (typeof elements !== \"object\") {\n const elementsType = typeof elements;\n\n throw new TypeError(\n `Elements given to isValidInstance() must be inside of an object. \"${elementsType}\" given.`\n );\n }\n\n for (const key in elements) {\n if (!(elements[key] instanceof contructor)) {\n const elementType = typeof elements[key];\n throw new TypeError(\n `${key} must be an instance of ${contructor.name}. \"${elementType}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are of a specific type.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking typeof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {string} type - The type to check for.\n * @param {object} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidType(type, values) {\n try {\n if (typeof values !== \"object\") {\n const valuesType = typeof values;\n\n throw new TypeError(\n `Values given to isValidType() must be inside of an object. \"${valuesType}\" given.`\n );\n }\n\n for (const key in values) {\n const valueType = typeof values[key];\n\n if (valueType !== type) {\n throw new TypeError(`${key} must be a ${type}. \"${valueType}\" given.`);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided values are valid query selectors.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isQuerySelector(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isQuerySelector() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n try {\n if (values[key] === null) {\n throw new Error();\n }\n\n document.querySelector(values[key]);\n } catch {\n throw new TypeError(\n `${key} must be a valid query selector. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided value is either a string or an array of strings.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string, string[]>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidClassList(values) {\n try {\n if (typeof values !== \"object\" || Array.isArray(values)) {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidClassList() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n const type = typeof values[key];\n\n if (type !== \"string\") {\n if (Array.isArray(values[key])) {\n values[key].forEach((value) => {\n if (typeof value !== \"string\") {\n throw new TypeError(\n `${key} must be a string or an array of strings. An array containing non-strings given.`\n );\n }\n });\n } else {\n throw new TypeError(\n `${key} must be a string or an array of strings. \"${type}\" given.`\n );\n }\n } else {\n const obj = {};\n obj[key] = values[key];\n\n isQuerySelector(obj);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided elements are using a specific tag.\n *\n * The elements must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `true` if the check is successful.\n *\n * @param {string} tagName - The name of the tag.\n * @param {Object<HTMLElement>} elements - The element(s) to check.\n * @return {boolean} - The result of the check.\n */\nexport function isTag(tagName, elements) {\n if (\n isValidType(\"string\", { tagName }).status &&\n isValidInstance(HTMLElement, elements).status\n ) {\n const tag = tagName.toLowerCase();\n let check = true;\n\n for (const key in elements) {\n if (elements[key].tagName.toLowerCase() !== tag) check = false;\n }\n\n return check;\n } else {\n return false;\n }\n}\n","/**\n * Add a class or array of classes to an element.\n *\n * @param {string|string[]} className - The class or classes to add.\n * @param {HTMLElement} element - The element to add the class to.\n */\nexport function addClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.add(className);\n } else {\n element.classList.add(...className);\n }\n}\n\n/**\n * Remove a class or array of classes from an element.\n *\n * @param {string|string[]} className - The class or classes to remove.\n * @param {HTMLElement} element - The element to remove the class from.\n */\nexport function removeClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.remove(className);\n } else {\n element.classList.remove(...className);\n }\n}\n","/**\n * Retrieves the pressed key from an event.\n *\n * @param {KeyboardEvent} event - The keyboard event.\n * @return {string} - The name of the key or an empty string.\n */\nexport function keyPress(event) {\n try {\n // Use event.key or event.keyCode to support older browsers.\n const key = event.key || event.keyCode;\n const keys = {\n Enter: key === \"Enter\" || key === 13,\n Space: key === \" \" || key === \"Spacebar\" || key === 32,\n Escape: key === \"Escape\" || key === \"Esc\" || key === 27,\n ArrowUp: key === \"ArrowUp\" || key === \"Up\" || key === 38,\n ArrowRight: key === \"ArrowRight\" || key === \"Right\" || key === 39,\n ArrowDown: key === \"ArrowDown\" || key === \"Down\" || key === 40,\n ArrowLeft: key === \"ArrowLeft\" || key === \"Left\" || key === 37,\n Home: key === \"Home\" || key === 36,\n End: key === \"End\" || key === 35,\n Tab: key === \"Tab\" || key === 9,\n };\n\n return Object.keys(keys).find((key) => keys[key] === true) || \"\";\n } catch {\n // Return an empty string if something goes wrong.\n return \"\";\n }\n}\n\n/**\n * Stops an event from taking action.\n *\n * @param {Event} event - The event.\n */\nexport function preventEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\n","/**\n * @file\n * Provides a system to get and store Graupl data in the browser.\n */\n\nimport { isValidType } from \"./validate.js\";\n\n/**\n * Initializes the storage system.\n *\n * @param {?string} [type = null] - The type of storage to initialize.\n */\nexport function initializeStorage(type = null) {\n window.Graupl = window.Graupl || {};\n\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = window.Graupl[type] || {};\n }\n}\n\n/**\n * Get the storage object.\n *\n * @param {?string} type - The type of storage to get.\n * @return {object} - The storage object.\n */\nexport function getStorage(type = null) {\n if (isValidType(\"string\", { type })) {\n return window.Graupl[type];\n }\n\n return window.Graupl;\n}\n\n/**\n * Set the storage object of a given type.\n *\n * @param {string} type - The type of storage to set.\n * @param {object} data - The data to set.\n */\nexport function setStorage(type, data = {}) {\n if (isValidType(\"string\", { type }) && isValidType(\"object\", { data })) {\n window.Graupl[type] = data;\n }\n}\n\n/**\n * Clear the storage object of a given type.\n *\n * @param {string} type - The type of storage to clear.\n */\nexport function clearStorage(type) {\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = {};\n }\n}\n\n/**\n * Push a value to the storage object.\n *\n * @param {string} type - The type of storage to push to.\n * @param {string} key - The key to use for the value.\n * @param {*} value - The value to store.\n */\nexport function pushToStorage(type, key, value) {\n if (isValidType(\"string\", { type, key })) {\n window.Graupl[type][key] = value;\n }\n}\n\n/**\n * Get a value from the storage object.\n *\n * @param {string }type - The type of storage to get from.\n * @param {string }key - The key to get the value from.\n * @return {*} - The value from the storage object.\n */\nexport function getFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n return window.Graupl[type][key];\n }\n\n return null;\n}\n\n/**\n * Remove a value from the storage object.\n *\n * @param {string} type - The type of storage to remove from.\n * @param {string} key - The key to remove the value from.\n */\nexport function removeFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n delete window.Graupl[type][key];\n }\n}\n\nexport default {\n initializeStorage,\n getStorage,\n setStorage,\n clearStorage,\n pushToStorage,\n getFromStorage,\n removeFromStorage,\n};\n","/**\n * @file\n * The alert class.\n */\n\nimport { isValidClassList, isValidInstance, isValidType } from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\n\nclass Alert {\n /**\n * The HTML elements for the alert in the DOM.\n *\n * @protected\n *\n * @type {Object<HTMLElement>}\n */\n _dom = {\n alert: null,\n controller: null,\n };\n\n /**\n * A flag to determine if the alert is hidden.\n *\n * @protected\n *\n * @type {boolean}\n */\n _hidden = false;\n\n /**\n * The class to use to show the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _showClass = \"\";\n\n /**\n * The class to use to hide the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _hideClass = \"\";\n\n /**\n * The class to use when transitioning the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _transitionClass = \"\";\n\n /**\n * The time in milliseconds the transition will take.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionTimer = 150;\n\n /**\n * The key used to generate IDs throughout the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * An array of error messages generated by the alert.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * The event that is triggered when the alert is shown.\n *\n * @protected\n *\n * @event grauplAlertShow\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Alert>} detail - The details object container the Alert itself.\n */\n _showEvent = new CustomEvent(\"grauplAlertShow\", {\n bubbles: true,\n detail: { alert: this },\n });\n\n /**\n * The event that is triggered when the alert is hidden.\n *\n * @protected\n *\n * @event grauplAlertHide\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Alert>} detail - The details object containing the Alert itself.\n */\n _hideEvent = new CustomEvent(\"grauplAlertHide\", {\n bubbles: true,\n detail: { alert: this },\n });\n\n /**\n * Constructs a new `Alert`.\n *\n * @param {object} options - The options object.\n * @param {HTMLElement} options.alertElement - The alert element.\n * @param {?HTMLElement} [options.controllerElement = null] - The controller element.\n * @param {string|string[]|null} [options.showClass = show] - The class to add when the alert is shown.\n * @param {string|string[]|null} [options.hideClass = hide] - The class to add when\n * @param {string|string[]|null} [options.transitionClass = transitioning] - The class to add when the alert is transitioning between shown and hidden.\n * @param {number} [options.transitionTimer = 150] - The time in milliseconds the transition will take.\n * @param {boolean} [options.isHidden = false] - A flag to determine the initial state of the alert.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the alert.\n * @param {boolean} [options.initialize = false] - AA flag to initialize the alert immediately upon creation.\n */\n constructor({\n alertElement,\n controllerElement = null,\n showClass = \"show\",\n hideClass = \"hide\",\n transitionClass = \"transitioning\",\n transitionTimer = 150,\n isHidden = false,\n key = null,\n initialize = false,\n }) {\n this._dom.alert = alertElement;\n this._dom.controller = controllerElement;\n this._showClass = showClass || \"\";\n this._hideClass = hideClass || \"\";\n this._transitionClass = transitionClass || \"\";\n this._transitionTimer = transitionTimer;\n this._hidden = isHidden;\n\n // Set the key.\n this._key = key || \"\";\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the alert.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Alert: cannot initialize alert. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n // Set up the DOM.\n this._generateKey();\n this._setIds();\n\n // Handle events.\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n\n // Set up the storage.\n storage.initializeStorage(\"alerts\");\n storage.pushToStorage(\"alerts\", this.dom.alert.id, this);\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The HTML elements for the alert in the DOM.\n *\n * @readonly\n *\n * @see _dom\n *\n * @type {object}\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The class to use the show the alert.\n *\n * @type {string|string[]}\n *\n * @see _showClass\n */\n get showClass() {\n return this._showClass;\n }\n\n /**\n * The class to use to hide the alert.\n *\n * @type {string|string[]}\n *\n * @see _hideClass\n */\n get hideClass() {\n return this._hideClass;\n }\n\n /**\n * The class to use when transitioning the alert.\n *\n * @type {string|string[]}\n *\n * @see _transitionClass\n */\n get transitionClass() {\n return this._transitionClass;\n }\n\n /**\n * The time in milliseconds the transition will take.\n *\n * @type {number}\n *\n * @see _transitionTimer\n */\n get transitionTimer() {\n return this._transitionTimer;\n }\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n set showClass(value) {\n isValidClassList({ showClass: value });\n\n if (this._showClass !== value) {\n this._showClass = value;\n }\n }\n\n set hideClass(value) {\n isValidClassList({ hideClass: value });\n\n if (this._hideClass !== value) {\n this._hideClass = value;\n }\n }\n\n set transitionClass(value) {\n isValidClassList({ transitionClass: value });\n\n if (this._transitionClass !== value) {\n this._transitionClass = value;\n }\n }\n\n set transitionTimer(value) {\n isValidType(\"number\", { transitionTimer: value });\n\n if (this._transitionTimer !== value) {\n this._transitionTimer = value;\n }\n }\n\n set key(value) {\n isValidType(\"string\", { value });\n\n if (this._key !== value) {\n this._key = value;\n }\n }\n\n /**\n * Validates all aspects of the alert to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The result of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n let htmlElementChecks;\n\n if (this._dom.controller !== null) {\n htmlElementChecks = isValidInstance(HTMLElement, {\n alertElement: this._dom.alert,\n controllerElement: this._dom.controller,\n });\n } else {\n htmlElementChecks = isValidInstance(HTMLElement, {\n alertElement: this._dom.alert,\n });\n }\n\n if (!htmlElementChecks.status) {\n this._errors.push(htmlElementChecks.message);\n check = false;\n }\n\n // Class list checks.\n if (this._showClass !== \"\") {\n const showClassCheck = isValidClassList({ showClass: this._showClass });\n\n if (!showClassCheck.status) {\n this._errors.push(showClassCheck.message);\n check = false;\n }\n }\n\n if (this._hideClass !== \"\") {\n const hideClassCheck = isValidClassList({ hideClass: this._hideClass });\n\n if (!hideClassCheck.status) {\n this._errors.push(hideClassCheck.message);\n check = false;\n }\n }\n\n if (this._transitionClass !== \"\") {\n const transitionClassCheck = isValidClassList({\n transitionClass: this._transitionClass,\n });\n\n if (!transitionClassCheck.status) {\n this._errors.push(transitionClassCheck.message);\n check = false;\n }\n }\n\n // Transition timer check.\n const transitionTimerCheck = isValidType(\"number\", {\n transitionTimer: this._transitionTimer,\n });\n\n if (!transitionTimerCheck.status) {\n this._errors.push(transitionTimerCheck.message);\n check = false;\n }\n\n // Hidden check.\n const hiddenCheck = isValidType(\"boolean\", { isHidden: this._hidden });\n\n if (!hiddenCheck.status) {\n this._errors.push(hiddenCheck.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Generates a key for the alert.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this.key === \"\" || regenerate) {\n this.key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the alert and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - alert: `alert-${key}`\n * - controller: `alert-controller-${key}`\n */\n _setIds() {\n this.dom.alert.id = this.dom.alert.id || `alert-${this.key}`;\n this.dom.controller.id =\n this.dom.controller.id || `alert-controller-${this.key}`;\n }\n\n /**\n * Shows the alert.\n *\n * @fires grauplAlertShow\n *\n * @param {boolean} [emit = true] - A toggle to emit the show event once shown.\n */\n show(emit = true) {\n if (!this._hidden) {\n return;\n }\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the hide class,\n // add the show class, and finally remove the transition class.\n if (this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.alert);\n\n requestAnimationFrame(() => {\n if (this.hideClass !== \"\") {\n removeClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n if (this.showClass !== \"\") {\n addClass(this.showClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n });\n });\n } else {\n // Add the show class\n if (this.showClass !== \"\") {\n addClass(this.showClass, this.dom.alert);\n }\n\n // Remove the hide class.\n if (this.hideClass !== \"\") {\n removeClass(this.hideClass, this.dom.alert);\n }\n }\n\n this._hidden = false;\n\n if (emit) {\n this.dom.alert.dispatchEvent(this._hideEvent);\n }\n }\n\n /**\n * Hides the alert.\n *\n * @fires grauplAlertHide\n *\n * @param {boolean} [emit = true] - A toggle to emit the hide event once shown.\n */\n hide(emit = true) {\n if (this._hidden) {\n return;\n }\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the show class,\n // add the hide class, and finally remove the transition class.\n if (this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.alert);\n\n requestAnimationFrame(() => {\n if (this.showClass !== \"\") {\n removeClass(this.showClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n if (this.transitionTimer > 0) {\n setTimeout(() => {\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n }, this.transitionTimer);\n } else {\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n }\n });\n });\n } else {\n // Add the hide class\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n // Remove the show class.\n if (this.showClass !== \"\") {\n removeClass(this.showClass, this.dom.alert);\n }\n }\n\n this._hidden = true;\n\n if (emit) {\n this.dom.alert.dispatchEvent(this._hideEvent);\n }\n }\n\n /**\n * Handles click events throughout the alert for proper use.\n *\n * - Adds a `pointerup` listener to the controller that will hide the alert.\n *\n * @protected\n */\n _handleClick() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"pointerup\", () => this.hide());\n }\n\n /**\n * Handles keydown events throughout the alert for proper use.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to the controller (if it exists).\n * - Blocks propagation on \"Space\" and \"Enter\" keys.\n */\n _handleKeydown() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n // Prevent default behavior for space and enter keys.\n if (key === \"Space\" || key === \"Enter\") {\n preventEvent(event);\n }\n });\n }\n\n /**\n * Handles keyup events throughout the alert for proper use.\n *\n * - Adds a `keyup` listener to the controller (if it exists).\n * - Hides the alert when the user hits \"Space\" or \"Enter\".\n */\n _handleKeyup() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n if (key === \"Space\" || key === \"Enter\") {\n this.hide();\n }\n });\n }\n}\n\nexport default Alert;\n"],"mappings":"AAeA,SAAgB0E,EAAgBzE,EAAYC,EAAU,CACpD,GAAI,CACF,GAAA,OAAWA,GAAa,SAAU,CAChC,MAAMC,EAAAA,OAAsBD,EAE5B,MAAM,IAAIE,UAAAA,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ACrE,CAUA9B,gBAAiB,CACX,KAAKI,IAAIlC,aAAe,MAI5B,KAAKkC,IAAIlC,WAAW8D,iBAAiB,UAAYC,GAAU,CACzD,MAAM1C,EAAM3B,EAASqE,CAAAA,GAGjB1C,IAAQ,SAAWA,IAAQ,UAC7B1B,EAAaoE,CAAAA,CAEhB,CAAA,CACH,CAQAhC,cAAe,CACT,KAAKG,IAAIlC,aAAe,MAI5B,KAAKkC,IAAIlC,WAAW8D,iBAAiB,QAAUC,GAAU,CACvD,MAAM1C,EAAM3B,EAASqE,CAAAA,GAEjB1C,IAAQ,SAAWA,IAAQ,UAC7B,KAAKuC,KAAAA,CAER,CAAA,CACH,CACF,EAEA,EAAe/D"}
@@ -0,0 +1,5 @@
1
+ var Alert=function(){function l(t,s){try{if(typeof s!="object"){const i=typeof s;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${i}" given.`)}for(const i in s)if(!(s[i]instanceof t)){const e=typeof s[i];throw new TypeError(`${i} must be an instance of ${t.name}. "${e}" given.`)}return{status:!0,error:null}}catch(i){return{status:!1,error:i}}}function r(t,s){try{if(typeof s!="object"){const i=typeof s;throw new TypeError(`Values given to isValidType() must be inside of an object. "${i}" given.`)}for(const i in s){const e=typeof s[i];if(e!==t)throw new TypeError(`${i} must be a ${t}. "${e}" given.`)}return{status:!0,error:null}}catch(i){return{status:!1,error:i}}}function u(t){try{if(typeof t!="object"){const s=typeof t;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${s}" given.`)}for(const s in t)try{if(t[s]===null)throw new Error;document.querySelector(t[s])}catch{throw new TypeError(`${s} must be a valid query selector. "${t[s]}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function h(t){try{if(typeof t!="object"||Array.isArray(t)){const s=typeof t;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${s}" given.`)}for(const s in t){const i=typeof t[s];if(i!=="string")if(Array.isArray(t[s]))t[s].forEach(e=>{if(typeof e!="string")throw new TypeError(`${s} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${s} must be a string or an array of strings. "${i}" given.`);else{const e={};e[s]=t[s],u(e)}}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function o(t,s){t===""||t.length===0||(typeof t=="string"?s.classList.add(t):s.classList.add(...t))}function a(t,s){t===""||t.length===0||(typeof t=="string"?s.classList.remove(t):s.classList.remove(...t))}function d(t){try{const s=t.key||t.keyCode,i={Enter:s==="Enter"||s===13,Space:s===" "||s==="Spacebar"||s===32,Escape:s==="Escape"||s==="Esc"||s===27,ArrowUp:s==="ArrowUp"||s==="Up"||s===38,ArrowRight:s==="ArrowRight"||s==="Right"||s===39,ArrowDown:s==="ArrowDown"||s==="Down"||s===40,ArrowLeft:s==="ArrowLeft"||s==="Left"||s===37,Home:s==="Home"||s===36,End:s==="End"||s===35,Tab:s==="Tab"||s===9};return Object.keys(i).find(e=>i[e]===!0)||""}catch{return""}}function c(t){t.preventDefault(),t.stopPropagation()}function m(t=null){window.Graupl=window.Graupl||{},r("string",{type:t})&&(window.Graupl[t]=window.Graupl[t]||{})}function w(t=null){return r("string",{type:t})?window.Graupl[t]:window.Graupl}function C(t,s={}){r("string",{type:t})&&r("object",{data:s})&&(window.Graupl[t]=s)}function _(t){r("string",{type:t})&&(window.Graupl[t]={})}function g(t,s,i){r("string",{type:t,key:s})&&(window.Graupl[t][s]=i)}function y(t,s){return r("string",{type:t,key:s})?window.Graupl[t][s]:null}function p(t,s){r("string",{type:t,key:s})&&delete window.Graupl[t][s]}var f={initializeStorage:m,getStorage:w,setStorage:C,clearStorage:_,pushToStorage:g,getFromStorage:y,removeFromStorage:p},E=class{_dom={alert:null,controller:null};_hidden=!1;_showClass="";_hideClass="";_transitionClass="";_transitionTimer=150;_key="";_errors=[];_showEvent=new CustomEvent("grauplAlertShow",{bubbles:!0,detail:{alert:this}});_hideEvent=new CustomEvent("grauplAlertHide",{bubbles:!0,detail:{alert:this}});constructor({alertElement:t,controllerElement:s=null,showClass:i="show",hideClass:e="hide",transitionClass:n="transitioning",transitionTimer:b=150,isHidden:k=!1,key:A=null,initialize:S=!1}){this._dom.alert=t,this._dom.controller=s,this._showClass=i||"",this._hideClass=e||"",this._transitionClass=n||"",this._transitionTimer=b,this._hidden=k,this._key=A||"",S&&this.initialize()}initialize(){try{if(!this._validate())throw new Error(`Graupl Alert: cannot initialize alert. The following errors have been found:
2
+ - ${this.errors.join(`
3
+ - `)}`);this._generateKey(),this._setIds(),this._handleClick(),this._handleKeydown(),this._handleKeyup(),f.initializeStorage("alerts"),f.pushToStorage("alerts",this.dom.alert.id,this)}catch(t){console.error(t)}}get dom(){return this._dom}get showClass(){return this._showClass}get hideClass(){return this._hideClass}get transitionClass(){return this._transitionClass}get transitionTimer(){return this._transitionTimer}get key(){return this._key}set showClass(t){h({showClass:t}),this._showClass!==t&&(this._showClass=t)}set hideClass(t){h({hideClass:t}),this._hideClass!==t&&(this._hideClass=t)}set transitionClass(t){h({transitionClass:t}),this._transitionClass!==t&&(this._transitionClass=t)}set transitionTimer(t){r("number",{transitionTimer:t}),this._transitionTimer!==t&&(this._transitionTimer=t)}set key(t){r("string",{value:t}),this._key!==t&&(this._key=t)}_validate(){let t=!0,s;if(this._dom.controller!==null?s=l(HTMLElement,{alertElement:this._dom.alert,controllerElement:this._dom.controller}):s=l(HTMLElement,{alertElement:this._dom.alert}),s.status||(this._errors.push(s.message),t=!1),this._showClass!==""){const n=h({showClass:this._showClass});n.status||(this._errors.push(n.message),t=!1)}if(this._hideClass!==""){const n=h({hideClass:this._hideClass});n.status||(this._errors.push(n.message),t=!1)}if(this._transitionClass!==""){const n=h({transitionClass:this._transitionClass});n.status||(this._errors.push(n.message),t=!1)}const i=r("number",{transitionTimer:this._transitionTimer});i.status||(this._errors.push(i.message),t=!1);const e=r("boolean",{isHidden:this._hidden});return e.status||(this._errors.push(e.message),t=!1),t}_generateKey(t=!1){(this.key===""||t)&&(this.key=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10))}_setIds(){this.dom.alert.id=this.dom.alert.id||`alert-${this.key}`,this.dom.controller.id=this.dom.controller.id||`alert-controller-${this.key}`}show(t=!0){this._hidden&&(this.transitionClass!==""?(o(this.transitionClass,this.dom.alert),requestAnimationFrame(()=>{this.hideClass!==""&&a(this.hideClass,this.dom.alert),requestAnimationFrame(()=>{this.showClass!==""&&o(this.showClass,this.dom.alert),requestAnimationFrame(()=>{a(this.transitionClass,this.dom.alert)})})})):(this.showClass!==""&&o(this.showClass,this.dom.alert),this.hideClass!==""&&a(this.hideClass,this.dom.alert)),this._hidden=!1,t&&this.dom.alert.dispatchEvent(this._hideEvent))}hide(t=!0){this._hidden||(this.transitionClass!==""?(o(this.transitionClass,this.dom.alert),requestAnimationFrame(()=>{this.showClass!==""&&a(this.showClass,this.dom.alert),requestAnimationFrame(()=>{this.transitionTimer>0?setTimeout(()=>{this.hideClass!==""&&o(this.hideClass,this.dom.alert),requestAnimationFrame(()=>{a(this.transitionClass,this.dom.alert)})},this.transitionTimer):(this.hideClass!==""&&o(this.hideClass,this.dom.alert),requestAnimationFrame(()=>{a(this.transitionClass,this.dom.alert)}))})})):(this.hideClass!==""&&o(this.hideClass,this.dom.alert),this.showClass!==""&&a(this.showClass,this.dom.alert)),this._hidden=!0,t&&this.dom.alert.dispatchEvent(this._hideEvent))}_handleClick(){this.dom.controller!==null&&this.dom.controller.addEventListener("pointerup",()=>this.hide())}_handleKeydown(){this.dom.controller!==null&&this.dom.controller.addEventListener("keydown",t=>{const s=d(t);(s==="Space"||s==="Enter")&&c(t)})}_handleKeyup(){this.dom.controller!==null&&this.dom.controller.addEventListener("keyup",t=>{const s=d(t);(s==="Space"||s==="Enter")&&this.hide()})}},T=E;return T}();
4
+
5
+ //# sourceMappingURL=alert.iife.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.iife.js","names":["isValidInstance","contructor","elements","elementsType","TypeError","key","elementType","name","status","error","isValidType","type","values","valuesType","valueType","isQuerySelector","Error","document","querySelector","isValidClassList","Array","isArray","forEach","value","obj","isTag","tagName","HTMLElement","tag","toLowerCase","check","addClass","className","element","length","classList","add","removeClass","remove","keyPress","event","key","keyCode","keys","Enter","Space","Escape","ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End","Tab","Object","find","preventEvent","preventDefault","stopPropagation","isValidType","initializeStorage","type","window","Graupl","getStorage","setStorage","data","clearStorage","pushToStorage","key","value","getFromStorage","removeFromStorage","isValidClassList","isValidInstance","isValidType","addClass","removeClass","keyPress","preventEvent","storage","Alert","_dom","alert","controller","_hidden","_showClass","_hideClass","_transitionClass","_transitionTimer","_key","_errors","_showEvent","CustomEvent","bubbles","detail","_hideEvent","constructor","alertElement","controllerElement","showClass","hideClass","transitionClass","transitionTimer","isHidden","key","initialize","_validate","Error","errors","join","_generateKey","_setIds","_handleClick","_handleKeydown","_handleKeyup","initializeStorage","pushToStorage","dom","id","error","console","value","check","htmlElementChecks","HTMLElement","status","push","message","showClassCheck","hideClassCheck","transitionClassCheck","transitionTimerCheck","hiddenCheck","regenerate","Math","random","toString","replace","substring","show","emit","requestAnimationFrame","dispatchEvent","hide","setTimeout","addEventListener","event"],"sources":["../../../packages/core/src/js/validate.js","../../../packages/core/src/js/domHelpers.js","../../../packages/core/src/js/eventHandlers.js","../../../packages/core/src/js/storage.js","../../../packages/core/src/js/alert/Alert.js"],"sourcesContent":["/**\n * Check to see if the provided elements have a specific contructor.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking instanceof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {object} contructor - The constructor to check for.\n * @param {object} elements - The element(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidInstance(contructor, elements) {\n try {\n if (typeof elements !== \"object\") {\n const elementsType = typeof elements;\n\n throw new TypeError(\n `Elements given to isValidInstance() must be inside of an object. \"${elementsType}\" given.`\n );\n }\n\n for (const key in elements) {\n if (!(elements[key] instanceof contructor)) {\n const elementType = typeof elements[key];\n throw new TypeError(\n `${key} must be an instance of ${contructor.name}. \"${elementType}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are of a specific type.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking typeof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {string} type - The type to check for.\n * @param {object} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidType(type, values) {\n try {\n if (typeof values !== \"object\") {\n const valuesType = typeof values;\n\n throw new TypeError(\n `Values given to isValidType() must be inside of an object. \"${valuesType}\" given.`\n );\n }\n\n for (const key in values) {\n const valueType = typeof values[key];\n\n if (valueType !== type) {\n throw new TypeError(`${key} must be a ${type}. \"${valueType}\" given.`);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided values are valid query selectors.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isQuerySelector(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isQuerySelector() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n try {\n if (values[key] === null) {\n throw new Error();\n }\n\n document.querySelector(values[key]);\n } catch {\n throw new TypeError(\n `${key} must be a valid query selector. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided value is either a string or an array of strings.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string, string[]>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidClassList(values) {\n try {\n if (typeof values !== \"object\" || Array.isArray(values)) {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidClassList() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n const type = typeof values[key];\n\n if (type !== \"string\") {\n if (Array.isArray(values[key])) {\n values[key].forEach((value) => {\n if (typeof value !== \"string\") {\n throw new TypeError(\n `${key} must be a string or an array of strings. An array containing non-strings given.`\n );\n }\n });\n } else {\n throw new TypeError(\n `${key} must be a string or an array of strings. \"${type}\" given.`\n );\n }\n } else {\n const obj = {};\n obj[key] = values[key];\n\n isQuerySelector(obj);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided elements are using a specific tag.\n *\n * The elements must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `true` if the check is successful.\n *\n * @param {string} tagName - The name of the tag.\n * @param {Object<HTMLElement>} elements - The element(s) to check.\n * @return {boolean} - The result of the check.\n */\nexport function isTag(tagName, elements) {\n if (\n isValidType(\"string\", { tagName }).status &&\n isValidInstance(HTMLElement, elements).status\n ) {\n const tag = tagName.toLowerCase();\n let check = true;\n\n for (const key in elements) {\n if (elements[key].tagName.toLowerCase() !== tag) check = false;\n }\n\n return check;\n } else {\n return false;\n }\n}\n","/**\n * Add a class or array of classes to an element.\n *\n * @param {string|string[]} className - The class or classes to add.\n * @param {HTMLElement} element - The element to add the class to.\n */\nexport function addClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.add(className);\n } else {\n element.classList.add(...className);\n }\n}\n\n/**\n * Remove a class or array of classes from an element.\n *\n * @param {string|string[]} className - The class or classes to remove.\n * @param {HTMLElement} element - The element to remove the class from.\n */\nexport function removeClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.remove(className);\n } else {\n element.classList.remove(...className);\n }\n}\n","/**\n * Retrieves the pressed key from an event.\n *\n * @param {KeyboardEvent} event - The keyboard event.\n * @return {string} - The name of the key or an empty string.\n */\nexport function keyPress(event) {\n try {\n // Use event.key or event.keyCode to support older browsers.\n const key = event.key || event.keyCode;\n const keys = {\n Enter: key === \"Enter\" || key === 13,\n Space: key === \" \" || key === \"Spacebar\" || key === 32,\n Escape: key === \"Escape\" || key === \"Esc\" || key === 27,\n ArrowUp: key === \"ArrowUp\" || key === \"Up\" || key === 38,\n ArrowRight: key === \"ArrowRight\" || key === \"Right\" || key === 39,\n ArrowDown: key === \"ArrowDown\" || key === \"Down\" || key === 40,\n ArrowLeft: key === \"ArrowLeft\" || key === \"Left\" || key === 37,\n Home: key === \"Home\" || key === 36,\n End: key === \"End\" || key === 35,\n Tab: key === \"Tab\" || key === 9,\n };\n\n return Object.keys(keys).find((key) => keys[key] === true) || \"\";\n } catch {\n // Return an empty string if something goes wrong.\n return \"\";\n }\n}\n\n/**\n * Stops an event from taking action.\n *\n * @param {Event} event - The event.\n */\nexport function preventEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\n","/**\n * @file\n * Provides a system to get and store Graupl data in the browser.\n */\n\nimport { isValidType } from \"./validate.js\";\n\n/**\n * Initializes the storage system.\n *\n * @param {?string} [type = null] - The type of storage to initialize.\n */\nexport function initializeStorage(type = null) {\n window.Graupl = window.Graupl || {};\n\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = window.Graupl[type] || {};\n }\n}\n\n/**\n * Get the storage object.\n *\n * @param {?string} type - The type of storage to get.\n * @return {object} - The storage object.\n */\nexport function getStorage(type = null) {\n if (isValidType(\"string\", { type })) {\n return window.Graupl[type];\n }\n\n return window.Graupl;\n}\n\n/**\n * Set the storage object of a given type.\n *\n * @param {string} type - The type of storage to set.\n * @param {object} data - The data to set.\n */\nexport function setStorage(type, data = {}) {\n if (isValidType(\"string\", { type }) && isValidType(\"object\", { data })) {\n window.Graupl[type] = data;\n }\n}\n\n/**\n * Clear the storage object of a given type.\n *\n * @param {string} type - The type of storage to clear.\n */\nexport function clearStorage(type) {\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = {};\n }\n}\n\n/**\n * Push a value to the storage object.\n *\n * @param {string} type - The type of storage to push to.\n * @param {string} key - The key to use for the value.\n * @param {*} value - The value to store.\n */\nexport function pushToStorage(type, key, value) {\n if (isValidType(\"string\", { type, key })) {\n window.Graupl[type][key] = value;\n }\n}\n\n/**\n * Get a value from the storage object.\n *\n * @param {string }type - The type of storage to get from.\n * @param {string }key - The key to get the value from.\n * @return {*} - The value from the storage object.\n */\nexport function getFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n return window.Graupl[type][key];\n }\n\n return null;\n}\n\n/**\n * Remove a value from the storage object.\n *\n * @param {string} type - The type of storage to remove from.\n * @param {string} key - The key to remove the value from.\n */\nexport function removeFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n delete window.Graupl[type][key];\n }\n}\n\nexport default {\n initializeStorage,\n getStorage,\n setStorage,\n clearStorage,\n pushToStorage,\n getFromStorage,\n removeFromStorage,\n};\n","/**\n * @file\n * The alert class.\n */\n\nimport { isValidClassList, isValidInstance, isValidType } from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\n\nclass Alert {\n /**\n * The HTML elements for the alert in the DOM.\n *\n * @protected\n *\n * @type {Object<HTMLElement>}\n */\n _dom = {\n alert: null,\n controller: null,\n };\n\n /**\n * A flag to determine if the alert is hidden.\n *\n * @protected\n *\n * @type {boolean}\n */\n _hidden = false;\n\n /**\n * The class to use to show the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _showClass = \"\";\n\n /**\n * The class to use to hide the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _hideClass = \"\";\n\n /**\n * The class to use when transitioning the alert.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _transitionClass = \"\";\n\n /**\n * The time in milliseconds the transition will take.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionTimer = 150;\n\n /**\n * The key used to generate IDs throughout the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * An array of error messages generated by the alert.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * The event that is triggered when the alert is shown.\n *\n * @protected\n *\n * @event grauplAlertShow\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Alert>} detail - The details object container the Alert itself.\n */\n _showEvent = new CustomEvent(\"grauplAlertShow\", {\n bubbles: true,\n detail: { alert: this },\n });\n\n /**\n * The event that is triggered when the alert is hidden.\n *\n * @protected\n *\n * @event grauplAlertHide\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Alert>} detail - The details object containing the Alert itself.\n */\n _hideEvent = new CustomEvent(\"grauplAlertHide\", {\n bubbles: true,\n detail: { alert: this },\n });\n\n /**\n * Constructs a new `Alert`.\n *\n * @param {object} options - The options object.\n * @param {HTMLElement} options.alertElement - The alert element.\n * @param {?HTMLElement} [options.controllerElement = null] - The controller element.\n * @param {string|string[]|null} [options.showClass = show] - The class to add when the alert is shown.\n * @param {string|string[]|null} [options.hideClass = hide] - The class to add when\n * @param {string|string[]|null} [options.transitionClass = transitioning] - The class to add when the alert is transitioning between shown and hidden.\n * @param {number} [options.transitionTimer = 150] - The time in milliseconds the transition will take.\n * @param {boolean} [options.isHidden = false] - A flag to determine the initial state of the alert.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the alert.\n * @param {boolean} [options.initialize = false] - AA flag to initialize the alert immediately upon creation.\n */\n constructor({\n alertElement,\n controllerElement = null,\n showClass = \"show\",\n hideClass = \"hide\",\n transitionClass = \"transitioning\",\n transitionTimer = 150,\n isHidden = false,\n key = null,\n initialize = false,\n }) {\n this._dom.alert = alertElement;\n this._dom.controller = controllerElement;\n this._showClass = showClass || \"\";\n this._hideClass = hideClass || \"\";\n this._transitionClass = transitionClass || \"\";\n this._transitionTimer = transitionTimer;\n this._hidden = isHidden;\n\n // Set the key.\n this._key = key || \"\";\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the alert.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Alert: cannot initialize alert. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n // Set up the DOM.\n this._generateKey();\n this._setIds();\n\n // Handle events.\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n\n // Set up the storage.\n storage.initializeStorage(\"alerts\");\n storage.pushToStorage(\"alerts\", this.dom.alert.id, this);\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The HTML elements for the alert in the DOM.\n *\n * @readonly\n *\n * @see _dom\n *\n * @type {object}\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The class to use the show the alert.\n *\n * @type {string|string[]}\n *\n * @see _showClass\n */\n get showClass() {\n return this._showClass;\n }\n\n /**\n * The class to use to hide the alert.\n *\n * @type {string|string[]}\n *\n * @see _hideClass\n */\n get hideClass() {\n return this._hideClass;\n }\n\n /**\n * The class to use when transitioning the alert.\n *\n * @type {string|string[]}\n *\n * @see _transitionClass\n */\n get transitionClass() {\n return this._transitionClass;\n }\n\n /**\n * The time in milliseconds the transition will take.\n *\n * @type {number}\n *\n * @see _transitionTimer\n */\n get transitionTimer() {\n return this._transitionTimer;\n }\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n set showClass(value) {\n isValidClassList({ showClass: value });\n\n if (this._showClass !== value) {\n this._showClass = value;\n }\n }\n\n set hideClass(value) {\n isValidClassList({ hideClass: value });\n\n if (this._hideClass !== value) {\n this._hideClass = value;\n }\n }\n\n set transitionClass(value) {\n isValidClassList({ transitionClass: value });\n\n if (this._transitionClass !== value) {\n this._transitionClass = value;\n }\n }\n\n set transitionTimer(value) {\n isValidType(\"number\", { transitionTimer: value });\n\n if (this._transitionTimer !== value) {\n this._transitionTimer = value;\n }\n }\n\n set key(value) {\n isValidType(\"string\", { value });\n\n if (this._key !== value) {\n this._key = value;\n }\n }\n\n /**\n * Validates all aspects of the alert to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The result of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n let htmlElementChecks;\n\n if (this._dom.controller !== null) {\n htmlElementChecks = isValidInstance(HTMLElement, {\n alertElement: this._dom.alert,\n controllerElement: this._dom.controller,\n });\n } else {\n htmlElementChecks = isValidInstance(HTMLElement, {\n alertElement: this._dom.alert,\n });\n }\n\n if (!htmlElementChecks.status) {\n this._errors.push(htmlElementChecks.message);\n check = false;\n }\n\n // Class list checks.\n if (this._showClass !== \"\") {\n const showClassCheck = isValidClassList({ showClass: this._showClass });\n\n if (!showClassCheck.status) {\n this._errors.push(showClassCheck.message);\n check = false;\n }\n }\n\n if (this._hideClass !== \"\") {\n const hideClassCheck = isValidClassList({ hideClass: this._hideClass });\n\n if (!hideClassCheck.status) {\n this._errors.push(hideClassCheck.message);\n check = false;\n }\n }\n\n if (this._transitionClass !== \"\") {\n const transitionClassCheck = isValidClassList({\n transitionClass: this._transitionClass,\n });\n\n if (!transitionClassCheck.status) {\n this._errors.push(transitionClassCheck.message);\n check = false;\n }\n }\n\n // Transition timer check.\n const transitionTimerCheck = isValidType(\"number\", {\n transitionTimer: this._transitionTimer,\n });\n\n if (!transitionTimerCheck.status) {\n this._errors.push(transitionTimerCheck.message);\n check = false;\n }\n\n // Hidden check.\n const hiddenCheck = isValidType(\"boolean\", { isHidden: this._hidden });\n\n if (!hiddenCheck.status) {\n this._errors.push(hiddenCheck.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Generates a key for the alert.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this.key === \"\" || regenerate) {\n this.key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the alert and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - alert: `alert-${key}`\n * - controller: `alert-controller-${key}`\n */\n _setIds() {\n this.dom.alert.id = this.dom.alert.id || `alert-${this.key}`;\n this.dom.controller.id =\n this.dom.controller.id || `alert-controller-${this.key}`;\n }\n\n /**\n * Shows the alert.\n *\n * @fires grauplAlertShow\n *\n * @param {boolean} [emit = true] - A toggle to emit the show event once shown.\n */\n show(emit = true) {\n if (!this._hidden) {\n return;\n }\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the hide class,\n // add the show class, and finally remove the transition class.\n if (this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.alert);\n\n requestAnimationFrame(() => {\n if (this.hideClass !== \"\") {\n removeClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n if (this.showClass !== \"\") {\n addClass(this.showClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n });\n });\n } else {\n // Add the show class\n if (this.showClass !== \"\") {\n addClass(this.showClass, this.dom.alert);\n }\n\n // Remove the hide class.\n if (this.hideClass !== \"\") {\n removeClass(this.hideClass, this.dom.alert);\n }\n }\n\n this._hidden = false;\n\n if (emit) {\n this.dom.alert.dispatchEvent(this._hideEvent);\n }\n }\n\n /**\n * Hides the alert.\n *\n * @fires grauplAlertHide\n *\n * @param {boolean} [emit = true] - A toggle to emit the hide event once shown.\n */\n hide(emit = true) {\n if (this._hidden) {\n return;\n }\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the show class,\n // add the hide class, and finally remove the transition class.\n if (this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.alert);\n\n requestAnimationFrame(() => {\n if (this.showClass !== \"\") {\n removeClass(this.showClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n if (this.transitionTimer > 0) {\n setTimeout(() => {\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n }, this.transitionTimer);\n } else {\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n requestAnimationFrame(() => {\n removeClass(this.transitionClass, this.dom.alert);\n });\n }\n });\n });\n } else {\n // Add the hide class\n if (this.hideClass !== \"\") {\n addClass(this.hideClass, this.dom.alert);\n }\n\n // Remove the show class.\n if (this.showClass !== \"\") {\n removeClass(this.showClass, this.dom.alert);\n }\n }\n\n this._hidden = true;\n\n if (emit) {\n this.dom.alert.dispatchEvent(this._hideEvent);\n }\n }\n\n /**\n * Handles click events throughout the alert for proper use.\n *\n * - Adds a `pointerup` listener to the controller that will hide the alert.\n *\n * @protected\n */\n _handleClick() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"pointerup\", () => this.hide());\n }\n\n /**\n * Handles keydown events throughout the alert for proper use.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to the controller (if it exists).\n * - Blocks propagation on \"Space\" and \"Enter\" keys.\n */\n _handleKeydown() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n // Prevent default behavior for space and enter keys.\n if (key === \"Space\" || key === \"Enter\") {\n preventEvent(event);\n }\n });\n }\n\n /**\n * Handles keyup events throughout the alert for proper use.\n *\n * - Adds a `keyup` listener to the controller (if it exists).\n * - Hides the alert when the user hits \"Space\" or \"Enter\".\n */\n _handleKeyup() {\n if (this.dom.controller === null) {\n return;\n }\n\n this.dom.controller.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n if (key === \"Space\" || key === \"Enter\") {\n this.hide();\n }\n });\n }\n}\n\nexport default Alert;\n"],"mappings":"qBAeA,SAAgB0E,EAAgBzE,EAAYC,EAAU,CACpD,GAAI,CACF,GAAA,OAAWA,GAAa,SAAU,CAChC,MAAMC,EAAAA,OAAsBD,EAE5B,MAAM,IAAIE,UAAAA,qEAC6DD,CAAAA,UAAY,CAErF,CAEA,UAAWsG,KAAOvG,EAChB,GAAA,EAAMA,EAASuG,CAAAA,YAAgBxG,GAAa,CAC1C,MAAMK,EAAAA,OAAqBJ,EAASuG,CAAAA,EACpC,MAAM,IAAIrG,UAAAA,GACLqG,CAAAA,2BAA8BxG,EAAWM,IAAAA,MAAUD,CAAAA,UAAW,CAErE,CAGF,MAAO,CACLwH,OAAQ,GACRN,MAAO,IACR,CACF,OAAQA,EAAO,CACd,MAAO,CACLM,OAAQ,GACRN,MAAAA,CACD,CACH,CACF,CAiBA,SAAgB7C,EAAYd,EAAMjD,EAAQ,CACxC,GAAI,CACF,GAAA,OAAWA,GAAW,SAAU,CAC9B,MAAMC,EAAAA,OAAoBD,EAE1B,MAAM,IAAIR,UAAAA,+DACuDS,CAAAA,UAAU,CAE7E,CAEA,UAAW4F,KAAO7F,EAAQ,CACxB,MAAME,EAAAA,OAAmBF,EAAO6F,CAAAA,EAEhC,GAAI3F,IAAc+C,EAChB,MAAM,IAAIzD,UAAAA,GAAaqG,CAAAA,cAAiB5C,CAAAA,MAAU/C,CAAAA,UAAS,CAE/D,CAEA,MAAO,CACLgH,OAAQ,GACRN,MAAO,IACR,CACF,OAAQA,EAAO,CACd,MAAO,CACLM,OAAQ,GACRN,MAAAA,CACD,CACH,CACF,CAaA,SAAgBzG,EAAgBH,EAAQ,CACtC,GAAI,CACF,GAAA,OAAWA,GAAW,SAAU,CAC9B,MAAMiD,EAAAA,OAAcjD,EAEpB,MAAM,IAAIR,UAAAA,mEAC2DyD,C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AAKiB,YAAc,IACrBvB,EAAY,KAAKuB,UAAW,KAAKkB,IAAInC,KAAAA,GAIzC,KAAKE,QAAU,GAEXwD,GACF,KAAKvB,IAAInC,MAAM4D,cAAc,KAAK/C,UAAAA,EAEtC,CASAiB,cAAe,CACT,KAAKK,IAAIlC,aAAe,MAI5B,KAAKkC,IAAIlC,WAAW8D,iBAAiB,YAAa,IAAM,KAAKF,KAAAA,CAAM,CACrE,CAUA9B,gBAAiB,CACX,KAAKI,IAAIlC,aAAe,MAI5B,KAAKkC,IAAIlC,WAAW8D,iBAAiB,UAAYC,GAAU,CACzD,MAAM1C,EAAM3B,EAASqE,CAAAA,GAGjB1C,IAAQ,SAAWA,IAAQ,UAC7B1B,EAAaoE,CAAAA,CAEhB,CAAA,CACH,CAQAhC,cAAe,CACT,KAAKG,IAAIlC,aAAe,MAI5B,KAAKkC,IAAIlC,WAAW8D,iBAAiB,QAAUC,GAAU,CACvD,MAAM1C,EAAM3B,EAASqE,CAAAA,GAEjB1C,IAAQ,SAAWA,IAAQ,UAC7B,KAAKuC,KAAAA,CAER,CAAA,CACH,CACF,EAEA,EAAe/D"}
@@ -0,0 +1,5 @@
1
+ function u(t,e){t===""||t.length===0||(typeof t=="string"?e.classList.add(t):e.classList.add(...t))}function c(t,e){t===""||t.length===0||(typeof t=="string"?e.classList.remove(t):e.classList.remove(...t))}function h(t){try{const e=t.key||t.keyCode,s={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Tab:e==="Tab"||e===9};return Object.keys(s).find(r=>s[r]===!0)||""}catch{return""}}function p(t){t.preventDefault(),t.stopPropagation()}function m(t,e){try{if(typeof e!="object"){const s=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${s}" given.`)}for(const s in e)if(!(e[s]instanceof t)){const r=typeof e[s];throw new TypeError(`${s} must be an instance of ${t.name}. "${r}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function i(t,e){try{if(typeof e!="object"){const s=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${s}" given.`)}for(const s in e){const r=typeof e[s];if(r!==t)throw new TypeError(`${s} must be a ${t}. "${r}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function _(t){try{if(typeof t!="object"){const e=typeof t;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in t)try{if(t[e]===null)throw new Error;document.querySelector(t[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${t[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function o(t){try{if(typeof t!="object"||Array.isArray(t)){const e=typeof t;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in t){const s=typeof t[e];if(s!=="string")if(Array.isArray(t[e]))t[e].forEach(r=>{if(typeof r!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${s}" given.`);else{const r={};r[e]=t[e],_(r)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function d(t,e){if(i("string",{tagName:t}).status&&m(HTMLElement,e).status){const s=t.toLowerCase();let r=!0;for(const n in e)e[n].tagName.toLowerCase()!==s&&(r=!1);return r}else return!1}function M(t=null){window.Graupl=window.Graupl||{},i("string",{type:t})&&(window.Graupl[t]=window.Graupl[t]||{})}function G(t=null){return i("string",{type:t})?window.Graupl[t]:window.Graupl}function O(t,e={}){i("string",{type:t})&&i("object",{data:e})&&(window.Graupl[t]=e)}function j(t){i("string",{type:t})&&(window.Graupl[t]={})}function P(t,e,s){i("string",{type:t,key:e})&&(window.Graupl[t][e]=s)}function F(t,e){return i("string",{type:t,key:e})?window.Graupl[t][e]:null}function V(t,e){i("string",{type:t,key:e})&&delete window.Graupl[t][e]}var y={initializeStorage:M,getStorage:G,setStorage:O,clearStorage:j,pushToStorage:P,getFromStorage:F,removeFromStorage:V},q=class{_dom={carousel:null,carouselItems:[],carouselItemContainer:null,carouselControls:[],carouselControlContainer:null,carouselTabs:[],carouselTabContainer:null,autoplay:null,next:null,previous:null};_selectors={carouselItems:"",carouselItemContainer:"",carouselControls:"",carouselControlContainer:"",carouselTabs:"",carouselTabContainer:"",autoplay:"",next:"",previous:""};_activeClass="active";_previousClass="previous";_nextClass="next";_playClass="play";_pauseClass="pause";_currentItem=0;_autoplay=!0;_transitionDelay=1e4;_transitionDuration=500;_playText="Play";_pauseText="Pause";_currentAction="next";_autoplayInterval=null;_prefix="graupl-";_key="";_errors=[];constructor({carouselElement:t,carouselItemSelector:e=".carousel-item",carouselItemContainerSelector:s=".carousel-item-container",carouselControlSelector:r=".carousel-control",carouselControlContainerSelector:n=".carousel-control-container",carouselTabSelector:l=".carousel-tab",carouselTabContainerSelector:f=".carousel-tab-container",autoplaySelector:a=".autoplay",nextSelector:C=".next",previousSelector:g=".previous",activeClass:I="active",previousClass:b="previous",nextClass:v="next",playClass:T="play",pauseClass:E="pause",autoplay:w=!0,transitionDelay:x=1e4,transitionDuration:k=500,playText:A="Play",pauseText:D="Pause",prefix:S="graupl-",key:L=null,initialize:$=!1}){this._dom.carousel=t,this._selectors.carouselItems=e,this._selectors.carouselItemContainer=s,this._selectors.carouselControls=r,this._selectors.carouselControlContainer=n,this._selectors.carouselTabs=l,this._selectors.carouselTabContainer=f,this._selectors.autoplay=a,this._selectors.next=C,this._selectors.previous=g,this._activeClass=I||"",this._previousClass=b||"",this._nextClass=v||"",this._playClass=T||"",this._pauseClass=E||"",this._autoplay=w,this._transitionDelay=x,this._transitionDuration=k,this._playText=A||"",this._pauseText=D||"",this._prefix=S||"",this._key=L||"",$&&this.initialize()}initialize(){try{if(!this._validate())throw new Error(`Graupl Carousel: cannot initialize carousel. The following errors have been found:
2
+ - ${this.errors.join(`
3
+ - `)}`);this._generateKey(),this._setDOMElements(),this._setIds(),this._setAriaAttributes(),this.activateFirstItem(),this._handleAutoplay(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this._setTransitionDuration(),y.initializeStorage("carousels"),y.pushToStorage("carousels",this.dom.carousel.id,this)}catch(t){console.error(t)}}get dom(){return this._dom}get selectors(){return this._selectors}get activeClass(){return this._activeClass}get previousClass(){return this._previousClass}get nextClass(){return this._nextClass}get playClass(){return this._playClass}get pauseClass(){return this._pauseClass}get currentItem(){return this._currentItem}get currentCarouselItem(){return this.dom.carouselItems[this.currentItem]}get currentCarouselTab(){return this.dom.carouselTabs[this.currentItem]}get autoplay(){return this._autoplay}get transitionDelay(){return this._transitionDelay}get transitionDuration(){return this._transitionDuration}get playText(){return this._playText}get pauseText(){return this._pauseText}get prefix(){return this._prefix}get key(){return this._key}get currentAction(){return this._currentAction}get errors(){return this._errors}set currentItem(t){if(i("number",{value:t}),t===this.currentItem)return;t<0?this._currentItem=0:t>=this.dom.carouselItems.length?this._currentItem=this.dom.carouselItems.length-1:this._currentItem=t,this._dom.carousel.querySelectorAll(this.selectors.carouselTab)&&this.dom.carouselItems.forEach((s,r)=>{s.setAttribute("aria-selected",r===this._currentItem)})}set autoplay(t){i("boolean",{value:t}),this._autoplay!==t&&(this._autoplay=t)}set activeClass(t){o({activeClass:t}),this._activeClass!==t&&(this._activeClass=t)}set previousClass(t){o({previousClass:t}),this._previousClass!==t&&(this._previousClass=t)}set nextClass(t){o({nextClass:t}),this._nextClass!==t&&(this._nextClass=t)}set playClass(t){o({playClass:t}),this._playClass!==t&&(this._playClass=t)}set pauseClass(t){o({pauseClass:t}),this._pauseClass!==t&&(this._pauseClass=t)}set transitionDelay(t){i("number",{value:t}),t!==this.transitionDelay&&t>=0&&(this._currentItem=t)}set transitionDuration(t){i("number",{value:t}),this._transitionDuration!==t&&t>=0&&(this._transitionDuration=t,this._setTransitionDuration())}set playText(t){i("string",{value:t}),this._playText!==t&&(this._playText=t)}set pauseText(t){i("string",{value:t}),this._pauseText!==t&&(this._pauseText=t)}set prefix(t){i("string",{value:t}),this._prefix!==t&&(this._prefix=t)}set key(t){i("string",{value:t}),this._key!==t&&(this._key=t)}_validate(){let t=!0;const e=m(HTMLElement,{carousel:this.dom.carousel});e||(this._errors.push(e.message),t=!1);const s=_({carouselItemsSelector:this._selectors.carouselItems,carouselItemContainerSelector:this._selectors.carouselItemContainer,carouselControlsSelector:this._selectors.carouselControls,carouselControlContainerSelector:this._selectors.carouselControlContainer,carouselTabsSelector:this._selectors.carouselTabs,carouselTabContainerSelector:this._selectors.carouselTabContainer,autoplaySelector:this._selectors.autoplay,nextSelector:this._selectors.next,previousSelector:this._selectors.previous});s||(this._errors.push(s.message),t=!1);const r=i("boolean",{autoplay:this.autoplay});r||(this._errors.push(r.message),t=!1);const n=i("number",{transitionDelay:this._transitionDelay});n||(this._errors.push(n.message),t=!1);const l=i("number",{transitionDuration:this._transitionDuration});if(l||(this._errors.push(l.message),t=!1),this._activeClass!==""){const a=o({activeClass:this._activeClass});a||(this._errors.push(a.message),t=!1)}if(this._previousClass!==""){const a=o({previousClass:this._previousClass});a||(this._errors.push(a.message),t=!1)}if(this._nextClass!==""){const a=o({nextClass:this._nextClass});a||(this._errors.push(a.message),t=!1)}if(this._playClass!==""){const a=o({playClass:this._playClass});a||(this._errors.push(a.message),t=!1)}if(this._pauseClass!==""){const a=o({pauseClass:this._pauseClass});a||(this._errors.push(a.message),t=!1)}if(this._playText!==""){const a=i("string",{playText:this._playText});a||(this._errors.push(a.message),t=!1)}if(this._pauseText!==""){const a=i("string",{pauseText:this._pauseText});a||(this._errors.push(a.message),t=!1)}const f=i("string",{prefix:this._prefix});return f||(this._errors.push(f.message),t=!1),t}_setDOMElementType(t,e=this.dom.carousel,s=!0){if(typeof this.selectors[t]=="string"){if(t==="carousel")throw new Error(`Graupl Carousel: "${t}" element cannot be set through _setDOMElementType.`);if(e!==this.dom.carousel&&m(HTMLElement,{base:e}),Array.isArray(this._dom[t])){const n=Array.from(e.querySelectorAll(this.selectors[t])).filter(l=>l.parentElement===e);s?this._dom[t]=n:this._dom[t]=[...this._dom[t],...n]}else{const r=e.querySelector(this.selectors[t]);if(r&&r.parentElement!==e)return;s&&(this._dom[t]=r)}}else throw new Error(`Graupl Carousel: "${t}" is not a valid element type within the carousel.`)}_resetDOMElementType(t){if(typeof this.selectors[t]=="string"){if(t==="carousel")throw new Error(`Graupl Carousel: "${t}" element cannot be reset through _resetDOMElementType.`);Array.isArray(this._dom[t])?this._dom[t]=[]:this._dom[t]=null}else throw new Error(`Graupl Carousel: "${t}" is not a valid element type within the carousel.`)}_setDOMElements(){this._setDOMElementType("carouselItemContainer"),this._setDOMElementType("carouselControlContainer"),this._setDOMElementType("carouselTabContainer"),this.dom.carouselItemContainer&&this._setDOMElementType("carouselItems",this.dom.carouselItemContainer),this.dom.carouselControlContainer&&(this._setDOMElementType("carouselControls",this.dom.carouselControlContainer),this._setDOMElementType("autoplay",this.dom.carouselControlContainer),this._setDOMElementType("next",this.dom.carouselControlContainer),this._setDOMElementType("previous",this.dom.carouselControlContainer)),this._dom.carouselTabContainer&&this._setDOMElementType("carouselTabs",this.dom.carouselTabContainer)}_generateKey(t=!1){(this.key===""||t)&&(this.key=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10))}_setIds(){this.dom.carousel.id=this.dom.carousel.id||`carousel-${this.key}`,this.dom.carouselItems.forEach((t,e)=>{t.id=t.id||`carousel-item-${this.key}-${e}`}),this.dom.carouselTabs.forEach((t,e)=>{t.id=t.id||`carousel-tab-${this.key}-${e}`})}_setAriaAttributes(){!d("section",{carousel:this.dom.carousel})&&!this.dom.carousel.getAttribute("role")!=="region"&&this.dom.carousel.setAttribute("role","group"),this._dom.carousel.setAttribute("aria-roledescription","carousel"),this.dom.carouselTabContainer&&this.dom.carouselTabContainer.setAttribute("role","tablist"),this.dom.carouselTabs.forEach((t,e)=>{d("button",{tab:t})||t.setAttribute("role","button"),t.setAttribute("aria-selected",e===0),t.setAttribute("aria-controls",this.dom.carouselItems[e].id)})}_setInterval(){this._clearInterval(),this._autoplayInterval=setInterval(()=>{this.activateNextItem()},this.transitionDelay)}_clearInterval(){clearInterval(this._autoplayInterval)}_handleAutoplay(){this.autoplay?(u(this.pauseClass,this.dom.autoplay),c(this.playClass,this.dom.autoplay),this.dom.autoplay.setAttribute("aria-label",this.pauseText),this.dom.carousel.setAttribute("aria-live","off"),this._setInterval()):(u(this.playClass,this.dom.autoplay),c(this.pauseClass,this.dom.autoplay),this.dom.autoplay.setAttribute("aria-label",this.playText),this.dom.carousel.setAttribute("aria-live","polite"),this._clearInterval())}_handleFocus(){this.dom.carousel.addEventListener("focusin",()=>{this.autoplay&&this._clearInterval()}),this.dom.carousel.addEventListener("focusout",()=>{this.autoplay&&this._setInterval()})}_handleClick(){this.dom.next.addEventListener("pointerup",()=>{this.activateNextItem()}),this.dom.previous.addEventListener("pointerup",()=>{this.activatePreviousItem()}),this.dom.autoplay.addEventListener("pointerup",()=>{this.toggleAutoplay()}),this.dom.carouselTabs.forEach((t,e)=>{t.addEventListener("pointerup",()=>{this.currentItem>e?this._currentAction="previous":this._currentAction="next",this.activateItem(e)})})}_handleHover(){this.dom.carousel.addEventListener("pointerover",()=>{this.autoplay&&this._clearInterval()}),this.dom.carousel.addEventListener("pointerleave",()=>{this.autoplay&&this._setInterval()})}_handleKeydown(){this.dom.carouselControls.forEach(t=>{t.addEventListener("keydown",e=>{switch(h(e)){case"Space":case"Enter":p(e);break}})}),this.dom.carouselTabs.forEach(t=>{t.addEventListener("keydown",e=>{switch(h(e)){case"Space":case"Enter":p(e);break}})})}_handleKeyup(){this.dom.next.addEventListener("keyup",t=>{switch(h(t)){case"Space":case"Enter":this.activateNextItem(),p(t);break}}),this.dom.previous.addEventListener("keyup",t=>{switch(h(t)){case"Space":case"Enter":this.activatePreviousItem(),p(t);break}}),this.dom.autoplay.addEventListener("keyup",t=>{switch(h(t)){case"Space":case"Enter":this.toggleAutoplay(),p(t);break}}),this.dom.carouselTabs.forEach((t,e)=>{t.addEventListener("keyup",s=>{switch(h(s)){case"Space":case"Enter":this.activateItem(e),p(s);break}})})}_setTransitionDuration(){this.dom.carousel.style.setProperty(`--${this.prefix}carousel-transition-duration`,`${this.transitionDuration}ms`)}activateCurrentItem(){u(this.activeClass,this.currentCarouselItem),this.currentCarouselTab&&(this.currentCarouselTab.setAttribute("aria-selected",!0),u(this.activeClass,this.currentCarouselTab))}deactivateCurrentItem(){c(this.activeClass,this.currentCarouselItem),this.currentCarouselTab&&(this.currentCarouselTab.setAttribute("aria-selected",!1),c(this.activeClass,this.currentCarouselTab))}activateItem(t){const e=this.currentItem;this.dom.carousel.dataset.grauplAction=this._currentAction,this.autoplay&&this._clearInterval(),u(this.previousClass,this.currentCarouselItem),u(this.nextClass,this.dom.carouselItems[t]),requestAnimationFrame(()=>{this.deactivateCurrentItem(),this.currentItem=t,this.activateCurrentItem(),requestAnimationFrame(()=>{setTimeout(()=>{c(this.previousClass,this.dom.carouselItems[e]),c(this.nextClass,this.currentCarouselItem)},this.transitionDuration)})}),this.autoplay&&this._setInterval()}activateFirstItem(){this.activateItem(0)}activateLastItem(){this.activateItem(this.dom.carouselItems.length-1)}activateNextItem(){this._currentAction="next",this.currentItem+1>=this.dom.carouselItems.length?this.activateFirstItem():this.activateItem(this.currentItem+1)}activatePreviousItem(){this._currentAction="previous",this.currentItem-1<0?this.activateLastItem():this.activateItem(this.currentItem-1)}toggleAutoplay(){this.autoplay=!this.autoplay,this._handleAutoplay()}},H=q;module.exports=H;
4
+
5
+ //# sourceMappingURL=carousel.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carousel.cjs.js","names":["addClass","className","element","length","classList","add","removeClass","remove","keyPress","event","key","keyCode","keys","Enter","Space","Escape","ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End","Tab","Object","find","preventEvent","preventDefault","stopPropagation","isValidInstance","contructor","elements","elementsType","TypeError","key","elementType","name","status","error","isValidType","type","values","valuesType","valueType","isQuerySelector","Error","document","querySelector","isValidClassList","Array","isArray","forEach","value","obj","isTag","tagName","HTMLElement","tag","toLowerCase","check","isValidType","initializeStorage","type","window","Graupl","getStorage","setStorage","data","clearStorage","pushToStorage","key","value","getFromStorage","removeFromStorage","addClass","removeClass","preventEvent","keyPress","storage","isQuerySelector","isTag","isValidClassList","isValidInstance","isValidType","Carousel","_dom","carousel","carouselItems","carouselItemContainer","carouselControls","carouselControlContainer","carouselTabs","carouselTabContainer","autoplay","next","previous","_selectors","_activeClass","_previousClass","_nextClass","_playClass","_pauseClass","_currentItem","_autoplay","_transitionDelay","_transitionDuration","_playText","_pauseText","_currentAction","_autoplayInterval","_prefix","_key","_errors","constructor","carouselElement","carouselItemSelector","carouselItemContainerSelector","carouselControlSelector","carouselControlContainerSelector","carouselTabSelector","carouselTabContainerSelector","autoplaySelector","nextSelector","previousSelector","activeClass","previousClass","nextClass","playClass","pauseClass","transitionDelay","transitionDuration","playText","pauseText","prefix","key","initialize","_validate","Error","errors","join","_generateKey","_setDOMElements","_setIds","_setAriaAttributes","activateFirstItem","_handleAutoplay","_handleFocus","_handleClick","_handleHover","_handleKeydown","_handleKeyup","_setTransitionDuration","initializeStorage","pushToStorage","dom","id","error","console","selectors","currentItem","currentCarouselItem","currentCarouselTab","currentAction","value","length","tabs","querySelectorAll","carouselTab","forEach","item","index","setAttribute","check","htmlElementChecks","HTMLElement","push","message","querySelectorChecks","carouselItemsSelector","carouselControlsSelector","carouselTabsSelector","autoplayChecks","delayCheck","durationCheck","activeClassChecks","previousClassChecks","nextClassChecks","playClassChecks","pauseClassChecks","playTextChecks","pauseTextChecks","prefixChecks","_setDOMElementType","elementType","base","overwrite","Array","isArray","domElements","from","filteredElements","filter","parentElement","domElement","querySelector","_resetDOMElementType","regenerate","Math","random","toString","replace","substring","tab","getAttribute","_setInterval","_clearInterval","setInterval","activateNextItem","clearInterval","addEventListener","activatePreviousItem","toggleAutoplay","activateItem","control","event","style","setProperty","activateCurrentItem","deactivateCurrentItem","currentIndex","dataset","grauplAction","requestAnimationFrame","setTimeout","activateLastItem"],"sources":["../../../packages/core/src/js/domHelpers.js","../../../packages/core/src/js/eventHandlers.js","../../../packages/core/src/js/validate.js","../../../packages/core/src/js/storage.js","../../../packages/core/src/js/carousel/Carousel.js"],"sourcesContent":["/**\n * Add a class or array of classes to an element.\n *\n * @param {string|string[]} className - The class or classes to add.\n * @param {HTMLElement} element - The element to add the class to.\n */\nexport function addClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.add(className);\n } else {\n element.classList.add(...className);\n }\n}\n\n/**\n * Remove a class or array of classes from an element.\n *\n * @param {string|string[]} className - The class or classes to remove.\n * @param {HTMLElement} element - The element to remove the class from.\n */\nexport function removeClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.remove(className);\n } else {\n element.classList.remove(...className);\n }\n}\n","/**\n * Retrieves the pressed key from an event.\n *\n * @param {KeyboardEvent} event - The keyboard event.\n * @return {string} - The name of the key or an empty string.\n */\nexport function keyPress(event) {\n try {\n // Use event.key or event.keyCode to support older browsers.\n const key = event.key || event.keyCode;\n const keys = {\n Enter: key === \"Enter\" || key === 13,\n Space: key === \" \" || key === \"Spacebar\" || key === 32,\n Escape: key === \"Escape\" || key === \"Esc\" || key === 27,\n ArrowUp: key === \"ArrowUp\" || key === \"Up\" || key === 38,\n ArrowRight: key === \"ArrowRight\" || key === \"Right\" || key === 39,\n ArrowDown: key === \"ArrowDown\" || key === \"Down\" || key === 40,\n ArrowLeft: key === \"ArrowLeft\" || key === \"Left\" || key === 37,\n Home: key === \"Home\" || key === 36,\n End: key === \"End\" || key === 35,\n Tab: key === \"Tab\" || key === 9,\n };\n\n return Object.keys(keys).find((key) => keys[key] === true) || \"\";\n } catch {\n // Return an empty string if something goes wrong.\n return \"\";\n }\n}\n\n/**\n * Stops an event from taking action.\n *\n * @param {Event} event - The event.\n */\nexport function preventEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\n","/**\n * Check to see if the provided elements have a specific contructor.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking instanceof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {object} contructor - The constructor to check for.\n * @param {object} elements - The element(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidInstance(contructor, elements) {\n try {\n if (typeof elements !== \"object\") {\n const elementsType = typeof elements;\n\n throw new TypeError(\n `Elements given to isValidInstance() must be inside of an object. \"${elementsType}\" given.`\n );\n }\n\n for (const key in elements) {\n if (!(elements[key] instanceof contructor)) {\n const elementType = typeof elements[key];\n throw new TypeError(\n `${key} must be an instance of ${contructor.name}. \"${elementType}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are of a specific type.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking typeof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {string} type - The type to check for.\n * @param {object} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidType(type, values) {\n try {\n if (typeof values !== \"object\") {\n const valuesType = typeof values;\n\n throw new TypeError(\n `Values given to isValidType() must be inside of an object. \"${valuesType}\" given.`\n );\n }\n\n for (const key in values) {\n const valueType = typeof values[key];\n\n if (valueType !== type) {\n throw new TypeError(`${key} must be a ${type}. \"${valueType}\" given.`);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided values are valid query selectors.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isQuerySelector(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isQuerySelector() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n try {\n if (values[key] === null) {\n throw new Error();\n }\n\n document.querySelector(values[key]);\n } catch {\n throw new TypeError(\n `${key} must be a valid query selector. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided value is either a string or an array of strings.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string, string[]>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidClassList(values) {\n try {\n if (typeof values !== \"object\" || Array.isArray(values)) {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidClassList() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n const type = typeof values[key];\n\n if (type !== \"string\") {\n if (Array.isArray(values[key])) {\n values[key].forEach((value) => {\n if (typeof value !== \"string\") {\n throw new TypeError(\n `${key} must be a string or an array of strings. An array containing non-strings given.`\n );\n }\n });\n } else {\n throw new TypeError(\n `${key} must be a string or an array of strings. \"${type}\" given.`\n );\n }\n } else {\n const obj = {};\n obj[key] = values[key];\n\n isQuerySelector(obj);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided elements are using a specific tag.\n *\n * The elements must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `true` if the check is successful.\n *\n * @param {string} tagName - The name of the tag.\n * @param {Object<HTMLElement>} elements - The element(s) to check.\n * @return {boolean} - The result of the check.\n */\nexport function isTag(tagName, elements) {\n if (\n isValidType(\"string\", { tagName }).status &&\n isValidInstance(HTMLElement, elements).status\n ) {\n const tag = tagName.toLowerCase();\n let check = true;\n\n for (const key in elements) {\n if (elements[key].tagName.toLowerCase() !== tag) check = false;\n }\n\n return check;\n } else {\n return false;\n }\n}\n","/**\n * @file\n * Provides a system to get and store Graupl data in the browser.\n */\n\nimport { isValidType } from \"./validate.js\";\n\n/**\n * Initializes the storage system.\n *\n * @param {?string} [type = null] - The type of storage to initialize.\n */\nexport function initializeStorage(type = null) {\n window.Graupl = window.Graupl || {};\n\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = window.Graupl[type] || {};\n }\n}\n\n/**\n * Get the storage object.\n *\n * @param {?string} type - The type of storage to get.\n * @return {object} - The storage object.\n */\nexport function getStorage(type = null) {\n if (isValidType(\"string\", { type })) {\n return window.Graupl[type];\n }\n\n return window.Graupl;\n}\n\n/**\n * Set the storage object of a given type.\n *\n * @param {string} type - The type of storage to set.\n * @param {object} data - The data to set.\n */\nexport function setStorage(type, data = {}) {\n if (isValidType(\"string\", { type }) && isValidType(\"object\", { data })) {\n window.Graupl[type] = data;\n }\n}\n\n/**\n * Clear the storage object of a given type.\n *\n * @param {string} type - The type of storage to clear.\n */\nexport function clearStorage(type) {\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = {};\n }\n}\n\n/**\n * Push a value to the storage object.\n *\n * @param {string} type - The type of storage to push to.\n * @param {string} key - The key to use for the value.\n * @param {*} value - The value to store.\n */\nexport function pushToStorage(type, key, value) {\n if (isValidType(\"string\", { type, key })) {\n window.Graupl[type][key] = value;\n }\n}\n\n/**\n * Get a value from the storage object.\n *\n * @param {string }type - The type of storage to get from.\n * @param {string }key - The key to get the value from.\n * @return {*} - The value from the storage object.\n */\nexport function getFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n return window.Graupl[type][key];\n }\n\n return null;\n}\n\n/**\n * Remove a value from the storage object.\n *\n * @param {string} type - The type of storage to remove from.\n * @param {string} key - The key to remove the value from.\n */\nexport function removeFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n delete window.Graupl[type][key];\n }\n}\n\nexport default {\n initializeStorage,\n getStorage,\n setStorage,\n clearStorage,\n pushToStorage,\n getFromStorage,\n removeFromStorage,\n};\n","/**\n * @file\n * The carousel class.\n */\n\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { preventEvent, keyPress } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\nimport {\n isQuerySelector,\n isTag,\n isValidClassList,\n isValidInstance,\n isValidType,\n} from \"../validate.js\";\n\nclass Carousel {\n /**\n * The DOM elements within the carousel.\n *\n * @protected\n *\n * @type {Object<HTMLElement, HTMLElement[]>}\n *\n * @property {HTMLElement} carousel - The carousel element.\n * @property {HTMLElement[]} carouselItems - The carousel items.\n * @property {HTMLElement} carouselItemContainer - The carousel item container.\n * @property {HTMLElement[]} carouselControls - The carousel controls.\n * @property {HTMLElement} carouselControlContainer - The carousel control container.\n * @property {HTMLElement[]} carouselTabs - The carousel tabs.\n * @property {HTMLElement} carouselTabContainer - The carousel tab container.\n * @property {HTMLElement} autoplay - The autoplay button.\n * @property {HTMLElement} next - The next button.\n * @property {HTMLElement} previous - The previous button.\n */\n _dom = {\n carousel: null,\n carouselItems: [],\n carouselItemContainer: null,\n carouselControls: [],\n carouselControlContainer: null,\n carouselTabs: [],\n carouselTabContainer: null,\n autoplay: null,\n next: null,\n previous: null,\n };\n\n /**\n * The query selectors used by the carousel to populate the dom.\n *\n * @protected\n *\n * @type {Object<string>}\n *\n * @property {string} carouselItems - The query selector string for carousel items.\n * @property {string} carouselItemContainer - The query selector string for the carousel item container.\n * @property {string} carouselControls - The query selector string for carousel controls.\n * @property {string} carouselControlContainer - The query selector string for carousel control container.\n * @property {string} carouselTabs - The query selector string for the carousel tabs.\n * @property {string} carouselTabContainer - The query selector string for the carousel tab container.\n * @property {string} autoplay - The query selector string for the autoplay button.\n * @property {string} next - The query selector string for the next button.\n * @property {string} previous - The query selector string for the previous button.\n */\n _selectors = {\n carouselItems: \"\",\n carouselItemContainer: \"\",\n carouselControls: \"\",\n carouselControlContainer: \"\",\n carouselTabs: \"\",\n carouselTabContainer: \"\",\n autoplay: \"\",\n next: \"\",\n previous: \"\",\n };\n\n /**\n * The class(es) to apply when a carousel item is active.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _activeClass = \"active\";\n\n /**\n * The class(es) to apply to a carousel item that is the previously active item.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _previousClass = \"previous\";\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _nextClass = \"next\";\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is paused.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _playClass = \"play\";\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is playing.\n *\n * @protected\n *\n * @type {string|string[]}\n */\n _pauseClass = \"pause\";\n\n /**\n * The index of the currently active carousel item.\n *\n * @protected\n *\n * @type {number}\n */\n _currentItem = 0;\n\n /**\n * A flag to indicate if the carousel is currently playing.\n *\n * @protected\n *\n * @type {boolean}\n */\n _autoplay = true;\n\n /**\n * A variable to delay transition slides in milliseconds.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionDelay = 10000;\n\n /**\n * The duration time (in milliseconds) for the transition between carousel items.\n *\n * @protected\n *\n * @type {number}\n */\n _transitionDuration = 500;\n\n /**\n * The label for the autoplay button when the carousel is paused.\n *\n * @protected\n *\n * @type {string}\n */\n _playText = \"Play\";\n\n /**\n * The label for the autoplay button when the carousel is playing.\n *\n * @protected\n *\n * @type {string}\n */\n _pauseText = \"Pause\";\n\n /**\n * The current action being performed by the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _currentAction = \"next\";\n\n /**\n * The stored interval callback for autoplaying the carousel.\n *\n * @protected\n *\n * @type {?Function}\n */\n _autoplayInterval = null;\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @protected\n *\n * @type {string}\n */\n _prefix = \"graupl-\";\n\n /**\n * The key used to generate IDs throughout the carousel.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * An array of error messages generated by the carousel.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * Contructs a new `Carousel`.\n *\n * @param {object} options - The options for the generated carousel.\n * @param {HTMLElement} options.carouselElement - The carousel element in the DOM.\n * @param {string} [options.carouselItemSelector = .carousel-item] - The query selector string for carousel items.\n * @param {string} [options.carouselItemContainerSelector = .carousel-item-container] - The query selector string for the carousel item container.\n * @param {string} [options.carouselControlSelector = .carousel-control] - The query selector string for carousel controls.\n * @param {string} [options.carouselControlContainerSelector = .carousel-control-container] - The query selector string for carousel control container.\n * @param {string} [options.carouselTabSelector = .carousel-tab] - The query selector string for carousel tabs.\n * @param {string} [options.carouselTabContainerSelector = .carousel-tab-container] - The query selector string for the carousel tab container.\n * @param {string} [options.autoplaySelector = .autoplay] - The query selector string for the autoplay button.\n * @param {string} [options.nextSelector = .next] - The query selector string for the next button.\n * @param {string} [options.previousSelector = .previous] - The query selector string for the previous button.\n * @param {?(string|string[])} [options.activeClass = active] - The class(es) to apply when a carousel item is active.\n * @param {?(string|string[])} [options.previousClass = previous] - The class(es) to apply to a carousel item that is the previously active item.\n * @param {?(string|string[])} [options.nextClass = next] - The class(es) to apply to a carousel item that is the next active item.\n * @param {?(string|string[])} [options.playClass = play] - The class(es) to apply to the autoplay button when the carousel is paused.\n * @param {?(string|string[])} [options.pauseClass = pause] - The class(es) to apply to the autoplay button when the carousel is playing.\n * @param {boolean} [options.autoplay = true] - A flag to indicate if the carousel should autoplay.\n * @param {number} [options.transitionDelay = 10000] - A flag to initialize the carousel immediately upon creation.\n * @param {number} [options.transitionDuration = 500] - The duration time (in milliseconds) for the transition between carousel items.\n * @param {?string} [options.playText = Play] - The text to use for the play button.\n * @param {?string} [options.pauseText = Pause] - The text to use for the pause button.\n * @param {?string} [options.prefix = graupl-] - The prefix to use for CSS custom properties.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the carousel.\n * @param {boolean} [options.initialize = false] - A flag to initialize the carousel immediately upon creation.\n */\n constructor({\n carouselElement,\n carouselItemSelector = \".carousel-item\",\n carouselItemContainerSelector = \".carousel-item-container\",\n carouselControlSelector = \".carousel-control\",\n carouselControlContainerSelector = \".carousel-control-container\",\n carouselTabSelector = \".carousel-tab\",\n carouselTabContainerSelector = \".carousel-tab-container\",\n autoplaySelector = \".autoplay\",\n nextSelector = \".next\",\n previousSelector = \".previous\",\n activeClass = \"active\",\n previousClass = \"previous\",\n nextClass = \"next\",\n playClass = \"play\",\n pauseClass = \"pause\",\n autoplay = true,\n transitionDelay = 10000,\n transitionDuration = 500,\n playText = \"Play\",\n pauseText = \"Pause\",\n prefix = \"graupl-\",\n key = null,\n initialize = false,\n }) {\n // Set DOM elements.\n this._dom.carousel = carouselElement;\n\n // Set query selectors.\n this._selectors.carouselItems = carouselItemSelector;\n this._selectors.carouselItemContainer = carouselItemContainerSelector;\n this._selectors.carouselControls = carouselControlSelector;\n this._selectors.carouselControlContainer = carouselControlContainerSelector;\n this._selectors.carouselTabs = carouselTabSelector;\n this._selectors.carouselTabContainer = carouselTabContainerSelector;\n this._selectors.autoplay = autoplaySelector;\n this._selectors.next = nextSelector;\n this._selectors.previous = previousSelector;\n\n // Set class names.\n this._activeClass = activeClass || \"\";\n this._previousClass = previousClass || \"\";\n this._nextClass = nextClass || \"\";\n this._playClass = playClass || \"\";\n this._pauseClass = pauseClass || \"\";\n\n // Set flags.\n this._autoplay = autoplay;\n\n // Set transition options.\n this._transitionDelay = transitionDelay;\n this._transitionDuration = transitionDuration;\n\n // Set labels.\n this._playText = playText || \"\";\n this._pauseText = pauseText || \"\";\n\n // Set prefix.\n this._prefix = prefix || \"\";\n\n // Set the key.\n this._key = key || \"\";\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the carousel.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Carousel: cannot initialize carousel. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n // Set up the DOM.\n this._generateKey();\n this._setDOMElements();\n this._setIds();\n this._setAriaAttributes();\n\n // Activate the first item.\n this.activateFirstItem();\n\n // Handle events.\n this._handleAutoplay();\n this._handleFocus();\n this._handleClick();\n this._handleHover();\n this._handleKeydown();\n this._handleKeyup();\n\n // Set the custom props.\n this._setTransitionDuration();\n\n // Set up the storage.\n storage.initializeStorage(\"carousels\");\n storage.pushToStorage(\"carousels\", this.dom.carousel.id, this);\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The HTML elements for the carousel in the DOM.\n *\n * @readonly\n *\n * @type {Object<HTMLElement>}\n *\n * @see _dom\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The query selectors used by the carousel to populate the dom.\n *\n * @readonly\n *\n * @type {Object<string>}\n *\n * @see _selectors\n */\n get selectors() {\n return this._selectors;\n }\n\n /**\n * The class(es) to apply when a carousel item is active.\n *\n * @type {string|string[]}\n *\n * @see _activeClass\n */\n get activeClass() {\n return this._activeClass;\n }\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @type {string|string[]}\n *\n * @see _previousClass\n */\n get previousClass() {\n return this._previousClass;\n }\n\n /**\n * The class(es) to apply to a carousel item that is the next active item.\n *\n * @type {string|string[]}\n *\n * @see _nextClass\n */\n get nextClass() {\n return this._nextClass;\n }\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is paused.\n *\n * @type {string|string[]}\n *\n * @see _playClass\n */\n get playClass() {\n return this._playClass;\n }\n\n /**\n * The class(es) to apply to the autoplay button when the carousel is playing.\n *\n * @type {string|string[]}\n *\n * @see _pauseClass\n */\n get pauseClass() {\n return this._pauseClass;\n }\n\n /**\n * The index of the currently active carousel item.\n *\n * @type {number}\n *\n * @see _currentItem\n */\n get currentItem() {\n return this._currentItem;\n }\n\n /**\n * The currently active carousel item.\n *\n * @readonly\n *\n * @type {HTMLElement}\n */\n get currentCarouselItem() {\n return this.dom.carouselItems[this.currentItem];\n }\n\n /**\n * The currently active carousel tab.\n *\n * @readonly\n *\n * @type {HTMLElement}\n */\n get currentCarouselTab() {\n return this.dom.carouselTabs[this.currentItem];\n }\n\n /**\n * A flag to indicate if the carousel is currently playing.\n *\n * @type {boolean}\n *\n * @see _autoplay\n */\n get autoplay() {\n return this._autoplay;\n }\n\n /**\n * The delay in milliseconds before transitioning slides.\n *\n * @type {number}\n *\n * @see _transitionDelay\n */\n get transitionDelay() {\n return this._transitionDelay;\n }\n\n /**\n * The duration time (in milliseconds) for the transition between carousel items.\n *\n * @type {number}\n *\n * @see _transitionDuration\n */\n get transitionDuration() {\n return this._transitionDuration;\n }\n\n /**\n * The label for the autoplay button when the carousel is paused.\n *\n * @type {string}\n *\n * @see _playText\n */\n get playText() {\n return this._playText;\n }\n\n /**\n * The label for the autoplay button when the carousel is playing.\n *\n * @type {string}\n *\n * @see _pauseText\n */\n get pauseText() {\n return this._pauseText;\n }\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @type {string}\n *\n * @see _prefix\n */\n get prefix() {\n return this._prefix;\n }\n\n /**\n * The key used to generate IDs throughout the accordion.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n /**\n * The current action being performed by the carousel.\n *\n * @type {string}\n *\n * @see _currentAction\n */\n get currentAction() {\n return this._currentAction;\n }\n\n /**\n * An array of error messages generated by the carousel.\n *\n * @readonly\n *\n * @type {string[]}\n *\n * @see _errors\n */\n get errors() {\n return this._errors;\n }\n\n set currentItem(value) {\n isValidType(\"number\", { value });\n\n if (value === this.currentItem) {\n return;\n }\n\n if (value < 0) {\n this._currentItem = 0;\n } else if (value >= this.dom.carouselItems.length) {\n this._currentItem = this.dom.carouselItems.length - 1;\n } else {\n this._currentItem = value;\n }\n\n // Keep the aria selected in sync with the current item.\n const tabs = this._dom.carousel.querySelectorAll(\n this.selectors.carouselTab\n );\n if (tabs) {\n this.dom.carouselItems.forEach((item, index) => {\n item.setAttribute(\"aria-selected\", index === this._currentItem);\n });\n }\n }\n\n set autoplay(value) {\n isValidType(\"boolean\", { value });\n\n if (this._autoplay !== value) {\n this._autoplay = value;\n }\n }\n\n set activeClass(value) {\n isValidClassList({ activeClass: value });\n\n if (this._activeClass !== value) {\n this._activeClass = value;\n }\n }\n\n set previousClass(value) {\n isValidClassList({ previousClass: value });\n\n if (this._previousClass !== value) {\n this._previousClass = value;\n }\n }\n\n set nextClass(value) {\n isValidClassList({ nextClass: value });\n\n if (this._nextClass !== value) {\n this._nextClass = value;\n }\n }\n\n set playClass(value) {\n isValidClassList({ playClass: value });\n\n if (this._playClass !== value) {\n this._playClass = value;\n }\n }\n\n set pauseClass(value) {\n isValidClassList({ pauseClass: value });\n\n if (this._pauseClass !== value) {\n this._pauseClass = value;\n }\n }\n\n set transitionDelay(value) {\n isValidType(\"number\", { value });\n\n if (value !== this.transitionDelay && value >= 0) {\n this._currentItem = value;\n }\n }\n\n set transitionDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._transitionDuration !== value && value >= 0) {\n this._transitionDuration = value;\n this._setTransitionDuration();\n }\n }\n\n set playText(value) {\n isValidType(\"string\", { value });\n\n if (this._playText !== value) {\n this._playText = value;\n }\n }\n\n set pauseText(value) {\n isValidType(\"string\", { value });\n\n if (this._pauseText !== value) {\n this._pauseText = value;\n }\n }\n\n set prefix(value) {\n isValidType(\"string\", { value });\n\n if (this._prefix !== value) {\n this._prefix = value;\n }\n }\n\n set key(value) {\n isValidType(\"string\", { value });\n\n if (this._key !== value) {\n this._key = value;\n }\n }\n\n /**\n * Validates all aspects of the carousel to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The results of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n const htmlElementChecks = isValidInstance(HTMLElement, {\n carousel: this.dom.carousel,\n });\n\n if (!htmlElementChecks) {\n this._errors.push(htmlElementChecks.message);\n check = false;\n }\n\n // Query selector checks.\n const querySelectorChecks = isQuerySelector({\n carouselItemsSelector: this._selectors.carouselItems,\n carouselItemContainerSelector: this._selectors.carouselItemContainer,\n carouselControlsSelector: this._selectors.carouselControls,\n carouselControlContainerSelector:\n this._selectors.carouselControlContainer,\n carouselTabsSelector: this._selectors.carouselTabs,\n carouselTabContainerSelector: this._selectors.carouselTabContainer,\n autoplaySelector: this._selectors.autoplay,\n nextSelector: this._selectors.next,\n previousSelector: this._selectors.previous,\n });\n\n if (!querySelectorChecks) {\n this._errors.push(querySelectorChecks.message);\n check = false;\n }\n\n // Autoplay checks.\n const autoplayChecks = isValidType(\"boolean\", { autoplay: this.autoplay });\n\n if (!autoplayChecks) {\n this._errors.push(autoplayChecks.message);\n check = false;\n }\n\n // Check delay is a valid value.\n const delayCheck = isValidType(\"number\", {\n transitionDelay: this._transitionDelay,\n });\n\n if (!delayCheck) {\n this._errors.push(delayCheck.message);\n check = false;\n }\n\n // Check duration is a valid value.\n const durationCheck = isValidType(\"number\", {\n transitionDuration: this._transitionDuration,\n });\n\n if (!durationCheck) {\n this._errors.push(durationCheck.message);\n check = false;\n }\n\n // Active class checks.\n if (this._activeClass !== \"\") {\n const activeClassChecks = isValidClassList({\n activeClass: this._activeClass,\n });\n\n if (!activeClassChecks) {\n this._errors.push(activeClassChecks.message);\n check = false;\n }\n }\n\n // Previous class checks.\n if (this._previousClass !== \"\") {\n const previousClassChecks = isValidClassList({\n previousClass: this._previousClass,\n });\n\n if (!previousClassChecks) {\n this._errors.push(previousClassChecks.message);\n check = false;\n }\n }\n\n // Next class checks.\n if (this._nextClass !== \"\") {\n const nextClassChecks = isValidClassList({\n nextClass: this._nextClass,\n });\n\n if (!nextClassChecks) {\n this._errors.push(nextClassChecks.message);\n check = false;\n }\n }\n\n // Play class checks.\n if (this._playClass !== \"\") {\n const playClassChecks = isValidClassList({\n playClass: this._playClass,\n });\n\n if (!playClassChecks) {\n this._errors.push(playClassChecks.message);\n check = false;\n }\n }\n\n // Pause class checks.\n if (this._pauseClass !== \"\") {\n const pauseClassChecks = isValidClassList({\n pauseClass: this._pauseClass,\n });\n\n if (!pauseClassChecks) {\n this._errors.push(pauseClassChecks.message);\n check = false;\n }\n }\n\n // Play text checks.\n if (this._playText !== \"\") {\n const playTextChecks = isValidType(\"string\", {\n playText: this._playText,\n });\n\n if (!playTextChecks) {\n this._errors.push(playTextChecks.message);\n check = false;\n }\n }\n\n // Pause text checks.\n if (this._pauseText !== \"\") {\n const pauseTextChecks = isValidType(\"string\", {\n pauseText: this._pauseText,\n });\n\n if (!pauseTextChecks) {\n this._errors.push(pauseTextChecks.message);\n check = false;\n }\n }\n\n // Prefix checks.\n const prefixChecks = isValidType(\"string\", { prefix: this._prefix });\n\n if (!prefixChecks) {\n this._errors.push(prefixChecks.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Sets DOM elements within the carousel.\n *\n * The carousel element _cannot_ be set through this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to populate.\n * @param {HTMLElement} [base = this.dom.carousel] - The element used as the base for the querySelector.\n * @param {boolean} [overwrite = true] - A flag to set if the existing elements will be overwritten.\n */\n _setDOMElementType(elementType, base = this.dom.carousel, overwrite = true) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (elementType === \"carousel\") {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" element cannot be set through _setDOMElementType.`\n );\n }\n\n if (base !== this.dom.carousel) isValidInstance(HTMLElement, { base });\n\n if (Array.isArray(this._dom[elementType])) {\n // Get all the elements matching the selector in the base.\n const domElements = Array.from(\n base.querySelectorAll(this.selectors[elementType])\n );\n\n // Filter the elements so only direct children of the base are kept.\n const filteredElements = domElements.filter(\n (item) => item.parentElement === base\n );\n\n if (overwrite) {\n this._dom[elementType] = filteredElements;\n } else {\n this._dom[elementType] = [\n ...this._dom[elementType],\n ...filteredElements,\n ];\n }\n } else {\n // Get the single element matching the selector in the base.\n const domElement = base.querySelector(this.selectors[elementType]);\n\n // Ensure the element is a direct child of the base.\n if (domElement && domElement.parentElement !== base) {\n return;\n }\n\n if (overwrite) {\n this._dom[elementType] = domElement;\n }\n }\n } else {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" is not a valid element type within the carousel.`\n );\n }\n }\n\n /**\n * Resets DOM elements within the menu.\n *\n * The carousel element _cannot_ be reset through this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to clear.\n */\n _resetDOMElementType(elementType) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (elementType === \"carousel\") {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" element cannot be reset through _resetDOMElementType.`\n );\n }\n\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [];\n } else {\n this._dom[elementType] = null;\n }\n } else {\n throw new Error(\n `Graupl Carousel: \"${elementType}\" is not a valid element type within the carousel.`\n );\n }\n }\n\n /**\n * Sets all DOM elements within the carousel.\n *\n * Utilizes _setDOMElementType and _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n this._setDOMElementType(\"carouselItemContainer\");\n this._setDOMElementType(\"carouselControlContainer\");\n this._setDOMElementType(\"carouselTabContainer\");\n\n if (this.dom.carouselItemContainer) {\n this._setDOMElementType(\"carouselItems\", this.dom.carouselItemContainer);\n }\n if (this.dom.carouselControlContainer) {\n this._setDOMElementType(\n \"carouselControls\",\n this.dom.carouselControlContainer\n );\n this._setDOMElementType(\"autoplay\", this.dom.carouselControlContainer);\n this._setDOMElementType(\"next\", this.dom.carouselControlContainer);\n this._setDOMElementType(\"previous\", this.dom.carouselControlContainer);\n }\n\n if (this._dom.carouselTabContainer) {\n this._setDOMElementType(\"carouselTabs\", this.dom.carouselTabContainer);\n }\n }\n\n /**\n * Generates a key for the carousel.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this.key === \"\" || regenerate) {\n this.key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the carousel and it's children if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - carousel: `carousel-${key}`\n * - carousel items: `carousel-item-${key}-${index}`\n * - carousel tabs: `carousel-tab-${key}-${index}`\n */\n _setIds() {\n this.dom.carousel.id = this.dom.carousel.id || `carousel-${this.key}`;\n\n this.dom.carouselItems.forEach((item, index) => {\n item.id = item.id || `carousel-item-${this.key}-${index}`;\n });\n\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.id = tab.id || `carousel-tab-${this.key}-${index}`;\n });\n }\n\n /**\n * Sets the aria attributes for the carousel.\n */\n _setAriaAttributes() {\n // Make sure the carousel has a proper role.\n // Sections and role=\"region\" are acceptable in certain cases, so\n // we only need to fallback to role=\"group\" if neither of those are present.\n if (\n !isTag(\"section\", { carousel: this.dom.carousel }) &&\n !this.dom.carousel.getAttribute(\"role\") !== \"region\"\n ) {\n this.dom.carousel.setAttribute(\"role\", \"group\");\n }\n\n // Set the role description for the carousel.\n this._dom.carousel.setAttribute(\"aria-roledescription\", \"carousel\");\n\n if (this.dom.carouselTabContainer) {\n this.dom.carouselTabContainer.setAttribute(\"role\", \"tablist\");\n }\n\n this.dom.carouselTabs.forEach((tab, index) => {\n if (!isTag(\"button\", { tab: tab })) {\n tab.setAttribute(\"role\", \"button\");\n }\n\n tab.setAttribute(\"aria-selected\", index === 0);\n tab.setAttribute(\"aria-controls\", this.dom.carouselItems[index].id);\n });\n }\n\n /**\n * Sets the interval for autoplaying the carousel.\n *\n * @protected\n */\n _setInterval() {\n this._clearInterval();\n\n this._autoplayInterval = setInterval(() => {\n this.activateNextItem();\n }, this.transitionDelay);\n }\n\n /**\n * Clears the interval for autoplaying the carousel.\n *\n * @protected\n */\n _clearInterval() {\n clearInterval(this._autoplayInterval);\n }\n\n /**\n * Handles the autoplay functionality of the carousel.\n *\n * - Adds the appropriate class to the autoplay button.\n * - Removes the appropriate class from the autoplay button.\n * - Sets the appropriate aria-label for the autoplay button.\n * - Sets the appropriate aria-live for the carousel.\n * - Sets/clears the interval for autoplaying the carousel.\n *\n * @protected\n */\n _handleAutoplay() {\n if (this.autoplay) {\n addClass(this.pauseClass, this.dom.autoplay);\n removeClass(this.playClass, this.dom.autoplay);\n\n this.dom.autoplay.setAttribute(\"aria-label\", this.pauseText);\n this.dom.carousel.setAttribute(\"aria-live\", \"off\");\n\n this._setInterval();\n } else {\n addClass(this.playClass, this.dom.autoplay);\n removeClass(this.pauseClass, this.dom.autoplay);\n\n this.dom.autoplay.setAttribute(\"aria-label\", this.playText);\n this.dom.carousel.setAttribute(\"aria-live\", \"polite\");\n\n this._clearInterval();\n }\n }\n\n /**\n * Handles the focus events throughout the carousel for proper use.\n *\n * - Adds a `focusin` listener to the carousel element to pause autoplay.\n * - Adds a `focusout` listener to the carousel element to resume autoplay.\n */\n _handleFocus() {\n // Pause autoplay when anything in the carousel is focused.\n this.dom.carousel.addEventListener(\"focusin\", () => {\n if (this.autoplay) {\n this._clearInterval();\n }\n });\n\n this.dom.carousel.addEventListener(\"focusout\", () => {\n if (this.autoplay) {\n this._setInterval();\n }\n });\n }\n\n /**\n * Handles the click events throughout the carousel.\n *\n * - Adds a `pointerup` listener to the next control to activate the next item.\n * - Adds a `pointerup` listener to the previous control to activate the previous item.\n * - Adds a `pointerup` listener to the autoplay control to toggle autoplay.\n * - Adds a `pointerup` listener to each tab control to activate the corresponding item.\n */\n _handleClick() {\n this.dom.next.addEventListener(\"pointerup\", () => {\n this.activateNextItem();\n });\n\n this.dom.previous.addEventListener(\"pointerup\", () => {\n this.activatePreviousItem();\n });\n\n this.dom.autoplay.addEventListener(\"pointerup\", () => {\n this.toggleAutoplay();\n });\n\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.addEventListener(\"pointerup\", () => {\n if (this.currentItem > index) {\n this._currentAction = \"previous\";\n } else {\n this._currentAction = \"next\";\n }\n\n this.activateItem(index);\n });\n });\n }\n\n /**\n * Handles the hover events throughout the carousel for proper use.\n *\n * - Adds a `pointerover` listener to the carousel to pause autoplay.\n * - Adds a `pointerleave` listener to the carousel to resume autoplay.\n */\n _handleHover() {\n // Pause autoplay when anything in the carousel is hovered.\n this.dom.carousel.addEventListener(\"pointerover\", () => {\n if (this.autoplay) {\n this._clearInterval();\n }\n });\n\n this.dom.carousel.addEventListener(\"pointerleave\", () => {\n if (this.autoplay) {\n this._setInterval();\n }\n });\n }\n\n /**\n * Handles keydown events throughout the carousel item for proper use.\n *\n * - Adds a `keydown` listener to all control elements.\n * - Prevents Space and Enter key events.\n * - Adds a `keydown` listener to all tab elements.\n * - Prevents Space and Enter key events.\n */\n _handleKeydown() {\n this.dom.carouselControls.forEach((control) => {\n control.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n\n this.dom.carouselTabs.forEach((tab) => {\n tab.addEventListener(\"keydown\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n }\n\n /**\n * Handles keyup events throughout the carousel item for proper use.\n *\n * - Adds a `keyup` listener to all control elements.\n * - Activates the next/previous item depending on which control is pressed.\n * - Toggles autoplay if the autoplay control is pressed.\n *\n */\n _handleKeyup() {\n // Activate the next item if the space or enter key on the next control.\n this.dom.next.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activateNextItem();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Activate the previous item if the space or enter key on the previous control.\n this.dom.previous.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activatePreviousItem();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Toggle autoplay if the space or enter key on the autoplay control.\n this.dom.autoplay.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.toggleAutoplay();\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n\n // Activate the item if the space or enter key on the tab control.\n this.dom.carouselTabs.forEach((tab, index) => {\n tab.addEventListener(\"keyup\", (event) => {\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.activateItem(index);\n\n // Prevent the default action of the event.\n preventEvent(event);\n\n break;\n }\n });\n });\n }\n\n /**\n * Sets the transition duration for the carousel as a CSS custom property.\n *\n * The custom property is set as `--graupl-carousel-transition-duration`.\n *\n * @protected\n */\n _setTransitionDuration() {\n this.dom.carousel.style.setProperty(\n `--${this.prefix}carousel-transition-duration`,\n `${this.transitionDuration}ms`\n );\n }\n\n /**\n * Activates the current carousel item.\n *\n * @public\n */\n activateCurrentItem() {\n addClass(this.activeClass, this.currentCarouselItem);\n\n if (this.currentCarouselTab) {\n this.currentCarouselTab.setAttribute(\"aria-selected\", true);\n addClass(this.activeClass, this.currentCarouselTab);\n }\n }\n\n /**\n * Deactivates the current carousel item.\n *\n * @public\n */\n deactivateCurrentItem() {\n removeClass(this.activeClass, this.currentCarouselItem);\n\n if (this.currentCarouselTab) {\n this.currentCarouselTab.setAttribute(\"aria-selected\", false);\n removeClass(this.activeClass, this.currentCarouselTab);\n }\n }\n\n /**\n * Activates the carousel item at a given index.\n *\n * @public\n *\n * @param {number} index - The index of the carousel item to activate.\n */\n activateItem(index) {\n const currentIndex = this.currentItem;\n\n this.dom.carousel.dataset.grauplAction = this._currentAction;\n\n if (this.autoplay) {\n this._clearInterval();\n }\n\n addClass(this.previousClass, this.currentCarouselItem);\n addClass(this.nextClass, this.dom.carouselItems[index]);\n\n requestAnimationFrame(() => {\n this.deactivateCurrentItem();\n this.currentItem = index;\n this.activateCurrentItem();\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(this.previousClass, this.dom.carouselItems[currentIndex]);\n removeClass(this.nextClass, this.currentCarouselItem);\n }, this.transitionDuration);\n });\n });\n\n if (this.autoplay) {\n this._setInterval();\n }\n }\n\n /**\n * Activates the first carousel item.\n *\n * @public\n */\n activateFirstItem() {\n this.activateItem(0);\n }\n\n /**\n * Activates the last carousel item.\n *\n * @public\n */\n activateLastItem() {\n this.activateItem(this.dom.carouselItems.length - 1);\n }\n\n /**\n * Activates the next carousel item.\n *\n * @public\n */\n activateNextItem() {\n this._currentAction = \"next\";\n\n if (this.currentItem + 1 >= this.dom.carouselItems.length) {\n this.activateFirstItem();\n } else {\n this.activateItem(this.currentItem + 1);\n }\n }\n\n /**\n * Activates the previous carousel item.\n *\n * @public\n */\n activatePreviousItem() {\n this._currentAction = \"previous\";\n\n if (this.currentItem - 1 < 0) {\n this.activateLastItem();\n } else {\n this.activateItem(this.currentItem - 1);\n }\n }\n\n /**\n * Toggles autoplay on the carousel.\n *\n * @public\n */\n toggleAutoplay() {\n this.autoplay = !this.autoplay;\n\n this._handleAutoplay();\n }\n}\n\nexport default Carousel;\n"],"mappings":"AAMA,SAAgByE,EAASxE,EAAWC,EAAS,CAEvCD,IAAc,IAAMA,EAAUkK,SAAW,IAI7C,OAAWlK,GAAc,SACvBC,EAAQE,UAAUC,IAAIJ,CAAAA,EAEtBC,EAAQE,UAAUC,IAAI,GAAGJ,CAAAA,EAE7B,CAQA,SAAgByE,EAAYzE,EAAWC,EAAS,CAE1CD,IAAc,IAAMA,EAAUkK,SAAW,IAI7C,OAAWlK,GAAc,SACvBC,EAAQE,UAAUG,OAAON,CAAAA,EAEzBC,EAAQE,UAAUG,OAAO,GAAGN,CAAAA,EAEhC,CC9BA,SAAgB2E,EAASmJ,EAAO,CAC9B,GAAI,CAEF,MAAM1F,EAAM0F,EAAM1F,KAAO0F,EAAMpN,QACzBC,EAAO,CACXC,MAAOwH,IAAQ,SAAWA,IAAQ,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AAKf,UACP,KAAK0H,eAAAA,EAGP7I,EAAS,KAAKmD,cAAe,KAAKmC,mBAAAA,EAClCtF,EAAS,KAAKoD,UAAW,KAAK4B,IAAInE,cAAcmF,CAAAA,CAAAA,EAEhD8D,sBAAsB,IAAM,CAC1B,KAAKJ,sBAAAA,EACL,KAAKrE,YAAcW,EACnB,KAAKyD,oBAAAA,EAELK,sBAAsB,IAAM,CAC1BC,WAAW,IAAM,CACf9J,EAAY,KAAKkD,cAAe,KAAK6B,IAAInE,cAAc8I,CAAAA,CAAAA,EACvD1J,EAAY,KAAKmD,UAAW,KAAKkC,mBAAAA,CAClC,EAAE,KAAK9B,kBAAAA,CACT,CAAA,CACF,CAAA,EAEG,KAAKrC,UACP,KAAKyH,aAAAA,CAET,CAOAtE,mBAAoB,CAClB,KAAK8E,aAAa,CAAA,CACpB,CAOAY,kBAAmB,CACjB,KAAKZ,aAAa,KAAKpE,IAAInE,cAAc6E,OAAS,CAAA,CACpD,CAOAqD,kBAAmB,CACjB,KAAK7G,eAAiB,OAElB,KAAKmD,YAAc,GAAK,KAAKL,IAAInE,cAAc6E,OACjD,KAAKpB,kBAAAA,EAEL,KAAK8E,aAAa,KAAK/D,YAAc,CAAA,CAEzC,CAOA6D,sBAAuB,CACrB,KAAKhH,eAAiB,WAElB,KAAKmD,YAAc,EAAI,EACzB,KAAK2E,iBAAAA,EAEL,KAAKZ,aAAa,KAAK/D,YAAc,CAAA,CAEzC,CAOA8D,gBAAiB,CACf,KAAKhI,SAAAA,CAAY,KAAKA,SAEtB,KAAKoD,gBAAAA,CACP,CACF,EAEA,EAAe7D"}
@@ -0,0 +1,5 @@
1
+ function u(t,e){t===""||t.length===0||(typeof t=="string"?e.classList.add(t):e.classList.add(...t))}function c(t,e){t===""||t.length===0||(typeof t=="string"?e.classList.remove(t):e.classList.remove(...t))}function h(t){try{const e=t.key||t.keyCode,s={Enter:e==="Enter"||e===13,Space:e===" "||e==="Spacebar"||e===32,Escape:e==="Escape"||e==="Esc"||e===27,ArrowUp:e==="ArrowUp"||e==="Up"||e===38,ArrowRight:e==="ArrowRight"||e==="Right"||e===39,ArrowDown:e==="ArrowDown"||e==="Down"||e===40,ArrowLeft:e==="ArrowLeft"||e==="Left"||e===37,Home:e==="Home"||e===36,End:e==="End"||e===35,Tab:e==="Tab"||e===9};return Object.keys(s).find(r=>s[r]===!0)||""}catch{return""}}function p(t){t.preventDefault(),t.stopPropagation()}function m(t,e){try{if(typeof e!="object"){const s=typeof e;throw new TypeError(`Elements given to isValidInstance() must be inside of an object. "${s}" given.`)}for(const s in e)if(!(e[s]instanceof t)){const r=typeof e[s];throw new TypeError(`${s} must be an instance of ${t.name}. "${r}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function i(t,e){try{if(typeof e!="object"){const s=typeof e;throw new TypeError(`Values given to isValidType() must be inside of an object. "${s}" given.`)}for(const s in e){const r=typeof e[s];if(r!==t)throw new TypeError(`${s} must be a ${t}. "${r}" given.`)}return{status:!0,error:null}}catch(s){return{status:!1,error:s}}}function _(t){try{if(typeof t!="object"){const e=typeof t;throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${e}" given.`)}for(const e in t)try{if(t[e]===null)throw new Error;document.querySelector(t[e])}catch{throw new TypeError(`${e} must be a valid query selector. "${t[e]}" given.`)}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function o(t){try{if(typeof t!="object"||Array.isArray(t)){const e=typeof t;throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${e}" given.`)}for(const e in t){const s=typeof t[e];if(s!=="string")if(Array.isArray(t[e]))t[e].forEach(r=>{if(typeof r!="string")throw new TypeError(`${e} must be a string or an array of strings. An array containing non-strings given.`)});else throw new TypeError(`${e} must be a string or an array of strings. "${s}" given.`);else{const r={};r[e]=t[e],_(r)}}return{status:!0,error:null}}catch(e){return{status:!1,error:e}}}function d(t,e){if(i("string",{tagName:t}).status&&m(HTMLElement,e).status){const s=t.toLowerCase();let r=!0;for(const n in e)e[n].tagName.toLowerCase()!==s&&(r=!1);return r}else return!1}function M(t=null){window.Graupl=window.Graupl||{},i("string",{type:t})&&(window.Graupl[t]=window.Graupl[t]||{})}function G(t=null){return i("string",{type:t})?window.Graupl[t]:window.Graupl}function O(t,e={}){i("string",{type:t})&&i("object",{data:e})&&(window.Graupl[t]=e)}function j(t){i("string",{type:t})&&(window.Graupl[t]={})}function P(t,e,s){i("string",{type:t,key:e})&&(window.Graupl[t][e]=s)}function F(t,e){return i("string",{type:t,key:e})?window.Graupl[t][e]:null}function V(t,e){i("string",{type:t,key:e})&&delete window.Graupl[t][e]}var y={initializeStorage:M,getStorage:G,setStorage:O,clearStorage:j,pushToStorage:P,getFromStorage:F,removeFromStorage:V},q=class{_dom={carousel:null,carouselItems:[],carouselItemContainer:null,carouselControls:[],carouselControlContainer:null,carouselTabs:[],carouselTabContainer:null,autoplay:null,next:null,previous:null};_selectors={carouselItems:"",carouselItemContainer:"",carouselControls:"",carouselControlContainer:"",carouselTabs:"",carouselTabContainer:"",autoplay:"",next:"",previous:""};_activeClass="active";_previousClass="previous";_nextClass="next";_playClass="play";_pauseClass="pause";_currentItem=0;_autoplay=!0;_transitionDelay=1e4;_transitionDuration=500;_playText="Play";_pauseText="Pause";_currentAction="next";_autoplayInterval=null;_prefix="graupl-";_key="";_errors=[];constructor({carouselElement:t,carouselItemSelector:e=".carousel-item",carouselItemContainerSelector:s=".carousel-item-container",carouselControlSelector:r=".carousel-control",carouselControlContainerSelector:n=".carousel-control-container",carouselTabSelector:l=".carousel-tab",carouselTabContainerSelector:f=".carousel-tab-container",autoplaySelector:a=".autoplay",nextSelector:C=".next",previousSelector:g=".previous",activeClass:I="active",previousClass:b="previous",nextClass:v="next",playClass:T="play",pauseClass:E="pause",autoplay:w=!0,transitionDelay:x=1e4,transitionDuration:k=500,playText:A="Play",pauseText:D="Pause",prefix:S="graupl-",key:L=null,initialize:$=!1}){this._dom.carousel=t,this._selectors.carouselItems=e,this._selectors.carouselItemContainer=s,this._selectors.carouselControls=r,this._selectors.carouselControlContainer=n,this._selectors.carouselTabs=l,this._selectors.carouselTabContainer=f,this._selectors.autoplay=a,this._selectors.next=C,this._selectors.previous=g,this._activeClass=I||"",this._previousClass=b||"",this._nextClass=v||"",this._playClass=T||"",this._pauseClass=E||"",this._autoplay=w,this._transitionDelay=x,this._transitionDuration=k,this._playText=A||"",this._pauseText=D||"",this._prefix=S||"",this._key=L||"",$&&this.initialize()}initialize(){try{if(!this._validate())throw new Error(`Graupl Carousel: cannot initialize carousel. The following errors have been found:
2
+ - ${this.errors.join(`
3
+ - `)}`);this._generateKey(),this._setDOMElements(),this._setIds(),this._setAriaAttributes(),this.activateFirstItem(),this._handleAutoplay(),this._handleFocus(),this._handleClick(),this._handleHover(),this._handleKeydown(),this._handleKeyup(),this._setTransitionDuration(),y.initializeStorage("carousels"),y.pushToStorage("carousels",this.dom.carousel.id,this)}catch(t){console.error(t)}}get dom(){return this._dom}get selectors(){return this._selectors}get activeClass(){return this._activeClass}get previousClass(){return this._previousClass}get nextClass(){return this._nextClass}get playClass(){return this._playClass}get pauseClass(){return this._pauseClass}get currentItem(){return this._currentItem}get currentCarouselItem(){return this.dom.carouselItems[this.currentItem]}get currentCarouselTab(){return this.dom.carouselTabs[this.currentItem]}get autoplay(){return this._autoplay}get transitionDelay(){return this._transitionDelay}get transitionDuration(){return this._transitionDuration}get playText(){return this._playText}get pauseText(){return this._pauseText}get prefix(){return this._prefix}get key(){return this._key}get currentAction(){return this._currentAction}get errors(){return this._errors}set currentItem(t){if(i("number",{value:t}),t===this.currentItem)return;t<0?this._currentItem=0:t>=this.dom.carouselItems.length?this._currentItem=this.dom.carouselItems.length-1:this._currentItem=t,this._dom.carousel.querySelectorAll(this.selectors.carouselTab)&&this.dom.carouselItems.forEach((s,r)=>{s.setAttribute("aria-selected",r===this._currentItem)})}set autoplay(t){i("boolean",{value:t}),this._autoplay!==t&&(this._autoplay=t)}set activeClass(t){o({activeClass:t}),this._activeClass!==t&&(this._activeClass=t)}set previousClass(t){o({previousClass:t}),this._previousClass!==t&&(this._previousClass=t)}set nextClass(t){o({nextClass:t}),this._nextClass!==t&&(this._nextClass=t)}set playClass(t){o({playClass:t}),this._playClass!==t&&(this._playClass=t)}set pauseClass(t){o({pauseClass:t}),this._pauseClass!==t&&(this._pauseClass=t)}set transitionDelay(t){i("number",{value:t}),t!==this.transitionDelay&&t>=0&&(this._currentItem=t)}set transitionDuration(t){i("number",{value:t}),this._transitionDuration!==t&&t>=0&&(this._transitionDuration=t,this._setTransitionDuration())}set playText(t){i("string",{value:t}),this._playText!==t&&(this._playText=t)}set pauseText(t){i("string",{value:t}),this._pauseText!==t&&(this._pauseText=t)}set prefix(t){i("string",{value:t}),this._prefix!==t&&(this._prefix=t)}set key(t){i("string",{value:t}),this._key!==t&&(this._key=t)}_validate(){let t=!0;const e=m(HTMLElement,{carousel:this.dom.carousel});e||(this._errors.push(e.message),t=!1);const s=_({carouselItemsSelector:this._selectors.carouselItems,carouselItemContainerSelector:this._selectors.carouselItemContainer,carouselControlsSelector:this._selectors.carouselControls,carouselControlContainerSelector:this._selectors.carouselControlContainer,carouselTabsSelector:this._selectors.carouselTabs,carouselTabContainerSelector:this._selectors.carouselTabContainer,autoplaySelector:this._selectors.autoplay,nextSelector:this._selectors.next,previousSelector:this._selectors.previous});s||(this._errors.push(s.message),t=!1);const r=i("boolean",{autoplay:this.autoplay});r||(this._errors.push(r.message),t=!1);const n=i("number",{transitionDelay:this._transitionDelay});n||(this._errors.push(n.message),t=!1);const l=i("number",{transitionDuration:this._transitionDuration});if(l||(this._errors.push(l.message),t=!1),this._activeClass!==""){const a=o({activeClass:this._activeClass});a||(this._errors.push(a.message),t=!1)}if(this._previousClass!==""){const a=o({previousClass:this._previousClass});a||(this._errors.push(a.message),t=!1)}if(this._nextClass!==""){const a=o({nextClass:this._nextClass});a||(this._errors.push(a.message),t=!1)}if(this._playClass!==""){const a=o({playClass:this._playClass});a||(this._errors.push(a.message),t=!1)}if(this._pauseClass!==""){const a=o({pauseClass:this._pauseClass});a||(this._errors.push(a.message),t=!1)}if(this._playText!==""){const a=i("string",{playText:this._playText});a||(this._errors.push(a.message),t=!1)}if(this._pauseText!==""){const a=i("string",{pauseText:this._pauseText});a||(this._errors.push(a.message),t=!1)}const f=i("string",{prefix:this._prefix});return f||(this._errors.push(f.message),t=!1),t}_setDOMElementType(t,e=this.dom.carousel,s=!0){if(typeof this.selectors[t]=="string"){if(t==="carousel")throw new Error(`Graupl Carousel: "${t}" element cannot be set through _setDOMElementType.`);if(e!==this.dom.carousel&&m(HTMLElement,{base:e}),Array.isArray(this._dom[t])){const n=Array.from(e.querySelectorAll(this.selectors[t])).filter(l=>l.parentElement===e);s?this._dom[t]=n:this._dom[t]=[...this._dom[t],...n]}else{const r=e.querySelector(this.selectors[t]);if(r&&r.parentElement!==e)return;s&&(this._dom[t]=r)}}else throw new Error(`Graupl Carousel: "${t}" is not a valid element type within the carousel.`)}_resetDOMElementType(t){if(typeof this.selectors[t]=="string"){if(t==="carousel")throw new Error(`Graupl Carousel: "${t}" element cannot be reset through _resetDOMElementType.`);Array.isArray(this._dom[t])?this._dom[t]=[]:this._dom[t]=null}else throw new Error(`Graupl Carousel: "${t}" is not a valid element type within the carousel.`)}_setDOMElements(){this._setDOMElementType("carouselItemContainer"),this._setDOMElementType("carouselControlContainer"),this._setDOMElementType("carouselTabContainer"),this.dom.carouselItemContainer&&this._setDOMElementType("carouselItems",this.dom.carouselItemContainer),this.dom.carouselControlContainer&&(this._setDOMElementType("carouselControls",this.dom.carouselControlContainer),this._setDOMElementType("autoplay",this.dom.carouselControlContainer),this._setDOMElementType("next",this.dom.carouselControlContainer),this._setDOMElementType("previous",this.dom.carouselControlContainer)),this._dom.carouselTabContainer&&this._setDOMElementType("carouselTabs",this.dom.carouselTabContainer)}_generateKey(t=!1){(this.key===""||t)&&(this.key=Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,10))}_setIds(){this.dom.carousel.id=this.dom.carousel.id||`carousel-${this.key}`,this.dom.carouselItems.forEach((t,e)=>{t.id=t.id||`carousel-item-${this.key}-${e}`}),this.dom.carouselTabs.forEach((t,e)=>{t.id=t.id||`carousel-tab-${this.key}-${e}`})}_setAriaAttributes(){!d("section",{carousel:this.dom.carousel})&&!this.dom.carousel.getAttribute("role")!=="region"&&this.dom.carousel.setAttribute("role","group"),this._dom.carousel.setAttribute("aria-roledescription","carousel"),this.dom.carouselTabContainer&&this.dom.carouselTabContainer.setAttribute("role","tablist"),this.dom.carouselTabs.forEach((t,e)=>{d("button",{tab:t})||t.setAttribute("role","button"),t.setAttribute("aria-selected",e===0),t.setAttribute("aria-controls",this.dom.carouselItems[e].id)})}_setInterval(){this._clearInterval(),this._autoplayInterval=setInterval(()=>{this.activateNextItem()},this.transitionDelay)}_clearInterval(){clearInterval(this._autoplayInterval)}_handleAutoplay(){this.autoplay?(u(this.pauseClass,this.dom.autoplay),c(this.playClass,this.dom.autoplay),this.dom.autoplay.setAttribute("aria-label",this.pauseText),this.dom.carousel.setAttribute("aria-live","off"),this._setInterval()):(u(this.playClass,this.dom.autoplay),c(this.pauseClass,this.dom.autoplay),this.dom.autoplay.setAttribute("aria-label",this.playText),this.dom.carousel.setAttribute("aria-live","polite"),this._clearInterval())}_handleFocus(){this.dom.carousel.addEventListener("focusin",()=>{this.autoplay&&this._clearInterval()}),this.dom.carousel.addEventListener("focusout",()=>{this.autoplay&&this._setInterval()})}_handleClick(){this.dom.next.addEventListener("pointerup",()=>{this.activateNextItem()}),this.dom.previous.addEventListener("pointerup",()=>{this.activatePreviousItem()}),this.dom.autoplay.addEventListener("pointerup",()=>{this.toggleAutoplay()}),this.dom.carouselTabs.forEach((t,e)=>{t.addEventListener("pointerup",()=>{this.currentItem>e?this._currentAction="previous":this._currentAction="next",this.activateItem(e)})})}_handleHover(){this.dom.carousel.addEventListener("pointerover",()=>{this.autoplay&&this._clearInterval()}),this.dom.carousel.addEventListener("pointerleave",()=>{this.autoplay&&this._setInterval()})}_handleKeydown(){this.dom.carouselControls.forEach(t=>{t.addEventListener("keydown",e=>{switch(h(e)){case"Space":case"Enter":p(e);break}})}),this.dom.carouselTabs.forEach(t=>{t.addEventListener("keydown",e=>{switch(h(e)){case"Space":case"Enter":p(e);break}})})}_handleKeyup(){this.dom.next.addEventListener("keyup",t=>{switch(h(t)){case"Space":case"Enter":this.activateNextItem(),p(t);break}}),this.dom.previous.addEventListener("keyup",t=>{switch(h(t)){case"Space":case"Enter":this.activatePreviousItem(),p(t);break}}),this.dom.autoplay.addEventListener("keyup",t=>{switch(h(t)){case"Space":case"Enter":this.toggleAutoplay(),p(t);break}}),this.dom.carouselTabs.forEach((t,e)=>{t.addEventListener("keyup",s=>{switch(h(s)){case"Space":case"Enter":this.activateItem(e),p(s);break}})})}_setTransitionDuration(){this.dom.carousel.style.setProperty(`--${this.prefix}carousel-transition-duration`,`${this.transitionDuration}ms`)}activateCurrentItem(){u(this.activeClass,this.currentCarouselItem),this.currentCarouselTab&&(this.currentCarouselTab.setAttribute("aria-selected",!0),u(this.activeClass,this.currentCarouselTab))}deactivateCurrentItem(){c(this.activeClass,this.currentCarouselItem),this.currentCarouselTab&&(this.currentCarouselTab.setAttribute("aria-selected",!1),c(this.activeClass,this.currentCarouselTab))}activateItem(t){const e=this.currentItem;this.dom.carousel.dataset.grauplAction=this._currentAction,this.autoplay&&this._clearInterval(),u(this.previousClass,this.currentCarouselItem),u(this.nextClass,this.dom.carouselItems[t]),requestAnimationFrame(()=>{this.deactivateCurrentItem(),this.currentItem=t,this.activateCurrentItem(),requestAnimationFrame(()=>{setTimeout(()=>{c(this.previousClass,this.dom.carouselItems[e]),c(this.nextClass,this.currentCarouselItem)},this.transitionDuration)})}),this.autoplay&&this._setInterval()}activateFirstItem(){this.activateItem(0)}activateLastItem(){this.activateItem(this.dom.carouselItems.length-1)}activateNextItem(){this._currentAction="next",this.currentItem+1>=this.dom.carouselItems.length?this.activateFirstItem():this.activateItem(this.currentItem+1)}activatePreviousItem(){this._currentAction="previous",this.currentItem-1<0?this.activateLastItem():this.activateItem(this.currentItem-1)}toggleAutoplay(){this.autoplay=!this.autoplay,this._handleAutoplay()}},H=q;export{H as default};
4
+
5
+ //# sourceMappingURL=carousel.es.js.map