@ulu/frontend 0.1.0-beta.12 → 0.1.0-beta.121

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 (344) hide show
  1. package/CHANGELOG.md +717 -0
  2. package/GEMINI.md +9 -0
  3. package/README.dev.md +3 -3
  4. package/README.md +14 -4
  5. package/dist/ulu-frontend.min.css +1 -1
  6. package/dist/ulu-frontend.min.js +36 -29
  7. package/docs-dev/.nojekyll +1 -0
  8. package/docs-dev/assets/main.js +832 -421
  9. package/docs-dev/assets/placeholder/icon-calendar.svg +1 -0
  10. package/docs-dev/assets/placeholder/icon-check.svg +1 -0
  11. package/docs-dev/assets/style.css +629 -233
  12. package/docs-dev/changelog/index.html +7613 -0
  13. package/docs-dev/changelog/updates-and-changes/index.html +5109 -0
  14. package/docs-dev/demos/accordion/index.html +1496 -358
  15. package/docs-dev/demos/badge/index.html +5895 -0
  16. package/docs-dev/demos/badge-stack/index.html +5876 -0
  17. package/docs-dev/demos/basic-hero/index.html +111 -0
  18. package/docs-dev/demos/breadcrumb/index.html +5930 -0
  19. package/docs-dev/demos/breakpoints-manager/index.html +5906 -0
  20. package/docs-dev/demos/button/index.html +1537 -343
  21. package/docs-dev/demos/button-group/index.html +5892 -0
  22. package/docs-dev/demos/button-verbose/index.html +5898 -0
  23. package/docs-dev/demos/callout/index.html +1559 -379
  24. package/docs-dev/demos/captioned-figure/index.html +1492 -339
  25. package/docs-dev/demos/card/index.html +1592 -800
  26. package/docs-dev/demos/card-grid/index.html +6017 -0
  27. package/docs-dev/demos/card-new/index.html +5088 -0
  28. package/docs-dev/demos/card-old/index.html +5223 -0
  29. package/docs-dev/demos/card.1/index.html +5223 -0
  30. package/docs-dev/demos/card.TRASH/index.html +5541 -0
  31. package/docs-dev/demos/counter-list/index.html +5900 -0
  32. package/docs-dev/demos/css-icons/index.html +1556 -380
  33. package/docs-dev/demos/data-grid/index.html +1492 -339
  34. package/docs-dev/demos/data-table/index.html +1634 -348
  35. package/docs-dev/demos/definition-list/index.html +6011 -0
  36. package/docs-dev/demos/details-group/index.html +5927 -0
  37. package/docs-dev/demos/donut-chart/index.html +5874 -0
  38. package/docs-dev/demos/file-save/index.html +1492 -339
  39. package/docs-dev/demos/flipcard/index.html +1492 -339
  40. package/docs-dev/demos/form-theme/index.html +1500 -347
  41. package/docs-dev/demos/headline-label/index.html +5862 -0
  42. package/docs-dev/demos/hero/index.html +12 -4
  43. package/docs-dev/demos/image-grid/index.html +12 -4
  44. package/docs-dev/demos/index.html +1493 -340
  45. package/docs-dev/demos/list-inline/index.html +1492 -339
  46. package/docs-dev/demos/list-lines/index.html +1492 -339
  47. package/docs-dev/demos/menu-stack/index.html +1652 -378
  48. package/docs-dev/demos/modals/index.html +1642 -366
  49. package/docs-dev/demos/nav-strip/index.html +1492 -339
  50. package/docs-dev/demos/overlay-section/index.html +1611 -388
  51. package/docs-dev/demos/panel/index.html +5922 -0
  52. package/docs-dev/demos/popovers/index.html +1752 -357
  53. package/docs-dev/demos/print/index.html +1492 -339
  54. package/docs-dev/demos/progress-bar/index.html +6030 -0
  55. package/docs-dev/demos/progress-circle/index.html +6197 -0
  56. package/docs-dev/demos/progress-donut/index.html +6107 -0
  57. package/docs-dev/demos/pull-quote/index.html +1492 -339
  58. package/docs-dev/demos/rail/index.html +5970 -0
  59. package/docs-dev/demos/rule/index.html +1509 -344
  60. package/docs-dev/demos/scroll-slider/index.html +72 -106
  61. package/docs-dev/demos/scrollpoints/index.html +1493 -340
  62. package/docs-dev/demos/skeleton/index.html +5918 -0
  63. package/docs-dev/demos/slider/index.html +12 -4
  64. package/docs-dev/demos/spoke-spinner/index.html +1492 -339
  65. package/docs-dev/demos/sticky-list/index.html +5883 -0
  66. package/docs-dev/demos/tabs/index.html +1565 -376
  67. package/docs-dev/demos/tag/index.html +1510 -345
  68. package/docs-dev/demos/theme-toggle/index.html +5939 -0
  69. package/docs-dev/demos/tile-grid-overlay/index.html +12 -4
  70. package/docs-dev/demos/tiles/index.html +1492 -339
  71. package/docs-dev/demos/tooltip/index.html +1492 -339
  72. package/docs-dev/demos/wysiwyg/index.html +5912 -0
  73. package/docs-dev/guide/building-stylesheet/index.html +1492 -339
  74. package/docs-dev/guide/developing-ulu-scss-module/index.html +1492 -339
  75. package/docs-dev/guide/index.html +1492 -339
  76. package/docs-dev/guide/updates-and-changes/index.html +5033 -0
  77. package/docs-dev/index.html +1492 -339
  78. package/docs-dev/javascript/events/index.html +1567 -376
  79. package/docs-dev/javascript/index.html +1492 -339
  80. package/docs-dev/javascript/settings/index.html +6065 -0
  81. package/docs-dev/javascript/ui-breakpoints/index.html +1506 -355
  82. package/docs-dev/javascript/ui-collapsible/index.html +1491 -340
  83. package/docs-dev/javascript/ui-details-group/index.html +5982 -0
  84. package/docs-dev/javascript/ui-dialog/index.html +1523 -357
  85. package/docs-dev/javascript/ui-flipcard/index.html +1552 -345
  86. package/docs-dev/javascript/ui-grid/index.html +1538 -413
  87. package/docs-dev/javascript/ui-modal-builder/index.html +1761 -470
  88. package/docs-dev/javascript/ui-overflow-scroller/index.html +1491 -340
  89. package/docs-dev/javascript/ui-overflow-scroller-pager/index.html +1491 -340
  90. package/docs-dev/javascript/ui-page/index.html +1491 -340
  91. package/docs-dev/javascript/ui-popover/index.html +1501 -354
  92. package/docs-dev/javascript/ui-print/index.html +1489 -346
  93. package/docs-dev/javascript/ui-print-details/index.html +1491 -340
  94. package/docs-dev/javascript/ui-programmatic-modal/index.html +1491 -340
  95. package/docs-dev/javascript/ui-proxy-click/index.html +1591 -355
  96. package/docs-dev/javascript/ui-resizer/index.html +1850 -434
  97. package/docs-dev/javascript/ui-scroll-slider/index.html +1531 -348
  98. package/docs-dev/javascript/ui-scrollpoint/index.html +1501 -357
  99. package/docs-dev/javascript/ui-slider/index.html +1708 -366
  100. package/docs-dev/javascript/ui-tabs/index.html +1523 -409
  101. package/docs-dev/javascript/ui-theme-toggle/index.html +6070 -0
  102. package/docs-dev/javascript/ui-tooltip/index.html +1501 -354
  103. package/docs-dev/javascript/utils-class-logger/index.html +1492 -341
  104. package/docs-dev/javascript/utils-css/index.html +5884 -0
  105. package/docs-dev/javascript/utils-dom/index.html +1523 -452
  106. package/docs-dev/javascript/utils-file-save/index.html +1491 -340
  107. package/docs-dev/javascript/utils-floating-ui/index.html +1491 -340
  108. package/docs-dev/javascript/utils-id/index.html +1491 -340
  109. package/docs-dev/javascript/utils-pause-youtube-video/index.html +1491 -340
  110. package/docs-dev/javascript/utils-system/index.html +6187 -0
  111. package/docs-dev/sass/base/color/index.html +1491 -340
  112. package/docs-dev/sass/base/elements/index.html +1492 -341
  113. package/docs-dev/sass/base/index/index.html +1492 -341
  114. package/docs-dev/sass/base/index.html +1492 -339
  115. package/docs-dev/sass/base/keyframes/index.html +1492 -341
  116. package/docs-dev/sass/base/layout/index.html +1492 -341
  117. package/docs-dev/sass/base/normalize/index.html +1491 -340
  118. package/docs-dev/sass/base/print/index.html +1492 -341
  119. package/docs-dev/sass/base/root/index.html +1495 -344
  120. package/docs-dev/sass/base/typography/index.html +1491 -340
  121. package/docs-dev/sass/components/accordion/index.html +1628 -436
  122. package/docs-dev/sass/components/adaptive-spacing/index.html +1491 -340
  123. package/docs-dev/sass/components/badge/index.html +1522 -353
  124. package/docs-dev/sass/components/badge-stack/index.html +6051 -0
  125. package/docs-dev/sass/components/basic-hero/index.html +6045 -0
  126. package/docs-dev/sass/components/breadcrumb/index.html +6092 -0
  127. package/docs-dev/sass/components/button/index.html +1491 -340
  128. package/docs-dev/sass/components/button-group/index.html +6043 -0
  129. package/docs-dev/sass/components/button-verbose/index.html +1613 -387
  130. package/docs-dev/sass/components/callout/index.html +1598 -388
  131. package/docs-dev/sass/components/captioned-figure/index.html +1491 -340
  132. package/docs-dev/sass/components/card/index.html +1601 -393
  133. package/docs-dev/sass/components/card-grid/index.html +1491 -340
  134. package/docs-dev/sass/components/counter-list/index.html +6127 -0
  135. package/docs-dev/sass/components/css-icon/index.html +1492 -341
  136. package/docs-dev/sass/components/data-grid/index.html +1511 -353
  137. package/docs-dev/sass/components/data-table/index.html +1510 -352
  138. package/docs-dev/sass/components/definition-list/index.html +6107 -0
  139. package/docs-dev/sass/components/fill-context/index.html +1491 -340
  140. package/docs-dev/sass/components/flipcard/index.html +1569 -387
  141. package/docs-dev/sass/components/flipcard-grid/index.html +1491 -340
  142. package/docs-dev/sass/components/form-theme/index.html +1718 -572
  143. package/docs-dev/sass/components/headline-label/index.html +6073 -0
  144. package/docs-dev/sass/components/hero/index.html +1499 -348
  145. package/docs-dev/sass/components/horizontal-rule/index.html +1491 -340
  146. package/docs-dev/sass/components/image-grid/index.html +1491 -340
  147. package/docs-dev/sass/components/index/index.html +1514 -349
  148. package/docs-dev/sass/components/index.html +1492 -339
  149. package/docs-dev/sass/components/links/index.html +1491 -340
  150. package/docs-dev/sass/components/list-inline/index.html +1491 -340
  151. package/docs-dev/sass/components/list-lines/index.html +1491 -340
  152. package/docs-dev/sass/components/list-ordered/index.html +1491 -340
  153. package/docs-dev/sass/components/list-unordered/index.html +1491 -340
  154. package/docs-dev/sass/components/menu-stack/index.html +1578 -378
  155. package/docs-dev/sass/components/modal/index.html +1576 -390
  156. package/docs-dev/sass/components/nav-strip/index.html +1499 -348
  157. package/docs-dev/sass/components/overlay-section/index.html +1499 -348
  158. package/docs-dev/sass/components/pager/index.html +1491 -340
  159. package/docs-dev/sass/components/panel/index.html +6273 -0
  160. package/docs-dev/sass/components/placeholder-block/index.html +1491 -340
  161. package/docs-dev/sass/components/popover/index.html +1561 -404
  162. package/docs-dev/sass/components/progress-bar/index.html +6252 -0
  163. package/docs-dev/sass/components/progress-circle/index.html +6144 -0
  164. package/docs-dev/sass/components/pull-quote/index.html +1491 -340
  165. package/docs-dev/sass/components/rail/index.html +6063 -0
  166. package/docs-dev/sass/components/ratio-box/index.html +1499 -348
  167. package/docs-dev/sass/components/rule/index.html +1492 -341
  168. package/docs-dev/sass/components/scroll-slider/index.html +1501 -362
  169. package/docs-dev/sass/components/skeleton/index.html +6101 -0
  170. package/docs-dev/sass/components/skip-link/index.html +1491 -340
  171. package/docs-dev/sass/components/slider/index.html +1581 -442
  172. package/docs-dev/sass/components/spoke-spinner/index.html +1493 -342
  173. package/docs-dev/sass/components/sticky-list/index.html +6263 -0
  174. package/docs-dev/sass/components/table-sticky/index.html +5707 -0
  175. package/docs-dev/sass/components/tabs/index.html +1519 -353
  176. package/docs-dev/sass/components/tag/index.html +1648 -403
  177. package/docs-dev/sass/components/tile-button/index.html +1491 -340
  178. package/docs-dev/sass/components/tile-grid/index.html +1491 -340
  179. package/docs-dev/sass/components/tile-grid-overlay/index.html +1491 -340
  180. package/docs-dev/sass/components/vignette/index.html +1499 -348
  181. package/docs-dev/sass/components/wysiwyg/index.html +1524 -355
  182. package/docs-dev/sass/core/breakpoint/index.html +1577 -374
  183. package/docs-dev/sass/core/button/index.html +1523 -370
  184. package/docs-dev/sass/core/color/index.html +1768 -485
  185. package/docs-dev/sass/core/cssvar/index.html +1491 -340
  186. package/docs-dev/sass/core/element/index.html +1837 -404
  187. package/docs-dev/sass/core/index.html +1491 -340
  188. package/docs-dev/sass/core/layout/index.html +1582 -412
  189. package/docs-dev/sass/core/path/index.html +1491 -340
  190. package/docs-dev/sass/core/selector/index.html +1491 -340
  191. package/docs-dev/sass/core/typography/index.html +1657 -448
  192. package/docs-dev/sass/core/units/index.html +1499 -342
  193. package/docs-dev/sass/core/utils/index.html +2781 -481
  194. package/docs-dev/sass/helpers/color/index.html +1491 -340
  195. package/docs-dev/sass/helpers/display/index.html +1492 -341
  196. package/docs-dev/sass/helpers/index/index.html +1491 -340
  197. package/docs-dev/sass/helpers/index.html +1492 -339
  198. package/docs-dev/sass/helpers/print/index.html +759 -298
  199. package/docs-dev/sass/helpers/typography/index.html +1491 -340
  200. package/docs-dev/sass/helpers/units/index.html +1491 -340
  201. package/docs-dev/sass/helpers/utilities/index.html +1495 -340
  202. package/docs-dev/sass/index.html +1492 -339
  203. package/js/events/index.js +17 -5
  204. package/js/index.js +1 -0
  205. package/js/settings.js +97 -0
  206. package/js/ui/breakpoints.js +19 -16
  207. package/js/ui/collapsible.js +8 -1
  208. package/js/ui/details-group.js +112 -0
  209. package/js/ui/dialog.js +103 -44
  210. package/js/ui/dialog.todo +2 -36
  211. package/js/ui/flipcard.js +37 -57
  212. package/js/ui/grid.js +15 -13
  213. package/js/ui/index.js +1 -0
  214. package/js/ui/modal-builder.js +127 -70
  215. package/js/ui/overflow-scroller.js +6 -4
  216. package/js/ui/page.js +2 -2
  217. package/js/ui/popover.js +38 -38
  218. package/js/ui/print.js +16 -25
  219. package/js/ui/programmatic-modal.js +9 -3
  220. package/js/ui/proxy-click.js +50 -36
  221. package/js/ui/resizer.js +408 -39
  222. package/js/ui/scroll-slider.js +24 -30
  223. package/js/ui/scrollpoint.js +29 -64
  224. package/js/ui/slider.js +108 -63
  225. package/js/ui/tabs.js +23 -36
  226. package/js/ui/theme-toggle.js +332 -94
  227. package/js/ui/tooltip.js +27 -32
  228. package/js/utils/class-logger.js +3 -3
  229. package/js/utils/css.js +13 -0
  230. package/js/utils/dom.js +23 -64
  231. package/js/utils/font-awesome.js +19 -0
  232. package/js/utils/index.js +2 -1
  233. package/js/utils/system.js +155 -0
  234. package/package.json +24 -9
  235. package/scss/README.md +9 -0
  236. package/scss/_breakpoint.scss +39 -5
  237. package/scss/_button.scss +7 -5
  238. package/scss/_color.scss +71 -40
  239. package/scss/_element.scss +124 -2
  240. package/scss/_layout.scss +7 -8
  241. package/scss/_typography.scss +15 -0
  242. package/scss/_units.scss +3 -2
  243. package/scss/_utils.scss +387 -16
  244. package/scss/base/_elements.scss +0 -1
  245. package/scss/base/_index.scss +1 -1
  246. package/scss/base/_keyframes.scss +15 -0
  247. package/scss/base/_layout.scss +1 -0
  248. package/scss/base/_print.scss +2 -0
  249. package/scss/base/_root.scss +2 -0
  250. package/scss/components/_accordion.scss +167 -110
  251. package/scss/components/_badge-stack.scss +84 -0
  252. package/scss/components/_badge.scss +30 -7
  253. package/scss/components/_basic-hero.scss +112 -0
  254. package/scss/components/_breadcrumb.scss +110 -0
  255. package/scss/components/_button-group.scss +90 -0
  256. package/scss/components/_button-verbose.scss +100 -18
  257. package/scss/components/_callout.scss +112 -53
  258. package/scss/components/_card-grid.scss +5 -2
  259. package/scss/components/_card.scss +216 -87
  260. package/scss/components/_counter-list.scss +151 -0
  261. package/scss/components/_css-icon.scss +27 -17
  262. package/scss/components/_data-grid.scss +55 -12
  263. package/scss/components/_data-table.scss +3 -0
  264. package/scss/components/_definition-list.scss +178 -0
  265. package/scss/components/_flipcard.scss +8 -3
  266. package/scss/components/_form-theme.scss +106 -95
  267. package/scss/components/_headline-label.scss +83 -0
  268. package/scss/components/_hero.scss +3 -10
  269. package/scss/components/_index.scss +79 -0
  270. package/scss/components/_menu-stack.scss +87 -23
  271. package/scss/components/_modal.scss +51 -23
  272. package/scss/components/_nav-strip.scss +2 -0
  273. package/scss/components/_overlay-section.scss +2 -5
  274. package/scss/components/_panel.scss +246 -0
  275. package/scss/components/_popover.scss +139 -38
  276. package/scss/components/_progress-bar.scss +260 -0
  277. package/scss/components/_progress-circle.scss +175 -0
  278. package/scss/components/_pull-quote.scss +1 -1
  279. package/scss/components/_rail.scss +127 -0
  280. package/scss/components/_ratio-box.scss +2 -5
  281. package/scss/components/_rule.scss +1 -0
  282. package/scss/components/_scroll-slider.scss +1 -5
  283. package/scss/components/_skeleton.scss +126 -0
  284. package/scss/components/_slider.scss +49 -72
  285. package/scss/components/_spoke-spinner.scss +2 -2
  286. package/scss/components/_sticky-list.scss +206 -0
  287. package/scss/components/_tabs.scss +22 -4
  288. package/scss/components/_tag.scss +49 -7
  289. package/scss/components/_vignette.scss +2 -5
  290. package/scss/components/_wysiwyg.scss +21 -13
  291. package/scss/helpers/_display.scss +15 -18
  292. package/scss/helpers/_print.scss +12 -7
  293. package/scss/helpers/_utilities.scss +62 -34
  294. package/types/events/index.d.ts +10 -1
  295. package/types/events/index.d.ts.map +1 -1
  296. package/types/index.d.ts +1 -0
  297. package/types/settings.d.ts +70 -0
  298. package/types/settings.d.ts.map +1 -0
  299. package/types/ui/breakpoints.d.ts +14 -14
  300. package/types/ui/breakpoints.d.ts.map +1 -1
  301. package/types/ui/collapsible.d.ts.map +1 -1
  302. package/types/ui/details-group.d.ts +38 -0
  303. package/types/ui/details-group.d.ts.map +1 -0
  304. package/types/ui/dialog.d.ts +20 -14
  305. package/types/ui/dialog.d.ts.map +1 -1
  306. package/types/ui/flipcard.d.ts +16 -10
  307. package/types/ui/flipcard.d.ts.map +1 -1
  308. package/types/ui/grid.d.ts +4 -6
  309. package/types/ui/grid.d.ts.map +1 -1
  310. package/types/ui/index.d.ts +1 -0
  311. package/types/ui/modal-builder.d.ts +116 -11
  312. package/types/ui/modal-builder.d.ts.map +1 -1
  313. package/types/ui/overflow-scroller.d.ts +2 -2
  314. package/types/ui/overflow-scroller.d.ts.map +1 -1
  315. package/types/ui/popover.d.ts +6 -7
  316. package/types/ui/popover.d.ts.map +1 -1
  317. package/types/ui/print.d.ts +0 -4
  318. package/types/ui/print.d.ts.map +1 -1
  319. package/types/ui/programmatic-modal.d.ts.map +1 -1
  320. package/types/ui/proxy-click.d.ts +19 -3
  321. package/types/ui/proxy-click.d.ts.map +1 -1
  322. package/types/ui/resizer.d.ts +116 -16
  323. package/types/ui/resizer.d.ts.map +1 -1
  324. package/types/ui/scroll-slider.d.ts +5 -7
  325. package/types/ui/scroll-slider.d.ts.map +1 -1
  326. package/types/ui/scrollpoint.d.ts +3 -8
  327. package/types/ui/scrollpoint.d.ts.map +1 -1
  328. package/types/ui/slider.d.ts +33 -14
  329. package/types/ui/slider.d.ts.map +1 -1
  330. package/types/ui/tabs.d.ts +6 -8
  331. package/types/ui/tabs.d.ts.map +1 -1
  332. package/types/ui/theme-toggle.d.ts +51 -7
  333. package/types/ui/theme-toggle.d.ts.map +1 -1
  334. package/types/ui/tooltip.d.ts +3 -5
  335. package/types/ui/tooltip.d.ts.map +1 -1
  336. package/types/utils/css.d.ts +11 -0
  337. package/types/utils/css.d.ts.map +1 -0
  338. package/types/utils/dom.d.ts +12 -32
  339. package/types/utils/dom.d.ts.map +1 -1
  340. package/types/utils/font-awesome.d.ts +5 -0
  341. package/types/utils/font-awesome.d.ts.map +1 -0
  342. package/types/utils/index.d.ts +1 -0
  343. package/types/utils/system.d.ts +113 -0
  344. package/types/utils/system.d.ts.map +1 -0
package/js/utils/dom.js CHANGED
@@ -2,53 +2,17 @@
2
2
  * @module utils/dom
3
3
  */
4
4
 
5
-
6
- export const regexJsonString = /^[{\[][\s\S]*[}\]]$/;
5
+ import { kebabToCamel } from "@ulu/utils/string.js";
7
6
 
8
7
  /**
9
- * Get an elements JSON dataset value
10
- * @param {Node} element
11
- * @param {String} key key in dataset object for element
12
- * @returns {Object} Empty object or JSON object from dataset
8
+ * Converts a data attribute name to its corresponding dataset property name.
9
+ * @param {string} dataAttribute - The data attribute name (e.g., "data-ulu-dialog").
10
+ * @returns {string} - The dataset property name (e.g., "uluDialog").
13
11
  */
14
- export function getDatasetJson(element, key) {
15
- const passed = element.dataset[key];
16
- try {
17
- return JSON.parse(passed);
18
- } catch (error) {
19
- console.error(`Error getting JSON from dataset (${ key }) -- "${ passed }"\n`, element, error);
20
- return {};
21
- }
12
+ export function dataAttributeToDatasetKey(attribute) {
13
+ return kebabToCamel(attribute.replace(/^data-/, ""));
22
14
  }
23
15
 
24
- /**
25
- * Get an elements JSON dataset value that could potentially just be a single string
26
- * - If JSON it will return the object else it will return the value directly
27
- * @param {Node} element
28
- * @param {String} key key in dataset object for element
29
- * @returns {Object|String} JSON object or current dataset value (string or empty string if no value)
30
- */
31
- export function getDatasetOptionalJson(element, key) {
32
- const passed = element.dataset[key];
33
- if (passed && regexJsonString.test(passed.trim())) {
34
- return getDatasetJson(element, key);
35
- } else {
36
- return passed;
37
- }
38
- }
39
-
40
- /**
41
- * Check if a pointer event x/y was outside an elements bounding box
42
- */
43
- export function wasClickOutside(element, event) {
44
- const rect = element.getBoundingClientRect();
45
- return (event.clientY < rect.top || // above
46
- event.clientY > rect.top + rect.height || // below
47
- event.clientX < rect.left || // left side
48
- event.clientX > rect.left + rect.width); // right side
49
- }
50
-
51
-
52
16
  /**
53
17
  * Sets up the positional classes that would come from the equal
54
18
  * height module. Needs to be rerun by user when layout changes
@@ -95,28 +59,23 @@ export function setPositionClasses(parent, classes = {
95
59
  }
96
60
 
97
61
  /**
98
- * Resolve a target to Element
99
- * @param {String|Node} target The selector or node/element
100
- * @param {Object} context [document] The context to query possible selectors from
62
+ * Resolves a class input (string or array) into a consistent array of class names.
63
+ * @param {string|string[]} input - The class input, which can be a string, an array of strings, or any other value.
64
+ * @returns {string[]} An array of class names. Returns an empty array for invalid or falsy input.
65
+ * @example
66
+ * resolveClassArray("fas fa-check my-class"); // Returns ["fas", "fa-check", "my-class"]
67
+ * resolveClassArray(["another-class", "yet-another-class"]); // Returns ["another-class", "yet-another-class"]
68
+ * resolveClassArray("single-class"); // Returns ["single-class"]
101
69
  */
102
- export function getElement(target, context = document) {
103
- if (typeof target === "string") {
104
- return context.querySelector(target);
105
- } else if (target instanceof Element) {
106
- return target;
70
+ export function resolveClasses(classes) {
71
+ if (typeof classes === "string") {
72
+ return classes.split(" ").filter(c => c !== ""); // Split and remove empty strings
73
+ } else if (Array.isArray(classes)) {
74
+ return classes;
75
+ } else if (!classes) {
76
+ return [];
107
77
  } else {
108
- console.warn("Unable to getElement()", target);
109
- return null;
78
+ console.warn("resolveClassArray: Invalid class input type.", classes);
79
+ return [];
110
80
  }
111
- }
112
-
113
- /**
114
- * Sets a CSS custom property equal to the scrollbar width
115
- * @param {Node} element The element that is the child of a scrollabel container
116
- * @param {Node} container The container that can be scrolled
117
- * @param {Stirng} propName Custom property to set
118
- */
119
- export function addScrollbarProperty(element = document.body, container = window, propName = "--ulu-scrollbar-width") {
120
- const scrollbarWidth = container.innerWidth - element.clientWidth;
121
- element.style.setProperty(propName, `${ scrollbarWidth }px`);
122
- }
81
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @module settings
3
+ * @description Utility module for setting up Font Awesome
4
+ */
5
+
6
+ import { updateSettings } from "../settings.js";
7
+
8
+ /**
9
+ * Sets icon settings to Font Awesome icons
10
+ */
11
+ export function configureIcons() {
12
+ updateSettings({
13
+ iconClassClose: "fas fa-xmark",
14
+ iconClassDragX: "fas fa-solid fa-grip-lines-vertical",
15
+ // iconClassDragBoth: "fas fa-solid fa-grip", // Not really any good icons for this (no diagonal arrows, etc)
16
+ iconClassPrevious: "fas fa-solid fa-chevron-left",
17
+ iconClassNext: "fas fa-solid fa-chevron-right"
18
+ });
19
+ }
package/js/utils/index.js CHANGED
@@ -4,4 +4,5 @@ export * as floatingUi from "./floating-ui.js";
4
4
  export * as id from "./id.js";
5
5
  export * as index from "./index.js";
6
6
  export * as pauseYoutubeVideo from "./pause-youtube-video.js";
7
- export * as fileSave from "./file-save.js";
7
+ export * as fileSave from "./file-save.js";
8
+ export * as fontAwesome from "./font-awesome.js";
@@ -0,0 +1,155 @@
1
+ /**
2
+ * @module utils/system
3
+ * @description Core classes and mechanisms that define how UI components are created and managed within the library
4
+ */
5
+
6
+ import { hasRequiredProps } from "@ulu/utils/object.js";
7
+ import { getDatasetOptionalJson } from "@ulu/utils/browser/dom.js";
8
+ import { dataAttributeToDatasetKey } from "./dom.js";
9
+ import { getName } from "../events/index.js";
10
+
11
+ /**
12
+ * Class serves as a utility for UI modules, handling the selection of elements and the initialization of corresponding component instances, ensuring consistent setup within the module
13
+ */
14
+ export class ComponentInitializer {
15
+ static defaults = {
16
+ type: null,
17
+ baseAttribute: null
18
+ };
19
+ static requiredOptions = [
20
+ "type",
21
+ "baseAttribute"
22
+ ];
23
+ static hasRequiredOptions = hasRequiredProps(
24
+ ComponentInitializer.requiredOptions
25
+ );
26
+
27
+ /**
28
+ * Create a new instance of ComponentInitializer
29
+ * @param {Object} options Options for configuring the component initializer.
30
+ * @param {String} options.type Type of component (used for logs).
31
+ * @param {String} options.baseAttribute Prefix and base attribute name (used for base attribute and further element attribute names).
32
+ */
33
+ constructor(options) {
34
+ if (!ComponentInitializer.hasRequiredOptions(options)) {
35
+ throw new Error(
36
+ `Missing a required options: ${ ComponentInitializer.requiredOptions.join(", ") }`
37
+ );
38
+ }
39
+ this.options = Object.assign({}, ComponentInitializer.defaults, options);
40
+ this.logTitle = `ULU: ${ this.options.type }:\n`;
41
+ }
42
+ /**
43
+ * Initializes the component based on the provided configuration.
44
+ * @param {Object} config The initialization configuration.
45
+ * @param {Function} config.setup The setup function to call for each element.
46
+ * @param {String} config.key [null] The optional key to use with attribute selector.
47
+ * @param {Boolean} config.withData [null] Whether to retrieve element data.
48
+ * @param {Array} config.events [null] Ulu events that should call setup when dispatched (ie. pageModified, pageResized)
49
+ * @param {Boolean} config.onPageResized [null] Whether to bind event listener for page resize end
50
+ * @param {HTMLElement} config.context [document] The context to query within.
51
+ */
52
+ init(config) {
53
+ this.setupElements(config);
54
+ // Attach Handler to reinitialize if page is updated
55
+ // Specifically checking entire document incase element that dispatched
56
+ // event made alterations outside of itself
57
+ if (config.events?.length) {
58
+ config.events.forEach(name => {
59
+ document.addEventListener(getName(name), () => this.setupElements(config));
60
+ });
61
+ }
62
+ }
63
+ /**
64
+ * Processes the elements based on the provided configuration.
65
+ * @param {object} config The initialization configuration.
66
+ * @param {function} config.setup The setup function to call for each element.
67
+ * @param {string} config.key The optional key to use with attribute selector.
68
+ * @param {boolean} config.withData [false] Whether to retrieve element data.
69
+ * @param {boolean} config.onPageModified [true] Whether to bind event listener for page modifications.
70
+ * @param {HTMLElement} config.context [document] The context to query within.
71
+ */
72
+ setupElements(config) {
73
+ const { setup, key, withData, context } = config;
74
+ const elementsWithData = this.queryAllInitial(key, withData, context);
75
+ elementsWithData.forEach(elementWithData => setup(elementWithData, this));
76
+ }
77
+ /**
78
+ * Get an attribute name
79
+ * @param {String} key Optional key, if no key will return baseAttribute if key will return key added to base
80
+ * @returns {String} String like data-ulu-dialog or data-ulu-dialog-element
81
+ */
82
+ getAttribute(key) {
83
+ const { baseAttribute } = this.options;
84
+ return key ? `${ baseAttribute }-${ key }` : `${ baseAttribute }`;
85
+ }
86
+ /**
87
+ * Create an attribute selector
88
+ * @param {String} key Optional key (see getAttribute)
89
+ */
90
+ attributeSelector(key) {
91
+ return `[${ this.getAttribute(key) }]`;
92
+ }
93
+ /**
94
+ * Create an attribute selector for initial
95
+ * @return {String}
96
+ */
97
+ attributeSelectorInitial(key) {
98
+ return `${ this.attributeSelector(key) }:not([${ this.getAttribute("init") }])`
99
+ }
100
+ /**
101
+ * Queries all main elements of a component that have not been initialized and extracts their data attributes.
102
+ * @param {HTMLElement} context The context to query within.
103
+ * @param {Boolean} withData Include dataset from element (as optional JSON)
104
+ * @param {Node} context Element to query elements from
105
+ * @returns {Array<{element: HTMLElement, data: object, initialize: Function}>} An array of objects containing the elements, their data, and convenience function initialize() which when called will set the init attribute on the element
106
+ */
107
+ queryAllInitial(key, withData, context = document) {
108
+ const elements = [ ...context.querySelectorAll(this.attributeSelectorInitial(key)) ];
109
+ return elements.map((element) => ({
110
+ element,
111
+ data: withData ? this.getData(element, key) : null,
112
+ initialize: () => this.initializeElement(element)
113
+ }));
114
+ }
115
+ /**
116
+ * Sets the init attribute on an element, marking it as initialized.
117
+ * @param {HTMLElement} element The element to initialize.
118
+ */
119
+ initializeElement(element) {
120
+ element.setAttribute(this.getAttribute("init"), "");
121
+ }
122
+ /**
123
+ * Get an elements dataset value as JSON or other value
124
+ * @return {*} The value of the dataset, if JSON will return object else will return string value or undefined
125
+ */
126
+ getData(element, key) {
127
+ const datasetKey = dataAttributeToDatasetKey(this.getAttribute(key));
128
+ return getDatasetOptionalJson(element, datasetKey);
129
+ }
130
+ /**
131
+ * Will output namespaced console logs for the given initializer
132
+ */
133
+ log(...msgs) {
134
+ console.log(this.logTitle, ...msgs);
135
+ }
136
+ /**
137
+ * Will output namespaced console warnings for the given initializer
138
+ */
139
+ warn(...msgs) {
140
+ console.warn(this.logTitle, ...msgs);
141
+ }
142
+ /**
143
+ * Will output namespaced console error for the given initializer
144
+ */
145
+ logError(...msgs) {
146
+ console.error(this.logTitle, ...msgs);
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Class serves as a base for representing individual occurrences of a UI component, providing a consistent structure for each
152
+ */
153
+ export class ComponentInstance {
154
+
155
+ }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@ulu/frontend",
3
- "version": "0.1.0-beta.12",
4
- "description": "Modular Sass Theming Library",
3
+ "version": "0.1.0-beta.121",
4
+ "description": "A versatile SCSS and JavaScript component library offering configurable, accessible components and flexible integration into any project, with SCSS modules suitable for modern JS frameworks.",
5
5
  "browser": "js/index.js",
6
6
  "main": "index.js",
7
+ ".": "./index.js",
7
8
  "exports": {
8
- ".": "./index.js",
9
9
  "./js/*.js": "./js/*.js",
10
10
  "./js/*": "./js/*",
11
11
  "./scss/*.scss": "./scss/*.scss",
@@ -30,7 +30,9 @@
30
30
  "docs:build:prod": "IS_PRODUCTION=true npx @11ty/eleventy --config=docs.eleventy.js",
31
31
  "docs:assets": "vite --config docs.vite.config.js --force",
32
32
  "docs:assets:build": "vite build --config docs.vite.config.js",
33
- "docs:assets:build:prod": "IS_PRODUCTION=true vite build --config docs.vite.config.js"
33
+ "docs:assets:build:prod": "IS_PRODUCTION=true vite build --config docs.vite.config.js",
34
+ "deploy": "npm run build && npm run types && npm run docs:build:prod && npm run docs:assets:build:prod",
35
+ "deploy:docs": "npm run docs:build:prod && npm run docs:assets:build:prod"
34
36
  },
35
37
  "repository": {
36
38
  "type": "git",
@@ -44,7 +46,18 @@
44
46
  "modules",
45
47
  "javascript",
46
48
  "framework",
47
- "mixin"
49
+ "mixin",
50
+ "components",
51
+ "HTML",
52
+ "frontend framework",
53
+ "css",
54
+ "utilities",
55
+ "design system",
56
+ "toolkit",
57
+ "accessibility",
58
+ "ui",
59
+ "user interface",
60
+ "responsive design"
48
61
  ],
49
62
  "authors": {
50
63
  "name": "Joe Scherben, Informatics Studio",
@@ -61,11 +74,12 @@
61
74
  "@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0",
62
75
  "@fortawesome/fontawesome-free": "^6.5.2",
63
76
  "@ulu/markdown-output-utils": "^0.0.6",
64
- "@ulu/sassdoc-to-markdown": "^0.0.15",
77
+ "@ulu/sassdoc-to-markdown": "^0.0.16",
65
78
  "@ulu/vite-config-cms-theme": "^0.0.10",
66
79
  "@ulu/vitepress-auto-menus": "^0.0.3",
67
80
  "@ulu/vitepress-sassdoc": "^0.0.9",
68
81
  "algoliasearch": "^4.23.3",
82
+ "autoprefixer": "^10.4.16",
69
83
  "chokidar": "^3.6.0",
70
84
  "eleventy-plugin-nesting-toc": "^1.3.0",
71
85
  "fs-extra": "^11.2.0",
@@ -78,14 +92,15 @@
78
92
  "sass-embedded": "^1.81.0",
79
93
  "sharp": "^0.33.4",
80
94
  "svgo": "^3.3.2",
95
+ "twig": "^1.17.1",
81
96
  "typescript": "^5.3.3",
82
- "autoprefixer": "^10.4.16",
83
97
  "vite": "^5.4.11"
84
98
  },
85
99
  "dependencies": {
86
- "@ulu/utils": "^0.0.17",
100
+ "@floating-ui/dom": "^1.6.5",
101
+ "@ulu/utils": "^0.0.30",
87
102
  "ally.js": "^1.4.1",
88
103
  "aria-tablist": "^1.2.2",
89
- "@floating-ui/dom": "^1.6.5"
104
+ "swipe-listener" : "^1.3.0"
90
105
  }
91
106
  }
package/scss/README.md CHANGED
@@ -35,12 +35,21 @@
35
35
  - Modules use simple variable, mixins and function names relative to their module
36
36
  - Forwards will make namespacing in the overall ulu packaged module
37
37
  - **Module Prefixes:** Modules all get prefixed by parent module ie lib will transform color.set() to color-set(), adding the modules namespace for users that are importing the whole library. It also matches the core modules `map-get()` and when @used `map.get()`
38
+ - Try to avoid "&" selector when possible?
39
+ - For example with
40
+ - .user-scope-selector { .component-example + .component-example { // This can be wrapped externally } }
41
+ - .user-scope-selector { .component-example { & + & {} } } // This will incorrectly inherit the users outer selector.
42
+ - Not crucial (we won't specifically design this way) but we may want to refactor in the future (at least components) so that we write selectors in a more static way so that scoping doesn't interfere
38
43
 
39
44
  ### Writing Docs
40
45
 
41
46
  - Should be written from the user's point of view
42
47
  - Use prefixes @see "Module Prefixes" in member names. This will avoid confusion about normal use case. For advanced user importing specific parts would already be familiar with this pattern.
43
48
 
49
+ #### Workaround for syntax highlighting bug
50
+
51
+ If the syntax highlighting isn't working properly after an example, add an empty line with `///` to workaround that bug
52
+
44
53
  ### Ideas
45
54
 
46
55
  - How to solve the inability to use standard vars (avoid with)
@@ -4,6 +4,7 @@
4
4
  ////
5
5
 
6
6
  @use "sass:map";
7
+ @use "sass:list";
7
8
  @use "utils";
8
9
 
9
10
  /// Module Settings
@@ -30,8 +31,10 @@ $config: (
30
31
  }
31
32
 
32
33
  /// Get a config option
33
- /// @example scss Get default breakpoint name
34
- /// $default: ulu.breakpoint-get("default");
34
+ /// @example scss {compile} Example usage
35
+ /// .test-get {
36
+ /// font-size: ulu.breakpoint-get("base");
37
+ /// }
35
38
  /// @param {Map} $name Name of property
36
39
  /// @return {*} Property Value
37
40
 
@@ -65,6 +68,12 @@ $sizes: (
65
68
  }
66
69
 
67
70
  /// Get all breakpoint sizes
71
+ /// @compiler
72
+ /// @example scss {compile} Example usage
73
+ /// .test-get-sizes {
74
+ /// $sizes: ulu.breakpoint-get-sizes();
75
+ /// content: map.get($sizes, "medium");
76
+ /// }
68
77
  /// @return {Map} Map of breakpoints (equivalent to $sizes)
69
78
 
70
79
  @function get-sizes() {
@@ -73,14 +82,25 @@ $sizes: (
73
82
 
74
83
  /// Get a specific breakpoint's raw value/size
75
84
  /// @param {String} $size The name of the size to get
85
+ /// @compiler
86
+ /// @example scss {compile} Example usage
87
+ /// .test-get-size {
88
+ /// content: ulu.breakpoint-get-size("medium");
89
+ /// }
76
90
  /// @return {Number} The sizes value
77
-
91
+
78
92
  @function get-size($size) {
79
93
  @return utils.require-map-get($sizes, $size, "breakpoint size");
80
94
  }
81
95
 
82
96
  /// Get a specific breakpoint's size's value and optionally specify max to get the ending/max value for a breakpoint
83
97
  /// @param {Boolean} $max [false] Get the max value
98
+ /// @compiler
99
+ /// @example scss {compile} Example usage
100
+ /// .test-get-size-value {
101
+ /// content: ulu.breakpoint-get-size-value("medium", true);
102
+ /// content: ulu.breakpoint-get-size-value("medium");
103
+ /// }
84
104
  /// @return {Number} The value for the given size
85
105
 
86
106
  @function get-size-value($size, $max: false) {
@@ -94,6 +114,20 @@ $sizes: (
94
114
  /// Check if a specific size exist
95
115
  /// @param {String} $name The breakpoint size to check if exists
96
116
  /// @return {Boolean}
117
+ /// @example scss {compile} Example usage
118
+ /// .test-exists {
119
+ /// @if(ulu.breakpoint-exists("medium")) {
120
+ /// @include ulu.breakpoint-min("medium") {
121
+ /// padding: 2rem;
122
+ /// }
123
+ /// }
124
+ /// // The below content doesn't print because the size doesn't exist.
125
+ /// @if(ulu.breakpoint-exists("too-large")) {
126
+ /// @include ulu.breakpoint-min("too-large") {
127
+ /// padding: 20000rem;
128
+ /// }
129
+ /// }
130
+ /// }
97
131
 
98
132
  @function exists($name) {
99
133
  $size: map.get($sizes, $name);
@@ -190,7 +224,7 @@ $sizes: (
190
224
  /// @include breakpoints.fromEach($breakpoints) using ($props) {
191
225
  /// width: map.get($props, "width");
192
226
  /// }
193
- /// @param {String} $breakpoints A map with breakpoints direction will be pulled from each items "direction" property, if direction is missing and no breakpoint will wrap the code
227
+ /// @param {String} $breakpoints A map with breakpoints direction will be pulled from each items "direction" property, if direction is missing no breakpoint will wrap the code (as convention we call the default non-breakpoint direction "default")
194
228
  /// @param {String} $options A map with options to change the behavior
195
229
  /// @param {Boolean} $options.directionRequired Require direction throw error if missing direction
196
230
 
@@ -220,7 +254,7 @@ $sizes: (
220
254
  /// - Breakpoints always min-width (upwards) for javascript setup
221
255
 
222
256
  @mixin embed-for-scripts() {
223
- &:before {
257
+ &::before {
224
258
  display: none;
225
259
  content: get("null-name");
226
260
  @each $size, $breakpoint in $sizes {
package/scss/_button.scss CHANGED
@@ -94,7 +94,7 @@ $config: (
94
94
 
95
95
  $sizes: (
96
96
  "small" : (
97
- "padding": (0.35em 1.5em),
97
+ "padding": (0.35em 1em),
98
98
  "min-width": 0,
99
99
  "icon-size": 2rem,
100
100
  "icon-font-size": 1rem
@@ -118,9 +118,9 @@ $styles: (
118
118
  "border-color" : transparent,
119
119
  "box-shadow" : none,
120
120
  "hover" : (
121
- "background-color" : "white",
122
- "color" : inherit,
123
- "border-color" : transparent,
121
+ "background-color" : "control-background",
122
+ "color" : "control",
123
+ "border-color" : "control-border",
124
124
  )
125
125
  ),
126
126
  "outline" : (
@@ -129,7 +129,9 @@ $styles: (
129
129
  "border-color" : "rule-light",
130
130
  "box-shadow" : none,
131
131
  "hover" : (
132
- "background-color" : "white",
132
+ "background-color" : "control-background",
133
+ "color" : "control",
134
+ "border-color" : "control-border",
133
135
  )
134
136
  ),
135
137
  ) !default;