@ulu/frontend 0.1.0-beta.8 → 0.1.0-beta.81

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 (294) hide show
  1. package/CHANGELOG.md +544 -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 +34 -27
  6. package/docs-dev/assets/main.js +8290 -635
  7. package/docs-dev/assets/placeholder/icon-calendar.svg +1 -0
  8. package/docs-dev/assets/placeholder/icon-check.svg +1 -0
  9. package/docs-dev/assets/style.css +789 -338
  10. package/docs-dev/changelog/index.html +6593 -0
  11. package/docs-dev/demos/accordion/index.html +850 -328
  12. package/docs-dev/demos/badge/index.html +5265 -0
  13. package/docs-dev/demos/basic-hero/index.html +111 -0
  14. package/docs-dev/demos/breakpoints-manager/index.html +5276 -0
  15. package/docs-dev/demos/button/index.html +892 -328
  16. package/docs-dev/demos/button-verbose/index.html +5268 -0
  17. package/docs-dev/demos/callout/index.html +895 -332
  18. package/docs-dev/demos/captioned-figure/index.html +850 -327
  19. package/docs-dev/demos/card/index.html +930 -768
  20. package/docs-dev/demos/card-grid/index.html +5387 -0
  21. package/docs-dev/demos/counter-list/index.html +5270 -0
  22. package/docs-dev/demos/css-icons/index.html +873 -327
  23. package/docs-dev/demos/data-grid/index.html +870 -347
  24. package/docs-dev/demos/data-table/index.html +1024 -368
  25. package/docs-dev/demos/details-group/index.html +5297 -0
  26. package/docs-dev/demos/file-save/index.html +850 -327
  27. package/docs-dev/demos/flipcard/index.html +850 -327
  28. package/docs-dev/demos/form-theme/index.html +868 -358
  29. package/docs-dev/demos/hero/index.html +12 -4
  30. package/docs-dev/demos/image-grid/index.html +12 -4
  31. package/docs-dev/demos/index.html +851 -328
  32. package/docs-dev/demos/list-inline/index.html +850 -327
  33. package/docs-dev/demos/list-lines/index.html +850 -327
  34. package/docs-dev/demos/menu-stack/index.html +884 -346
  35. package/docs-dev/demos/modals/index.html +977 -331
  36. package/docs-dev/demos/nav-strip/index.html +850 -327
  37. package/docs-dev/demos/overlay-section/index.html +939 -346
  38. package/docs-dev/demos/popovers/index.html +1112 -347
  39. package/docs-dev/demos/print/index.html +850 -327
  40. package/docs-dev/demos/pull-quote/index.html +850 -327
  41. package/docs-dev/demos/rule/index.html +863 -328
  42. package/docs-dev/demos/scroll-slider/index.html +72 -106
  43. package/docs-dev/demos/scrollpoints/index.html +851 -328
  44. package/docs-dev/demos/slider/index.html +12 -4
  45. package/docs-dev/demos/spoke-spinner/index.html +850 -327
  46. package/docs-dev/demos/{list-inline.1 → sticky-list}/index.html +883 -357
  47. package/docs-dev/demos/tabs/index.html +886 -327
  48. package/docs-dev/demos/tag/index.html +850 -327
  49. package/docs-dev/demos/theme-toggle/index.html +5309 -0
  50. package/docs-dev/demos/tile-grid-overlay/index.html +12 -4
  51. package/docs-dev/demos/tiles/index.html +850 -327
  52. package/docs-dev/demos/tooltip/index.html +850 -327
  53. package/docs-dev/guide/building-stylesheet/index.html +850 -327
  54. package/docs-dev/guide/developing-ulu-scss-module/index.html +850 -327
  55. package/docs-dev/guide/index.html +850 -327
  56. package/docs-dev/index.html +850 -327
  57. package/docs-dev/javascript/events/index.html +888 -327
  58. package/docs-dev/javascript/index.html +850 -327
  59. package/docs-dev/javascript/settings/index.html +5435 -0
  60. package/docs-dev/javascript/ui-breakpoints/index.html +862 -341
  61. package/docs-dev/javascript/ui-collapsible/index.html +847 -326
  62. package/docs-dev/javascript/ui-details-group/index.html +5352 -0
  63. package/docs-dev/javascript/ui-dialog/index.html +879 -343
  64. package/docs-dev/javascript/ui-flipcard/index.html +908 -331
  65. package/docs-dev/javascript/ui-grid/index.html +857 -362
  66. package/docs-dev/javascript/ui-modal-builder/index.html +1047 -386
  67. package/docs-dev/javascript/ui-overflow-scroller/index.html +847 -326
  68. package/docs-dev/javascript/ui-overflow-scroller-pager/index.html +847 -326
  69. package/docs-dev/javascript/ui-page/index.html +847 -326
  70. package/docs-dev/javascript/ui-popover/index.html +855 -338
  71. package/docs-dev/javascript/ui-print/index.html +847 -334
  72. package/docs-dev/javascript/ui-print-details/index.html +847 -326
  73. package/docs-dev/javascript/ui-programmatic-modal/index.html +847 -326
  74. package/docs-dev/javascript/ui-proxy-click/index.html +934 -328
  75. package/docs-dev/javascript/ui-resizer/index.html +926 -336
  76. package/docs-dev/javascript/ui-scroll-slider/index.html +885 -332
  77. package/docs-dev/javascript/ui-scrollpoint/index.html +853 -339
  78. package/docs-dev/javascript/ui-slider/index.html +1043 -331
  79. package/docs-dev/javascript/ui-tabs/index.html +858 -374
  80. package/docs-dev/javascript/ui-theme-toggle/index.html +5440 -0
  81. package/docs-dev/javascript/ui-tooltip/index.html +854 -337
  82. package/docs-dev/javascript/utils-class-logger/index.html +848 -327
  83. package/docs-dev/javascript/utils-css/index.html +5254 -0
  84. package/docs-dev/javascript/utils-dom/index.html +887 -446
  85. package/docs-dev/javascript/utils-file-save/index.html +847 -326
  86. package/docs-dev/javascript/utils-floating-ui/index.html +847 -326
  87. package/docs-dev/javascript/utils-id/index.html +847 -326
  88. package/docs-dev/javascript/utils-pause-youtube-video/index.html +847 -326
  89. package/docs-dev/javascript/utils-system/index.html +5557 -0
  90. package/docs-dev/sass/base/color/index.html +847 -326
  91. package/docs-dev/sass/base/elements/index.html +847 -326
  92. package/docs-dev/sass/base/index/index.html +847 -326
  93. package/docs-dev/sass/base/index.html +850 -327
  94. package/docs-dev/sass/base/keyframes/index.html +847 -326
  95. package/docs-dev/sass/base/layout/index.html +847 -326
  96. package/docs-dev/sass/base/normalize/index.html +847 -326
  97. package/docs-dev/sass/base/print/index.html +847 -326
  98. package/docs-dev/sass/base/root/index.html +847 -326
  99. package/docs-dev/sass/base/typography/index.html +847 -326
  100. package/docs-dev/sass/components/accordion/index.html +866 -338
  101. package/docs-dev/sass/components/adaptive-spacing/index.html +847 -326
  102. package/docs-dev/sass/components/badge/index.html +869 -337
  103. package/docs-dev/sass/components/basic-hero/index.html +5415 -0
  104. package/docs-dev/sass/components/button/index.html +847 -326
  105. package/docs-dev/sass/components/button-verbose/index.html +933 -337
  106. package/docs-dev/sass/components/callout/index.html +958 -418
  107. package/docs-dev/sass/components/captioned-figure/index.html +970 -334
  108. package/docs-dev/sass/components/card/index.html +939 -346
  109. package/docs-dev/sass/components/card-grid/index.html +847 -326
  110. package/docs-dev/sass/components/counter-list/index.html +5497 -0
  111. package/docs-dev/sass/components/css-icon/index.html +864 -336
  112. package/docs-dev/sass/components/data-grid/index.html +868 -340
  113. package/docs-dev/sass/components/data-table/index.html +1063 -352
  114. package/docs-dev/sass/components/fill-context/index.html +847 -326
  115. package/docs-dev/sass/components/flipcard/index.html +888 -336
  116. package/docs-dev/sass/components/flipcard-grid/index.html +847 -326
  117. package/docs-dev/sass/components/form-theme/index.html +1063 -446
  118. package/docs-dev/sass/components/hero/index.html +903 -334
  119. package/docs-dev/sass/components/horizontal-rule/index.html +847 -326
  120. package/docs-dev/sass/components/image-grid/index.html +847 -326
  121. package/docs-dev/sass/components/index/index.html +860 -336
  122. package/docs-dev/sass/components/index.html +850 -327
  123. package/docs-dev/sass/components/links/index.html +847 -326
  124. package/docs-dev/sass/components/list-inline/index.html +847 -326
  125. package/docs-dev/sass/components/list-lines/index.html +847 -326
  126. package/docs-dev/sass/components/list-ordered/index.html +847 -326
  127. package/docs-dev/sass/components/list-unordered/index.html +847 -326
  128. package/docs-dev/sass/components/menu-stack/index.html +881 -347
  129. package/docs-dev/sass/components/modal/index.html +898 -342
  130. package/docs-dev/sass/components/nav-strip/index.html +855 -334
  131. package/docs-dev/sass/components/overlay-section/index.html +855 -334
  132. package/docs-dev/sass/components/pager/index.html +847 -326
  133. package/docs-dev/sass/components/placeholder-block/index.html +847 -326
  134. package/docs-dev/sass/components/popover/index.html +904 -347
  135. package/docs-dev/sass/components/pull-quote/index.html +859 -338
  136. package/docs-dev/sass/components/ratio-box/index.html +855 -334
  137. package/docs-dev/sass/components/rule/index.html +848 -327
  138. package/docs-dev/sass/components/scroll-slider/index.html +855 -346
  139. package/docs-dev/sass/components/skip-link/index.html +847 -326
  140. package/docs-dev/sass/components/slider/index.html +897 -388
  141. package/docs-dev/sass/components/spoke-spinner/index.html +849 -328
  142. package/docs-dev/sass/components/sticky-list/index.html +5633 -0
  143. package/docs-dev/sass/components/tabs/index.html +872 -336
  144. package/docs-dev/sass/components/tag/index.html +849 -328
  145. package/docs-dev/sass/components/tile-button/index.html +847 -326
  146. package/docs-dev/sass/components/tile-grid/index.html +847 -326
  147. package/docs-dev/sass/components/tile-grid-overlay/index.html +847 -326
  148. package/docs-dev/sass/components/vignette/index.html +861 -334
  149. package/docs-dev/sass/components/wysiwyg/index.html +847 -326
  150. package/docs-dev/sass/core/breakpoint/index.html +931 -358
  151. package/docs-dev/sass/core/button/index.html +847 -326
  152. package/docs-dev/sass/core/color/index.html +1019 -366
  153. package/docs-dev/sass/core/cssvar/index.html +847 -326
  154. package/docs-dev/sass/core/element/index.html +1108 -381
  155. package/docs-dev/sass/core/index.html +847 -326
  156. package/docs-dev/sass/core/layout/index.html +903 -363
  157. package/docs-dev/sass/core/path/index.html +847 -326
  158. package/docs-dev/sass/core/selector/index.html +847 -326
  159. package/docs-dev/sass/core/typography/index.html +847 -326
  160. package/docs-dev/sass/core/units/index.html +857 -330
  161. package/docs-dev/sass/core/utils/index.html +2104 -476
  162. package/docs-dev/sass/helpers/color/index.html +847 -326
  163. package/docs-dev/sass/helpers/display/index.html +848 -327
  164. package/docs-dev/sass/helpers/index/index.html +847 -326
  165. package/docs-dev/sass/helpers/index.html +850 -327
  166. package/docs-dev/sass/helpers/print/index.html +759 -298
  167. package/docs-dev/sass/helpers/typography/index.html +847 -326
  168. package/docs-dev/sass/helpers/units/index.html +847 -326
  169. package/docs-dev/sass/helpers/utilities/index.html +849 -328
  170. package/docs-dev/sass/index.html +850 -327
  171. package/js/events/index.js +17 -5
  172. package/js/index.js +1 -0
  173. package/js/settings.js +97 -0
  174. package/js/ui/breakpoints.js +19 -16
  175. package/js/ui/collapsible.js +8 -1
  176. package/js/ui/details-group.js +112 -0
  177. package/js/ui/dialog.js +132 -45
  178. package/js/ui/dialog.todo +2 -36
  179. package/js/ui/flipcard.js +37 -57
  180. package/js/ui/grid.js +15 -13
  181. package/js/ui/index.js +1 -0
  182. package/js/ui/modal-builder.js +126 -69
  183. package/js/ui/overflow-scroller.js +6 -4
  184. package/js/ui/page.js +2 -2
  185. package/js/ui/popover.js +38 -38
  186. package/js/ui/print.js +16 -25
  187. package/js/ui/programmatic-modal.js +9 -3
  188. package/js/ui/proxy-click.js +50 -36
  189. package/js/ui/resizer.js +186 -36
  190. package/js/ui/scroll-slider.js +24 -30
  191. package/js/ui/scrollpoint.js +29 -64
  192. package/js/ui/slider.js +108 -63
  193. package/js/ui/tabs.js +23 -36
  194. package/js/ui/theme-toggle.js +332 -94
  195. package/js/ui/tooltip.js +27 -32
  196. package/js/utils/class-logger.js +3 -3
  197. package/js/utils/css.js +13 -0
  198. package/js/utils/dom.js +23 -64
  199. package/js/utils/font-awesome.js +19 -0
  200. package/js/utils/index.js +2 -1
  201. package/js/utils/system.js +155 -0
  202. package/package.json +23 -8
  203. package/scss/README.md +4 -0
  204. package/scss/_breakpoint.scss +38 -4
  205. package/scss/_color.scss +40 -9
  206. package/scss/_element.scss +108 -2
  207. package/scss/_layout.scss +7 -8
  208. package/scss/_units.scss +3 -2
  209. package/scss/_utils.scss +380 -16
  210. package/scss/components/README.todos +14 -0
  211. package/scss/components/_accordion.scss +33 -19
  212. package/scss/components/_badge.scss +23 -4
  213. package/scss/components/_basic-hero.scss +112 -0
  214. package/scss/components/_button-verbose.scss +100 -18
  215. package/scss/components/_callout.scss +125 -78
  216. package/scss/components/_captioned-figure.scss +17 -0
  217. package/scss/components/_card-grid.scss +1 -1
  218. package/scss/components/_card.scss +246 -74
  219. package/scss/components/_counter-list.scss +151 -0
  220. package/scss/components/_css-icon.scss +35 -21
  221. package/scss/components/_data-grid.scss +55 -9
  222. package/scss/components/_data-table.scss +39 -3
  223. package/scss/components/_flipcard.scss +8 -3
  224. package/scss/components/_form-theme.scss +119 -108
  225. package/scss/components/_hero.scss +12 -10
  226. package/scss/components/_index.scss +18 -0
  227. package/scss/components/_menu-stack.scss +42 -26
  228. package/scss/components/_modal.scss +58 -29
  229. package/scss/components/_nav-strip.scss +2 -0
  230. package/scss/components/_overlay-section.scss +2 -5
  231. package/scss/components/_popover.scss +165 -64
  232. package/scss/components/_pull-quote.scss +13 -13
  233. package/scss/components/_ratio-box.scss +2 -5
  234. package/scss/components/_rule.scss +1 -0
  235. package/scss/components/_scroll-slider.scss +1 -5
  236. package/scss/components/_slider.scss +49 -72
  237. package/scss/components/_spoke-spinner.scss +2 -2
  238. package/scss/components/_sticky-list.scss +206 -0
  239. package/scss/components/_tabs.scss +22 -4
  240. package/scss/components/_vignette.scss +3 -5
  241. package/scss/helpers/_display.scss +15 -18
  242. package/scss/helpers/_print.scss +12 -7
  243. package/scss/helpers/_utilities.scss +42 -32
  244. package/types/events/index.d.ts +10 -1
  245. package/types/events/index.d.ts.map +1 -1
  246. package/types/index.d.ts +1 -0
  247. package/types/settings.d.ts +70 -0
  248. package/types/settings.d.ts.map +1 -0
  249. package/types/ui/breakpoints.d.ts +14 -14
  250. package/types/ui/breakpoints.d.ts.map +1 -1
  251. package/types/ui/collapsible.d.ts.map +1 -1
  252. package/types/ui/details-group.d.ts +38 -0
  253. package/types/ui/details-group.d.ts.map +1 -0
  254. package/types/ui/dialog.d.ts +20 -14
  255. package/types/ui/dialog.d.ts.map +1 -1
  256. package/types/ui/flipcard.d.ts +16 -10
  257. package/types/ui/flipcard.d.ts.map +1 -1
  258. package/types/ui/grid.d.ts +4 -6
  259. package/types/ui/grid.d.ts.map +1 -1
  260. package/types/ui/index.d.ts +2 -1
  261. package/types/ui/modal-builder.d.ts +116 -11
  262. package/types/ui/modal-builder.d.ts.map +1 -1
  263. package/types/ui/overflow-scroller.d.ts +2 -2
  264. package/types/ui/overflow-scroller.d.ts.map +1 -1
  265. package/types/ui/popover.d.ts +6 -7
  266. package/types/ui/popover.d.ts.map +1 -1
  267. package/types/ui/print.d.ts +0 -4
  268. package/types/ui/print.d.ts.map +1 -1
  269. package/types/ui/programmatic-modal.d.ts.map +1 -1
  270. package/types/ui/proxy-click.d.ts +19 -3
  271. package/types/ui/proxy-click.d.ts.map +1 -1
  272. package/types/ui/resizer.d.ts +39 -12
  273. package/types/ui/resizer.d.ts.map +1 -1
  274. package/types/ui/scroll-slider.d.ts +5 -7
  275. package/types/ui/scroll-slider.d.ts.map +1 -1
  276. package/types/ui/scrollpoint.d.ts +3 -8
  277. package/types/ui/scrollpoint.d.ts.map +1 -1
  278. package/types/ui/slider.d.ts +33 -14
  279. package/types/ui/slider.d.ts.map +1 -1
  280. package/types/ui/tabs.d.ts +6 -8
  281. package/types/ui/tabs.d.ts.map +1 -1
  282. package/types/ui/theme-toggle.d.ts +51 -7
  283. package/types/ui/theme-toggle.d.ts.map +1 -1
  284. package/types/ui/tooltip.d.ts +3 -5
  285. package/types/ui/tooltip.d.ts.map +1 -1
  286. package/types/utils/css.d.ts +11 -0
  287. package/types/utils/css.d.ts.map +1 -0
  288. package/types/utils/dom.d.ts +12 -32
  289. package/types/utils/dom.d.ts.map +1 -1
  290. package/types/utils/font-awesome.d.ts +5 -0
  291. package/types/utils/font-awesome.d.ts.map +1 -0
  292. package/types/utils/index.d.ts +2 -1
  293. package/types/utils/system.d.ts +113 -0
  294. package/types/utils/system.d.ts.map +1 -0
@@ -69,6 +69,8 @@ $config: (
69
69
  "ul-list-style-type": disc,
70
70
  "ul-list-style-type-2": circle,
71
71
  "ul-list-style-type-3": square,
72
+ "cap-color" : "accent",
73
+ "cap-size" : 5px
72
74
  ) !default;
73
75
 
74
76
  /// Rule style map, redefine defaults or add to
@@ -114,9 +116,10 @@ $rule-margins: (
114
116
 
115
117
  /// Sets rule margins
116
118
  /// @param {Map} $changes Map of changes
119
+ /// @param {String} $merge-mode Merge mode see utils.map-merge() [null|"deep"|"overwrite"]
117
120
 
118
- @mixin set-rule-margins($changes) {
119
- $rule-margins: map.merge($rule-margins, $changes) !global;
121
+ @mixin set-rule-margins($changes, $merge-mode: null) {
122
+ $rule-margins: utils.map-merge($rule-margins, $changes, $merge-mode) !global;
120
123
  }
121
124
 
122
125
  /// Get a rule style
@@ -290,4 +293,107 @@ $rule-margins: (
290
293
  white-space: normal;
291
294
  width: auto;
292
295
  }
296
+ }
297
+
298
+
299
+ /// Layout utility to add a colored bar (cap) to an element's edge, positioned over the element and its border
300
+ /// - You need to set position (relative, fixed) on parent
301
+ /// @param {String} $side The side to place the cap (top, bottom, left, right)
302
+ /// @param {Map} $options Options for the appearance of the cap
303
+ /// @param {Color} $options.color [$config.cap-color] The color for the end cap
304
+ /// @param {Number} $options.size [$config.cap-size] The width/height of the cap
305
+ /// @param {Number} $options.offset [0] A positive number of the amount the cap should extend outside the box (to account for border-width)
306
+ /// @param {Number} $options.border-radius [null] An optional border-radius to apply to the outward-facing edges of the cap (used to match parent)
307
+ /// @param {Boolean} $before [true] Whether or not to use the ::before element (if not uses :after)
308
+
309
+ @mixin cap(
310
+ $side,
311
+ $options: (),
312
+ $before: true,
313
+ ) {
314
+ $defaults: (
315
+ "color" : get("cap-color"),
316
+ "size" : get("cap-size"),
317
+ "offset" : 0,
318
+ "color-hover" : null,
319
+ "border-radius" : null,
320
+ "padding-adjust" : null,
321
+ );
322
+ $config: map.merge($defaults, $options);
323
+ $element: if($before, "::before", "::after");
324
+
325
+ &#{ $element } {
326
+ content: "";
327
+ position: absolute;
328
+ display: block;
329
+ }
330
+
331
+ @include cap-appearance($side, $config, $before);
332
+ }
333
+
334
+
335
+
336
+ /// Provides the appearance styles for a given cap
337
+ /// - If an option is not provided it won't be output
338
+ /// - This is used to update the caps styling (states, modifiers, etc)
339
+ /// @param {String} $side The side to place the cap (top, bottom, left, right)
340
+ /// @param {Map} $options Options for the appearance of the cap (see options from element.cap)
341
+ /// @param {Boolean} $before Whether or not to use the ::before element (if not uses :after)
342
+
343
+ @mixin cap-appearance(
344
+ $side,
345
+ $options: (),
346
+ $before: true
347
+ ) {
348
+ $element: if($before, "::before", "::after");
349
+ $size: map.get($options, "size");
350
+ $offset: map.get($options, "offset");
351
+ $border-radius: map.get($options, "border-radius");
352
+ $padding-adjust: map.get($options, "padding-adjust");
353
+
354
+ $end: $side == "top" or $side == "bottom";
355
+ $position: if($offset, 0 - $offset, null);
356
+
357
+ @if ($padding-adjust and $size) {
358
+ padding-#{ $side }: calc($padding-adjust + $size);
359
+ }
360
+
361
+ &#{ $element } {
362
+ background-color: color.get(map.get($options, "color"));
363
+ #{ $side }: $position;
364
+
365
+ @if $end {
366
+ left: $position;
367
+ right: $position;
368
+ height: $size;
369
+ } @else {
370
+ top: $position;
371
+ bottom: $position;
372
+ width: $size;
373
+ }
374
+
375
+ @if $border-radius {
376
+ @if $end {
377
+ border-#{ $side }-left-radius: $border-radius;
378
+ border-#{ $side }-right-radius: $border-radius;
379
+ } @else {
380
+ border-top-#{ $side }-radius: $border-radius;
381
+ border-bottom-#{ $side }-radius: $border-radius;
382
+ }
383
+ }
384
+ }
385
+ }
386
+
387
+ /// Add backdrop-filter blur
388
+ /// @param {CssUnit} $amount [get("backdrop-blur")] Amount to blur
389
+ ///
390
+ @mixin backdrop-filter-blur($amount: get("backdrop-blur")) {
391
+ backdrop-filter: blur($amount);
392
+ }
393
+
394
+ /// Accessibly hide focus ring while keeping it when it's required
395
+ @mixin focus-ring-required-only() {
396
+ &:focus:not(:focus-visible) {
397
+ outline: none;
398
+ }
293
399
  }
package/scss/_layout.scss CHANGED
@@ -7,6 +7,7 @@
7
7
  @use "sass:meta";
8
8
  @use "utils";
9
9
  @use "breakpoint";
10
+ @use "color";
10
11
 
11
12
  /// Module Settings
12
13
  /// @type Map
@@ -215,10 +216,7 @@ $containers: (
215
216
  $breakpoints: map.get($container, "breakpoints");
216
217
 
217
218
  $width: map.get($container, "width");
218
- // @debug $specific-breakpoint;
219
- // @if $specific-breakpoint {
220
- // @debug $container;
221
- // }
219
+
222
220
  @if ($width == null) {
223
221
  $width: 100%;
224
222
  }
@@ -243,14 +241,14 @@ $containers: (
243
241
  /// Prints clearfix styles
244
242
 
245
243
  @mixin clearfix() {
246
- &:before,
247
- &:after {
244
+ &::before,
245
+ &::after {
248
246
  content: "";
249
247
  display: table;
250
248
  flex-basis: 0; // Flexbox, clear fix for pseudo elements in Safari
251
249
  order: 1;
252
250
  }
253
- &:after {
251
+ &::after {
254
252
  clear: both;
255
253
  }
256
254
  }
@@ -267,6 +265,7 @@ $containers: (
267
265
  /// Layout utility for absolute (zero on all sides)
268
266
  /// - Probably helpful for gzip if we use this when these exact styles are needed
269
267
  /// so they are identical for compression
268
+ /// @param {Boolean} $set-size [false] Whether or not to use sizes to fill the space (height/width 100%) versus setting bottom and right to 0)
270
269
  @mixin absolute-fill($set-size: false) {
271
270
  position: absolute;
272
271
  top: 0;
@@ -278,4 +277,4 @@ $containers: (
278
277
  width: 100%;
279
278
  height: 100%;
280
279
  }
281
- }
280
+ }
package/scss/_units.scss CHANGED
@@ -27,13 +27,14 @@ $config: (
27
27
 
28
28
  /// Update the units config
29
29
  /// @param {Map} $changes A map to merge into the color palette
30
+ /// @param {String} $merge-mode Merge mode see utils.map-merge() [null|"deep"|"overwrite"]
30
31
  /// @example scss Setting the error and type color
31
32
  /// @include ulu.units-set((
32
33
  /// "default" : 1.5em
33
34
  /// ));
34
35
 
35
- @mixin set($changes) {
36
- $config: map.merge($config, $changes) !global;
36
+ @mixin set($changes, $merge-mode: null) {
37
+ $config: utils.map-merge($config, $changes, $merge-mode) !global;
37
38
  }
38
39
 
39
40
  /// Get a unit by name (preset) or number (multiplier of base)
package/scss/_utils.scss CHANGED
@@ -20,7 +20,7 @@ $config: (
20
20
  "debug-maps": true,
21
21
  "file-header-comments": true,
22
22
  "responsive-change": 0.5vw,
23
- "pixel-em-base" : 16px
23
+ "pixel-em-base" : 16px,
24
24
  ) !default;
25
25
 
26
26
  /// Change modules $config
@@ -34,8 +34,11 @@ $config: (
34
34
 
35
35
  /// Get a config option
36
36
  /// @param {Map} $name Name of property
37
- /// @example scss - General example
38
- /// @include ulu.utils-get("property");
37
+ /// @example scss {compile} Example usage
38
+ /// .test-em-to-pixel {
39
+ /// width: ulu.utils-get("pixel-em-base");
40
+ /// }
41
+ /// @return {Dimension}
39
42
 
40
43
  @function get($name) {
41
44
  @return require-map-get($config, $name, 'utils');
@@ -46,6 +49,11 @@ $config: (
46
49
  /// @param {Map} $map The map to get the value from
47
50
  /// @param {String} $key The key in the map to get value from
48
51
  /// @param {String} $context The context of using this function for debugging help
52
+ /// @example scss {compile} Example usage
53
+ /// .test-require-map {
54
+ /// $test-map: ("test-font-size": 12px);
55
+ /// font-size: ulu.utils-require-map-get($test-map, "test-font-size");
56
+ /// }
49
57
  /// @return {*} The value from the map
50
58
 
51
59
  @function require-map-get($map, $key, $context: "unknown") {
@@ -93,6 +101,21 @@ $config: (
93
101
  /// Returns true if we should include something (map of booleans)
94
102
  /// @param {String} $name Name of item to see if it's included
95
103
  /// @param {Map} $includes Map of includes
104
+ /// @example scss {compile} Example usage
105
+ /// $include-styles : (
106
+ /// "h2" : true,
107
+ /// "h3" : false
108
+ /// );
109
+ /// @if(ulu.utils-included("h2", $include-styles)) {
110
+ /// h2 {
111
+ /// font-size: 24px;
112
+ /// }
113
+ /// }
114
+ /// @if(ulu.utils-included("h3", $include-styles)) {
115
+ /// h3 {
116
+ /// font-size: 18px;
117
+ /// }
118
+ /// }
96
119
 
97
120
  @function included($name, $includes) {
98
121
  $value: map.get($includes, $name);
@@ -113,10 +136,21 @@ $config: (
113
136
  }
114
137
  }
115
138
 
116
- // Provide a default when value type is not correct
139
+ /// Provide a default when value type is not correct
117
140
  /// @param {String} $type type of value it should be
118
141
  /// @param {String} $value the value to provide if it is that type
119
142
  /// @param {String} $fallback the fallback value
143
+ /// @example scss {compile} Example usage
144
+ /// $user-accent-color: #FE5F55;
145
+ /// $user-error-color: "##C6ECAE";
146
+ /// $default-color: #777DA7;
147
+ /// .accent-color {
148
+ /// background-color: ulu.utils-if-type("color", $user-accent-color, $default-color);
149
+ /// }
150
+ /// .error-color {
151
+ /// background-color: ulu.utils-if-type("color", $user-error-color, $default-color);
152
+ /// }
153
+ /// @return {CssValue} Returns the value or the fallback.
120
154
 
121
155
  @function if-type($type, $value, $fallback) {
122
156
  @if meta.type-of($value) == $type {
@@ -126,31 +160,112 @@ $config: (
126
160
  }
127
161
  }
128
162
 
129
- // Returns number unit info, and strips the unit
163
+ /// Returns number unit info, and strips the unit
130
164
  /// @param {String} $number Number to get meta info for
131
- /// @return {Map} With properties (unit, value)
165
+ /// @return {Map} With properties (unit, value, invalid [true/false if not number])
166
+ /// @example scss {compile} Example usage
167
+ /// $size-info: ulu.utils-number-info(24px);
168
+ /// $size-info-invalid: ulu.utils-number-info("Twenty Four Pixels");
169
+ /// .number-info-result {
170
+ /// content: meta.inspect($size-info);
171
+ /// }
172
+ /// .number-info-invalid-result {
173
+ /// content: meta.inspect($size-info-invalid);
174
+ /// }
175
+ ///
132
176
 
133
- @function number-info($number) {
134
- $is-number: meta.type-of($number) != 'number';
135
- $is-unitless: math.is-unitless($number);
136
- @if ($is-unitless or not $is-number) {
177
+ @function number-info($number, $errors: false) {
178
+
179
+ @if (meta.type-of($number) == 'number') {
180
+ $is-unitless: math.is-unitless($number);
137
181
  @return (
138
- "unit": null,
139
- "value": $number
182
+ "unit": if($is-unitless, null, math.unit($number)),
183
+ "value": if($is-unitless, $number, strip-unit($number)),
184
+ "invalid" : false
140
185
  );
186
+
141
187
  } @else {
188
+ @if ($errors) {
189
+ @error "Expected Number, got #{ meta.type-of($number) } for #{ $number }";
190
+ }
142
191
  @return (
143
- "unit" : math.unit($value),
144
- "value": math.div($number, ($number * 0 + 1))
192
+ "unit": null,
193
+ "value": $number,
194
+ "invalid" : true
145
195
  );
146
196
  }
147
197
  }
148
198
 
199
+ /// Adds unit to unitless number
200
+ /// @param {Number} $number The unitless number to add unit to
201
+ /// @param {String} $unit The unit to add to number
202
+ /// @return {String} Number with unit attached (can't be used in maths)
203
+ /// @example scss {compile} Example usage
204
+ /// $number: 12;
205
+ /// $unit: "px";
206
+ /// $number-with-unit: ulu.utils-add-unit($number, $unit);
207
+ /// .add-unit-result {
208
+ /// content: $number-with-unit;
209
+ /// }
210
+ ///
211
+
212
+ @function add-unit($number, $unit) {
213
+ @return $number + string.unquote($unit);
214
+ }
215
+
216
+ /// Checks if two numbers are the same unit
217
+ /// @param {Number} $number
218
+ /// @param {String} $other-number
219
+ /// @return {Boolean} Whether they have the same unit type
220
+ /// Could be made into multiple arguments in future if needed
221
+ /// @example scss {compile} Example usage
222
+ /// $number-1: 12px;
223
+ /// $number-2: 12px;
224
+ /// $number-3: 12rem;
225
+ /// .positive-result {
226
+ /// content: ulu.utils-units-match($number-1, $number-2);
227
+ /// }
228
+ /// .negative-result {
229
+ /// content: ulu.utils-units-match($number-1, $number-3);
230
+ /// }
231
+ ///
232
+
233
+ @function units-match($number, $other-number) {
234
+ @return math.unit($number) == math.unit($other-number);
235
+ }
236
+
149
237
  /// Reusable merge method
150
238
  /// @param {Map} $original Source map
151
239
  /// @param {Map} $changes Changes to merge into source map
152
240
  /// @param {String} $mode How to merge changes (merge [defualt], deep, or overwrite)
153
- /// @return {Map} New map with changes
241
+ /// @example scss {compile} Example usage
242
+ /// $map-1: (
243
+ /// "inner-map" : (
244
+ /// "color" : "green",
245
+ /// "secondary-color" : "green"
246
+ /// ),
247
+ /// "color" : "green",
248
+ /// "secondary-color" : "green"
249
+ /// );
250
+ /// $map-2: (
251
+ /// "inner-map" : (
252
+ /// "color" : "red"
253
+ /// ),
254
+ /// "color" : "red",
255
+ /// );
256
+ /// .result-default {
257
+ /// $merged-map: ulu.utils-map-merge($map-1, $map-2);
258
+ /// content: meta.inspect($merged-map);
259
+ /// }
260
+ /// .result-deep {
261
+ /// $merged-map-deep: ulu.utils-map-merge($map-1, $map-2, "deep");
262
+ /// content: meta.inspect($merged-map-deep);
263
+ /// }
264
+ /// .result-overwrite {
265
+ /// $merged-map-overwrite: ulu.utils-map-merge($map-1, $map-2, "overwrite");
266
+ /// content: meta.inspect($merged-map-overwrite);
267
+ /// }
268
+ ///
154
269
 
155
270
  @function map-merge($original, $changes, $mode: null) {
156
271
  @if ($mode == "deep") {
@@ -166,6 +281,20 @@ $config: (
166
281
  /// @param {Map} $map Source map
167
282
  /// @param {String} $key Property to check for
168
283
  /// @return {Boolean}
284
+ /// @example scss {compile} Example usage
285
+ /// $map-1 : (
286
+ /// "has-key" : true
287
+ /// );
288
+ /// $map-2 : (
289
+ /// "missing-key" : true
290
+ /// );
291
+ /// .map-1 {
292
+ /// content: ulu.utils-map-has($map-1, "has-key");
293
+ /// }
294
+ /// .map-2 {
295
+ /// content: ulu.utils-map-has($map-2, "has-key");
296
+ /// }
297
+ ///
169
298
 
170
299
  @function map-has($map, $key) {
171
300
  @if (meta.type-of($map) != "map") {
@@ -189,6 +318,17 @@ $config: (
189
318
 
190
319
  /// Utility for providing fallbacks, the first truthy value (non false or null) will be returned
191
320
  /// @return {*} The first truthy value
321
+ /// @example scss {compile} Example usage
322
+ /// $fallback-text: "No input received";
323
+ /// .user-name:after {
324
+ /// $user-name: "Johnny";
325
+ /// content: ulu.utils-fallback($user-name, $fallback-text);
326
+ /// }
327
+ /// .user-birthdate:after {
328
+ /// $user-birthdate: null;
329
+ /// content: ulu.utils-fallback($user-birthdate, $fallback-text);
330
+ /// }
331
+ ///
192
332
 
193
333
  @function fallback($args...) {
194
334
  @each $arg in $args {
@@ -200,6 +340,19 @@ $config: (
200
340
  }
201
341
 
202
342
  /// Provides fallback values from the same map
343
+ /// @return {*}
344
+ /// @example scss {compile} Example usage
345
+ /// $map: (
346
+ /// "name": doug,
347
+ /// "gpa": "3",
348
+ /// "grade": "B",
349
+ /// );
350
+ /// .fallback-map {
351
+ /// // iterates through properties until it finds one that is a key in the map.
352
+ /// content: ulu.utils-map-fallback($map, "gpa", "grade", "average");
353
+ /// }
354
+ ///
355
+
203
356
  @function map-fallback($map, $properties...) {
204
357
  @each $prop in $properties {
205
358
  $value: map.get($map, $prop);
@@ -216,6 +369,18 @@ $config: (
216
369
  /// @param {List} $keys The list of keys to check for
217
370
  /// @param {List} $options Options for how this behaves
218
371
  /// @param {List} $options.with-value Requires that at least one of the map entries from the list has a value other than null
372
+ /// @example scss {compile} Example usage
373
+ /// $map : (
374
+ /// "has-key" : true
375
+ /// );
376
+ /// $keys : (
377
+ /// "has-key",
378
+ /// "needs-key",
379
+ /// );
380
+ /// .map-contains-any-result {
381
+ /// content: ulu.utils-map-contains-any($map, $keys);
382
+ /// }
383
+ ///
219
384
  @function map-contains-any($map, $keys, $options: ()) {
220
385
  @if (meta.type-of($map) != "map") {
221
386
  @error "map-contains-any(): Incorrect type for $map (should be map)";
@@ -242,6 +407,8 @@ $config: (
242
407
  /// @param {*} $value The value that may need the fallback
243
408
  /// @param {Map} $lookup Map of properties to functions (use sass:meta > meta.get-function to populate)
244
409
  /// @return {*} The user's original value, or if the value is true get the default value from the provided function
410
+ /// @example scss {compile} Example usage
411
+ ///
245
412
 
246
413
  @function function-fallback($prop, $value, $lookup) {
247
414
  $arguments: null;
@@ -448,9 +615,21 @@ $config: (
448
615
  /// Strips the unit from the number
449
616
  /// - Normally this shouldn't be needed
450
617
  /// @link https://stackoverflow.com/questions/12328259/how-do-you-strip-the-unit-from-any-number-in-sass/12335841#12335841 Original source (Miriam Suzanne)
618
+ /// @example scss {compile} Example usage
619
+ /// .test {
620
+ /// line-height: ulu.utils-strip-unit(4rem);
621
+ /// }
451
622
 
452
623
  @function strip-unit($value) {
453
- @return math.div($value, ($value * 0 + 1));
624
+ @if (is-number($value)) {
625
+ @if (math.is-unitless($value)) {
626
+ @return $value;
627
+ } @else {
628
+ @return math.div($value, ($value * 0 + 1));
629
+ }
630
+ } @else {
631
+ @error "Expected number, got #{ $value }";
632
+ }
454
633
  }
455
634
 
456
635
  /// Calculate the size of something at a given scale (percentage/exponential)
@@ -485,4 +664,189 @@ $config: (
485
664
  ) {
486
665
  #{ $property } : $value;
487
666
  #{ $property } : calc(#{ $value } + #{ $responsive-change });
667
+ }
668
+
669
+ /// Calculates the hypotenuse of a triangle
670
+ /// - Can be used to get length between two corners of a rectangle
671
+ /// @param {Number} $width The width of the triangle
672
+ /// @param {Number} $height The height of the triangle
673
+ /// @return {Number} Hypotenuse of a triangle
674
+
675
+ @function hypotenuse($width, $height) {
676
+ @return math.sqrt(math.pow($width, 2) + math.pow($height, 2));
677
+ }
678
+
679
+ /// Get's the info about a box shadow
680
+ /// @param {List} $shadow The box shadow property (ie. 0 0 4px red)
681
+ /// @return {Map} Map with info about the shadow with the following keys (inset, offset-x, offset-y, blur, spread, color)
682
+ /// @throw When shadow is not type list
683
+
684
+ @function box-shadow-info($shadow) {
685
+ @if (meta.type-of($shadow) != "list") {
686
+ @error "Box shadow passed is not correct type (list)";
687
+ }
688
+ $result: (
689
+ "inset": false,
690
+ "offset-x": 0,
691
+ "offset-y": 0,
692
+ "blur": 0,
693
+ "spread": 0,
694
+ "color": null,
695
+ );
696
+
697
+ $number-keys: ("offset-x", "offset-y", "blur", "spread");
698
+ $number-index: 1;
699
+
700
+ @each $value in $shadow {
701
+ $type: meta.type-of($value);
702
+ @if $type == "color" {
703
+ $result: map.merge($result, ("color": $value));
704
+ } @else if $type == "string" and $value == inset {
705
+ $result: map.merge($result, ("inset": true));
706
+ } @else if $type == "number" and $number-index <= 4 {
707
+ // Add each back in by key in the order they appear
708
+ // if not found it's the default
709
+ $result: map.merge($result, (list.nth($number-keys, $number-index): $value));
710
+ $number-index: $number-index + 1;
711
+ }
712
+ }
713
+
714
+ @return $result;
715
+ }
716
+
717
+ /// Get's the extent (how far the shadow extends past the box's edge)
718
+ /// - This will only work on box-shadows that have matching units for the numbers
719
+ /// @param {List} $shadow The box shadow property (ie. 0 0 4px red)
720
+ /// @param {String} $side Optionally pass the side of box to get extend for, if not specified offsets are ignored and just the extent of the shadow is passed
721
+ /// @return {Number} The size the shadow extends past it's box
722
+
723
+ @function box-shadow-extent($shadow, $side: null) {
724
+ $info: box-shadow-info($shadow);
725
+ $extent: map.get($info, "spread") + map.get($info, "blur");
726
+ $offset-x: map.get($info, "offset-x");
727
+ $offset-y: map.get($info, "offset-y");
728
+ @if (not $side) {
729
+ @return $extent;
730
+ } @else {
731
+ @if ($side == "top") {
732
+ @return $extent - $offset-y;
733
+ } @else if ($side == "bottom") {
734
+ @return $extent + $offset-y;
735
+ } @else if ($side == "left") {
736
+ @return $extent - $offset-x;
737
+ } @else if ($side == "right") {
738
+ @return $extent + $offset-x;
739
+ }
740
+ }
741
+ }
742
+
743
+ /// Determines if value passed is a list
744
+ /// @param {*} $value Value to check
745
+ /// @return {Boolean} Whether the item was type list
746
+
747
+ @function is-list($value) {
748
+ @return meta.type-of($value) == "list";
749
+ }
750
+
751
+ /// Determines if value passed is a map
752
+ /// @param {*} $value Value to check
753
+ /// @return {Boolean} Whether the item was type map
754
+
755
+ @function is-map($value) {
756
+ @return meta.type-of($value) == "map";
757
+ }
758
+
759
+ /// Determines if value passed is a number
760
+ /// @param {*} $value Value to check
761
+ /// @return {Boolean} Whether the item was type number
762
+
763
+ @function is-number($value) {
764
+ @return meta.type-of($value) == "number";
765
+ }
766
+
767
+ /// Determines if value passed is a string
768
+ /// @param {*} $value Value to check
769
+ /// @return {Boolean} Whether the item was type string
770
+
771
+ @function is-string($value) {
772
+ @return meta.type-of($value) == "string";
773
+ }
774
+
775
+ /// Determines if value passed is a color
776
+ /// @param {*} $value Value to check
777
+ /// @return {Boolean} Whether the item was type color
778
+
779
+ @function is-color($value) {
780
+ @return meta.type-of($value) == "color";
781
+ }
782
+
783
+
784
+
785
+ // /// Determines if value passed is a bool
786
+ // /// @param {*} $value Value to check
787
+ // /// @return {Boolean} Whether the item was type bool
788
+
789
+ // @function is-bool($value) {
790
+ // @return meta.type-of($value) == "bool";
791
+ // }
792
+
793
+ // /// Determines if value passed is a null
794
+ // /// @param {*} $value Value to check
795
+ // /// @return {Boolean} Whether the item was type null
796
+
797
+ // @function is-null($value) {
798
+ // @return meta.type-of($value) == "null";
799
+ // }
800
+
801
+ /// Returns true if number passed is even
802
+ /// - Allows unit and unitless numbers
803
+ /// @param {Number} $number The number to check
804
+ /// @return {Boolean} Whether or not it is an even number
805
+
806
+ @function is-even($number) {
807
+ @if (is-number($number)) {
808
+ @return strip-unit($number) % 2 == 0;
809
+ } @else {
810
+ @error "Expected Number, got #{ $number }";
811
+ }
812
+ }
813
+
814
+ /// Returns true if number passed is odd
815
+ /// @param {Number} $number The number to check
816
+ /// @return {Boolean} Whether or not it is an odd number
817
+
818
+ @function is-odd($number) {
819
+ @return not is-even($number);
820
+ }
821
+
822
+ /// Always returns a map
823
+ /// @param {*} $value The value to check if is map
824
+ /// @return {Map} The $value if it was a map, else empty map
825
+
826
+ @function ensure-map($value) {
827
+ @return if(is-map($value), $value, ());
828
+ }
829
+
830
+ /// Returns true if edge passed is an end (top/bottom)
831
+ /// @param {String} $edge The edge string to test
832
+ /// @return {Boolean} Whether the edge was an end (versus side/x-axis)
833
+ /// @throw If $edge is not a valid value (not top/bottom/left/right)
834
+
835
+ @function is-end($edge) {
836
+ @if ($edge == "top" or $edge == "bottom") {
837
+ @return true;
838
+ } @else if ($edge == "left" or $edge == "right") {
839
+ @return false;
840
+ } @else {
841
+ @error "Expected side to be top/bottom/left/right, got #{ $edge }";
842
+ }
843
+ }
844
+
845
+ /// Returns true if edge passed is an side (left/right)
846
+ /// @param {String} $edge The edge string to test
847
+ /// @return {Boolean} Whether the edge was an side (versus end/y-axis)
848
+ /// @throw If $edge is not a valid value (not top/bottom/left/right)
849
+
850
+ @function is-side($edge) {
851
+ @return not is-end($edge);
488
852
  }