@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.
- package/CHANGELOG.md +20 -0
- package/deprecated/js/drupal-programmatic-modal.js +91 -0
- package/{js/ui/modals.js → deprecated/js/micromodal-modals.js} +41 -67
- package/dist/ulu-frontend.min.css +1 -1
- package/dist/ulu-frontend.min.js +70 -1
- package/index.js +6 -1
- package/js/events/index.js +58 -7
- package/js/index.js +3 -7
- package/js/{helpers/css-breakpoint.js → ui/breakpoints.js} +9 -11
- package/js/ui/collapsible.js +195 -0
- package/js/ui/dialog.js +157 -0
- package/js/ui/dialog.todo +37 -0
- package/js/ui/flipcard.js +55 -11
- package/js/ui/grid.js +2 -47
- package/js/ui/index.js +21 -0
- package/js/ui/modal-builder.js +197 -0
- package/js/ui/overflow-scroller-pager.js +1 -1
- package/js/ui/overflow-scroller.js +8 -5
- package/js/ui/page.js +14 -0
- package/js/ui/popover.js +135 -0
- package/js/ui/print-details.js +44 -0
- package/js/ui/print.js +67 -0
- package/js/ui/programmatic-modal.js +79 -81
- package/js/ui/proxy-click.js +80 -0
- package/js/ui/resizer.js +3 -3
- package/js/ui/scroll-slider.js +56 -0
- package/js/ui/scrollpoint.js +300 -0
- package/js/ui/slider.js +72 -10
- package/js/ui/tabs.js +85 -58
- package/js/ui/theme-toggle.js +129 -0
- package/js/ui/tooltip.js +268 -67
- package/js/utils/{logger.js → class-logger.js} +6 -5
- package/js/utils/dom.js +122 -0
- package/js/utils/file-save.js +67 -0
- package/js/utils/floating-ui.js +83 -0
- package/js/utils/id.js +22 -0
- package/js/utils/index.js +7 -0
- package/js/{helpers → utils}/pause-youtube-video.js +1 -1
- package/package.json +33 -13
- package/resources/drupal/twig-macros/accordion.twig +99 -0
- package/resources/drupal/twig-macros/dropdown.twig +44 -0
- package/resources/drupal/twig-macros/flipcard.twig +69 -0
- package/resources/drupal/twig-macros/image.twig +30 -0
- package/resources/drupal/twig-macros/layout.twig +338 -0
- package/resources/drupal/twig-macros/slider.twig +214 -0
- package/resources/drupal/twig-macros/tabs.twig +84 -0
- package/scss/README.md +13 -1
- package/scss/_breakpoint.scss +69 -26
- package/scss/_button.scss +148 -57
- package/scss/_color.scss +46 -28
- package/scss/_cssvar.scss +103 -12
- package/scss/_element.scss +84 -67
- package/scss/_index.scss +0 -3
- package/scss/_layout.scss +57 -26
- package/scss/_path.scss +2 -2
- package/scss/_selector.scss +20 -11
- package/scss/_typography.scss +115 -82
- package/scss/_units.scss +14 -13
- package/scss/_utils.scss +280 -18
- package/scss/base/_color.scss +2 -1
- package/scss/base/_elements.scss +61 -35
- package/scss/base/_index.scss +60 -23
- package/scss/base/_keyframes.scss +115 -16
- package/scss/base/_layout.scss +10 -6
- package/scss/base/_normalize.scss +6 -122
- package/scss/base/_print.scss +49 -0
- package/scss/base/_root.scss +28 -0
- package/scss/base/_typography.scss +4 -1
- package/scss/components/_accordion.scss +217 -0
- package/scss/components/_adaptive-spacing.scss +148 -0
- package/scss/components/_badge.scss +17 -14
- package/scss/components/_button-verbose.scss +138 -0
- package/scss/components/_button.scss +9 -4
- package/scss/components/_callout.scss +175 -0
- package/scss/components/_captioned-figure.scss +173 -0
- package/scss/components/_card-grid.scss +75 -0
- package/scss/components/_card.scss +420 -0
- package/scss/components/_css-icon.scss +433 -0
- package/scss/{_grid.scss → components/_data-grid.scss} +100 -68
- package/scss/components/_data-table.scss +180 -0
- package/scss/components/_fill-context.scss +20 -22
- package/scss/components/_flipcard-grid.scss +66 -0
- package/scss/components/_flipcard.scss +304 -0
- package/scss/components/_form-theme.scss +633 -0
- package/scss/components/_hero.scss +183 -0
- package/scss/components/_horizontal-rule.scss +51 -0
- package/scss/components/_image-grid.scss +71 -0
- package/scss/components/_index.scss +276 -38
- package/scss/components/_links.scss +1 -1
- package/scss/components/_list-lines.scss +14 -3
- package/scss/components/_list-ordered.scss +3 -1
- package/scss/components/_list-unordered.scss +3 -1
- package/scss/components/_menu-stack.scss +245 -0
- package/scss/components/_modal.scss +495 -0
- package/scss/components/_nav-strip.scss +148 -0
- package/scss/components/_overlay-section.scss +122 -0
- package/scss/components/_pager.scss +168 -0
- package/scss/components/_placeholder-block.scss +121 -0
- package/scss/components/_popover.scss +263 -0
- package/scss/components/_pull-quote.scss +111 -0
- package/scss/components/_ratio-box.scss +64 -0
- package/scss/components/_rule.scss +12 -9
- package/scss/components/_scroll-slider.scss +204 -0
- package/scss/components/_skip-link.scss +92 -0
- package/scss/components/_slider.scss +241 -0
- package/scss/components/_spoke-spinner.scss +193 -0
- package/scss/components/_tabs.scss +179 -0
- package/scss/components/_tag.scss +156 -0
- package/scss/components/_tile-button.scss +131 -0
- package/scss/components/_tile-grid-overlay.scss +132 -0
- package/scss/components/_tile-grid.scss +172 -0
- package/scss/components/_vignette.scss +65 -0
- package/scss/components/_wysiwyg.scss +94 -0
- package/scss/helpers/_color.scss +1 -0
- package/scss/helpers/_display.scss +2 -1
- package/scss/helpers/_index.scss +45 -22
- package/scss/helpers/_print.scss +20 -43
- package/scss/helpers/_typography.scss +3 -0
- package/scss/helpers/_units.scss +10 -13
- package/scss/helpers/_utilities.scss +5 -1
- package/scss/stylesheets/base-styles.scss +7 -0
- package/scss/stylesheets/component-styles.scss +7 -0
- package/scss/stylesheets/helper-styles.scss +7 -0
- package/types/events/index.d.ts +1 -1
- package/types/events/index.d.ts.map +1 -1
- package/types/index.d.ts +2 -2
- package/types/{helpers/css-breakpoint.d.ts → ui/breakpoints.d.ts} +3 -3
- package/types/ui/breakpoints.d.ts.map +1 -0
- package/types/ui/collapsible.d.ts +67 -0
- package/types/ui/collapsible.d.ts.map +1 -0
- package/types/ui/dialog.d.ts +42 -0
- package/types/ui/dialog.d.ts.map +1 -0
- package/types/ui/flipcard.d.ts +8 -1
- package/types/ui/flipcard.d.ts.map +1 -1
- package/types/ui/grid.d.ts +0 -11
- package/types/ui/grid.d.ts.map +1 -1
- package/types/ui/index.d.ts +23 -0
- package/types/ui/index.d.ts.map +1 -0
- package/types/ui/modal-builder.d.ts +54 -0
- package/types/ui/modal-builder.d.ts.map +1 -0
- package/types/ui/overflow-scroller-pager.d.ts +1 -1
- package/types/ui/overflow-scroller-pager.d.ts.map +1 -1
- package/types/ui/overflow-scroller.d.ts +3 -1
- package/types/ui/overflow-scroller.d.ts.map +1 -1
- package/types/ui/page.d.ts +5 -0
- package/types/ui/page.d.ts.map +1 -0
- package/types/ui/popover.d.ts +40 -0
- package/types/ui/popover.d.ts.map +1 -0
- package/types/ui/print-details.d.ts +10 -0
- package/types/ui/print-details.d.ts.map +1 -0
- package/types/ui/print.d.ts +10 -0
- package/types/ui/print.d.ts.map +1 -0
- package/types/ui/programmatic-modal.d.ts +19 -1
- package/types/ui/programmatic-modal.d.ts.map +1 -1
- package/types/ui/proxy-click.d.ts +18 -0
- package/types/ui/proxy-click.d.ts.map +1 -0
- package/types/ui/resizer.d.ts +1 -1
- package/types/ui/resizer.d.ts.map +1 -1
- package/types/ui/scroll-slider.d.ts +13 -0
- package/types/ui/scroll-slider.d.ts.map +1 -0
- package/types/ui/scrollpoint.d.ts +133 -0
- package/types/ui/scrollpoint.d.ts.map +1 -0
- package/types/ui/slider.d.ts +14 -2
- package/types/ui/slider.d.ts.map +1 -1
- package/types/ui/tabs.d.ts +22 -0
- package/types/ui/tabs.d.ts.map +1 -1
- package/types/ui/theme-toggle.d.ts +14 -0
- package/types/ui/theme-toggle.d.ts.map +1 -0
- package/types/ui/tooltip.d.ts +92 -10
- package/types/ui/tooltip.d.ts.map +1 -1
- package/types/utils/{logger.d.ts → class-logger.d.ts} +1 -1
- package/types/utils/class-logger.d.ts.map +1 -0
- package/types/utils/dom.d.ts +48 -0
- package/types/utils/dom.d.ts.map +1 -0
- package/types/utils/file-save.d.ts +64 -0
- package/types/utils/file-save.d.ts.map +1 -0
- package/types/utils/floating-ui.d.ts +19 -0
- package/types/utils/floating-ui.d.ts.map +1 -0
- package/types/utils/id.d.ts +10 -0
- package/types/utils/id.d.ts.map +1 -0
- package/types/utils/index.d.ts +9 -0
- package/types/utils/index.d.ts.map +1 -0
- package/types/utils/pause-youtube-video.d.ts.map +1 -0
- package/js/helpers/file-save.js +0 -52
- package/js/helpers/scrollbar-width-property.js +0 -14
- package/project.todo +0 -22
- package/scss/_calculate.scss +0 -64
- package/scss/_utility.scss +0 -12
- package/types/helpers/css-breakpoint.d.ts.map +0 -1
- package/types/helpers/file-save.d.ts +0 -17
- package/types/helpers/file-save.d.ts.map +0 -1
- package/types/helpers/node-data-manager.d.ts +0 -45
- package/types/helpers/node-data-manager.d.ts.map +0 -1
- package/types/helpers/pause-youtube-video.d.ts.map +0 -1
- package/types/helpers/scrollbar-width-property.d.ts +0 -11
- package/types/helpers/scrollbar-width-property.d.ts.map +0 -1
- package/types/ui/modals.d.ts +0 -27
- package/types/ui/modals.d.ts.map +0 -1
- package/types/utils/logger.d.ts.map +0 -1
- package/vite.config.js +0 -36
- /package/{js/deprecated → deprecated/js}/doc-ready.js +0 -0
- /package/{js/deprecated → deprecated/js}/jquery-prototypes.js +0 -0
- /package/{js/deprecated → deprecated/js}/mini-collapsible-popper-positioning.js +0 -0
- /package/{js/deprecated → deprecated/js}/mini-collapsible.js +0 -0
- /package/{js/helpers → deprecated/js}/node-data-manager.js +0 -0
- /package/{js/deprecated → deprecated/js}/script-loader.js +0 -0
- /package/{js/deprecated → deprecated/js}/waypoints/README.md +0 -0
- /package/{js/deprecated → deprecated/js}/waypoints/anchor-menu.js +0 -0
- /package/{js/deprecated → deprecated/js}/waypoints/element-waypoint.js +0 -0
- /package/{js/deprecated → deprecated/js}/waypoints/examples/page-link-menu.md +0 -0
- /package/{js/deprecated → deprecated/js}/waypoints/state-in-attribute.js +0 -0
- /package/types/{helpers → utils}/pause-youtube-video.d.ts +0 -0
package/scss/_utils.scss
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
////
|
|
2
2
|
/// @group utils
|
|
3
|
+
/// Basic utility functions/mixins used throughout system
|
|
3
4
|
////
|
|
4
5
|
|
|
5
6
|
@use "sass:map";
|
|
@@ -10,33 +11,38 @@
|
|
|
10
11
|
|
|
11
12
|
/// Module Settings
|
|
12
13
|
/// @type Map
|
|
13
|
-
/// @prop {Boolean}
|
|
14
|
-
/// @prop {Boolean}
|
|
14
|
+
/// @prop {Boolean} debug-maps [true] Enable or disable debug map output
|
|
15
|
+
/// @prop {Boolean} file-header-comments [true] Enable or disable module/file header comments
|
|
16
|
+
/// @prop {Number} responsive-change [0.5vw] Default responsive amount to modify items using responsive-property mixin
|
|
17
|
+
/// @prop {Number} pixel-em-base [16px] Default base pixel font size for pixel-to-em
|
|
15
18
|
|
|
16
19
|
$config: (
|
|
17
20
|
"debug-maps": true,
|
|
18
|
-
"file-header-comments": true
|
|
21
|
+
"file-header-comments": true,
|
|
22
|
+
"responsive-change": 0.5vw,
|
|
23
|
+
"pixel-em-base" : 16px
|
|
19
24
|
) !default;
|
|
20
25
|
|
|
21
26
|
/// Change modules $config
|
|
22
27
|
/// @param {Map} $changes Map of changes
|
|
23
|
-
/// @example scss - General example
|
|
24
|
-
/// @include
|
|
28
|
+
/// @example scss - General example
|
|
29
|
+
/// @include ulu.utils-set(( "property" : value ));
|
|
30
|
+
|
|
25
31
|
@mixin set($changes) {
|
|
26
32
|
$config: map.merge($config, $changes) !global;
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
/// Get a config option
|
|
30
36
|
/// @param {Map} $name Name of property
|
|
31
|
-
/// @example scss - General example
|
|
32
|
-
/// @include
|
|
37
|
+
/// @example scss - General example
|
|
38
|
+
/// @include ulu.utils-get("property");
|
|
33
39
|
|
|
34
40
|
@function get($name) {
|
|
35
41
|
@return require-map-get($config, $name, 'utils');
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
/// Get a required value from a map, throw an error if not found
|
|
39
|
-
/// -
|
|
45
|
+
/// - Remember that that maps cannot intentionally use null (use false instead, if trying to avoid output if not configured)
|
|
40
46
|
/// @param {Map} $map The map to get the value from
|
|
41
47
|
/// @param {String} $key The key in the map to get value from
|
|
42
48
|
/// @param {String} $context The context of using this function for debugging help
|
|
@@ -58,21 +64,29 @@ $config: (
|
|
|
58
64
|
/// @param {List} $list The map to get the value from
|
|
59
65
|
/// @param {String} $value The value to search for in the list
|
|
60
66
|
/// @param {String} $context The context of using this function for debugging help
|
|
67
|
+
/// @param {String} $warn Display warning instead of throwing error
|
|
61
68
|
|
|
62
|
-
@mixin require-list-has($list, $value, $context: "unknown") {
|
|
63
|
-
$index: list.index($list, $value)
|
|
69
|
+
@mixin require-list-has($list, $value, $context: "unknown", $warn: false) {
|
|
70
|
+
$index: list.index($list, $value);
|
|
64
71
|
@if ($index == null) {
|
|
65
|
-
|
|
72
|
+
$message: 'ULU: Unable to find item "#{ $value }" in #{ $context } list.';
|
|
73
|
+
@if ($warn) {
|
|
74
|
+
@warn $message;
|
|
75
|
+
} @else {
|
|
76
|
+
@error $message;
|
|
77
|
+
}
|
|
66
78
|
}
|
|
67
79
|
}
|
|
68
80
|
|
|
69
81
|
/// Require that the list only is only made up of allowed items
|
|
70
82
|
/// @param {List} $allowed The list of allowed items
|
|
71
83
|
/// @param {String} $list The list to test allowed against
|
|
84
|
+
/// @param {String} $context The context of using this function for debugging help
|
|
85
|
+
/// @param {String} $warn Display warning instead of throwing error
|
|
72
86
|
|
|
73
|
-
@mixin require-list-contains($allowed, $list, $context: "unknown") {
|
|
87
|
+
@mixin require-list-contains($allowed, $list, $context: "unknown", $warn: false) {
|
|
74
88
|
@each $item in $list {
|
|
75
|
-
@include require-list-has($allowed, $item, $context);
|
|
89
|
+
@include require-list-has($allowed, $item, $context, $warn);
|
|
76
90
|
}
|
|
77
91
|
}
|
|
78
92
|
|
|
@@ -148,8 +162,20 @@ $config: (
|
|
|
148
162
|
}
|
|
149
163
|
}
|
|
150
164
|
|
|
165
|
+
/// Returns true/false if map has property
|
|
166
|
+
/// @param {Map} $map Source map
|
|
167
|
+
/// @param {String} $key Property to check for
|
|
168
|
+
/// @return {Boolean}
|
|
169
|
+
|
|
170
|
+
@function map-has($map, $key) {
|
|
171
|
+
@if (meta.type-of($map) != "map") {
|
|
172
|
+
@error "map-has(): Incorrect type for $map (should be map)";
|
|
173
|
+
}
|
|
174
|
+
@return map.get($map, $key) != null;
|
|
175
|
+
}
|
|
176
|
+
|
|
151
177
|
/// Repeatable pattern in core
|
|
152
|
-
/// @deprecated Left in for
|
|
178
|
+
/// @deprecated Left in for compatibility, will be removed, use map-merge with mode
|
|
153
179
|
|
|
154
180
|
@function map-merge-or-overwrite($original, $changes, $deep: false, $overwrite: false) {
|
|
155
181
|
$mode: null;
|
|
@@ -184,6 +210,33 @@ $config: (
|
|
|
184
210
|
@return null;
|
|
185
211
|
}
|
|
186
212
|
|
|
213
|
+
|
|
214
|
+
/// Checks if a map contains one or more of the keys
|
|
215
|
+
/// @param {Map} $map The map to check
|
|
216
|
+
/// @param {List} $keys The list of keys to check for
|
|
217
|
+
/// @param {List} $options Options for how this behaves
|
|
218
|
+
/// @param {List} $options.with-value Requires that at least one of the map entries from the list has a value other than null
|
|
219
|
+
@function map-contains-any($map, $keys, $options: ()) {
|
|
220
|
+
@if (meta.type-of($map) != "map") {
|
|
221
|
+
@error "map-contains-any(): Incorrect type for $map (should be map)";
|
|
222
|
+
}
|
|
223
|
+
@if (meta.type-of($keys) != "list") {
|
|
224
|
+
@error "map-contains-any(): Incorrect type for $keys (should be list)";
|
|
225
|
+
}
|
|
226
|
+
@each $key in $keys {
|
|
227
|
+
@if map.has-key($map, $key) {
|
|
228
|
+
@if map.get($options, "with-value") {
|
|
229
|
+
@if map.get($map, $key) != null {
|
|
230
|
+
@return true;
|
|
231
|
+
}
|
|
232
|
+
} @else {
|
|
233
|
+
@return true;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
@return false;
|
|
238
|
+
}
|
|
239
|
+
|
|
187
240
|
/// Helps in providing a dynamic fallback for modules whose defaults should come from another
|
|
188
241
|
/// @param {String} $prop Property trying to get fallback for
|
|
189
242
|
/// @param {*} $value The value that may need the fallback
|
|
@@ -191,17 +244,34 @@ $config: (
|
|
|
191
244
|
/// @return {*} The user's original value, or if the value is true get the default value from the provided function
|
|
192
245
|
|
|
193
246
|
@function function-fallback($prop, $value, $lookup) {
|
|
247
|
+
$arguments: null;
|
|
194
248
|
// If there was already a value return it else resolve through passed function
|
|
195
249
|
@if ($value == true) {
|
|
196
|
-
$
|
|
197
|
-
|
|
198
|
-
|
|
250
|
+
$function: map.get($lookup, $prop);
|
|
251
|
+
// Allow user to pass a nested map to route to another property
|
|
252
|
+
@if (meta.type-of($function) == "map") {
|
|
253
|
+
$functionMap: $function;
|
|
254
|
+
$function: map.get($functionMap, "function");
|
|
255
|
+
$prop: map.get($functionMap, "property");
|
|
256
|
+
// Arguments will override everything (allow calling functions with args)
|
|
257
|
+
$arguments: map.get($functionMap, "arguments");
|
|
258
|
+
}
|
|
259
|
+
@if ($function) {
|
|
260
|
+
@if ($arguments) {
|
|
261
|
+
@if (meta.type-of($arguments) == "list") {
|
|
262
|
+
@return meta.call($function, $arguments...);
|
|
263
|
+
} @else {
|
|
264
|
+
@error "Arguments must be a list, use single list for single argument ie '(3,)'";
|
|
265
|
+
}
|
|
266
|
+
} @else {
|
|
267
|
+
@return meta.call($function, $prop);
|
|
268
|
+
}
|
|
199
269
|
}
|
|
200
270
|
}
|
|
201
271
|
@return $value;
|
|
202
272
|
}
|
|
203
273
|
|
|
204
|
-
/// Replaces all or one
|
|
274
|
+
/// Replaces all or one occurrence of a string within a string
|
|
205
275
|
/// @param {String} $string String to operate on
|
|
206
276
|
/// @param {String} $find String to find within string
|
|
207
277
|
/// @param {String} $replace String to replace found strings
|
|
@@ -224,3 +294,195 @@ $config: (
|
|
|
224
294
|
@return $string;
|
|
225
295
|
}
|
|
226
296
|
}
|
|
297
|
+
|
|
298
|
+
/// Remove an item from a list (not map)
|
|
299
|
+
/// - Used for excluding things or as general utility
|
|
300
|
+
/// @param {List} $list String to operate on
|
|
301
|
+
/// @param {*} $remove Element in the list to remove
|
|
302
|
+
/// @return {List} New list with item removed
|
|
303
|
+
|
|
304
|
+
@function list-remove($list, $remove) {
|
|
305
|
+
$new-list: ();
|
|
306
|
+
@each $item in $list {
|
|
307
|
+
@if $item != $remove {
|
|
308
|
+
$new-list: list.append($new-list, $item);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
@return $new-list;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/// Remove an item from a list (not map)
|
|
315
|
+
/// - Used for excluding things or as general utility
|
|
316
|
+
/// @param {List} $list String to operate on
|
|
317
|
+
/// @param {List} $remove List elements that should each be removed
|
|
318
|
+
/// @return {List} New list with item removed
|
|
319
|
+
|
|
320
|
+
@function list-without($list, $removal-list) {
|
|
321
|
+
$new-list: ();
|
|
322
|
+
@each $item in $list {
|
|
323
|
+
@if not list.index($removal-list, $item) {
|
|
324
|
+
$new-list: list.append($new-list, $item);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
@return $new-list;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/// Join a list with a separator
|
|
331
|
+
/// @param {List} $list List to join
|
|
332
|
+
/// @param {String} $separator [", "] Separator to use
|
|
333
|
+
/// @param {Boolean} $to-string [true] The resulting list with join separator will be converted to a string (false will return new list with separators added between original items
|
|
334
|
+
/// @return {String|List} If separator was +, the result would be "value1 + value2" or (value1, "+", value2) depending on $to-string argument
|
|
335
|
+
|
|
336
|
+
@function list-join($list, $separator: ", ", $to-string: true) {
|
|
337
|
+
$joined: ();
|
|
338
|
+
$length: list.length($list);
|
|
339
|
+
@for $i from 1 through $length {
|
|
340
|
+
$item: list.nth($list, $i);
|
|
341
|
+
$joined: list.append($joined, $item);
|
|
342
|
+
@if $i < $length {
|
|
343
|
+
$joined: list.append($joined, $separator);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
@if ($to-string) {
|
|
347
|
+
@return #{ $joined };
|
|
348
|
+
} @else {
|
|
349
|
+
@return $joined;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/// Resolve spacing info (ie. margin/padding like arguments)
|
|
354
|
+
/// - Will normalize the argument that may be shorthand or single value
|
|
355
|
+
/// - Used for programmatic things with single value config options for padding/margin
|
|
356
|
+
///
|
|
357
|
+
/// @param {Number|List} $value The value to resolve (usually a config option)
|
|
358
|
+
/// @example scss Example of getting left value
|
|
359
|
+
/// $user-padding: (1em, 2em, 4em);
|
|
360
|
+
/// $spacing: get-spacing($user-padding);
|
|
361
|
+
/// // $spacing ("top" : 1em, "right" : 2em, "bottom" : 4em, "left" : 2em);
|
|
362
|
+
///
|
|
363
|
+
/// .example {
|
|
364
|
+
/// left: map.get($spacing, "left");
|
|
365
|
+
/// // left = 2em
|
|
366
|
+
/// }
|
|
367
|
+
/// @return {Map} Map with spacing info for each side (top, right, bottom, left)
|
|
368
|
+
/// @throw If the list length > 4 (incorrect syntax for shorthand)
|
|
369
|
+
|
|
370
|
+
@function get-spacing($value) {
|
|
371
|
+
$is-list: meta.type-of($value) == "list";
|
|
372
|
+
$length: if($is-list, list.length($value), 1);
|
|
373
|
+
$single: $length == 1;
|
|
374
|
+
$top: if($is-list, list.nth($value, 1), $value); // Top is always the same
|
|
375
|
+
|
|
376
|
+
@if ($length > 4) {
|
|
377
|
+
@error "Spacing has more than 4 arguments (not correct shorthand)";
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
@return (
|
|
381
|
+
"top" : $top,
|
|
382
|
+
"right" : if($single, $top, list.nth($value, 2)),
|
|
383
|
+
"bottom" : if($single, $top, list.nth($value, if($length >= 3, 3, 1))),
|
|
384
|
+
"left" : if($single, $top, list.nth($value, if($length == 4, 4, 2)))
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/// Resolve the top spacing value for margin/padding like arguments
|
|
389
|
+
/// @param {Number|List} $value The value to resolve (usually a config option)
|
|
390
|
+
/// @example scss Example of getting top value
|
|
391
|
+
/// $user-padding: (1em, 2em, 4em);
|
|
392
|
+
///
|
|
393
|
+
/// .example {
|
|
394
|
+
/// top: get-spacing-top($user-padding);
|
|
395
|
+
/// // top = 2em
|
|
396
|
+
/// }
|
|
397
|
+
/// @return {Number}
|
|
398
|
+
|
|
399
|
+
@function get-spacing-top($value) {
|
|
400
|
+
@return map.get(get-spacing($value), "top");
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/// Resolve the right spacing value for margin/padding like arguments
|
|
404
|
+
/// @param {Number|List} $value The value to resolve (usually a config option)
|
|
405
|
+
/// @example scss Example of getting right value
|
|
406
|
+
/// $user-padding: (1em, 2em, 4em);
|
|
407
|
+
///
|
|
408
|
+
/// .example {
|
|
409
|
+
/// right: get-spacing-right($user-padding);
|
|
410
|
+
/// // right = 2em
|
|
411
|
+
/// }
|
|
412
|
+
/// @return {Number}
|
|
413
|
+
|
|
414
|
+
@function get-spacing-right($value) {
|
|
415
|
+
@return map.get(get-spacing($value), "right");
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/// Resolve the bottom spacing value for margin/padding like arguments
|
|
419
|
+
/// @param {Number|List} $value The value to resolve (usually a config option)
|
|
420
|
+
/// @example scss Example of getting bottom value
|
|
421
|
+
/// $user-padding: (1em, 2em, 4em);
|
|
422
|
+
///
|
|
423
|
+
/// .example {
|
|
424
|
+
/// bottom: get-spacing-bottom($user-padding);
|
|
425
|
+
/// // bottom = 2em
|
|
426
|
+
/// }
|
|
427
|
+
/// @return {Number}
|
|
428
|
+
|
|
429
|
+
@function get-spacing-bottom($value) {
|
|
430
|
+
@return map.get(get-spacing($value), "bottom");
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/// Resolve the left spacing value for margin/padding like arguments
|
|
434
|
+
/// @param {Number|List} $value The value to resolve (usually a config option)
|
|
435
|
+
/// @example scss Example of getting left value
|
|
436
|
+
/// $user-padding: (1em, 2em, 4em);
|
|
437
|
+
///
|
|
438
|
+
/// .example {
|
|
439
|
+
/// left: get-spacing-left($user-padding);
|
|
440
|
+
/// // left = 2em
|
|
441
|
+
/// }
|
|
442
|
+
/// @return {Number}
|
|
443
|
+
|
|
444
|
+
@function get-spacing-left($value) {
|
|
445
|
+
@return map.get(get-spacing($value), "left");
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/// Strips the unit from the number
|
|
449
|
+
/// - Normally this shouldn't be needed
|
|
450
|
+
/// @link https://stackoverflow.com/questions/12328259/how-do-you-strip-the-unit-from-any-number-in-sass/12335841#12335841 Original source (Miriam Suzanne)
|
|
451
|
+
|
|
452
|
+
@function strip-unit($value) {
|
|
453
|
+
@return math.div($value, ($value * 0 + 1));
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/// Calculate the size of something at a given scale (percentage/exponential)
|
|
457
|
+
/// @param {Number} $base The number the scale starts at
|
|
458
|
+
/// @param {Number} $ratio The amount the scale changes over one set
|
|
459
|
+
/// @param {Number} $sizes The number of steps in the scale
|
|
460
|
+
/// @param {Number} $size The step you are trying to calculate
|
|
461
|
+
/// @return {Number}
|
|
462
|
+
|
|
463
|
+
@function ratio-scale-size($base, $ratio, $sizes, $size) {
|
|
464
|
+
@return $base * math.pow($ratio, math.div($size, $sizes));
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/// Convert from pixel to em
|
|
468
|
+
/// @param {Number} $pixels The number the scale starts at
|
|
469
|
+
/// @param {Number} $base How many pixels equal 1em
|
|
470
|
+
/// @return {Number} Em Conversion
|
|
471
|
+
|
|
472
|
+
@function pixel-to-em($pixels, $base: get("pixel-em-base")) {
|
|
473
|
+
@return math.div($pixels, $base) + 1em;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/// Provides user with a fallback for a calc that's just an enhancement
|
|
477
|
+
/// @param {String} $property The CSS property to set
|
|
478
|
+
/// @param {*} $value The value to set on the property
|
|
479
|
+
/// @param {Css} $responsive-change The amount to change (vw or vh units) (combined with unit past)
|
|
480
|
+
|
|
481
|
+
@mixin responsive-property(
|
|
482
|
+
$property,
|
|
483
|
+
$value,
|
|
484
|
+
$responsive-change: get("responsive-change")
|
|
485
|
+
) {
|
|
486
|
+
#{ $property } : $value;
|
|
487
|
+
#{ $property } : calc(#{ $value } + #{ $responsive-change });
|
|
488
|
+
}
|
package/scss/base/_color.scss
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
////
|
|
2
2
|
/// @group color
|
|
3
|
+
/// Outputs color base classes
|
|
3
4
|
////
|
|
4
5
|
|
|
5
6
|
@use "../utils";
|
|
6
7
|
@use "../color";
|
|
7
8
|
|
|
8
|
-
///
|
|
9
|
+
/// Outputs color-context styles as base classes (top of stylesheet)
|
|
9
10
|
|
|
10
11
|
@mixin styles {
|
|
11
12
|
@include utils.file-header('base', 'color');
|
package/scss/base/_elements.scss
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
////
|
|
2
2
|
/// @group elements
|
|
3
|
+
/// Outputs general HTML element styles (body, a, etc)
|
|
3
4
|
////
|
|
4
5
|
|
|
5
6
|
@use "sass:map";
|
|
@@ -14,32 +15,36 @@
|
|
|
14
15
|
|
|
15
16
|
/// Module Settings
|
|
16
17
|
/// @type Map
|
|
17
|
-
/// @prop {
|
|
18
|
+
/// @prop {CssValue} details-animation [(UluFadeInDown 350ms ease-in-out)] Animation for the details element when toggled.
|
|
19
|
+
/// @prop {Boolean} link [true] Enables link styling.
|
|
20
|
+
/// @prop {Boolean} link-hover [true] Enables link hover and focus styling.
|
|
21
|
+
/// @prop {Boolean} link-visited [true] Enables visited link styling.
|
|
18
22
|
|
|
19
23
|
$config: (
|
|
24
|
+
"details-animation" : (UluFadeInDown 350ms ease-in-out),
|
|
20
25
|
"link" : true,
|
|
21
|
-
"link
|
|
22
|
-
"link
|
|
26
|
+
"link-hover" : true,
|
|
27
|
+
"link-visited" : false,
|
|
23
28
|
) !default;
|
|
24
29
|
|
|
25
30
|
/// Change modules $config
|
|
26
31
|
/// @param {Map} $changes Map of changes
|
|
27
|
-
/// @example scss - General example
|
|
28
|
-
/// @include
|
|
32
|
+
/// @example scss - General example
|
|
33
|
+
/// @include ulu.base-elements-set(( "property" : value ));
|
|
29
34
|
@mixin set($changes) {
|
|
30
35
|
$config: map.merge($config, $changes) !global;
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
/// Get a config option
|
|
34
39
|
/// @param {Map} $name Name of property
|
|
35
|
-
/// @example scss - General example
|
|
36
|
-
/// @include
|
|
40
|
+
/// @example scss - General example
|
|
41
|
+
/// @include ulu.base-elements-get("property");
|
|
37
42
|
|
|
38
43
|
@function get($name) {
|
|
39
44
|
@return utils.require-map-get($config, $name, "element [config]");
|
|
40
45
|
}
|
|
41
46
|
|
|
42
|
-
///
|
|
47
|
+
/// Output the elements base styles
|
|
43
48
|
/// @name base-elements-styles
|
|
44
49
|
/// @example scss
|
|
45
50
|
/// @include ulu.base-elements-styles();
|
|
@@ -47,7 +52,6 @@ $config: (
|
|
|
47
52
|
@mixin styles {
|
|
48
53
|
|
|
49
54
|
@include utils.file-header('base', 'elements');
|
|
50
|
-
|
|
51
55
|
*,
|
|
52
56
|
::before,
|
|
53
57
|
::after {
|
|
@@ -60,15 +64,7 @@ $config: (
|
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
body {
|
|
63
|
-
|
|
64
|
-
background-color: color.get("background");
|
|
65
|
-
font-family: typography.get("font-family");
|
|
66
|
-
margin: 0;
|
|
67
|
-
// Note we are using relative units here instead of setting a
|
|
68
|
-
// pixel base like we use to on the HTML
|
|
69
|
-
// This will allow the user preference in font size
|
|
70
|
-
// Useful for accessibility
|
|
71
|
-
@include typography.size("base");
|
|
67
|
+
@include styles-body();
|
|
72
68
|
@include breakpoint.embed-for-scripts();
|
|
73
69
|
}
|
|
74
70
|
h1,
|
|
@@ -118,6 +114,9 @@ $config: (
|
|
|
118
114
|
form {
|
|
119
115
|
width: 100%;
|
|
120
116
|
}
|
|
117
|
+
video {
|
|
118
|
+
display: block;
|
|
119
|
+
}
|
|
121
120
|
code,
|
|
122
121
|
kbd,
|
|
123
122
|
samp,
|
|
@@ -147,33 +146,30 @@ $config: (
|
|
|
147
146
|
border-style: none;
|
|
148
147
|
}
|
|
149
148
|
// Not styling ordered lists because they are used in navigation and other UI components
|
|
150
|
-
|
|
149
|
+
// - Would rather explicitly style numbered lists so menus and things
|
|
150
|
+
// don't have to reset. Usually there's only a few type of in content
|
|
151
|
+
// numbered lists and those are styled via classes or wysiwyg
|
|
152
|
+
ul,
|
|
153
|
+
ol {
|
|
151
154
|
list-style: none;
|
|
152
155
|
}
|
|
153
|
-
// Style ordered lists since we don't use them much in the UI components
|
|
154
|
-
ol {
|
|
155
|
-
list-style: none;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
156
|
a {
|
|
159
157
|
// User can disable link styling if they want to add more specific styling
|
|
160
158
|
// and omit this in element base
|
|
161
159
|
@if (get("link")) {
|
|
162
160
|
@include element.link-defaults(
|
|
163
|
-
$hover: get("link
|
|
164
|
-
$visited: get("link
|
|
161
|
+
$hover: get("link-hover"),
|
|
162
|
+
$visited: get("link-visited"),
|
|
165
163
|
);
|
|
166
164
|
}
|
|
167
165
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
[role="tab"] {
|
|
176
|
-
cursor: pointer;
|
|
166
|
+
[disabled],
|
|
167
|
+
:disabled {
|
|
168
|
+
opacity: 0.5;
|
|
169
|
+
cursor: not-allowed;
|
|
170
|
+
}
|
|
171
|
+
button[disabled] {
|
|
172
|
+
pointer-events: none;
|
|
177
173
|
}
|
|
178
174
|
dt {
|
|
179
175
|
font-weight: bold;
|
|
@@ -185,4 +181,34 @@ $config: (
|
|
|
185
181
|
blockquote {
|
|
186
182
|
margin: 0;
|
|
187
183
|
}
|
|
184
|
+
@if get("details-animation") {
|
|
185
|
+
details {
|
|
186
|
+
&[open] {
|
|
187
|
+
summary {
|
|
188
|
+
~ * {
|
|
189
|
+
// Prevent issues with opening these programmatically on firefox
|
|
190
|
+
// - Animation would not be complete in the clone on firefox (looks empty)
|
|
191
|
+
@media screen {
|
|
192
|
+
animation: get("details-animation");
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
audio {
|
|
200
|
+
display: block;
|
|
201
|
+
margin: 1rem 0;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@mixin styles-body() {
|
|
206
|
+
color: color.get('type');
|
|
207
|
+
background-color: color.get("background");
|
|
208
|
+
font-family: typography.get("font-family");
|
|
209
|
+
// Note we are using relative units here instead of setting a
|
|
210
|
+
// pixel base like we use to on the HTML
|
|
211
|
+
// This will allow the user preference in font size
|
|
212
|
+
// Useful for accessibility
|
|
213
|
+
@include typography.size("base");
|
|
188
214
|
}
|
package/scss/base/_index.scss
CHANGED
|
@@ -1,62 +1,99 @@
|
|
|
1
1
|
////
|
|
2
|
-
/// @group
|
|
2
|
+
/// @group index
|
|
3
|
+
/// Output all base styles
|
|
3
4
|
////
|
|
4
5
|
|
|
6
|
+
@forward "root" as root-*;
|
|
5
7
|
@forward "normalize" as normalize-*;
|
|
8
|
+
@forward "print" as print-*;
|
|
9
|
+
@forward "color" as color-*;
|
|
6
10
|
@forward "elements" as elements-*;
|
|
7
11
|
@forward "keyframes" as keyframes-*;
|
|
8
12
|
@forward "typography" as typography-*;
|
|
9
13
|
@forward "layout" as layout-*;
|
|
10
14
|
|
|
11
|
-
@use "sass:
|
|
15
|
+
@use "sass:list";
|
|
16
|
+
|
|
12
17
|
@use "../utils";
|
|
13
18
|
@use "normalize";
|
|
14
|
-
@use "
|
|
19
|
+
@use "root";
|
|
15
20
|
@use "elements";
|
|
21
|
+
@use "print";
|
|
22
|
+
@use "typography";
|
|
16
23
|
@use "color";
|
|
17
24
|
@use "keyframes";
|
|
18
25
|
@use "layout";
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
/// Default includes, all modules
|
|
28
|
+
/// @type List
|
|
21
29
|
|
|
22
|
-
|
|
23
|
-
"normalize"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
30
|
+
$all-includes: (
|
|
31
|
+
"normalize",
|
|
32
|
+
"root"
|
|
33
|
+
"elements,"
|
|
34
|
+
"print",
|
|
35
|
+
"elements",
|
|
36
|
+
"keyframes",
|
|
37
|
+
"typography",
|
|
38
|
+
"color",
|
|
39
|
+
"layout"
|
|
29
40
|
);
|
|
30
41
|
|
|
42
|
+
/// Current included modules (for output when using styles), defaults to all
|
|
43
|
+
/// @type List
|
|
44
|
+
|
|
45
|
+
$current-includes: $all-includes;
|
|
46
|
+
|
|
47
|
+
/// Change default includes (when user prints modules)
|
|
48
|
+
/// - This available as configuration so that it can be configured (to allow easily copying configuration)
|
|
49
|
+
/// @param {List} $includes List of modules by name to be included when styles are printed
|
|
50
|
+
|
|
51
|
+
@mixin set-includes($includes) {
|
|
52
|
+
@include utils.require-list-contains($all-includes, $includes, "base.set-includes", true);
|
|
53
|
+
$current-includes: $includes !global;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/// Exclude certain items from includes
|
|
57
|
+
/// @param {List} $excludes List of item names
|
|
58
|
+
|
|
59
|
+
@mixin set-excludes($excludes) {
|
|
60
|
+
$current-includes: utils.list-without($current-includes, $excludes) !global;
|
|
61
|
+
}
|
|
62
|
+
|
|
31
63
|
/// Prints all Base styles
|
|
32
64
|
/// @name base-styles
|
|
33
|
-
/// @param {List} $includes A list of
|
|
65
|
+
/// @param {List} $includes [$all-includes] A list of components to include (defaults to current)
|
|
34
66
|
/// @example scss
|
|
35
67
|
/// @include ulu.base-styles();
|
|
36
68
|
|
|
37
|
-
@mixin styles($includes:
|
|
69
|
+
@mixin styles($includes: $current-includes) {
|
|
38
70
|
@include utils.file-header("base");
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
@if (map.get($-all-includes, "normalize")) {
|
|
71
|
+
|
|
72
|
+
@include utils.require-list-contains($all-includes, $includes, "base.$includes", true);
|
|
73
|
+
|
|
74
|
+
@if (list.index($includes, "normalize")) {
|
|
44
75
|
@include normalize.styles;
|
|
45
76
|
}
|
|
46
|
-
@if (
|
|
77
|
+
@if (list.index($includes, "root")) {
|
|
78
|
+
@include root.styles;
|
|
79
|
+
}
|
|
80
|
+
@if (list.index($includes, "elements")) {
|
|
47
81
|
@include elements.styles;
|
|
48
82
|
}
|
|
49
|
-
@if (
|
|
83
|
+
@if (list.index($includes, "keyframes")) {
|
|
50
84
|
@include keyframes.styles;
|
|
51
85
|
}
|
|
52
|
-
@if (
|
|
86
|
+
@if (list.index($includes, "typography")) {
|
|
53
87
|
@include typography.styles;
|
|
54
88
|
}
|
|
55
|
-
@if (
|
|
89
|
+
@if (list.index($includes, "color")) {
|
|
56
90
|
@include color.styles;
|
|
57
91
|
}
|
|
58
|
-
@if (
|
|
92
|
+
@if (list.index($includes, "layout")) {
|
|
59
93
|
@include layout.styles;
|
|
60
94
|
}
|
|
95
|
+
@if (list.index($includes, "print")) {
|
|
96
|
+
@include normalize.styles;
|
|
97
|
+
}
|
|
61
98
|
}
|
|
62
99
|
|