@graupl/graupl 1.0.0-beta.1 → 1.0.0-beta.11

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 (382) hide show
  1. package/dist/css/base/button.css +1 -1
  2. package/dist/css/base/button.css.map +1 -1
  3. package/dist/css/base/form.css +1 -1
  4. package/dist/css/base/form.css.map +1 -1
  5. package/dist/css/base/link.css +1 -1
  6. package/dist/css/base/link.css.map +1 -1
  7. package/dist/css/base/table.css +1 -1
  8. package/dist/css/base/table.css.map +1 -1
  9. package/dist/css/base.css +1 -1
  10. package/dist/css/base.css.map +1 -1
  11. package/dist/css/component/accordion.css +4 -1
  12. package/dist/css/component/accordion.css.map +1 -1
  13. package/dist/css/component/alert.css +1 -1
  14. package/dist/css/component/alert.css.map +1 -1
  15. package/dist/css/component/card.css +1 -1
  16. package/dist/css/component/card.css.map +1 -1
  17. package/dist/css/component/carousel.css +1 -1
  18. package/dist/css/component/carousel.css.map +1 -1
  19. package/dist/css/component/input-group.css +1 -1
  20. package/dist/css/component/input-group.css.map +1 -1
  21. package/dist/css/component/list.css +2 -0
  22. package/dist/css/component/list.css.map +1 -0
  23. package/dist/css/component/menu.css +1 -1
  24. package/dist/css/component/menu.css.map +1 -1
  25. package/dist/css/component/navigation.css +1 -1
  26. package/dist/css/component/navigation.css.map +1 -1
  27. package/dist/css/component.css +4 -1
  28. package/dist/css/component.css.map +1 -1
  29. package/dist/css/graupl.css +4 -1
  30. package/dist/css/graupl.css.map +1 -1
  31. package/dist/css/init.css.map +1 -1
  32. package/dist/css/layout/columns.css +1 -1
  33. package/dist/css/layout/columns.css.map +1 -1
  34. package/dist/css/layout/container.css +1 -1
  35. package/dist/css/layout/container.css.map +1 -1
  36. package/dist/css/layout/flex-columns.css +1 -1
  37. package/dist/css/layout/flex-columns.css.map +1 -1
  38. package/dist/css/layout.css +4 -1
  39. package/dist/css/layout.css.map +1 -1
  40. package/dist/css/normalize.css +1 -1
  41. package/dist/css/normalize.css.map +1 -1
  42. package/dist/css/state/focus.css +1 -1
  43. package/dist/css/state/focus.css.map +1 -1
  44. package/dist/css/state.css +1 -1
  45. package/dist/css/state.css.map +1 -1
  46. package/dist/css/theme/color.css +1 -1
  47. package/dist/css/theme/color.css.map +1 -1
  48. package/dist/css/theme/typography.css +1 -1
  49. package/dist/css/theme/typography.css.map +1 -1
  50. package/dist/css/theme.css +1 -1
  51. package/dist/css/theme.css.map +1 -1
  52. package/dist/css/utilities/alignment.css +1 -1
  53. package/dist/css/utilities/alignment.css.map +1 -1
  54. package/dist/css/utilities/background.css +2 -0
  55. package/dist/css/utilities/background.css.map +1 -0
  56. package/dist/css/utilities/border.css +2 -0
  57. package/dist/css/utilities/border.css.map +1 -0
  58. package/dist/css/utilities/color.css +1 -1
  59. package/dist/css/utilities/color.css.map +1 -1
  60. package/dist/css/utilities/container.css +2 -0
  61. package/dist/css/utilities/container.css.map +1 -0
  62. package/dist/css/utilities/display.css +1 -1
  63. package/dist/css/utilities/display.css.map +1 -1
  64. package/dist/css/utilities/flex.css +1 -1
  65. package/dist/css/utilities/flex.css.map +1 -1
  66. package/dist/css/utilities/gradient.css +2 -0
  67. package/dist/css/utilities/gradient.css.map +1 -0
  68. package/dist/css/utilities/height.css +1 -1
  69. package/dist/css/utilities/height.css.map +1 -1
  70. package/dist/css/utilities/inset.css +1 -1
  71. package/dist/css/utilities/inset.css.map +1 -1
  72. package/dist/css/utilities/justification.css +1 -1
  73. package/dist/css/utilities/justification.css.map +1 -1
  74. package/dist/css/utilities/list.css +1 -1
  75. package/dist/css/utilities/list.css.map +1 -1
  76. package/dist/css/utilities/order.css +1 -1
  77. package/dist/css/utilities/order.css.map +1 -1
  78. package/dist/css/utilities/position.css +2 -0
  79. package/dist/css/utilities/position.css.map +1 -0
  80. package/dist/css/utilities/ratio.css +1 -1
  81. package/dist/css/utilities/ratio.css.map +1 -1
  82. package/dist/css/utilities/spacing.css +1 -1
  83. package/dist/css/utilities/spacing.css.map +1 -1
  84. package/dist/css/utilities/typography.css +1 -1
  85. package/dist/css/utilities/typography.css.map +1 -1
  86. package/dist/css/utilities/visibility.css +1 -1
  87. package/dist/css/utilities/visibility.css.map +1 -1
  88. package/dist/css/utilities/visually-hidden.css +2 -0
  89. package/dist/css/utilities/visually-hidden.css.map +1 -0
  90. package/dist/css/utilities/width.css +1 -1
  91. package/dist/css/utilities/width.css.map +1 -1
  92. package/dist/css/utilities/z-index.css +2 -0
  93. package/dist/css/utilities/z-index.css.map +1 -0
  94. package/dist/css/utilities.css +1 -1
  95. package/dist/css/utilities.css.map +1 -1
  96. package/dist/js/accordion.js +5 -0
  97. package/dist/js/accordion.js.map +1 -0
  98. package/dist/js/alert.js +5 -0
  99. package/dist/js/alert.js.map +1 -0
  100. package/dist/js/carousel.js +5 -0
  101. package/dist/js/carousel.js.map +1 -0
  102. package/dist/js/component/accordion.cjs.js +4 -2
  103. package/dist/js/component/accordion.cjs.js.map +1 -0
  104. package/dist/js/component/accordion.es.js +5 -0
  105. package/dist/js/component/accordion.es.js.map +1 -0
  106. package/dist/js/component/accordion.iife.js +4 -2
  107. package/dist/js/component/accordion.iife.js.map +1 -0
  108. package/dist/js/component/alert.cjs.js +4 -2
  109. package/dist/js/component/alert.cjs.js.map +1 -0
  110. package/dist/js/component/alert.es.js +5 -0
  111. package/dist/js/component/alert.es.js.map +1 -0
  112. package/dist/js/component/alert.iife.js +4 -2
  113. package/dist/js/component/alert.iife.js.map +1 -0
  114. package/dist/js/component/carousel.cjs.js +4 -2
  115. package/dist/js/component/carousel.cjs.js.map +1 -0
  116. package/dist/js/component/carousel.es.js +5 -0
  117. package/dist/js/component/carousel.es.js.map +1 -0
  118. package/dist/js/component/carousel.iife.js +4 -2
  119. package/dist/js/component/carousel.iife.js.map +1 -0
  120. package/dist/js/generator/accordion.cjs.js +5 -0
  121. package/dist/js/generator/accordion.cjs.js.map +1 -0
  122. package/dist/js/generator/accordion.es.js +5 -0
  123. package/dist/js/generator/accordion.es.js.map +1 -0
  124. package/dist/js/generator/accordion.iife.js +5 -0
  125. package/dist/js/generator/accordion.iife.js.map +1 -0
  126. package/dist/js/generator/carousel.cjs.js +5 -0
  127. package/dist/js/generator/carousel.cjs.js.map +1 -0
  128. package/dist/js/generator/carousel.es.js +5 -0
  129. package/dist/js/generator/carousel.es.js.map +1 -0
  130. package/dist/js/generator/carousel.iife.js +5 -0
  131. package/dist/js/generator/carousel.iife.js.map +1 -0
  132. package/dist/js/generator/navigation.cjs.js +3 -0
  133. package/dist/js/generator/navigation.cjs.js.map +1 -0
  134. package/dist/js/generator/navigation.es.js +3 -0
  135. package/dist/js/generator/navigation.es.js.map +1 -0
  136. package/dist/js/generator/navigation.iife.js +3 -0
  137. package/dist/js/generator/navigation.iife.js.map +1 -0
  138. package/dist/js/graupl.js +9 -0
  139. package/dist/js/graupl.js.map +1 -0
  140. package/dist/js/navigation.js +3 -0
  141. package/dist/js/navigation.js.map +1 -0
  142. package/package.json +43 -37
  143. package/scss/base/button.scss +1 -1
  144. package/scss/base/form.scss +1 -1
  145. package/scss/base/link.scss +1 -1
  146. package/scss/base/table.scss +1 -1
  147. package/scss/base.scss +1 -1
  148. package/scss/component/accordion.scss +1 -1
  149. package/scss/component/alert.scss +1 -1
  150. package/scss/component/card.scss +1 -1
  151. package/scss/component/carousel.scss +1 -1
  152. package/scss/component/input-group.scss +1 -1
  153. package/scss/component/list.scss +3 -0
  154. package/scss/component/menu.scss +1 -1
  155. package/scss/component/navigation.scss +1 -1
  156. package/scss/component.scss +1 -1
  157. package/scss/graupl.scss +1 -1
  158. package/scss/init.scss +1 -1
  159. package/scss/layout/columns.scss +1 -1
  160. package/scss/layout/container.scss +1 -1
  161. package/scss/layout/flex-columns.scss +1 -1
  162. package/scss/layout.scss +1 -1
  163. package/scss/normalize.scss +1 -1
  164. package/scss/state/focus.scss +1 -1
  165. package/scss/state.scss +1 -1
  166. package/scss/theme/color.scss +1 -1
  167. package/scss/theme/typography.scss +1 -1
  168. package/scss/theme.scss +1 -1
  169. package/scss/utilities/alignment.scss +1 -1
  170. package/scss/utilities/background.scss +3 -0
  171. package/scss/utilities/border.scss +3 -0
  172. package/scss/utilities/color.scss +1 -1
  173. package/scss/utilities/container.scss +3 -0
  174. package/scss/utilities/display.scss +1 -1
  175. package/scss/utilities/flex.scss +1 -1
  176. package/scss/utilities/gradient.scss +3 -0
  177. package/scss/utilities/height.scss +1 -1
  178. package/scss/utilities/inset.scss +1 -1
  179. package/scss/utilities/justification.scss +1 -1
  180. package/scss/utilities/list.scss +1 -1
  181. package/scss/utilities/order.scss +1 -1
  182. package/scss/utilities/position.scss +3 -0
  183. package/scss/utilities/ratio.scss +1 -1
  184. package/scss/utilities/spacing.scss +1 -1
  185. package/scss/utilities/typography.scss +1 -1
  186. package/scss/utilities/visibility.scss +1 -1
  187. package/scss/utilities/visually-hidden.scss +3 -0
  188. package/scss/utilities/width.scss +1 -1
  189. package/scss/utilities/z-index.scss +3 -0
  190. package/scss/utilities.scss +1 -1
  191. package/.browserslistrc +0 -3
  192. package/.czrc +0 -3
  193. package/.editorconfig +0 -13
  194. package/.github/CODE_OF_CONDUCT.md +0 -73
  195. package/.github/COMMIT_CONVENTION.md +0 -17
  196. package/.github/CONTRIBUTING.md +0 -86
  197. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -30
  198. package/.github/ISSUE_TEMPLATE/documentation.md +0 -20
  199. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  200. package/.github/SECURITY.md +0 -26
  201. package/.github/dependabot.yml +0 -17
  202. package/.github/pull_request_template.md +0 -5
  203. package/.github/workflows/codeql-analysis.yml +0 -71
  204. package/.github/workflows/docs.yml +0 -59
  205. package/.github/workflows/test.yml +0 -27
  206. package/.husky/commit-msg +0 -3
  207. package/.husky/pre-commit +0 -4
  208. package/.prettierignore +0 -12
  209. package/.stylelintignore +0 -9
  210. package/.versionrc.cjs +0 -61
  211. package/CHANGELOG.md +0 -364
  212. package/build.js +0 -7
  213. package/commitlint.config.js +0 -5
  214. package/dist/css/utilities/postion.css +0 -2
  215. package/dist/css/utilities/postion.css.map +0 -1
  216. package/dist/js/component/accordion.esm.js +0 -1289
  217. package/dist/js/component/alert.esm.js +0 -529
  218. package/dist/js/component/carousel.esm.js +0 -1110
  219. package/dist/js/graupl.cjs.js +0 -5
  220. package/dist/js/graupl.esm.js +0 -1462
  221. package/dist/js/graupl.iife.js +0 -5
  222. package/docs/.vitepress/config.js +0 -78
  223. package/docs/.vitepress/theme/custom.scss +0 -35
  224. package/docs/.vitepress/theme/index.js +0 -4
  225. package/docs/compiling-graupl.md +0 -56
  226. package/docs/components/alert.md +0 -130
  227. package/docs/components/button.md +0 -84
  228. package/docs/components/card.md +0 -369
  229. package/docs/components/index.md +0 -1
  230. package/docs/components/inputgroup.md +0 -159
  231. package/docs/components/menu.md +0 -326
  232. package/docs/components/navigation.md +0 -158
  233. package/docs/content.md +0 -237
  234. package/docs/defaults.md +0 -121
  235. package/docs/forms.md +0 -79
  236. package/docs/functions.md +0 -9
  237. package/docs/getting-started.md +0 -1
  238. package/docs/index.md +0 -1
  239. package/docs/introduction.md +0 -25
  240. package/docs/layout.md +0 -200
  241. package/docs/mixins.md +0 -47
  242. package/docs/state.md +0 -67
  243. package/docs/theme.md +0 -258
  244. package/docs/utilities.md +0 -357
  245. package/eslint.config.js +0 -74
  246. package/index.html +0 -851
  247. package/index.js +0 -12
  248. package/lint-staged.config.js +0 -6
  249. package/postcss.config.cjs +0 -12
  250. package/prettier.config.js +0 -16
  251. package/scss/utilities/postion.scss +0 -3
  252. package/src/js/accordion/Accordion.js +0 -1163
  253. package/src/js/accordion/AccordionItem.js +0 -496
  254. package/src/js/accordion/index.js +0 -10
  255. package/src/js/alert/Alert.js +0 -581
  256. package/src/js/alert/index.js +0 -11
  257. package/src/js/carousel/Carousel.js +0 -1427
  258. package/src/js/carousel/index.js +0 -10
  259. package/src/js/domHelpers.js +0 -37
  260. package/src/js/eventHandlers.js +0 -39
  261. package/src/js/navigation/index.js +0 -36
  262. package/src/js/storage.js +0 -106
  263. package/src/js/validate.js +0 -225
  264. package/src/scss/_defaults.scss +0 -136
  265. package/src/scss/_index.scss +0 -15
  266. package/src/scss/_init.scss +0 -3
  267. package/src/scss/_normalize.scss +0 -197
  268. package/src/scss/_variables.scss +0 -53
  269. package/src/scss/base/_index.scss +0 -6
  270. package/src/scss/base/button/_defaults.scss +0 -60
  271. package/src/scss/base/button/_index.scss +0 -107
  272. package/src/scss/base/button/_mixins.scss +0 -166
  273. package/src/scss/base/button/_variables.scss +0 -176
  274. package/src/scss/base/form/_defaults.scss +0 -17
  275. package/src/scss/base/form/_index.scss +0 -93
  276. package/src/scss/base/form/_variables.scss +0 -153
  277. package/src/scss/base/link/_defaults.scss +0 -50
  278. package/src/scss/base/link/_index.scss +0 -134
  279. package/src/scss/base/link/_variables.scss +0 -262
  280. package/src/scss/base/table/_defaults.scss +0 -53
  281. package/src/scss/base/table/_index.scss +0 -121
  282. package/src/scss/base/table/_variables.scss +0 -135
  283. package/src/scss/component/_index.scss +0 -9
  284. package/src/scss/component/accordion/_defaults.scss +0 -40
  285. package/src/scss/component/accordion/_index.scss +0 -180
  286. package/src/scss/component/accordion/_variables.scss +0 -316
  287. package/src/scss/component/alert/_defaults.scss +0 -49
  288. package/src/scss/component/alert/_index.scss +0 -118
  289. package/src/scss/component/alert/_variables.scss +0 -170
  290. package/src/scss/component/card/_defaults.scss +0 -32
  291. package/src/scss/component/card/_index.scss +0 -178
  292. package/src/scss/component/card/_variables.scss +0 -186
  293. package/src/scss/component/carousel/_defaults.scss +0 -43
  294. package/src/scss/component/carousel/_index.scss +0 -188
  295. package/src/scss/component/carousel/_variables.scss +0 -104
  296. package/src/scss/component/input-group/_defaults.scss +0 -30
  297. package/src/scss/component/input-group/_index.scss +0 -47
  298. package/src/scss/component/input-group/_variables.scss +0 -66
  299. package/src/scss/component/menu/_defaults.scss +0 -66
  300. package/src/scss/component/menu/_index.scss +0 -305
  301. package/src/scss/component/menu/_variables.scss +0 -500
  302. package/src/scss/component/navigation/_defaults.scss +0 -29
  303. package/src/scss/component/navigation/_index.scss +0 -189
  304. package/src/scss/component/navigation/_variables.scss +0 -237
  305. package/src/scss/functions/_important.scss +0 -13
  306. package/src/scss/functions/_screen.scss +0 -30
  307. package/src/scss/functions/_theme.scss +0 -39
  308. package/src/scss/layout/_index.scss +0 -5
  309. package/src/scss/layout/columns/_defaults.scss +0 -19
  310. package/src/scss/layout/columns/_index.scss +0 -58
  311. package/src/scss/layout/columns/_variables.scss +0 -51
  312. package/src/scss/layout/container/_defaults.scss +0 -17
  313. package/src/scss/layout/container/_index.scss +0 -41
  314. package/src/scss/layout/container/_variables.scss +0 -50
  315. package/src/scss/layout/flex-columns/_defaults.scss +0 -18
  316. package/src/scss/layout/flex-columns/_index.scss +0 -80
  317. package/src/scss/layout/flex-columns/_variables.scss +0 -26
  318. package/src/scss/mixins/_animation.scss +0 -15
  319. package/src/scss/mixins/_layer.scss +0 -12
  320. package/src/scss/mixins/_screen.scss +0 -56
  321. package/src/scss/mixins/_utility.scss +0 -30
  322. package/src/scss/mixins/_visually-hidden.scss +0 -20
  323. package/src/scss/state/_index.scss +0 -3
  324. package/src/scss/state/focus/_defaults.scss +0 -10
  325. package/src/scss/state/focus/_index.scss +0 -13
  326. package/src/scss/state/focus/_mixins.scss +0 -15
  327. package/src/scss/state/focus/_variables.scss +0 -44
  328. package/src/scss/theme/_index.scss +0 -4
  329. package/src/scss/theme/color/_defaults.scss +0 -143
  330. package/src/scss/theme/color/_index.scss +0 -42
  331. package/src/scss/theme/color/_variables.scss +0 -129
  332. package/src/scss/theme/typography/_defaults.scss +0 -54
  333. package/src/scss/theme/typography/_index.scss +0 -111
  334. package/src/scss/theme/typography/_variables.scss +0 -231
  335. package/src/scss/utilities/_index.scss +0 -17
  336. package/src/scss/utilities/alignment/_defaults.scss +0 -62
  337. package/src/scss/utilities/alignment/_index.scss +0 -75
  338. package/src/scss/utilities/alignment/_variables.scss +0 -6
  339. package/src/scss/utilities/color/_defaults.scss +0 -35
  340. package/src/scss/utilities/color/_index.scss +0 -91
  341. package/src/scss/utilities/color/_variables.scss +0 -6
  342. package/src/scss/utilities/display/_defaults.scss +0 -32
  343. package/src/scss/utilities/display/_index.scss +0 -61
  344. package/src/scss/utilities/display/_variables.scss +0 -6
  345. package/src/scss/utilities/flex/_defaults.scss +0 -63
  346. package/src/scss/utilities/flex/_index.scss +0 -71
  347. package/src/scss/utilities/flex/_variables.scss +0 -6
  348. package/src/scss/utilities/height/_defaults.scss +0 -41
  349. package/src/scss/utilities/height/_index.scss +0 -98
  350. package/src/scss/utilities/height/_variables.scss +0 -6
  351. package/src/scss/utilities/inset/_defaults.scss +0 -41
  352. package/src/scss/utilities/inset/_index.scss +0 -37
  353. package/src/scss/utilities/inset/_variables.scss +0 -6
  354. package/src/scss/utilities/justification/_defaults.scss +0 -59
  355. package/src/scss/utilities/justification/_index.scss +0 -75
  356. package/src/scss/utilities/justification/_variables.scss +0 -6
  357. package/src/scss/utilities/list/_defaults.scss +0 -39
  358. package/src/scss/utilities/list/_index.scss +0 -56
  359. package/src/scss/utilities/list/_variables.scss +0 -6
  360. package/src/scss/utilities/order/_defaults.scss +0 -22
  361. package/src/scss/utilities/order/_index.scss +0 -63
  362. package/src/scss/utilities/order/_variables.scss +0 -6
  363. package/src/scss/utilities/position/_defaults.scss +0 -26
  364. package/src/scss/utilities/position/_index.scss +0 -37
  365. package/src/scss/utilities/position/_variables.scss +0 -6
  366. package/src/scss/utilities/ratio/_defaults.scss +0 -28
  367. package/src/scss/utilities/ratio/_index.scss +0 -52
  368. package/src/scss/utilities/ratio/_variables.scss +0 -9
  369. package/src/scss/utilities/spacing/_defaults.scss +0 -49
  370. package/src/scss/utilities/spacing/_index.scss +0 -169
  371. package/src/scss/utilities/spacing/_variables.scss +0 -6
  372. package/src/scss/utilities/typography/_defaults.scss +0 -30
  373. package/src/scss/utilities/typography/_index.scss +0 -224
  374. package/src/scss/utilities/typography/_variables.scss +0 -6
  375. package/src/scss/utilities/visibility/_defaults.scss +0 -25
  376. package/src/scss/utilities/visibility/_index.scss +0 -36
  377. package/src/scss/utilities/visibility/_variables.scss +0 -6
  378. package/src/scss/utilities/width/_defaults.scss +0 -41
  379. package/src/scss/utilities/width/_index.scss +0 -98
  380. package/src/scss/utilities/width/_variables.scss +0 -6
  381. package/stylelint.config.js +0 -21
  382. package/vite.config.js +0 -57
@@ -1,529 +0,0 @@
1
- var _ = Object.defineProperty;
2
- var y = (s, t, i) => t in s ? _(s, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[t] = i;
3
- var n = (s, t, i) => y(s, typeof t != "symbol" ? t + "" : t, i);
4
- function f(s, t) {
5
- try {
6
- if (typeof t != "object") {
7
- const i = typeof t;
8
- throw new TypeError(
9
- `Elements given to isValidInstance() must be inside of an object. "${i}" given.`
10
- );
11
- }
12
- for (const i in t)
13
- if (!(t[i] instanceof s)) {
14
- const e = typeof t[i];
15
- throw new TypeError(
16
- `${i} must be an instance of ${s.name}. "${e}" given.`
17
- );
18
- }
19
- return {
20
- status: !0,
21
- error: null
22
- };
23
- } catch (i) {
24
- return {
25
- status: !1,
26
- error: i
27
- };
28
- }
29
- }
30
- function r(s, t) {
31
- try {
32
- if (typeof t != "object") {
33
- const i = typeof t;
34
- throw new TypeError(
35
- `Values given to isValidType() must be inside of an object. "${i}" given.`
36
- );
37
- }
38
- for (const i in t) {
39
- const e = typeof t[i];
40
- if (e !== s)
41
- throw new TypeError(`${i} must be a ${s}. "${e}" given.`);
42
- }
43
- return {
44
- status: !0,
45
- error: null
46
- };
47
- } catch (i) {
48
- return {
49
- status: !1,
50
- error: i
51
- };
52
- }
53
- }
54
- function p(s) {
55
- try {
56
- if (typeof s != "object") {
57
- const t = typeof s;
58
- throw new TypeError(
59
- `Values given to isQuerySelector() must be inside of an object. "${t}" given.`
60
- );
61
- }
62
- for (const t in s)
63
- try {
64
- if (s[t] === null)
65
- throw new Error();
66
- document.querySelector(s[t]);
67
- } catch {
68
- throw new TypeError(
69
- `${t} must be a valid query selector. "${s[t]}" given.`
70
- );
71
- }
72
- return {
73
- status: !0,
74
- error: null
75
- };
76
- } catch (t) {
77
- return {
78
- status: !1,
79
- error: t
80
- };
81
- }
82
- }
83
- function l(s) {
84
- try {
85
- if (typeof s != "object" || Array.isArray(s)) {
86
- const t = typeof s;
87
- throw new TypeError(
88
- `Values given to isValidClassList() must be inside of an object. "${t}" given.`
89
- );
90
- }
91
- for (const t in s) {
92
- const i = typeof s[t];
93
- if (i !== "string")
94
- if (Array.isArray(s[t]))
95
- s[t].forEach((e) => {
96
- if (typeof e != "string")
97
- throw new TypeError(
98
- `${t} must be a string or an array of strings. An array containing non-strings given.`
99
- );
100
- });
101
- else
102
- throw new TypeError(
103
- `${t} must be a string or an array of strings. "${i}" given.`
104
- );
105
- else {
106
- const e = {};
107
- e[t] = s[t], p(e);
108
- }
109
- }
110
- return {
111
- status: !0,
112
- error: null
113
- };
114
- } catch (t) {
115
- return {
116
- status: !1,
117
- error: t
118
- };
119
- }
120
- }
121
- function a(s, t) {
122
- s === "" || s.length === 0 || (typeof s == "string" ? t.classList.add(s) : t.classList.add(...s));
123
- }
124
- function h(s, t) {
125
- s === "" || s.length === 0 || (typeof s == "string" ? t.classList.remove(s) : t.classList.remove(...s));
126
- }
127
- function u(s) {
128
- try {
129
- const t = s.key || s.keyCode, i = {
130
- Enter: t === "Enter" || t === 13,
131
- Space: t === " " || t === "Spacebar" || t === 32,
132
- Escape: t === "Escape" || t === "Esc" || t === 27,
133
- ArrowUp: t === "ArrowUp" || t === "Up" || t === 38,
134
- ArrowRight: t === "ArrowRight" || t === "Right" || t === 39,
135
- ArrowDown: t === "ArrowDown" || t === "Down" || t === 40,
136
- ArrowLeft: t === "ArrowLeft" || t === "Left" || t === 37,
137
- Home: t === "Home" || t === 36,
138
- End: t === "End" || t === 35,
139
- Tab: t === "Tab" || t === 9
140
- };
141
- return Object.keys(i).find((e) => i[e] === !0) || "";
142
- } catch {
143
- return "";
144
- }
145
- }
146
- function E(s) {
147
- s.preventDefault(), s.stopPropagation();
148
- }
149
- function T(s = null) {
150
- window.Graupl = window.Graupl || {}, r("string", { type: s }) && (window.Graupl[s] = window.Graupl[s] || {});
151
- }
152
- function b(s = null) {
153
- return r("string", { type: s }) ? window.Graupl[s] : window.Graupl;
154
- }
155
- function k(s, t = {}) {
156
- r("string", { type: s }) && r("object", { data: t }) && (window.Graupl[s] = t);
157
- }
158
- function A(s) {
159
- r("string", { type: s }) && (window.Graupl[s] = {});
160
- }
161
- function S(s, t, i) {
162
- r("string", { type: s, key: t }) && (window.Graupl[s][t] = i);
163
- }
164
- function $(s, t) {
165
- return r("string", { type: s, key: t }) ? window.Graupl[s][t] : null;
166
- }
167
- function L(s, t) {
168
- r("string", { type: s, key: t }) && delete window.Graupl[s][t];
169
- }
170
- const c = {
171
- initializeStorage: T,
172
- getStorage: b,
173
- setStorage: k,
174
- clearStorage: A,
175
- pushToStorage: S,
176
- getFromStorage: $,
177
- removeFromStorage: L
178
- };
179
- class G {
180
- /**
181
- * Constructs a new `Alert`.
182
- *
183
- * @param {object} options - The options object.
184
- * @param {HTMLElement} options.alertElement - The alert element.
185
- * @param {?HTMLElement} [options.controllerElement = null] - The controller element.
186
- * @param {string|string[]|null} [options.showClass = show] - The class to add when the alert is shown.
187
- * @param {string|string[]|null} [options.hideClass = hide] - The class to add when
188
- * @param {string|string[]|null} [options.transitionClass = transitioning] - The class to add when the alert is transitioning between shown and hidden.
189
- * @param {number} [options.transitionTimer = 150] - The time in milliseconds the transition will take.
190
- * @param {boolean} [options.isHidden = false] - A flag to determine the initial state of the alert.
191
- * @param {?string} [options.key = null] - The key used to generate IDs throughout the alert.
192
- * @param {boolean} [options.initialize = false] - AA flag to initialize the alert immediately upon creation.
193
- */
194
- constructor({
195
- alertElement: t,
196
- controllerElement: i = null,
197
- showClass: e = "show",
198
- hideClass: d = "hide",
199
- transitionClass: o = "transitioning",
200
- transitionTimer: m = 150,
201
- isHidden: w = !1,
202
- key: C = null,
203
- initialize: g = !1
204
- }) {
205
- /**
206
- * The HTML elements for the alert in the DOM.
207
- *
208
- * @protected
209
- *
210
- * @type {Object<HTMLElement>}
211
- */
212
- n(this, "_dom", {
213
- alert: null,
214
- controller: null
215
- });
216
- /**
217
- * A flag to determine if the alert is hidden.
218
- *
219
- * @protected
220
- *
221
- * @type {boolean}
222
- */
223
- n(this, "_hidden", !1);
224
- /**
225
- * The class to use to show the alert.
226
- *
227
- * @protected
228
- *
229
- * @type {string|string[]}
230
- */
231
- n(this, "_showClass", "");
232
- /**
233
- * The class to use to hide the alert.
234
- *
235
- * @protected
236
- *
237
- * @type {string|string[]}
238
- */
239
- n(this, "_hideClass", "");
240
- /**
241
- * The class to use when transitioning the alert.
242
- *
243
- * @protected
244
- *
245
- * @type {string|string[]}
246
- */
247
- n(this, "_transitionClass", "");
248
- /**
249
- * The time in milliseconds the transition will take.
250
- *
251
- * @protected
252
- *
253
- * @type {number}
254
- */
255
- n(this, "_transitionTimer", 150);
256
- /**
257
- * The key used to generate IDs throughout the carousel.
258
- *
259
- * @protected
260
- *
261
- * @type {string}
262
- */
263
- n(this, "_key", "");
264
- /**
265
- * An array of error messages generated by the alert.
266
- *
267
- * @protected
268
- *
269
- * @type {string[]}
270
- */
271
- n(this, "_errors", []);
272
- /**
273
- * The event that is triggered when the alert is shown.
274
- *
275
- * @protected
276
- *
277
- * @event grauplAlertShow
278
- *
279
- * @type {CustomEvent}
280
- *
281
- * @property {boolean} bubbles - A flag to bubble the event.
282
- * @property {Object<Alert>} detail - The details object container the Alert itself.
283
- */
284
- n(this, "_showEvent", new CustomEvent("grauplAlertShow", {
285
- bubbles: !0,
286
- detail: { alert: this }
287
- }));
288
- /**
289
- * The event that is triggered when the alert is hidden.
290
- *
291
- * @protected
292
- *
293
- * @event grauplAlertHide
294
- *
295
- * @type {CustomEvent}
296
- *
297
- * @property {boolean} bubbles - A flag to bubble the event.
298
- * @property {Object<Alert>} detail - The details object containing the Alert itself.
299
- */
300
- n(this, "_hideEvent", new CustomEvent("grauplAlertHide", {
301
- bubbles: !0,
302
- detail: { alert: this }
303
- }));
304
- this._dom.alert = t, this._dom.controller = i, this._showClass = e || "", this._hideClass = d || "", this._transitionClass = o || "", this._transitionTimer = m, this._hidden = w, this._key = C || "", g && this.initialize();
305
- }
306
- /**
307
- * Initializes the alert.
308
- */
309
- initialize() {
310
- try {
311
- if (!this._validate())
312
- throw new Error(
313
- `Graupl Alert: cannot initialize alert. The following errors have been found:
314
- - ${this.errors.join(
315
- `
316
- - `
317
- )}`
318
- );
319
- this._generateKey(), this._setIds(), this._handleClick(), this._handleKeydown(), this._handleKeyup(), c.initializeStorage("alerts"), c.pushToStorage("alerts", this.dom.alert.id, this);
320
- } catch (t) {
321
- console.error(t);
322
- }
323
- }
324
- /**
325
- * The HTML elements for the alert in the DOM.
326
- *
327
- * @readonly
328
- *
329
- * @see _dom
330
- *
331
- * @type {object}
332
- */
333
- get dom() {
334
- return this._dom;
335
- }
336
- /**
337
- * The class to use the show the alert.
338
- *
339
- * @type {string|string[]}
340
- *
341
- * @see _showClass
342
- */
343
- get showClass() {
344
- return this._showClass;
345
- }
346
- /**
347
- * The class to use to hide the alert.
348
- *
349
- * @type {string|string[]}
350
- *
351
- * @see _hideClass
352
- */
353
- get hideClass() {
354
- return this._hideClass;
355
- }
356
- /**
357
- * The class to use when transitioning the alert.
358
- *
359
- * @type {string|string[]}
360
- *
361
- * @see _transitionClass
362
- */
363
- get transitionClass() {
364
- return this._transitionClass;
365
- }
366
- /**
367
- * The time in milliseconds the transition will take.
368
- *
369
- * @type {number}
370
- *
371
- * @see _transitionTimer
372
- */
373
- get transitionTimer() {
374
- return this._transitionTimer;
375
- }
376
- /**
377
- * The key used to generate IDs throughout the accordion.
378
- *
379
- * @type {string}
380
- *
381
- * @see _key
382
- */
383
- get key() {
384
- return this._key;
385
- }
386
- set showClass(t) {
387
- l({ showClass: t }), this._showClass !== t && (this._showClass = t);
388
- }
389
- set hideClass(t) {
390
- l({ hideClass: t }), this._hideClass !== t && (this._hideClass = t);
391
- }
392
- set transitionClass(t) {
393
- l({ transitionClass: t }), this._transitionClass !== t && (this._transitionClass = t);
394
- }
395
- set transitionTimer(t) {
396
- r("number", { transitionTimer: t }), this._transitionTimer !== t && (this._transitionTimer = t);
397
- }
398
- set key(t) {
399
- r("string", { value: t }), this._key !== t && (this._key = t);
400
- }
401
- /**
402
- * Validates all aspects of the alert to ensure proper functionality.
403
- *
404
- * @protected
405
- *
406
- * @return {boolean} - The result of the validation.
407
- */
408
- _validate() {
409
- let t = !0, i;
410
- if (this._dom.controller !== null ? i = f(HTMLElement, {
411
- alertElement: this._dom.alert,
412
- controllerElement: this._dom.controller
413
- }) : i = f(HTMLElement, {
414
- alertElement: this._dom.alert
415
- }), i.status || (this._errors.push(i.message), t = !1), this._showClass !== "") {
416
- const o = l({ showClass: this._showClass });
417
- o.status || (this._errors.push(o.message), t = !1);
418
- }
419
- if (this._hideClass !== "") {
420
- const o = l({ hideClass: this._hideClass });
421
- o.status || (this._errors.push(o.message), t = !1);
422
- }
423
- if (this._transitionClass !== "") {
424
- const o = l({
425
- transitionClass: this._transitionClass
426
- });
427
- o.status || (this._errors.push(o.message), t = !1);
428
- }
429
- const e = r("number", {
430
- transitionTimer: this._transitionTimer
431
- });
432
- e.status || (this._errors.push(e.message), t = !1);
433
- const d = r("boolean", { isHidden: this._hidden });
434
- return d.status || (this._errors.push(d.message), t = !1), t;
435
- }
436
- /**
437
- * Generates a key for the alert.
438
- *
439
- * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.
440
- */
441
- _generateKey(t = !1) {
442
- (this.key === "" || t) && (this.key = Math.random().toString(36).replace(/[^a-z]+/g, "").substring(0, 10));
443
- }
444
- /**
445
- * Sets the IDs of the alert and it's children if they do not already exist.
446
- *
447
- * The generated IDs use the key and follow the format:
448
- * - alert: `alert-${key}`
449
- * - controller: `alert-controller-${key}`
450
- */
451
- _setIds() {
452
- this.dom.alert.id = this.dom.alert.id || `alert-${this.key}`, this.dom.controller.id = this.dom.controller.id || `alert-controller-${this.key}`;
453
- }
454
- /**
455
- * Shows the alert.
456
- *
457
- * @fires grauplAlertShow
458
- *
459
- * @param {boolean} [emit = true] - A toggle to emit the show event once shown.
460
- */
461
- show(t = !0) {
462
- this._hidden && (this.transitionClass !== "" ? (a(this.transitionClass, this.dom.alert), requestAnimationFrame(() => {
463
- this.hideClass !== "" && h(this.hideClass, this.dom.alert), requestAnimationFrame(() => {
464
- this.showClass !== "" && a(this.showClass, this.dom.alert), requestAnimationFrame(() => {
465
- h(this.transitionClass, this.dom.alert);
466
- });
467
- });
468
- })) : (this.showClass !== "" && a(this.showClass, this.dom.alert), this.hideClass !== "" && h(this.hideClass, this.dom.alert)), this._hidden = !1, t && this.dom.alert.dispatchEvent(this._hideEvent));
469
- }
470
- /**
471
- * Hides the alert.
472
- *
473
- * @fires grauplAlertHide
474
- *
475
- * @param {boolean} [emit = true] - A toggle to emit the hide event once shown.
476
- */
477
- hide(t = !0) {
478
- this._hidden || (this.transitionClass !== "" ? (a(this.transitionClass, this.dom.alert), requestAnimationFrame(() => {
479
- this.showClass !== "" && h(this.showClass, this.dom.alert), requestAnimationFrame(() => {
480
- this.transitionTimer > 0 ? setTimeout(() => {
481
- this.hideClass !== "" && a(this.hideClass, this.dom.alert), requestAnimationFrame(() => {
482
- h(this.transitionClass, this.dom.alert);
483
- });
484
- }, this.transitionTimer) : (this.hideClass !== "" && a(this.hideClass, this.dom.alert), requestAnimationFrame(() => {
485
- h(this.transitionClass, this.dom.alert);
486
- }));
487
- });
488
- })) : (this.hideClass !== "" && a(this.hideClass, this.dom.alert), this.showClass !== "" && h(this.showClass, this.dom.alert)), this._hidden = !0, t && this.dom.alert.dispatchEvent(this._hideEvent));
489
- }
490
- /**
491
- * Handles click events throughout the alert for proper use.
492
- *
493
- * - Adds a `pointerup` listener to the controller that will hide the alert.
494
- *
495
- * @protected
496
- */
497
- _handleClick() {
498
- this.dom.controller !== null && this.dom.controller.addEventListener("pointerup", () => this.hide());
499
- }
500
- /**
501
- * Handles keydown events throughout the alert for proper use.
502
- *
503
- * This method exists to assist the _handleKeyup method.
504
- *
505
- * - Adds a `keydown` listener to the controller (if it exists).
506
- * - Blocks propagation on "Space" and "Enter" keys.
507
- */
508
- _handleKeydown() {
509
- this.dom.controller !== null && this.dom.controller.addEventListener("keydown", (t) => {
510
- const i = u(t);
511
- (i === "Space" || i === "Enter") && E(t);
512
- });
513
- }
514
- /**
515
- * Handles keyup events throughout the alert for proper use.
516
- *
517
- * - Adds a `keyup` listener to the controller (if it exists).
518
- * - Hides the alert when the user hits "Space" or "Enter".
519
- */
520
- _handleKeyup() {
521
- this.dom.controller !== null && this.dom.controller.addEventListener("keyup", (t) => {
522
- const i = u(t);
523
- (i === "Space" || i === "Enter") && this.hide();
524
- });
525
- }
526
- }
527
- export {
528
- G as default
529
- };