@ulu/frontend 0.1.0-beta.10 → 0.1.0-beta.100

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 (324) hide show
  1. package/CHANGELOG.md +641 -0
  2. package/README.dev.md +3 -3
  3. package/README.md +14 -4
  4. package/dist/ulu-frontend.min.css +1 -1
  5. package/dist/ulu-frontend.min.js +36 -29
  6. package/docs-dev/.nojekyll +1 -0
  7. package/docs-dev/assets/main.js +8290 -635
  8. package/docs-dev/assets/placeholder/icon-calendar.svg +1 -0
  9. package/docs-dev/assets/placeholder/icon-check.svg +1 -0
  10. package/docs-dev/assets/style.css +789 -338
  11. package/docs-dev/changelog/index.html +7184 -0
  12. package/docs-dev/demos/accordion/index.html +1277 -365
  13. package/docs-dev/demos/badge/index.html +5655 -0
  14. package/docs-dev/demos/badge-stack/index.html +5636 -0
  15. package/docs-dev/demos/{list-inline.1 → badge.1}/index.html +1231 -363
  16. package/docs-dev/demos/basic-hero/index.html +111 -0
  17. package/docs-dev/demos/breakpoints-manager/index.html +5666 -0
  18. package/docs-dev/demos/button/index.html +1309 -355
  19. package/docs-dev/demos/button-group/index.html +5652 -0
  20. package/docs-dev/demos/button-verbose/index.html +5658 -0
  21. package/docs-dev/demos/callout/index.html +1300 -347
  22. package/docs-dev/demos/captioned-figure/index.html +1271 -358
  23. package/docs-dev/demos/card/index.html +1374 -822
  24. package/docs-dev/demos/card-grid/index.html +5777 -0
  25. package/docs-dev/demos/counter-list/index.html +5660 -0
  26. package/docs-dev/demos/css-icons/index.html +1292 -356
  27. package/docs-dev/demos/data-grid/index.html +1271 -358
  28. package/docs-dev/demos/data-table/index.html +1405 -359
  29. package/docs-dev/demos/details-group/index.html +5687 -0
  30. package/docs-dev/demos/file-save/index.html +1271 -358
  31. package/docs-dev/demos/flipcard/index.html +1271 -358
  32. package/docs-dev/demos/form-theme/index.html +1295 -395
  33. package/docs-dev/demos/headline-label/index.html +5622 -0
  34. package/docs-dev/demos/hero/index.html +12 -4
  35. package/docs-dev/demos/image-grid/index.html +12 -4
  36. package/docs-dev/demos/index.html +1272 -359
  37. package/docs-dev/demos/list-inline/index.html +1271 -358
  38. package/docs-dev/demos/list-lines/index.html +1271 -358
  39. package/docs-dev/demos/menu-stack/index.html +1303 -375
  40. package/docs-dev/demos/modals/index.html +1382 -346
  41. package/docs-dev/demos/nav-strip/index.html +1271 -358
  42. package/docs-dev/demos/overlay-section/index.html +1335 -352
  43. package/docs-dev/demos/panel/index.html +5682 -0
  44. package/docs-dev/demos/popovers/index.html +1562 -407
  45. package/docs-dev/demos/print/index.html +1271 -358
  46. package/docs-dev/demos/pull-quote/index.html +1271 -358
  47. package/docs-dev/demos/rail/index.html +5730 -0
  48. package/docs-dev/demos/rule/index.html +1288 -363
  49. package/docs-dev/demos/scroll-slider/index.html +72 -106
  50. package/docs-dev/demos/scrollpoints/index.html +1272 -359
  51. package/docs-dev/demos/skeleton/index.html +5678 -0
  52. package/docs-dev/demos/slider/index.html +12 -4
  53. package/docs-dev/demos/spoke-spinner/index.html +1271 -358
  54. package/docs-dev/demos/sticky-list/index.html +5643 -0
  55. package/docs-dev/demos/tabs/index.html +1301 -352
  56. package/docs-dev/demos/tag/index.html +1271 -358
  57. package/docs-dev/demos/theme-toggle/index.html +5699 -0
  58. package/docs-dev/demos/tile-grid-overlay/index.html +12 -4
  59. package/docs-dev/demos/tiles/index.html +1271 -358
  60. package/docs-dev/demos/tooltip/index.html +1271 -358
  61. package/docs-dev/demos/wysiwyg/index.html +5672 -0
  62. package/docs-dev/guide/building-stylesheet/index.html +1271 -358
  63. package/docs-dev/guide/developing-ulu-scss-module/index.html +1271 -358
  64. package/docs-dev/guide/index.html +1271 -358
  65. package/docs-dev/index.html +1271 -358
  66. package/docs-dev/javascript/events/index.html +1303 -352
  67. package/docs-dev/javascript/index.html +1271 -358
  68. package/docs-dev/javascript/settings/index.html +5825 -0
  69. package/docs-dev/javascript/ui-breakpoints/index.html +1285 -374
  70. package/docs-dev/javascript/ui-collapsible/index.html +1270 -359
  71. package/docs-dev/javascript/ui-details-group/index.html +5742 -0
  72. package/docs-dev/javascript/ui-dialog/index.html +1302 -376
  73. package/docs-dev/javascript/ui-flipcard/index.html +1331 -364
  74. package/docs-dev/javascript/ui-grid/index.html +1274 -389
  75. package/docs-dev/javascript/ui-modal-builder/index.html +1497 -446
  76. package/docs-dev/javascript/ui-overflow-scroller/index.html +1270 -359
  77. package/docs-dev/javascript/ui-overflow-scroller-pager/index.html +1270 -359
  78. package/docs-dev/javascript/ui-page/index.html +1270 -359
  79. package/docs-dev/javascript/ui-popover/index.html +1280 -373
  80. package/docs-dev/javascript/ui-print/index.html +1268 -365
  81. package/docs-dev/javascript/ui-print-details/index.html +1270 -359
  82. package/docs-dev/javascript/ui-programmatic-modal/index.html +1270 -359
  83. package/docs-dev/javascript/ui-proxy-click/index.html +1331 -335
  84. package/docs-dev/javascript/ui-resizer/index.html +1588 -412
  85. package/docs-dev/javascript/ui-scroll-slider/index.html +1310 -367
  86. package/docs-dev/javascript/ui-scrollpoint/index.html +1280 -376
  87. package/docs-dev/javascript/ui-slider/index.html +1454 -352
  88. package/docs-dev/javascript/ui-tabs/index.html +1261 -387
  89. package/docs-dev/javascript/ui-theme-toggle/index.html +5830 -0
  90. package/docs-dev/javascript/ui-tooltip/index.html +1273 -366
  91. package/docs-dev/javascript/utils-class-logger/index.html +1271 -360
  92. package/docs-dev/javascript/utils-css/index.html +5644 -0
  93. package/docs-dev/javascript/utils-dom/index.html +1269 -438
  94. package/docs-dev/javascript/utils-file-save/index.html +1270 -359
  95. package/docs-dev/javascript/utils-floating-ui/index.html +1270 -359
  96. package/docs-dev/javascript/utils-id/index.html +1270 -359
  97. package/docs-dev/javascript/utils-pause-youtube-video/index.html +1270 -359
  98. package/docs-dev/javascript/utils-system/index.html +5947 -0
  99. package/docs-dev/sass/base/color/index.html +1270 -359
  100. package/docs-dev/sass/base/elements/index.html +1271 -360
  101. package/docs-dev/sass/base/index/index.html +1271 -360
  102. package/docs-dev/sass/base/index.html +1271 -358
  103. package/docs-dev/sass/base/keyframes/index.html +1271 -360
  104. package/docs-dev/sass/base/layout/index.html +1271 -360
  105. package/docs-dev/sass/base/normalize/index.html +1270 -359
  106. package/docs-dev/sass/base/print/index.html +1271 -360
  107. package/docs-dev/sass/base/root/index.html +1274 -363
  108. package/docs-dev/sass/base/typography/index.html +1270 -359
  109. package/docs-dev/sass/components/accordion/index.html +1293 -375
  110. package/docs-dev/sass/components/adaptive-spacing/index.html +1270 -359
  111. package/docs-dev/sass/components/badge/index.html +1295 -366
  112. package/docs-dev/sass/components/badge-stack/index.html +5811 -0
  113. package/docs-dev/sass/components/basic-hero/index.html +5805 -0
  114. package/docs-dev/sass/components/button/index.html +1270 -359
  115. package/docs-dev/sass/components/button-group/index.html +5803 -0
  116. package/docs-dev/sass/components/button-verbose/index.html +1342 -356
  117. package/docs-dev/sass/components/callout/index.html +1352 -422
  118. package/docs-dev/sass/components/captioned-figure/index.html +1373 -347
  119. package/docs-dev/sass/components/card/index.html +1339 -356
  120. package/docs-dev/sass/components/card-grid/index.html +1270 -359
  121. package/docs-dev/sass/components/counter-list/index.html +5887 -0
  122. package/docs-dev/sass/components/css-icon/index.html +1271 -360
  123. package/docs-dev/sass/components/data-grid/index.html +1290 -372
  124. package/docs-dev/sass/components/data-table/index.html +1449 -348
  125. package/docs-dev/sass/components/fill-context/index.html +1270 -359
  126. package/docs-dev/sass/components/flipcard/index.html +1305 -363
  127. package/docs-dev/sass/components/flipcard-grid/index.html +1270 -359
  128. package/docs-dev/sass/components/form-theme/index.html +1449 -442
  129. package/docs-dev/sass/components/headline-label/index.html +5833 -0
  130. package/docs-dev/sass/components/hero/index.html +1316 -357
  131. package/docs-dev/sass/components/horizontal-rule/index.html +1270 -359
  132. package/docs-dev/sass/components/image-grid/index.html +1270 -359
  133. package/docs-dev/sass/components/index/index.html +1289 -369
  134. package/docs-dev/sass/components/index.html +1271 -358
  135. package/docs-dev/sass/components/links/index.html +1270 -359
  136. package/docs-dev/sass/components/list-inline/index.html +1270 -359
  137. package/docs-dev/sass/components/list-lines/index.html +1270 -359
  138. package/docs-dev/sass/components/list-ordered/index.html +1270 -359
  139. package/docs-dev/sass/components/list-unordered/index.html +1270 -359
  140. package/docs-dev/sass/components/menu-stack/index.html +1294 -369
  141. package/docs-dev/sass/components/modal/index.html +1306 -360
  142. package/docs-dev/sass/components/nav-strip/index.html +1278 -367
  143. package/docs-dev/sass/components/overlay-section/index.html +1278 -367
  144. package/docs-dev/sass/components/pager/index.html +1270 -359
  145. package/docs-dev/sass/components/panel/index.html +6033 -0
  146. package/docs-dev/sass/components/placeholder-block/index.html +1270 -359
  147. package/docs-dev/sass/components/popover/index.html +1323 -376
  148. package/docs-dev/sass/components/pull-quote/index.html +1282 -371
  149. package/docs-dev/sass/components/rail/index.html +5823 -0
  150. package/docs-dev/sass/components/ratio-box/index.html +1278 -367
  151. package/docs-dev/sass/components/rule/index.html +1271 -360
  152. package/docs-dev/sass/components/scroll-slider/index.html +1280 -381
  153. package/docs-dev/sass/components/skeleton/index.html +5861 -0
  154. package/docs-dev/sass/components/skip-link/index.html +1270 -359
  155. package/docs-dev/sass/components/slider/index.html +1310 -411
  156. package/docs-dev/sass/components/spoke-spinner/index.html +1272 -361
  157. package/docs-dev/sass/components/sticky-list/index.html +6023 -0
  158. package/docs-dev/sass/components/table-sticky/index.html +5677 -0
  159. package/docs-dev/sass/components/tabs/index.html +1291 -365
  160. package/docs-dev/sass/components/tag/index.html +1272 -361
  161. package/docs-dev/sass/components/tile-button/index.html +1270 -359
  162. package/docs-dev/sass/components/tile-grid/index.html +1270 -359
  163. package/docs-dev/sass/components/tile-grid-overlay/index.html +1270 -359
  164. package/docs-dev/sass/components/vignette/index.html +1282 -365
  165. package/docs-dev/sass/components/wysiwyg/index.html +1296 -367
  166. package/docs-dev/sass/core/breakpoint/index.html +1349 -386
  167. package/docs-dev/sass/core/button/index.html +1302 -389
  168. package/docs-dev/sass/core/color/index.html +1414 -370
  169. package/docs-dev/sass/core/cssvar/index.html +1270 -359
  170. package/docs-dev/sass/core/element/index.html +1641 -448
  171. package/docs-dev/sass/core/index.html +1270 -359
  172. package/docs-dev/sass/core/layout/index.html +1318 -388
  173. package/docs-dev/sass/core/path/index.html +1270 -359
  174. package/docs-dev/sass/core/selector/index.html +1270 -359
  175. package/docs-dev/sass/core/typography/index.html +1270 -359
  176. package/docs-dev/sass/core/units/index.html +1278 -361
  177. package/docs-dev/sass/core/utils/index.html +2580 -520
  178. package/docs-dev/sass/helpers/color/index.html +1270 -359
  179. package/docs-dev/sass/helpers/display/index.html +1271 -360
  180. package/docs-dev/sass/helpers/index/index.html +1270 -359
  181. package/docs-dev/sass/helpers/index.html +1271 -358
  182. package/docs-dev/sass/helpers/print/index.html +759 -298
  183. package/docs-dev/sass/helpers/typography/index.html +1270 -359
  184. package/docs-dev/sass/helpers/units/index.html +1270 -359
  185. package/docs-dev/sass/helpers/utilities/index.html +1272 -361
  186. package/docs-dev/sass/index.html +1271 -358
  187. package/js/events/index.js +17 -5
  188. package/js/index.js +1 -0
  189. package/js/settings.js +97 -0
  190. package/js/ui/breakpoints.js +19 -16
  191. package/js/ui/collapsible.js +8 -1
  192. package/js/ui/details-group.js +112 -0
  193. package/js/ui/dialog.js +103 -44
  194. package/js/ui/dialog.todo +2 -36
  195. package/js/ui/flipcard.js +37 -57
  196. package/js/ui/grid.js +15 -13
  197. package/js/ui/index.js +1 -0
  198. package/js/ui/modal-builder.js +127 -70
  199. package/js/ui/overflow-scroller.js +6 -4
  200. package/js/ui/page.js +2 -2
  201. package/js/ui/popover.js +38 -38
  202. package/js/ui/print.js +16 -25
  203. package/js/ui/programmatic-modal.js +9 -3
  204. package/js/ui/proxy-click.js +50 -36
  205. package/js/ui/resizer.js +408 -39
  206. package/js/ui/scroll-slider.js +24 -30
  207. package/js/ui/scrollpoint.js +29 -64
  208. package/js/ui/slider.js +108 -63
  209. package/js/ui/tabs.js +23 -36
  210. package/js/ui/theme-toggle.js +332 -94
  211. package/js/ui/tooltip.js +27 -32
  212. package/js/utils/class-logger.js +3 -3
  213. package/js/utils/css.js +13 -0
  214. package/js/utils/dom.js +23 -64
  215. package/js/utils/font-awesome.js +19 -0
  216. package/js/utils/index.js +2 -1
  217. package/js/utils/system.js +155 -0
  218. package/package.json +23 -8
  219. package/scss/README.md +9 -0
  220. package/scss/_breakpoint.scss +39 -5
  221. package/scss/_button.scss +7 -5
  222. package/scss/_color.scss +42 -10
  223. package/scss/_element.scss +124 -2
  224. package/scss/_layout.scss +7 -8
  225. package/scss/_units.scss +3 -2
  226. package/scss/_utils.scss +387 -16
  227. package/scss/base/_elements.scss +0 -1
  228. package/scss/base/_index.scss +1 -1
  229. package/scss/base/_keyframes.scss +15 -0
  230. package/scss/base/_layout.scss +1 -0
  231. package/scss/base/_print.scss +2 -0
  232. package/scss/base/_root.scss +2 -0
  233. package/scss/components/README.todos +14 -0
  234. package/scss/components/_accordion.scss +33 -19
  235. package/scss/components/_badge-stack.scss +84 -0
  236. package/scss/components/_badge.scss +30 -7
  237. package/scss/components/_basic-hero.scss +112 -0
  238. package/scss/components/_button-group.scss +90 -0
  239. package/scss/components/_button-verbose.scss +100 -18
  240. package/scss/components/_callout.scss +125 -78
  241. package/scss/components/_captioned-figure.scss +17 -0
  242. package/scss/components/_card-grid.scss +1 -1
  243. package/scss/components/_card.scss +229 -67
  244. package/scss/components/_counter-list.scss +151 -0
  245. package/scss/components/_css-icon.scss +27 -17
  246. package/scss/components/_data-grid.scss +55 -12
  247. package/scss/components/_data-table.scss +39 -3
  248. package/scss/components/_flipcard.scss +8 -3
  249. package/scss/components/_form-theme.scss +119 -108
  250. package/scss/components/_headline-label.scss +83 -0
  251. package/scss/components/_hero.scss +12 -10
  252. package/scss/components/_index.scss +54 -0
  253. package/scss/components/_menu-stack.scss +42 -25
  254. package/scss/components/_modal.scss +51 -23
  255. package/scss/components/_nav-strip.scss +2 -0
  256. package/scss/components/_overlay-section.scss +2 -5
  257. package/scss/components/_panel.scss +246 -0
  258. package/scss/components/_popover.scss +165 -64
  259. package/scss/components/_pull-quote.scss +13 -13
  260. package/scss/components/_rail.scss +127 -0
  261. package/scss/components/_ratio-box.scss +2 -5
  262. package/scss/components/_rule.scss +1 -0
  263. package/scss/components/_scroll-slider.scss +1 -5
  264. package/scss/components/_skeleton.scss +126 -0
  265. package/scss/components/_slider.scss +49 -72
  266. package/scss/components/_spoke-spinner.scss +2 -2
  267. package/scss/components/_sticky-list.scss +206 -0
  268. package/scss/components/_tabs.scss +22 -4
  269. package/scss/components/_vignette.scss +3 -5
  270. package/scss/components/_wysiwyg.scss +21 -13
  271. package/scss/helpers/_display.scss +15 -18
  272. package/scss/helpers/_print.scss +12 -7
  273. package/scss/helpers/_utilities.scss +41 -31
  274. package/types/events/index.d.ts +10 -1
  275. package/types/events/index.d.ts.map +1 -1
  276. package/types/index.d.ts +1 -0
  277. package/types/settings.d.ts +70 -0
  278. package/types/settings.d.ts.map +1 -0
  279. package/types/ui/breakpoints.d.ts +14 -14
  280. package/types/ui/breakpoints.d.ts.map +1 -1
  281. package/types/ui/collapsible.d.ts.map +1 -1
  282. package/types/ui/details-group.d.ts +38 -0
  283. package/types/ui/details-group.d.ts.map +1 -0
  284. package/types/ui/dialog.d.ts +20 -14
  285. package/types/ui/dialog.d.ts.map +1 -1
  286. package/types/ui/flipcard.d.ts +16 -10
  287. package/types/ui/flipcard.d.ts.map +1 -1
  288. package/types/ui/grid.d.ts +4 -6
  289. package/types/ui/grid.d.ts.map +1 -1
  290. package/types/ui/index.d.ts +2 -1
  291. package/types/ui/modal-builder.d.ts +116 -11
  292. package/types/ui/modal-builder.d.ts.map +1 -1
  293. package/types/ui/overflow-scroller.d.ts +2 -2
  294. package/types/ui/overflow-scroller.d.ts.map +1 -1
  295. package/types/ui/popover.d.ts +6 -7
  296. package/types/ui/popover.d.ts.map +1 -1
  297. package/types/ui/print.d.ts +0 -4
  298. package/types/ui/print.d.ts.map +1 -1
  299. package/types/ui/programmatic-modal.d.ts.map +1 -1
  300. package/types/ui/proxy-click.d.ts +19 -3
  301. package/types/ui/proxy-click.d.ts.map +1 -1
  302. package/types/ui/resizer.d.ts +116 -16
  303. package/types/ui/resizer.d.ts.map +1 -1
  304. package/types/ui/scroll-slider.d.ts +5 -7
  305. package/types/ui/scroll-slider.d.ts.map +1 -1
  306. package/types/ui/scrollpoint.d.ts +3 -8
  307. package/types/ui/scrollpoint.d.ts.map +1 -1
  308. package/types/ui/slider.d.ts +33 -14
  309. package/types/ui/slider.d.ts.map +1 -1
  310. package/types/ui/tabs.d.ts +6 -8
  311. package/types/ui/tabs.d.ts.map +1 -1
  312. package/types/ui/theme-toggle.d.ts +51 -7
  313. package/types/ui/theme-toggle.d.ts.map +1 -1
  314. package/types/ui/tooltip.d.ts +3 -5
  315. package/types/ui/tooltip.d.ts.map +1 -1
  316. package/types/utils/css.d.ts +11 -0
  317. package/types/utils/css.d.ts.map +1 -0
  318. package/types/utils/dom.d.ts +12 -32
  319. package/types/utils/dom.d.ts.map +1 -1
  320. package/types/utils/font-awesome.d.ts +5 -0
  321. package/types/utils/font-awesome.d.ts.map +1 -0
  322. package/types/utils/index.d.ts +2 -1
  323. package/types/utils/system.d.ts +113 -0
  324. 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,7 +1,7 @@
1
1
  {
2
2
  "name": "@ulu/frontend",
3
- "version": "0.1.0-beta.10",
4
- "description": "Modular Sass Theming Library",
3
+ "version": "0.1.0-beta.100",
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
7
  "exports": {
@@ -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
+ /// height: 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
+ /// height: 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
+ /// height: ulu.breakpoint-get-size-value("medium", true);
102
+ /// max-height: 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;
package/scss/_color.scss CHANGED
@@ -20,14 +20,21 @@ $palette: (
20
20
  "white" : white,
21
21
  "type" : black,
22
22
  "type-secondary" : rgb(82, 82, 82),
23
- "type-tertiary" : rgb(157, 157, 157),
23
+ "type-tertiary" : rgb(125, 125, 125),
24
+ "type-disabled" : rgb(160, 160, 160),
24
25
  "headline" : inherit,
25
26
  "background" : white,
26
- "background-gray" : #F7F8F7,
27
+ "background-gray" : #fafafa,
27
28
  "focus" : blue,
28
- "error" : red,
29
- "warning" : orange,
30
29
  "accent" : orange,
30
+ "info" : #00bde3,
31
+ "success" : #00a91c,
32
+ "warning" : #ffbe2e,
33
+ "danger" : #d54309,
34
+ "info-background" : #e7f6f8,
35
+ "success-background" : #ecf3ec,
36
+ "warning-background" : #faf3d1,
37
+ "danger-background" : #f4e3db,
31
38
  "selected" : green,
32
39
  "box-shadow" : rgba(0, 0, 0, 0.349),
33
40
  "box-shadow-hover" : rgba(0, 0, 0, 0.5),
@@ -40,10 +47,10 @@ $palette: (
40
47
  "bullet" : inherit,
41
48
  "control" : white,
42
49
  "control-hover" : white,
43
- "control-active" : white,
50
+ "control-active" : white,
44
51
  "control-border" : purple,
45
- "control-border-hover" : blue,
46
- "control-border-active" : orange,
52
+ "control-border-hover" : blue,
53
+ "control-border-active" : orange,
47
54
  "control-background" : purple,
48
55
  "control-background-hover": blue,
49
56
  "control-background-active": orange,
@@ -95,8 +102,11 @@ $color-classes: (
95
102
  @function get($name) {
96
103
  // Allow non lookup if the value is already a color (helps with code flow)
97
104
  @if (meta.type-of($name) == "string") {
105
+ $is-keyword: $name == "inherit" or $name == "transparent" or $name == "currentColor";
106
+ $is-cssvar: string.index($name, "var(") == 1;
107
+ $is-color-mix: string.index($name, "color-mix(") == 1;
98
108
  // Allow custom-properties and keyword inherit/transparent to pass through
99
- @if ($name == "inherit" or $name == "transparent" or $name == "currentColor" or string.index($name, "var(") == 1) {
109
+ @if ($is-keyword or $is-cssvar or $is-color-mix) {
100
110
  @return $name;
101
111
  // Else look up the color from the palette
102
112
  } @else {
@@ -172,7 +182,7 @@ $color-classes: (
172
182
  color: get-context-value($name, "color");
173
183
  }
174
184
 
175
- /// Lighten a color using the default white by a percentage
185
+ /// Tint (add white) a color using the default white by a percentage
176
186
  /// @param {Color, String} $color Color/palette color name to apply to tint
177
187
  /// @param {Number} $percentage Percentage
178
188
  /// @return {Color}
@@ -183,7 +193,18 @@ $color-classes: (
183
193
  @return color.mix(get("white"), get($color), $percentage);
184
194
  }
185
195
 
186
- /// Darken a color with the default black by a percentage
196
+ /// Tint (add white) a color using the default white by a percentage (Using color-mix)
197
+ /// - This only works in modern browsers (as of June 2025)
198
+ /// - These match ulu.color-tint() and are designed to accept the same arguments with the same results
199
+ /// @param {Color, String} $color Color or custom property to apply mix to
200
+ /// @param {Number} $percentage Percentage
201
+ /// @return {Color}
202
+
203
+ @function css-tint($color, $percentage) {
204
+ @return color-mix(in srgb, get("white") $percentage, get($color) calc(100% - $percentage));
205
+ }
206
+
207
+ /// Shade (add black) a color with the default black by a percentage
187
208
  /// @param {Color, String} $color Color/palette color name to shade
188
209
  /// @param {Number} $percentage Percentage to shade
189
210
  /// @return {Color}
@@ -194,6 +215,17 @@ $color-classes: (
194
215
  @return color.mix(get("black"), get($color), $percentage);
195
216
  }
196
217
 
218
+ /// Shade (add black) a color using the default white by a percentage (Using color-mix)
219
+ /// - This only works in modern browsers (as of June 2025)
220
+ /// - These match ulu.color-shade() and are designed to accept the same arguments with the same results
221
+ /// @param {Color, String} $color Color or custom property to apply mix to
222
+ /// @param {Number} $percentage Percentage
223
+ /// @return {Color}
224
+
225
+ @function css-shade($color, $percentage) {
226
+ @return color-mix(in srgb, get("black") $percentage, get($color) calc(100% - $percentage));
227
+ }
228
+
197
229
  /// Prints all context styles
198
230
  /// @param {String} $with-prop Checks the specific context for a certain prop (has to be truthy)(used for output in helper/base color modules)
199
231
  /// @example scss