@ulu/frontend 0.1.0-beta.9 → 0.1.0-beta.90

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 (316) hide show
  1. package/CHANGELOG.md +606 -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 +6985 -0
  12. package/docs-dev/demos/accordion/index.html +1126 -334
  13. package/docs-dev/demos/badge/index.html +5535 -0
  14. package/docs-dev/demos/basic-hero/index.html +111 -0
  15. package/docs-dev/demos/breakpoints-manager/index.html +5546 -0
  16. package/docs-dev/demos/button/index.html +1172 -338
  17. package/docs-dev/demos/button-group/index.html +5532 -0
  18. package/docs-dev/demos/button-verbose/index.html +5538 -0
  19. package/docs-dev/demos/callout/index.html +1177 -344
  20. package/docs-dev/demos/captioned-figure/index.html +1120 -327
  21. package/docs-dev/demos/card/index.html +1186 -754
  22. package/docs-dev/demos/card-grid/index.html +5657 -0
  23. package/docs-dev/demos/counter-list/index.html +5540 -0
  24. package/docs-dev/demos/css-icons/index.html +1148 -332
  25. package/docs-dev/demos/data-grid/index.html +1120 -327
  26. package/docs-dev/demos/data-table/index.html +1298 -372
  27. package/docs-dev/demos/details-group/index.html +5567 -0
  28. package/docs-dev/demos/file-save/index.html +1120 -327
  29. package/docs-dev/demos/flipcard/index.html +1120 -327
  30. package/docs-dev/demos/form-theme/index.html +1144 -364
  31. package/docs-dev/demos/headline-label/index.html +5502 -0
  32. package/docs-dev/demos/hero/index.html +12 -4
  33. package/docs-dev/demos/image-grid/index.html +12 -4
  34. package/docs-dev/demos/index.html +1121 -328
  35. package/docs-dev/demos/list-inline/index.html +1120 -327
  36. package/docs-dev/demos/list-lines/index.html +1120 -327
  37. package/docs-dev/demos/menu-stack/index.html +1159 -351
  38. package/docs-dev/demos/modals/index.html +1259 -343
  39. package/docs-dev/demos/nav-strip/index.html +1120 -327
  40. package/docs-dev/demos/overlay-section/index.html +1205 -342
  41. package/docs-dev/demos/panel/index.html +5562 -0
  42. package/docs-dev/demos/popovers/index.html +1368 -333
  43. package/docs-dev/demos/print/index.html +1120 -327
  44. package/docs-dev/demos/pull-quote/index.html +1120 -327
  45. package/docs-dev/demos/rail/index.html +5598 -0
  46. package/docs-dev/demos/rule/index.html +1137 -332
  47. package/docs-dev/demos/scroll-slider/index.html +72 -106
  48. package/docs-dev/demos/scrollpoints/index.html +1121 -328
  49. package/docs-dev/demos/slider/index.html +12 -4
  50. package/docs-dev/demos/spoke-spinner/index.html +1120 -327
  51. package/docs-dev/demos/{list-inline.1 → sticky-list}/index.html +1159 -363
  52. package/docs-dev/demos/tabs/index.html +1156 -327
  53. package/docs-dev/demos/tag/index.html +1120 -327
  54. package/docs-dev/demos/theme-toggle/index.html +5579 -0
  55. package/docs-dev/demos/tile-grid-overlay/index.html +12 -4
  56. package/docs-dev/demos/tiles/index.html +1120 -327
  57. package/docs-dev/demos/tooltip/index.html +1120 -327
  58. package/docs-dev/demos/wysiwyg/index.html +5552 -0
  59. package/docs-dev/guide/building-stylesheet/index.html +1120 -327
  60. package/docs-dev/guide/developing-ulu-scss-module/index.html +1120 -327
  61. package/docs-dev/guide/index.html +1120 -327
  62. package/docs-dev/index.html +1120 -327
  63. package/docs-dev/javascript/events/index.html +1158 -327
  64. package/docs-dev/javascript/index.html +1120 -327
  65. package/docs-dev/javascript/settings/index.html +5705 -0
  66. package/docs-dev/javascript/ui-breakpoints/index.html +1134 -343
  67. package/docs-dev/javascript/ui-collapsible/index.html +1119 -328
  68. package/docs-dev/javascript/ui-details-group/index.html +5622 -0
  69. package/docs-dev/javascript/ui-dialog/index.html +1151 -345
  70. package/docs-dev/javascript/ui-flipcard/index.html +1180 -333
  71. package/docs-dev/javascript/ui-grid/index.html +1130 -365
  72. package/docs-dev/javascript/ui-modal-builder/index.html +1303 -372
  73. package/docs-dev/javascript/ui-overflow-scroller/index.html +1119 -328
  74. package/docs-dev/javascript/ui-overflow-scroller-pager/index.html +1119 -328
  75. package/docs-dev/javascript/ui-page/index.html +1119 -328
  76. package/docs-dev/javascript/ui-popover/index.html +1129 -342
  77. package/docs-dev/javascript/ui-print/index.html +1117 -334
  78. package/docs-dev/javascript/ui-print-details/index.html +1119 -328
  79. package/docs-dev/javascript/ui-programmatic-modal/index.html +1119 -328
  80. package/docs-dev/javascript/ui-proxy-click/index.html +1208 -332
  81. package/docs-dev/javascript/ui-resizer/index.html +1400 -344
  82. package/docs-dev/javascript/ui-scroll-slider/index.html +1159 -336
  83. package/docs-dev/javascript/ui-scrollpoint/index.html +1129 -345
  84. package/docs-dev/javascript/ui-slider/index.html +1317 -335
  85. package/docs-dev/javascript/ui-tabs/index.html +1138 -384
  86. package/docs-dev/javascript/ui-theme-toggle/index.html +5710 -0
  87. package/docs-dev/javascript/ui-tooltip/index.html +1136 -349
  88. package/docs-dev/javascript/utils-class-logger/index.html +1120 -329
  89. package/docs-dev/javascript/utils-css/index.html +5524 -0
  90. package/docs-dev/javascript/utils-dom/index.html +1153 -442
  91. package/docs-dev/javascript/utils-file-save/index.html +1119 -328
  92. package/docs-dev/javascript/utils-floating-ui/index.html +1119 -328
  93. package/docs-dev/javascript/utils-id/index.html +1119 -328
  94. package/docs-dev/javascript/utils-pause-youtube-video/index.html +1119 -328
  95. package/docs-dev/javascript/utils-system/index.html +5827 -0
  96. package/docs-dev/sass/base/color/index.html +1119 -328
  97. package/docs-dev/sass/base/elements/index.html +1127 -336
  98. package/docs-dev/sass/base/index/index.html +1119 -328
  99. package/docs-dev/sass/base/index.html +1120 -327
  100. package/docs-dev/sass/base/keyframes/index.html +1120 -329
  101. package/docs-dev/sass/base/layout/index.html +1119 -328
  102. package/docs-dev/sass/base/normalize/index.html +1119 -328
  103. package/docs-dev/sass/base/print/index.html +1119 -328
  104. package/docs-dev/sass/base/root/index.html +1119 -328
  105. package/docs-dev/sass/base/typography/index.html +1119 -328
  106. package/docs-dev/sass/components/accordion/index.html +1142 -344
  107. package/docs-dev/sass/components/adaptive-spacing/index.html +1119 -328
  108. package/docs-dev/sass/components/badge/index.html +1145 -343
  109. package/docs-dev/sass/components/basic-hero/index.html +5685 -0
  110. package/docs-dev/sass/components/button/index.html +1119 -328
  111. package/docs-dev/sass/components/button-group/index.html +5683 -0
  112. package/docs-dev/sass/components/button-verbose/index.html +1205 -339
  113. package/docs-dev/sass/components/callout/index.html +1224 -414
  114. package/docs-dev/sass/components/captioned-figure/index.html +1243 -337
  115. package/docs-dev/sass/components/card/index.html +1215 -352
  116. package/docs-dev/sass/components/card-grid/index.html +1119 -328
  117. package/docs-dev/sass/components/counter-list/index.html +5767 -0
  118. package/docs-dev/sass/components/css-icon/index.html +1140 -342
  119. package/docs-dev/sass/components/data-grid/index.html +1139 -341
  120. package/docs-dev/sass/components/data-table/index.html +1327 -346
  121. package/docs-dev/sass/components/fill-context/index.html +1119 -328
  122. package/docs-dev/sass/components/flipcard/index.html +1161 -339
  123. package/docs-dev/sass/components/flipcard-grid/index.html +1119 -328
  124. package/docs-dev/sass/components/form-theme/index.html +1334 -447
  125. package/docs-dev/sass/components/headline-label/index.html +5713 -0
  126. package/docs-dev/sass/components/hero/index.html +1179 -340
  127. package/docs-dev/sass/components/horizontal-rule/index.html +1119 -328
  128. package/docs-dev/sass/components/image-grid/index.html +1119 -328
  129. package/docs-dev/sass/components/index/index.html +1136 -338
  130. package/docs-dev/sass/components/index.html +1120 -327
  131. package/docs-dev/sass/components/links/index.html +1119 -328
  132. package/docs-dev/sass/components/list-inline/index.html +1119 -328
  133. package/docs-dev/sass/components/list-lines/index.html +1119 -328
  134. package/docs-dev/sass/components/list-ordered/index.html +1119 -328
  135. package/docs-dev/sass/components/list-unordered/index.html +1119 -328
  136. package/docs-dev/sass/components/menu-stack/index.html +1156 -352
  137. package/docs-dev/sass/components/modal/index.html +1173 -347
  138. package/docs-dev/sass/components/nav-strip/index.html +1127 -336
  139. package/docs-dev/sass/components/overlay-section/index.html +1127 -336
  140. package/docs-dev/sass/components/pager/index.html +1119 -328
  141. package/docs-dev/sass/components/panel/index.html +5913 -0
  142. package/docs-dev/sass/components/placeholder-block/index.html +1119 -328
  143. package/docs-dev/sass/components/popover/index.html +1179 -352
  144. package/docs-dev/sass/components/pull-quote/index.html +1131 -340
  145. package/docs-dev/sass/components/rail/index.html +5700 -0
  146. package/docs-dev/sass/components/ratio-box/index.html +1127 -336
  147. package/docs-dev/sass/components/rule/index.html +1120 -329
  148. package/docs-dev/sass/components/scroll-slider/index.html +1129 -350
  149. package/docs-dev/sass/components/skip-link/index.html +1119 -328
  150. package/docs-dev/sass/components/slider/index.html +1173 -394
  151. package/docs-dev/sass/components/spoke-spinner/index.html +1121 -330
  152. package/docs-dev/sass/components/sticky-list/index.html +5903 -0
  153. package/docs-dev/sass/components/table-sticky/index.html +5677 -0
  154. package/docs-dev/sass/components/tabs/index.html +1154 -348
  155. package/docs-dev/sass/components/tag/index.html +1121 -330
  156. package/docs-dev/sass/components/tile-button/index.html +1119 -328
  157. package/docs-dev/sass/components/tile-grid/index.html +1119 -328
  158. package/docs-dev/sass/components/tile-grid-overlay/index.html +1119 -328
  159. package/docs-dev/sass/components/vignette/index.html +1131 -334
  160. package/docs-dev/sass/components/wysiwyg/index.html +1159 -350
  161. package/docs-dev/sass/core/breakpoint/index.html +1212 -369
  162. package/docs-dev/sass/core/button/index.html +1151 -358
  163. package/docs-dev/sass/core/color/index.html +1291 -368
  164. package/docs-dev/sass/core/cssvar/index.html +1119 -328
  165. package/docs-dev/sass/core/element/index.html +1440 -367
  166. package/docs-dev/sass/core/index.html +1119 -328
  167. package/docs-dev/sass/core/layout/index.html +1173 -363
  168. package/docs-dev/sass/core/path/index.html +1119 -328
  169. package/docs-dev/sass/core/selector/index.html +1119 -328
  170. package/docs-dev/sass/core/typography/index.html +1119 -328
  171. package/docs-dev/sass/core/units/index.html +1127 -330
  172. package/docs-dev/sass/core/utils/index.html +2389 -449
  173. package/docs-dev/sass/helpers/color/index.html +1119 -328
  174. package/docs-dev/sass/helpers/display/index.html +1120 -329
  175. package/docs-dev/sass/helpers/index/index.html +1119 -328
  176. package/docs-dev/sass/helpers/index.html +1120 -327
  177. package/docs-dev/sass/helpers/print/index.html +759 -298
  178. package/docs-dev/sass/helpers/typography/index.html +1119 -328
  179. package/docs-dev/sass/helpers/units/index.html +1119 -328
  180. package/docs-dev/sass/helpers/utilities/index.html +1121 -330
  181. package/docs-dev/sass/index.html +1120 -327
  182. package/js/events/index.js +17 -5
  183. package/js/index.js +1 -0
  184. package/js/settings.js +97 -0
  185. package/js/ui/breakpoints.js +19 -16
  186. package/js/ui/collapsible.js +8 -1
  187. package/js/ui/details-group.js +112 -0
  188. package/js/ui/dialog.js +103 -44
  189. package/js/ui/dialog.todo +2 -36
  190. package/js/ui/flipcard.js +37 -57
  191. package/js/ui/grid.js +15 -13
  192. package/js/ui/index.js +1 -0
  193. package/js/ui/modal-builder.js +127 -70
  194. package/js/ui/overflow-scroller.js +6 -4
  195. package/js/ui/page.js +2 -2
  196. package/js/ui/popover.js +38 -38
  197. package/js/ui/print.js +16 -25
  198. package/js/ui/programmatic-modal.js +9 -3
  199. package/js/ui/proxy-click.js +50 -36
  200. package/js/ui/resizer.js +408 -39
  201. package/js/ui/scroll-slider.js +24 -30
  202. package/js/ui/scrollpoint.js +29 -64
  203. package/js/ui/slider.js +108 -63
  204. package/js/ui/tabs.js +23 -36
  205. package/js/ui/theme-toggle.js +332 -94
  206. package/js/ui/tooltip.js +27 -32
  207. package/js/utils/class-logger.js +3 -3
  208. package/js/utils/css.js +13 -0
  209. package/js/utils/dom.js +23 -64
  210. package/js/utils/font-awesome.js +19 -0
  211. package/js/utils/index.js +2 -1
  212. package/js/utils/system.js +155 -0
  213. package/package.json +23 -8
  214. package/scss/README.md +4 -0
  215. package/scss/_breakpoint.scss +39 -5
  216. package/scss/_button.scss +7 -5
  217. package/scss/_color.scss +40 -9
  218. package/scss/_element.scss +124 -2
  219. package/scss/_layout.scss +7 -8
  220. package/scss/_units.scss +3 -2
  221. package/scss/_utils.scss +387 -16
  222. package/scss/base/_elements.scss +0 -1
  223. package/scss/base/_keyframes.scss +10 -0
  224. package/scss/base/_layout.scss +1 -0
  225. package/scss/base/_print.scss +2 -0
  226. package/scss/base/_root.scss +2 -0
  227. package/scss/components/README.todos +14 -0
  228. package/scss/components/_accordion.scss +33 -19
  229. package/scss/components/_badge.scss +23 -4
  230. package/scss/components/_basic-hero.scss +112 -0
  231. package/scss/components/_button-group.scss +90 -0
  232. package/scss/components/_button-verbose.scss +100 -18
  233. package/scss/components/_callout.scss +125 -78
  234. package/scss/components/_captioned-figure.scss +17 -0
  235. package/scss/components/_card-grid.scss +1 -1
  236. package/scss/components/_card.scss +228 -66
  237. package/scss/components/_counter-list.scss +151 -0
  238. package/scss/components/_css-icon.scss +35 -21
  239. package/scss/components/_data-grid.scss +55 -12
  240. package/scss/components/_data-table.scss +39 -3
  241. package/scss/components/_flipcard.scss +8 -3
  242. package/scss/components/_form-theme.scss +119 -108
  243. package/scss/components/_headline-label.scss +83 -0
  244. package/scss/components/_hero.scss +12 -10
  245. package/scss/components/_index.scss +42 -0
  246. package/scss/components/_menu-stack.scss +42 -26
  247. package/scss/components/_modal.scss +58 -29
  248. package/scss/components/_nav-strip.scss +2 -0
  249. package/scss/components/_overlay-section.scss +2 -5
  250. package/scss/components/_panel.scss +246 -0
  251. package/scss/components/_popover.scss +165 -64
  252. package/scss/components/_pull-quote.scss +13 -13
  253. package/scss/components/_rail.scss +120 -0
  254. package/scss/components/_ratio-box.scss +2 -5
  255. package/scss/components/_rule.scss +1 -0
  256. package/scss/components/_scroll-slider.scss +1 -5
  257. package/scss/components/_slider.scss +49 -72
  258. package/scss/components/_spoke-spinner.scss +2 -2
  259. package/scss/components/_sticky-list.scss +206 -0
  260. package/scss/components/_tabs.scss +22 -4
  261. package/scss/components/_vignette.scss +3 -5
  262. package/scss/components/_wysiwyg.scss +21 -13
  263. package/scss/helpers/_display.scss +15 -18
  264. package/scss/helpers/_print.scss +12 -7
  265. package/scss/helpers/_utilities.scss +42 -32
  266. package/types/events/index.d.ts +10 -1
  267. package/types/events/index.d.ts.map +1 -1
  268. package/types/index.d.ts +1 -0
  269. package/types/settings.d.ts +70 -0
  270. package/types/settings.d.ts.map +1 -0
  271. package/types/ui/breakpoints.d.ts +14 -14
  272. package/types/ui/breakpoints.d.ts.map +1 -1
  273. package/types/ui/collapsible.d.ts.map +1 -1
  274. package/types/ui/details-group.d.ts +38 -0
  275. package/types/ui/details-group.d.ts.map +1 -0
  276. package/types/ui/dialog.d.ts +20 -14
  277. package/types/ui/dialog.d.ts.map +1 -1
  278. package/types/ui/flipcard.d.ts +16 -10
  279. package/types/ui/flipcard.d.ts.map +1 -1
  280. package/types/ui/grid.d.ts +4 -6
  281. package/types/ui/grid.d.ts.map +1 -1
  282. package/types/ui/index.d.ts +2 -1
  283. package/types/ui/modal-builder.d.ts +116 -11
  284. package/types/ui/modal-builder.d.ts.map +1 -1
  285. package/types/ui/overflow-scroller.d.ts +2 -2
  286. package/types/ui/overflow-scroller.d.ts.map +1 -1
  287. package/types/ui/popover.d.ts +6 -7
  288. package/types/ui/popover.d.ts.map +1 -1
  289. package/types/ui/print.d.ts +0 -4
  290. package/types/ui/print.d.ts.map +1 -1
  291. package/types/ui/programmatic-modal.d.ts.map +1 -1
  292. package/types/ui/proxy-click.d.ts +19 -3
  293. package/types/ui/proxy-click.d.ts.map +1 -1
  294. package/types/ui/resizer.d.ts +116 -16
  295. package/types/ui/resizer.d.ts.map +1 -1
  296. package/types/ui/scroll-slider.d.ts +5 -7
  297. package/types/ui/scroll-slider.d.ts.map +1 -1
  298. package/types/ui/scrollpoint.d.ts +3 -8
  299. package/types/ui/scrollpoint.d.ts.map +1 -1
  300. package/types/ui/slider.d.ts +33 -14
  301. package/types/ui/slider.d.ts.map +1 -1
  302. package/types/ui/tabs.d.ts +6 -8
  303. package/types/ui/tabs.d.ts.map +1 -1
  304. package/types/ui/theme-toggle.d.ts +51 -7
  305. package/types/ui/theme-toggle.d.ts.map +1 -1
  306. package/types/ui/tooltip.d.ts +3 -5
  307. package/types/ui/tooltip.d.ts.map +1 -1
  308. package/types/utils/css.d.ts +11 -0
  309. package/types/utils/css.d.ts.map +1 -0
  310. package/types/utils/dom.d.ts +12 -32
  311. package/types/utils/dom.d.ts.map +1 -1
  312. package/types/utils/font-awesome.d.ts +5 -0
  313. package/types/utils/font-awesome.d.ts.map +1 -0
  314. package/types/utils/index.d.ts +2 -1
  315. package/types/utils/system.d.ts +113 -0
  316. 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.9",
4
- "description": "Modular Sass Theming Library",
3
+ "version": "0.1.0-beta.90",
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
@@ -41,6 +41,10 @@
41
41
  - Should be written from the user's point of view
42
42
  - 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
43
 
44
+ #### Workaround for syntax highlighting bug
45
+
46
+ If the syntax highlighting isn't working properly after an example, add an empty line with `///` to workaround that bug
47
+
44
48
  ### Ideas
45
49
 
46
50
  - 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
@@ -23,11 +23,17 @@ $palette: (
23
23
  "type-tertiary" : rgb(157, 157, 157),
24
24
  "headline" : inherit,
25
25
  "background" : white,
26
- "background-gray" : #F7F8F7,
26
+ "background-gray" : #fafafa,
27
27
  "focus" : blue,
28
- "error" : red,
29
- "warning" : orange,
30
28
  "accent" : orange,
29
+ "info" : #00bde3,
30
+ "success" : #00a91c,
31
+ "warning" : #ffbe2e,
32
+ "danger" : #d54309,
33
+ "info-background" : #e7f6f8,
34
+ "success-background" : #ecf3ec,
35
+ "warning-background" : #faf3d1,
36
+ "danger-background" : #f4e3db,
31
37
  "selected" : green,
32
38
  "box-shadow" : rgba(0, 0, 0, 0.349),
33
39
  "box-shadow-hover" : rgba(0, 0, 0, 0.5),
@@ -40,10 +46,10 @@ $palette: (
40
46
  "bullet" : inherit,
41
47
  "control" : white,
42
48
  "control-hover" : white,
43
- "control-active" : white,
49
+ "control-active" : white,
44
50
  "control-border" : purple,
45
- "control-border-hover" : blue,
46
- "control-border-active" : orange,
51
+ "control-border-hover" : blue,
52
+ "control-border-active" : orange,
47
53
  "control-background" : purple,
48
54
  "control-background-hover": blue,
49
55
  "control-background-active": orange,
@@ -95,8 +101,11 @@ $color-classes: (
95
101
  @function get($name) {
96
102
  // Allow non lookup if the value is already a color (helps with code flow)
97
103
  @if (meta.type-of($name) == "string") {
104
+ $is-keyword: $name == "inherit" or $name == "transparent" or $name == "currentColor";
105
+ $is-cssvar: string.index($name, "var(") == 1;
106
+ $is-color-mix: string.index($name, "color-mix(") == 1;
98
107
  // 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) {
108
+ @if ($is-keyword or $is-cssvar or $is-color-mix) {
100
109
  @return $name;
101
110
  // Else look up the color from the palette
102
111
  } @else {
@@ -172,7 +181,7 @@ $color-classes: (
172
181
  color: get-context-value($name, "color");
173
182
  }
174
183
 
175
- /// Lighten a color using the default white by a percentage
184
+ /// Tint (add white) a color using the default white by a percentage
176
185
  /// @param {Color, String} $color Color/palette color name to apply to tint
177
186
  /// @param {Number} $percentage Percentage
178
187
  /// @return {Color}
@@ -183,7 +192,18 @@ $color-classes: (
183
192
  @return color.mix(get("white"), get($color), $percentage);
184
193
  }
185
194
 
186
- /// Darken a color with the default black by a percentage
195
+ /// Tint (add white) a color using the default white by a percentage (Using color-mix)
196
+ /// - This only works in modern browsers (as of June 2025)
197
+ /// - These match ulu.color-tint() and are designed to accept the same arguments with the same results
198
+ /// @param {Color, String} $color Color or custom property to apply mix to
199
+ /// @param {Number} $percentage Percentage
200
+ /// @return {Color}
201
+
202
+ @function css-tint($color, $percentage) {
203
+ @return color-mix(in srgb, get("white") $percentage, get($color) calc(100% - $percentage));
204
+ }
205
+
206
+ /// Shade (add black) a color with the default black by a percentage
187
207
  /// @param {Color, String} $color Color/palette color name to shade
188
208
  /// @param {Number} $percentage Percentage to shade
189
209
  /// @return {Color}
@@ -194,6 +214,17 @@ $color-classes: (
194
214
  @return color.mix(get("black"), get($color), $percentage);
195
215
  }
196
216
 
217
+ /// Shade (add black) a color using the default white by a percentage (Using color-mix)
218
+ /// - This only works in modern browsers (as of June 2025)
219
+ /// - These match ulu.color-shade() and are designed to accept the same arguments with the same results
220
+ /// @param {Color, String} $color Color or custom property to apply mix to
221
+ /// @param {Number} $percentage Percentage
222
+ /// @return {Color}
223
+
224
+ @function css-shade($color, $percentage) {
225
+ @return color-mix(in srgb, get("black") $percentage, get($color) calc(100% - $percentage));
226
+ }
227
+
197
228
  /// Prints all context styles
198
229
  /// @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
230
  /// @example scss