@ulu/frontend 0.0.23 → 0.1.0-beta.1

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 (212) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/deprecated/js/drupal-programmatic-modal.js +91 -0
  3. package/{js/ui/modals.js → deprecated/js/micromodal-modals.js} +41 -67
  4. package/dist/ulu-frontend.min.css +1 -1
  5. package/dist/ulu-frontend.min.js +70 -1
  6. package/index.js +6 -1
  7. package/js/events/index.js +58 -7
  8. package/js/index.js +3 -7
  9. package/js/{helpers/css-breakpoint.js → ui/breakpoints.js} +9 -11
  10. package/js/ui/collapsible.js +195 -0
  11. package/js/ui/dialog.js +157 -0
  12. package/js/ui/dialog.todo +37 -0
  13. package/js/ui/flipcard.js +55 -11
  14. package/js/ui/grid.js +2 -47
  15. package/js/ui/index.js +21 -0
  16. package/js/ui/modal-builder.js +197 -0
  17. package/js/ui/overflow-scroller-pager.js +1 -1
  18. package/js/ui/overflow-scroller.js +8 -5
  19. package/js/ui/page.js +14 -0
  20. package/js/ui/popover.js +135 -0
  21. package/js/ui/print-details.js +44 -0
  22. package/js/ui/print.js +67 -0
  23. package/js/ui/programmatic-modal.js +79 -81
  24. package/js/ui/proxy-click.js +80 -0
  25. package/js/ui/resizer.js +3 -3
  26. package/js/ui/scroll-slider.js +56 -0
  27. package/js/ui/scrollpoint.js +300 -0
  28. package/js/ui/slider.js +72 -10
  29. package/js/ui/tabs.js +85 -58
  30. package/js/ui/theme-toggle.js +129 -0
  31. package/js/ui/tooltip.js +268 -67
  32. package/js/utils/{logger.js → class-logger.js} +6 -5
  33. package/js/utils/dom.js +122 -0
  34. package/js/utils/file-save.js +67 -0
  35. package/js/utils/floating-ui.js +83 -0
  36. package/js/utils/id.js +22 -0
  37. package/js/utils/index.js +7 -0
  38. package/js/{helpers → utils}/pause-youtube-video.js +1 -1
  39. package/package.json +33 -13
  40. package/resources/drupal/twig-macros/accordion.twig +99 -0
  41. package/resources/drupal/twig-macros/dropdown.twig +44 -0
  42. package/resources/drupal/twig-macros/flipcard.twig +69 -0
  43. package/resources/drupal/twig-macros/image.twig +30 -0
  44. package/resources/drupal/twig-macros/layout.twig +338 -0
  45. package/resources/drupal/twig-macros/slider.twig +214 -0
  46. package/resources/drupal/twig-macros/tabs.twig +84 -0
  47. package/scss/README.md +13 -1
  48. package/scss/_breakpoint.scss +69 -26
  49. package/scss/_button.scss +148 -57
  50. package/scss/_color.scss +46 -28
  51. package/scss/_cssvar.scss +103 -12
  52. package/scss/_element.scss +84 -67
  53. package/scss/_index.scss +0 -3
  54. package/scss/_layout.scss +57 -26
  55. package/scss/_path.scss +2 -2
  56. package/scss/_selector.scss +20 -11
  57. package/scss/_typography.scss +115 -82
  58. package/scss/_units.scss +14 -13
  59. package/scss/_utils.scss +280 -18
  60. package/scss/base/_color.scss +2 -1
  61. package/scss/base/_elements.scss +61 -35
  62. package/scss/base/_index.scss +60 -23
  63. package/scss/base/_keyframes.scss +115 -16
  64. package/scss/base/_layout.scss +10 -6
  65. package/scss/base/_normalize.scss +6 -122
  66. package/scss/base/_print.scss +49 -0
  67. package/scss/base/_root.scss +28 -0
  68. package/scss/base/_typography.scss +4 -1
  69. package/scss/components/_accordion.scss +217 -0
  70. package/scss/components/_adaptive-spacing.scss +148 -0
  71. package/scss/components/_badge.scss +17 -14
  72. package/scss/components/_button-verbose.scss +138 -0
  73. package/scss/components/_button.scss +9 -4
  74. package/scss/components/_callout.scss +175 -0
  75. package/scss/components/_captioned-figure.scss +173 -0
  76. package/scss/components/_card-grid.scss +75 -0
  77. package/scss/components/_card.scss +420 -0
  78. package/scss/components/_css-icon.scss +433 -0
  79. package/scss/{_grid.scss → components/_data-grid.scss} +100 -68
  80. package/scss/components/_data-table.scss +180 -0
  81. package/scss/components/_fill-context.scss +20 -22
  82. package/scss/components/_flipcard-grid.scss +66 -0
  83. package/scss/components/_flipcard.scss +304 -0
  84. package/scss/components/_form-theme.scss +633 -0
  85. package/scss/components/_hero.scss +183 -0
  86. package/scss/components/_horizontal-rule.scss +51 -0
  87. package/scss/components/_image-grid.scss +71 -0
  88. package/scss/components/_index.scss +276 -38
  89. package/scss/components/_links.scss +1 -1
  90. package/scss/components/_list-lines.scss +14 -3
  91. package/scss/components/_list-ordered.scss +3 -1
  92. package/scss/components/_list-unordered.scss +3 -1
  93. package/scss/components/_menu-stack.scss +245 -0
  94. package/scss/components/_modal.scss +495 -0
  95. package/scss/components/_nav-strip.scss +148 -0
  96. package/scss/components/_overlay-section.scss +122 -0
  97. package/scss/components/_pager.scss +168 -0
  98. package/scss/components/_placeholder-block.scss +121 -0
  99. package/scss/components/_popover.scss +263 -0
  100. package/scss/components/_pull-quote.scss +111 -0
  101. package/scss/components/_ratio-box.scss +64 -0
  102. package/scss/components/_rule.scss +12 -9
  103. package/scss/components/_scroll-slider.scss +204 -0
  104. package/scss/components/_skip-link.scss +92 -0
  105. package/scss/components/_slider.scss +241 -0
  106. package/scss/components/_spoke-spinner.scss +193 -0
  107. package/scss/components/_tabs.scss +179 -0
  108. package/scss/components/_tag.scss +156 -0
  109. package/scss/components/_tile-button.scss +131 -0
  110. package/scss/components/_tile-grid-overlay.scss +132 -0
  111. package/scss/components/_tile-grid.scss +172 -0
  112. package/scss/components/_vignette.scss +65 -0
  113. package/scss/components/_wysiwyg.scss +94 -0
  114. package/scss/helpers/_color.scss +1 -0
  115. package/scss/helpers/_display.scss +2 -1
  116. package/scss/helpers/_index.scss +45 -22
  117. package/scss/helpers/_print.scss +20 -43
  118. package/scss/helpers/_typography.scss +3 -0
  119. package/scss/helpers/_units.scss +10 -13
  120. package/scss/helpers/_utilities.scss +5 -1
  121. package/scss/stylesheets/base-styles.scss +7 -0
  122. package/scss/stylesheets/component-styles.scss +7 -0
  123. package/scss/stylesheets/helper-styles.scss +7 -0
  124. package/types/events/index.d.ts +1 -1
  125. package/types/events/index.d.ts.map +1 -1
  126. package/types/index.d.ts +2 -2
  127. package/types/{helpers/css-breakpoint.d.ts → ui/breakpoints.d.ts} +3 -3
  128. package/types/ui/breakpoints.d.ts.map +1 -0
  129. package/types/ui/collapsible.d.ts +67 -0
  130. package/types/ui/collapsible.d.ts.map +1 -0
  131. package/types/ui/dialog.d.ts +42 -0
  132. package/types/ui/dialog.d.ts.map +1 -0
  133. package/types/ui/flipcard.d.ts +8 -1
  134. package/types/ui/flipcard.d.ts.map +1 -1
  135. package/types/ui/grid.d.ts +0 -11
  136. package/types/ui/grid.d.ts.map +1 -1
  137. package/types/ui/index.d.ts +23 -0
  138. package/types/ui/index.d.ts.map +1 -0
  139. package/types/ui/modal-builder.d.ts +54 -0
  140. package/types/ui/modal-builder.d.ts.map +1 -0
  141. package/types/ui/overflow-scroller-pager.d.ts +1 -1
  142. package/types/ui/overflow-scroller-pager.d.ts.map +1 -1
  143. package/types/ui/overflow-scroller.d.ts +3 -1
  144. package/types/ui/overflow-scroller.d.ts.map +1 -1
  145. package/types/ui/page.d.ts +5 -0
  146. package/types/ui/page.d.ts.map +1 -0
  147. package/types/ui/popover.d.ts +40 -0
  148. package/types/ui/popover.d.ts.map +1 -0
  149. package/types/ui/print-details.d.ts +10 -0
  150. package/types/ui/print-details.d.ts.map +1 -0
  151. package/types/ui/print.d.ts +10 -0
  152. package/types/ui/print.d.ts.map +1 -0
  153. package/types/ui/programmatic-modal.d.ts +19 -1
  154. package/types/ui/programmatic-modal.d.ts.map +1 -1
  155. package/types/ui/proxy-click.d.ts +18 -0
  156. package/types/ui/proxy-click.d.ts.map +1 -0
  157. package/types/ui/resizer.d.ts +1 -1
  158. package/types/ui/resizer.d.ts.map +1 -1
  159. package/types/ui/scroll-slider.d.ts +13 -0
  160. package/types/ui/scroll-slider.d.ts.map +1 -0
  161. package/types/ui/scrollpoint.d.ts +133 -0
  162. package/types/ui/scrollpoint.d.ts.map +1 -0
  163. package/types/ui/slider.d.ts +14 -2
  164. package/types/ui/slider.d.ts.map +1 -1
  165. package/types/ui/tabs.d.ts +22 -0
  166. package/types/ui/tabs.d.ts.map +1 -1
  167. package/types/ui/theme-toggle.d.ts +14 -0
  168. package/types/ui/theme-toggle.d.ts.map +1 -0
  169. package/types/ui/tooltip.d.ts +92 -10
  170. package/types/ui/tooltip.d.ts.map +1 -1
  171. package/types/utils/{logger.d.ts → class-logger.d.ts} +1 -1
  172. package/types/utils/class-logger.d.ts.map +1 -0
  173. package/types/utils/dom.d.ts +48 -0
  174. package/types/utils/dom.d.ts.map +1 -0
  175. package/types/utils/file-save.d.ts +64 -0
  176. package/types/utils/file-save.d.ts.map +1 -0
  177. package/types/utils/floating-ui.d.ts +19 -0
  178. package/types/utils/floating-ui.d.ts.map +1 -0
  179. package/types/utils/id.d.ts +10 -0
  180. package/types/utils/id.d.ts.map +1 -0
  181. package/types/utils/index.d.ts +9 -0
  182. package/types/utils/index.d.ts.map +1 -0
  183. package/types/utils/pause-youtube-video.d.ts.map +1 -0
  184. package/js/helpers/file-save.js +0 -52
  185. package/js/helpers/scrollbar-width-property.js +0 -14
  186. package/project.todo +0 -22
  187. package/scss/_calculate.scss +0 -64
  188. package/scss/_utility.scss +0 -12
  189. package/types/helpers/css-breakpoint.d.ts.map +0 -1
  190. package/types/helpers/file-save.d.ts +0 -17
  191. package/types/helpers/file-save.d.ts.map +0 -1
  192. package/types/helpers/node-data-manager.d.ts +0 -45
  193. package/types/helpers/node-data-manager.d.ts.map +0 -1
  194. package/types/helpers/pause-youtube-video.d.ts.map +0 -1
  195. package/types/helpers/scrollbar-width-property.d.ts +0 -11
  196. package/types/helpers/scrollbar-width-property.d.ts.map +0 -1
  197. package/types/ui/modals.d.ts +0 -27
  198. package/types/ui/modals.d.ts.map +0 -1
  199. package/types/utils/logger.d.ts.map +0 -1
  200. package/vite.config.js +0 -36
  201. /package/{js/deprecated → deprecated/js}/doc-ready.js +0 -0
  202. /package/{js/deprecated → deprecated/js}/jquery-prototypes.js +0 -0
  203. /package/{js/deprecated → deprecated/js}/mini-collapsible-popper-positioning.js +0 -0
  204. /package/{js/deprecated → deprecated/js}/mini-collapsible.js +0 -0
  205. /package/{js/helpers → deprecated/js}/node-data-manager.js +0 -0
  206. /package/{js/deprecated → deprecated/js}/script-loader.js +0 -0
  207. /package/{js/deprecated → deprecated/js}/waypoints/README.md +0 -0
  208. /package/{js/deprecated → deprecated/js}/waypoints/anchor-menu.js +0 -0
  209. /package/{js/deprecated → deprecated/js}/waypoints/element-waypoint.js +0 -0
  210. /package/{js/deprecated → deprecated/js}/waypoints/examples/page-link-menu.md +0 -0
  211. /package/{js/deprecated → deprecated/js}/waypoints/state-in-attribute.js +0 -0
  212. /package/types/{helpers → utils}/pause-youtube-video.d.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  ////
2
2
  /// @group typography
3
- /// @todo Idea: Should the maps value be processes when using the set-sizes, set? Instead of recalculated each time get-size is or get is used.
3
+ /// Manages typography settings, sizes and provides typography related utilities
4
4
  ////
5
5
 
6
6
  @use "sass:map";
@@ -10,51 +10,62 @@
10
10
 
11
11
  @use "color";
12
12
  @use "utils";
13
- @use "utility";
14
- @use "calculate";
15
13
  @use "breakpoint";
16
14
 
17
15
  /// Module Settings
18
16
  /// @type Map
19
- /// @prop {Number} $config.font-size Default font size (use pixels, converted, is used for rem base)
20
- /// @prop {Number} $config.font-family Default font family
21
- /// @prop {Number} $config.font-family-monospace Base font-family for monospace
22
- /// @prop {Number} $config.line-height Default line height
23
- /// @prop {Number} $config.line-height-dense Default dense line height
24
- /// @prop {Number} $config.size-ratio Font size scale when using preset sizes, ratio mixin)
25
- /// @prop {Number} $config.size-line-height-ratio Default line height scaling (when using preset sizes, ratio mixin). Can shrink line-height as size increase if desrireable
26
- /// @prop {Number} $config.responsive-change Amount to scale typography by browser's width (use viewport units)
27
- /// @prop {Number} $config.margin Default margin for typography (like paragraphs)
17
+ /// @prop {Dimension} letter-spacing-uppercase [0.04em]
18
+ /// @prop {Number} margin-bottom [1em] Default margin for typography (like paragraphs)
19
+ /// @prop {Number} margin-top [null] Default margin for typography (like paragraphs)
20
+ /// @prop {Number} responsive-change [0.05vw] Amount to scale typography by browser's width (use viewport units)
21
+ /// @prop {Number} scale-steps [5]
22
+ /// @prop {Number} size-ratio [1.8] Font size scale when using preset sizes, ratio mixin)
23
+ /// @prop {Number} size-line-height-ratio [0.97] Default line height scaling (when using preset sizes, ratio mixin). Can shrink line-height as size increase if desirable
24
+ /// @prop {Number} font-family [(ui-sans-serif, "Open Sans", Helvetica, Arial, sans-serif)] Default font family
25
+ /// @prop {Number} font-family-monospace [(Menlo, Consolas, Monaco, monospace)] Base font-family for monospace
26
+ /// @prop {CssValue} font-family-sans [(ui-sans-serif, "Open Sans", Helvetica, Arial, sans-serif)]
27
+ /// @prop {CssValue} font-family-serif [(Cambria, Georgia, serif]
28
+ /// @prop {Number} font-size [16px] Default font size (use pixels, converted, is used for rem base)
29
+ /// @prop {CssValue} font-weight [inherit]
30
+ /// @prop {CssValue} font-weight-bold [bold]
31
+ /// @prop {CssValue} font-weight-light [300]
32
+ /// @prop {CssValue} font-weight-normal [normal]
33
+ /// @prop {CssValue} font-weight-semibold [600]
34
+ /// @prop {Number} line-height [1.5] Default line height
35
+ /// @prop {Number} line-height-dense [1.3] Default dense line height
36
+ /// @prop {Number} line-height-densest [1.1]
37
+ /// @prop {Number} line-height-spaced [1.75]
28
38
 
29
39
  $config: (
30
- "font-size" : 16px,
31
- "font-family" : (ui-sans-serif, "Open Sans", Helvetica, Arial, sans-serif),
32
- "font-family-sans" : (ui-sans-serif, "Open Sans", Helvetica, Arial, sans-serif),
33
- "font-family-serif" : (Cambria, Georgia, serif),
34
- "font-family-monospace" : (Menlo, Consolas, Monaco, monospace),
35
- "font-weight" : inherit,
36
- "font-weight-headline" : bold,
37
- "font-weight-light" : 300,
38
- "font-weight-normal" : normal,
39
- "font-weight-semibold" : 600,
40
- "font-weight-bold" : bold,
41
- "line-height" : 1.5,
42
- "line-height-dense": 1.3,
43
- "line-height-spaced": 1.75,
44
- "size-ratio": 2,
45
- "size-line-height-ratio": 0.97,
46
- "scale-steps": 5,
47
- "responsive-change": 0.05vw,
48
- "margin-bottom": 1em,
49
- "margin-top": false,
50
- "letter-spacing-uppercase" : 0.04em,
51
- "max-width" : 60rem,
52
- "max-width-small" : 50rem
40
+ "letter-spacing-uppercase": 0.04em,
41
+ "margin-bottom": 1em,
42
+ "margin-top": null,
43
+ "responsive-change": 0.05vw,
44
+ "scale-steps": 5,
45
+ "size-ratio": 1.8,
46
+ "size-line-height-ratio": 0.97,
47
+ "font-family": (ui-sans-serif, "Open Sans", Helvetica, Arial, sans-serif),
48
+ "font-family-monospace": (Menlo, Consolas, Monaco, monospace),
49
+ "font-family-sans": (ui-sans-serif, "Open Sans", Helvetica, Arial, sans-serif),
50
+ "font-family-serif": (Cambria, Georgia, serif),
51
+ "font-size": 16px,
52
+ "font-weight": inherit,
53
+ "font-weight-bold": bold,
54
+ "font-weight-light": 300,
55
+ "font-weight-normal": normal,
56
+ "font-weight-semibold": 600,
57
+ "line-height": 1.5,
58
+ "line-height-dense": 1.3,
59
+ "line-height-densest": 1.1,
60
+ "line-height-spaced": 1.75,
61
+ "max-width": 60em,
62
+ "max-width-large": 75em,
63
+ "max-width-small": 45em,
53
64
  ) !default;
54
65
 
55
66
  /// Change modules $config
56
67
  /// @param {Map} $changes Map of changes
57
- /// @include typography.set-options(( "font-size" : 14px ));
68
+ /// @include ulu.typography-set(( "font-size" : 14px ));
58
69
 
59
70
  @mixin set($changes) {
60
71
  $config: map.merge($config, $changes) !global;
@@ -62,7 +73,7 @@ $config: (
62
73
 
63
74
  /// Get a config option
64
75
  /// @param {Map} $changes Map of changes
65
- /// @include typography.set-options(( "font-size" : 14px ));
76
+ /// @include ulu.typography-get(( "font-size" : 14px ));
66
77
 
67
78
  @function get($name) {
68
79
  @return utils.require-map-get($config, $name, 'typography [config]');
@@ -73,7 +84,7 @@ $config: (
73
84
  /// @return {Number} Scaled value
74
85
 
75
86
  @function scale($step) {
76
- @return calculate.ratio-scale-size(get("font-size"), get("size-ratio"), get("scale-steps"), $step);
87
+ @return utils.ratio-scale-size(get("font-size"), get("size-ratio"), get("scale-steps"), $step);
77
88
  }
78
89
 
79
90
  /// Get scale of the line-height
@@ -82,7 +93,7 @@ $config: (
82
93
  /// @todo Setup breakpoints
83
94
 
84
95
  @function scale-line-height($step) {
85
- @return calculate.ratio-scale-size(get("line-height"), get("size-line-height-ratio"), get("scale-steps"), $step);
96
+ @return utils.ratio-scale-size(get("line-height"), get("size-line-height-ratio"), get("scale-steps"), $step);
86
97
  }
87
98
 
88
99
  /// Convert pixel value to rem value based on typography $font-size
@@ -111,7 +122,7 @@ $config: (
111
122
  }
112
123
  }
113
124
 
114
- /// Break word stradegy
125
+ /// Output CSS Break word strategy
115
126
  /// @param {Boolean} $force Force words to break (will have unusual breaks)
116
127
 
117
128
  @mixin word-break($force: false) {
@@ -122,6 +133,7 @@ $config: (
122
133
 
123
134
  /// Creates a size map
124
135
  /// - This is just an accelerator for creating a size map
136
+ /// - This is opinionated about how sizes are setup, headlines get (margins, bold, headline color) and are base classes while non-headlines are added as helper classes and do not get (margins, bold, color)
125
137
  /// - You can pass your own size maps using set-sizes()
126
138
  /// @param {Number} $font-size Font size
127
139
  /// @param {Number} $line-height Line height
@@ -130,13 +142,39 @@ $config: (
130
142
  @function new-size($font-size, $line-height: true, $is-headline: false) {
131
143
  @return (
132
144
  "font-size": $font-size,
133
- "font-weight" : if($is-headline, get("font-weight-headline"), null),
145
+ "font-weight" : if($is-headline, get("font-weight-bold"), null),
134
146
  "line-height": $line-height,
147
+ "margin-bottom" : if($is-headline, get("margin-bottom"), null),
148
+ "margin-top" : if($is-headline, get("margin-top"), null),
135
149
  "responsive" : true,
136
150
  "helper-class" : if($is-headline, false, true),
137
151
  "helper-class-prefixed" : true,
138
152
  "base-class" : if($is-headline, true, false),
139
- "base-class-prefixed" : false
153
+ "base-class-prefixed" : false,
154
+ "color" : if($is-headline, color.get("headline"), null)
155
+ );
156
+ }
157
+
158
+ /// Function that returns default sizes
159
+ /// - Used to set the sizes initially and
160
+ /// - You can use this if you've reconfigured typography settings and want to update the default sizes with the new settings
161
+ /// @return {Map} The default typography sizes
162
+
163
+ @function get-default-sizes() {
164
+ @return (
165
+ "small-x" : new-size(scale(-2)),
166
+ "small" : new-size(scale(-1)),
167
+ "base" : new-size(scale(0)),
168
+ "large" : new-size(scale(1), scale-line-height(1)),
169
+ "large-x" : new-size(scale(2), scale-line-height(2)),
170
+ "large-xx" : new-size(scale(3), scale-line-height(3)),
171
+ "large-xxx" : new-size(scale(4), scale-line-height(4)),
172
+ "h6" : new-size(scale(1), scale-line-height(1), true),
173
+ "h5" : new-size(scale(2), scale-line-height(2), true),
174
+ "h4" : new-size(scale(3), scale-line-height(3), true),
175
+ "h3" : new-size(scale(4), scale-line-height(4), true),
176
+ "h2" : new-size(scale(5), scale-line-height(5), true),
177
+ "h1" : new-size(scale(6), scale-line-height(6), true),
140
178
  );
141
179
  }
142
180
 
@@ -146,41 +184,37 @@ $config: (
146
184
  /// @prop {Number} $size.name.font-size Font size in rems or pixels
147
185
  /// @prop {Number} $size.name.line-height Line height (unitless)
148
186
  /// @prop {Number} $size.name.responsive Apply responsive sizes
149
- /// @prop {Boolean} $size.name.base-class This style should be included in the base (top can be overriden)
187
+ /// @prop {Number} $size.name.breakpoints Map of breakpoints where each key is breakpoint with map of changes (ie. font-size, etc)
188
+ /// @prop {Number} $size.name.breakpoints.breakpoint.direction Direction the breakpoint should be applied to (ie. min/max)
189
+ /// @prop {Boolean} $size.name.base-class This style should be included in the base (top can be overridden)
150
190
  /// @prop {Boolean} $size.name.helper-class This style should be included in the helpers (overrides)
151
- /// @todo Add adaptive and use a map of breakpoints and whether it's up or down
152
- /// @todo Add headlines
153
-
154
- $sizes: (
155
- "small-x" : new-size(scale(-2)),
156
- "small" : new-size(scale(-1)),
157
- "base" : new-size(scale(0)),
158
- "large" : new-size(scale(1), scale-line-height(1)),
159
- "large-x" : new-size(scale(2), scale-line-height(2)),
160
- "large-xx" : new-size(scale(3), scale-line-height(3)),
161
- "large-xxx" : new-size(scale(4), scale-line-height(4)),
162
- "h1" : new-size(scale(6), scale-line-height(6), true),
163
- "h2" : new-size(scale(5), scale-line-height(5), true),
164
- "h3" : new-size(scale(4), scale-line-height(4), true),
165
- "h4" : new-size(scale(3), scale-line-height(3), true),
166
- "h5" : new-size(scale(2), scale-line-height(2), true),
167
- "h6" : new-size(scale(1), scale-line-height(1), true)
168
- ) !default;
169
191
 
170
- /// Update the typography presets map
192
+ $sizes: get-default-sizes() !default;
193
+
194
+ /// Configure the typography sizes
171
195
  /// @param {Map} $changes A map to merge into the color palette
172
- /// @param {Map} $deep Use deep merge
173
- /// @param {Map} $overwrite Overwrite the presets completly (cannot be used with deep)
174
- /// @example scss Setting the error and type color
175
- /// @include typography.set((
176
- /// "small" : 0.8rem
177
- /// ));
196
+ /// @param {Map} $merge-mode [null] Merge strategy see, utils.map-merge options
197
+ /// @example scss - Adjusting the h1 and h2 sizes while keeping pre-existing sizes by using deep merge
198
+ /// @include ulu.typography-set-sizes((
199
+ /// "h1" : (
200
+ /// "color" : "accent",
201
+ /// "font-size": 50px,
202
+ /// "margin-top" : null,
203
+ /// "margin-bottom" : 0.5em
204
+ /// ),
205
+ /// "h2" : (
206
+ /// "font-size": 38px,
207
+ /// "color" : blue,
208
+ /// "margin-top" : 2.5em,
209
+ /// "margin-bottom" : 1em,
210
+ /// ),
211
+ /// ), "deep");
178
212
 
179
213
  @mixin set-sizes($changes, $merge-mode: null) {
180
214
  $sizes: utils.map-merge($sizes, $changes, $merge-mode) !global;
181
215
  }
182
216
 
183
- /// Get a size's map
217
+ /// Get a specific size's settings map
184
218
  /// @param {String} $name Name of size
185
219
  /// @return {Map}
186
220
 
@@ -188,14 +222,12 @@ $sizes: (
188
222
  @return utils.require-map-get($sizes, $name, 'typography [size]');
189
223
  }
190
224
 
191
- /// Print a font-size for a given size
192
- /// @todo Remove doesn't work for breakpoints or responsive
193
- /// @param {String} $value Size name
225
+ /// Check if a typography size exists
226
+ /// @param {String} $name Name of size
227
+ /// @return {Boolean}
194
228
 
195
- @function font-size($name: null) {
196
- $size: get-size($name);
197
- $font-size: map.get($size, "font-size");
198
- @return rem($font-size);
229
+ @function has-size($name) {
230
+ @return utils.map-has($sizes, $name);
199
231
  }
200
232
 
201
233
  /// Forces conversion to unitless line-height
@@ -203,20 +235,21 @@ $sizes: (
203
235
  /// @param {Number} $font-size Font size in px, em, or rem
204
236
 
205
237
  @function unitless-line-height($line-height, $font-size) {
206
- // Font size is rems, line-height is unkown
238
+ // Font size is rems, line-height is unknown
207
239
  @if (math.is-unitless($line-height)) {
208
240
  @return $line-height;
209
241
  }
210
242
  $unit: math.unit($line-height);
211
243
  @if ($unit == "em") {
212
- @return utility.strip-unit($line-height);
244
+ @return utils.strip-unit($line-height);
213
245
  } @else if ($unit == "pixels" or $unit == "rem") {
214
246
  $calc: math.div(rem($line-height), rem($font-size));
215
- @return utility.strip-unit($calc);
247
+ @return utils.strip-unit($calc);
216
248
  } @else {
217
249
  @error "ULU: Unable to convert to unitless line-height for: #{ $line-height }";
218
250
  }
219
251
  }
252
+
220
253
  /// Print a value from the size and convert it (to appropriate unit for framework)
221
254
  /// @param {Map} $size Size's map
222
255
  /// @param {String} $props The property to get
@@ -249,7 +282,6 @@ $sizes: (
249
282
  }
250
283
  }
251
284
 
252
-
253
285
  /// Get a sizes property value that doesn't need conversion
254
286
  /// - Reason: Will map to default if user set's size prop to true
255
287
  /// @param {Map} $size Size's map
@@ -274,8 +306,8 @@ $sizes: (
274
306
 
275
307
  /// Print a typography size (font-size, line-height)
276
308
  /// @param {String} $nameOrMap Name to retrieve from sizes map or a unique size map that follows the API
277
- /// @param {Map} $changes Modifications to be merged into size before using
278
- /// @param {Boolean} $only-font-size Only print the font size
309
+ /// @param {Map} $changes Modifications to be merged into size before output
310
+ /// @param {Boolean} $only-font-size Only output the font size
279
311
 
280
312
  @mixin size($name, $changes: false, $only-font-size: null) {
281
313
  $size: $name;
@@ -302,6 +334,7 @@ $sizes: (
302
334
  @if (not $only-font-size) {
303
335
  font-weight: get-size-value($size, "font-weight");
304
336
  font-family: get-size-value($size, "font-family");
337
+ font-variation-settings: get-size-value($size, "font-variation-settings");
305
338
  line-height: get-size-converted-value($size, "line-height");
306
339
  margin-top: get-size-converted-value($size, "margin-top");
307
340
  margin-bottom: get-size-converted-value($size, "margin-bottom");
package/scss/_units.scss CHANGED
@@ -1,5 +1,6 @@
1
1
  ////
2
2
  /// @group units
3
+ /// Manages common spacing values (used by utility classes like margin/padding)
3
4
  ////
4
5
 
5
6
  @use "sass:meta";
@@ -8,26 +9,26 @@
8
9
 
9
10
  /// Module Settings
10
11
  /// @type Map
11
- /// @prop {Number} small-x
12
- /// @prop {Number} small
13
- /// @prop {Number} default Base unit of measurent
14
- /// @prop {Number} large
15
- /// @prop {Number} large-x
16
- /// @prop {Number} large-xx
12
+ /// @prop {Number} default [1rem] Base unit of measure
13
+ /// @prop {Number} large [1rem * 2]
14
+ /// @prop {Number} large-x [1rem * 3]
15
+ /// @prop {Number} large-xx [1rem * 4]
16
+ /// @prop {Number} small [1rem * 0.75]
17
+ /// @prop {Number} small-x [1rem * 0.5]
17
18
 
18
19
  $config: (
19
- "small-x" : 1rem * 0.5,
20
- "small" : 1rem * 0.75,
21
- "default" : 1rem,
22
- "large" : 1rem * 2,
23
- "large-x" : 1rem * 3,
24
- "large-xx" : 1rem * 4
20
+ "default": 1rem,
21
+ "large": 1rem * 2,
22
+ "large-x": 1rem * 3,
23
+ "large-xx": 1rem * 4,
24
+ "small": 1rem * 0.75,
25
+ "small-x": 1rem * 0.5,
25
26
  ) !default;
26
27
 
27
28
  /// Update the units config
28
29
  /// @param {Map} $changes A map to merge into the color palette
29
30
  /// @example scss Setting the error and type color
30
- /// @include units.set((
31
+ /// @include ulu.units-set((
31
32
  /// "default" : 1.5em
32
33
  /// ));
33
34