@ulu/frontend 0.0.3
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/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/ulu-frontend.min.css +1 -0
- package/dist/ulu-frontend.min.js +1 -0
- package/index.js +2 -0
- package/js/deprecated/doc-ready.js +28 -0
- package/js/deprecated/jquery-prototypes.js +309 -0
- package/js/deprecated/mini-collapsible-popper-positioning.js +126 -0
- package/js/deprecated/mini-collapsible.js +607 -0
- package/js/deprecated/script-loader.js +60 -0
- package/js/events/index.js +42 -0
- package/js/helpers/css-breakpoint.js +247 -0
- package/js/helpers/file-save.js +48 -0
- package/js/helpers/node-data-manager.js +74 -0
- package/js/helpers/pause-youtube-video.js +42 -0
- package/js/helpers/scrollbar-width-property.js +10 -0
- package/js/index.js +15 -0
- package/js/polyfills/element-closest.js +17 -0
- package/js/ui/flipcard.js +202 -0
- package/js/ui/grid.js +67 -0
- package/js/ui/modals.js +219 -0
- package/js/ui/overflow-scroller-pager.js +58 -0
- package/js/ui/overflow-scroller.js +160 -0
- package/js/ui/programmatic-modal.js +91 -0
- package/js/ui/resizer.js +60 -0
- package/js/ui/slider.js +468 -0
- package/js/ui/tabs.js +109 -0
- package/js/ui/tooltip.js +82 -0
- package/js/utils/array.js +28 -0
- package/js/utils/dom.js +122 -0
- package/js/utils/logger.js +69 -0
- package/js/utils/object.js +22 -0
- package/js/utils/performance.js +43 -0
- package/js/utils/regex.js +10 -0
- package/js/utils/string.js +107 -0
- package/js/waypoints/README.md +3 -0
- package/js/waypoints/anchor-menu.js +76 -0
- package/js/waypoints/element-waypoint.js +75 -0
- package/js/waypoints/examples/page-link-menu.md +106 -0
- package/js/waypoints/state-in-attribute.js +32 -0
- package/package.json +38 -0
- package/scss/README.md +58 -0
- package/scss/_breakpoint.scss +190 -0
- package/scss/_button.scss +241 -0
- package/scss/_calculate.scss +64 -0
- package/scss/_color.scss +211 -0
- package/scss/_cssvar.scss +116 -0
- package/scss/_element.scss +276 -0
- package/scss/_grid.scss +699 -0
- package/scss/_index.scss +29 -0
- package/scss/_layout.scss +202 -0
- package/scss/_path.scss +58 -0
- package/scss/_selector.scss +81 -0
- package/scss/_typography.scss +320 -0
- package/scss/_units.scss +47 -0
- package/scss/_utility.scss +12 -0
- package/scss/_utils.scss +209 -0
- package/scss/base/_color.scss +13 -0
- package/scss/base/_elements.scss +188 -0
- package/scss/base/_index.scss +62 -0
- package/scss/base/_keyframes.scss +78 -0
- package/scss/base/_layout.scss +100 -0
- package/scss/base/_normalize.scss +315 -0
- package/scss/base/_typography.scss +41 -0
- package/scss/components/README.md +5 -0
- package/scss/components/README.todos +15 -0
- package/scss/components/_button.scss +95 -0
- package/scss/components/_index.scss +63 -0
- package/scss/components/_links.scss +34 -0
- package/scss/components/_list-lines.scss +73 -0
- package/scss/components/_list-ordered.scss +16 -0
- package/scss/components/_list-unordered.scss +21 -0
- package/scss/components/_rule.scss +93 -0
- package/scss/helpers/_color.scss +14 -0
- package/scss/helpers/_display.scss +73 -0
- package/scss/helpers/_index.scss +67 -0
- package/scss/helpers/_print.scss +58 -0
- package/scss/helpers/_typography.scss +80 -0
- package/scss/helpers/_units.scss +79 -0
- package/scss/helpers/_utilities.scss +102 -0
- package/scss/stylesheets/README.md +3 -0
- package/scss/stylesheets/full.scss +17 -0
- package/trash/js-old/deprecated/doc-ready.js +28 -0
- package/trash/js-old/deprecated/jquery-prototypes.js +309 -0
- package/trash/js-old/deprecated/mini-collapsible-popper-positioning.js +126 -0
- package/trash/js-old/deprecated/mini-collapsible.js +607 -0
- package/trash/js-old/deprecated/script-loader.js +60 -0
- package/trash/js-old/events/index.js +42 -0
- package/trash/js-old/helpers/css-breakpoint.js +247 -0
- package/trash/js-old/helpers/file-save.js +48 -0
- package/trash/js-old/helpers/node-data-manager.js +74 -0
- package/trash/js-old/helpers/pause-youtube-video.js +42 -0
- package/trash/js-old/index.js +15 -0
- package/trash/js-old/polyfills/element-closest.js +17 -0
- package/trash/js-old/ui/flipcard.js +202 -0
- package/trash/js-old/ui/grid.js +67 -0
- package/trash/js-old/ui/modals.js +219 -0
- package/trash/js-old/ui/programmatic-modal.js +91 -0
- package/trash/js-old/ui/resizer.js +60 -0
- package/trash/js-old/ui/slider.js +469 -0
- package/trash/js-old/ui/tabs.js +109 -0
- package/trash/js-old/ui/tooltip.js +82 -0
- package/trash/js-old/utils/array.js +28 -0
- package/trash/js-old/utils/dom.js +122 -0
- package/trash/js-old/utils/logger.js +69 -0
- package/trash/js-old/utils/object.js +22 -0
- package/trash/js-old/utils/performance.js +43 -0
- package/trash/js-old/utils/regex.js +10 -0
- package/trash/js-old/utils/string.js +107 -0
- package/trash/js-old/waypoints/README.md +3 -0
- package/trash/js-old/waypoints/anchor-menu.js +76 -0
- package/trash/js-old/waypoints/element-waypoint.js +75 -0
- package/trash/js-old/waypoints/examples/page-link-menu.md +106 -0
- package/trash/js-old/waypoints/state-in-attribute.js +32 -0
- package/trash/js-old-230729/deprecated/doc-ready.js +28 -0
- package/trash/js-old-230729/deprecated/jquery-prototypes.js +309 -0
- package/trash/js-old-230729/deprecated/mini-collapsible-popper-positioning.js +126 -0
- package/trash/js-old-230729/deprecated/mini-collapsible.js +607 -0
- package/trash/js-old-230729/deprecated/script-loader.js +60 -0
- package/trash/js-old-230729/events/index.js +42 -0
- package/trash/js-old-230729/helpers/css-breakpoint.js +247 -0
- package/trash/js-old-230729/helpers/file-save.js +48 -0
- package/trash/js-old-230729/helpers/node-data-manager.js +74 -0
- package/trash/js-old-230729/helpers/pause-youtube-video.js +42 -0
- package/trash/js-old-230729/helpers/scrollbar-width-property.js +10 -0
- package/trash/js-old-230729/index.js +15 -0
- package/trash/js-old-230729/polyfills/element-closest.js +17 -0
- package/trash/js-old-230729/ui/flipcard.js +202 -0
- package/trash/js-old-230729/ui/grid.js +67 -0
- package/trash/js-old-230729/ui/modals.js +219 -0
- package/trash/js-old-230729/ui/overflow-scroller-pager.js +58 -0
- package/trash/js-old-230729/ui/overflow-scroller.js +160 -0
- package/trash/js-old-230729/ui/programmatic-modal.js +91 -0
- package/trash/js-old-230729/ui/resizer.js +60 -0
- package/trash/js-old-230729/ui/slider.js +468 -0
- package/trash/js-old-230729/ui/tabs.js +109 -0
- package/trash/js-old-230729/ui/tooltip.js +82 -0
- package/trash/js-old-230729/utils/array.js +28 -0
- package/trash/js-old-230729/utils/dom.js +122 -0
- package/trash/js-old-230729/utils/logger.js +69 -0
- package/trash/js-old-230729/utils/object.js +22 -0
- package/trash/js-old-230729/utils/performance.js +43 -0
- package/trash/js-old-230729/utils/regex.js +10 -0
- package/trash/js-old-230729/utils/string.js +107 -0
- package/trash/js-old-230729/waypoints/README.md +3 -0
- package/trash/js-old-230729/waypoints/anchor-menu.js +76 -0
- package/trash/js-old-230729/waypoints/element-waypoint.js +75 -0
- package/trash/js-old-230729/waypoints/examples/page-link-menu.md +106 -0
- package/trash/js-old-230729/waypoints/state-in-attribute.js +32 -0
- package/trash/logo-1.svg +13 -0
- package/trash/logo.svg +16 -0
- package/trash/scss-before-cqc-update/README.md +58 -0
- package/trash/scss-before-cqc-update/_breakpoint.scss +190 -0
- package/trash/scss-before-cqc-update/_button.scss +229 -0
- package/trash/scss-before-cqc-update/_calculate.scss +65 -0
- package/trash/scss-before-cqc-update/_color.scss +211 -0
- package/trash/scss-before-cqc-update/_cssvar.scss +116 -0
- package/trash/scss-before-cqc-update/_element.scss +275 -0
- package/trash/scss-before-cqc-update/_index.scss +29 -0
- package/trash/scss-before-cqc-update/_layout.scss +247 -0
- package/trash/scss-before-cqc-update/_path.scss +59 -0
- package/trash/scss-before-cqc-update/_selector.scss +82 -0
- package/trash/scss-before-cqc-update/_typography.scss +322 -0
- package/trash/scss-before-cqc-update/_units.scss +48 -0
- package/trash/scss-before-cqc-update/_utility.scss +13 -0
- package/trash/scss-before-cqc-update/_utils.scss +211 -0
- package/trash/scss-before-cqc-update/base/_color.scss +14 -0
- package/trash/scss-before-cqc-update/base/_elements.scss +189 -0
- package/trash/scss-before-cqc-update/base/_index.scss +63 -0
- package/trash/scss-before-cqc-update/base/_keyframes.scss +74 -0
- package/trash/scss-before-cqc-update/base/_layout.scss +88 -0
- package/trash/scss-before-cqc-update/base/_normalize.scss +316 -0
- package/trash/scss-before-cqc-update/base/_typography.scss +42 -0
- package/trash/scss-before-cqc-update/components/README.md +5 -0
- package/trash/scss-before-cqc-update/components/README.todos +15 -0
- package/trash/scss-before-cqc-update/components/_button.scss +96 -0
- package/trash/scss-before-cqc-update/components/_grid.scss +671 -0
- package/trash/scss-before-cqc-update/components/_index.scss +70 -0
- package/trash/scss-before-cqc-update/components/_links.scss +35 -0
- package/trash/scss-before-cqc-update/components/_list-lines.scss +74 -0
- package/trash/scss-before-cqc-update/components/_list-ordered.scss +17 -0
- package/trash/scss-before-cqc-update/components/_list-unordered.scss +22 -0
- package/trash/scss-before-cqc-update/components/_rule.scss +94 -0
- package/trash/scss-before-cqc-update/helpers/_color.scss +15 -0
- package/trash/scss-before-cqc-update/helpers/_display.scss +73 -0
- package/trash/scss-before-cqc-update/helpers/_index.scss +68 -0
- package/trash/scss-before-cqc-update/helpers/_print.scss +59 -0
- package/trash/scss-before-cqc-update/helpers/_typography.scss +73 -0
- package/trash/scss-before-cqc-update/helpers/_units.scss +79 -0
- package/trash/scss-before-cqc-update/helpers/_utilities.scss +88 -0
- package/trash/scss-before-cqc-update/stylesheets/README.md +3 -0
- package/trash/scss-before-cqc-update/stylesheets/full.scss +17 -0
- package/trash/scss-old/README.md +58 -0
- package/trash/scss-old/_breakpoint.scss +140 -0
- package/trash/scss-old/_button.scss +223 -0
- package/trash/scss-old/_calculate.scss +64 -0
- package/trash/scss-old/_color.scss +200 -0
- package/trash/scss-old/_element.scss +262 -0
- package/trash/scss-old/_grid.scss +558 -0
- package/trash/scss-old/_index.scss +25 -0
- package/trash/scss-old/_layout.scss +170 -0
- package/trash/scss-old/_path.scss +58 -0
- package/trash/scss-old/_selector.scss +81 -0
- package/trash/scss-old/_typography.scss +320 -0
- package/trash/scss-old/_units.scss +47 -0
- package/trash/scss-old/_utility.scss +12 -0
- package/trash/scss-old/_utils.scss +186 -0
- package/trash/scss-old/base/_color.scss +13 -0
- package/trash/scss-old/base/_elements.scss +183 -0
- package/trash/scss-old/base/_index.scss +62 -0
- package/trash/scss-old/base/_keyframes.scss +74 -0
- package/trash/scss-old/base/_layout.scss +81 -0
- package/trash/scss-old/base/_normalize.scss +316 -0
- package/trash/scss-old/base/_typography.scss +42 -0
- package/trash/scss-old/components/README.md +5 -0
- package/trash/scss-old/components/README.todos +15 -0
- package/trash/scss-old/components/_button.scss +74 -0
- package/trash/scss-old/components/_index.scss +63 -0
- package/trash/scss-old/components/_links.scss +34 -0
- package/trash/scss-old/components/_list-lines.scss +73 -0
- package/trash/scss-old/components/_list-ordered.scss +16 -0
- package/trash/scss-old/components/_list-unordered.scss +21 -0
- package/trash/scss-old/components/_rule.scss +84 -0
- package/trash/scss-old/helpers/_color.scss +14 -0
- package/trash/scss-old/helpers/_display.scss +68 -0
- package/trash/scss-old/helpers/_index.scss +67 -0
- package/trash/scss-old/helpers/_print.scss +59 -0
- package/trash/scss-old/helpers/_typography.scss +73 -0
- package/trash/scss-old/helpers/_units.scss +68 -0
- package/trash/scss-old/helpers/_utilities.scss +82 -0
- package/trash/scss-old/packages/README.md +3 -0
- package/trash/scss-old/packages/everything.scss +17 -0
- package/trash/scss-old-2/README.md +58 -0
- package/trash/scss-old-2/_breakpoint.scss +139 -0
- package/trash/scss-old-2/_button.scss +223 -0
- package/trash/scss-old-2/_calculate.scss +64 -0
- package/trash/scss-old-2/_color.scss +202 -0
- package/trash/scss-old-2/_element.scss +263 -0
- package/trash/scss-old-2/_grid.scss +558 -0
- package/trash/scss-old-2/_index.scss +25 -0
- package/trash/scss-old-2/_layout.scss +170 -0
- package/trash/scss-old-2/_path.scss +58 -0
- package/trash/scss-old-2/_selector.scss +81 -0
- package/trash/scss-old-2/_typography.scss +320 -0
- package/trash/scss-old-2/_units.scss +47 -0
- package/trash/scss-old-2/_utility.scss +12 -0
- package/trash/scss-old-2/_utils.scss +186 -0
- package/trash/scss-old-2/base/_color.scss +13 -0
- package/trash/scss-old-2/base/_elements.scss +182 -0
- package/trash/scss-old-2/base/_index.scss +62 -0
- package/trash/scss-old-2/base/_keyframes.scss +73 -0
- package/trash/scss-old-2/base/_layout.scss +83 -0
- package/trash/scss-old-2/base/_normalize.scss +315 -0
- package/trash/scss-old-2/base/_typography.scss +41 -0
- package/trash/scss-old-2/components/README.md +5 -0
- package/trash/scss-old-2/components/README.todos +15 -0
- package/trash/scss-old-2/components/_button.scss +95 -0
- package/trash/scss-old-2/components/_index.scss +63 -0
- package/trash/scss-old-2/components/_links.scss +33 -0
- package/trash/scss-old-2/components/_list-lines.scss +73 -0
- package/trash/scss-old-2/components/_list-ordered.scss +16 -0
- package/trash/scss-old-2/components/_list-unordered.scss +21 -0
- package/trash/scss-old-2/components/_rule.scss +84 -0
- package/trash/scss-old-2/helpers/_color.scss +14 -0
- package/trash/scss-old-2/helpers/_display.scss +67 -0
- package/trash/scss-old-2/helpers/_index.scss +67 -0
- package/trash/scss-old-2/helpers/_print.scss +58 -0
- package/trash/scss-old-2/helpers/_typography.scss +72 -0
- package/trash/scss-old-2/helpers/_units.scss +68 -0
- package/trash/scss-old-2/helpers/_utilities.scss +81 -0
- package/trash/scss-old-2/packages/README.md +3 -0
- package/trash/scss-old-2/packages/everything.scss +17 -0
- package/trash/scss-old-230729/README.md +58 -0
- package/trash/scss-old-230729/_breakpoint.scss +139 -0
- package/trash/scss-old-230729/_button.scss +223 -0
- package/trash/scss-old-230729/_calculate.scss +64 -0
- package/trash/scss-old-230729/_color.scss +202 -0
- package/trash/scss-old-230729/_element.scss +273 -0
- package/trash/scss-old-230729/_grid.scss +694 -0
- package/trash/scss-old-230729/_index.scss +25 -0
- package/trash/scss-old-230729/_layout.scss +193 -0
- package/trash/scss-old-230729/_path.scss +58 -0
- package/trash/scss-old-230729/_selector.scss +81 -0
- package/trash/scss-old-230729/_typography.scss +320 -0
- package/trash/scss-old-230729/_units.scss +47 -0
- package/trash/scss-old-230729/_utility.scss +12 -0
- package/trash/scss-old-230729/_utils.scss +186 -0
- package/trash/scss-old-230729/base/_color.scss +13 -0
- package/trash/scss-old-230729/base/_elements.scss +188 -0
- package/trash/scss-old-230729/base/_index.scss +62 -0
- package/trash/scss-old-230729/base/_keyframes.scss +73 -0
- package/trash/scss-old-230729/base/_layout.scss +83 -0
- package/trash/scss-old-230729/base/_normalize.scss +315 -0
- package/trash/scss-old-230729/base/_typography.scss +41 -0
- package/trash/scss-old-230729/components/README.md +5 -0
- package/trash/scss-old-230729/components/README.todos +15 -0
- package/trash/scss-old-230729/components/_button.scss +95 -0
- package/trash/scss-old-230729/components/_index.scss +63 -0
- package/trash/scss-old-230729/components/_links.scss +34 -0
- package/trash/scss-old-230729/components/_list-lines.scss +73 -0
- package/trash/scss-old-230729/components/_list-ordered.scss +16 -0
- package/trash/scss-old-230729/components/_list-unordered.scss +21 -0
- package/trash/scss-old-230729/components/_rule.scss +93 -0
- package/trash/scss-old-230729/helpers/_color.scss +14 -0
- package/trash/scss-old-230729/helpers/_display.scss +73 -0
- package/trash/scss-old-230729/helpers/_index.scss +67 -0
- package/trash/scss-old-230729/helpers/_print.scss +58 -0
- package/trash/scss-old-230729/helpers/_typography.scss +72 -0
- package/trash/scss-old-230729/helpers/_units.scss +68 -0
- package/trash/scss-old-230729/helpers/_utilities.scss +87 -0
- package/trash/scss-old-230729/packages/README.md +3 -0
- package/trash/scss-old-230729/packages/everything.scss +17 -0
- package/trash/vue/directives/background-image-url.js +12 -0
- package/trash/vue/helpers/add-required-components.js +14 -0
- package/trash/vue/ui/CollapsibleRegion/CollapsibleRegion.vue +277 -0
- package/trash/vue/ui/CollapsibleRegion/Demo.vue +101 -0
- package/trash/vue/ui/Dropdown/Dropdown.vue +184 -0
- package/trash/vue/ui/Modals/components/Modal.vue +49 -0
- package/trash/vue/ui/Modals/components/Modals.vue +103 -0
- package/trash/vue/ui/Modals/plugin.js +215 -0
- package/trash/vue/ui/Modals/readme.note +10 -0
- package/trash/vue/ui/Modals/reference/example-usage.vue +27 -0
- package/trash/vue/ui/Modals/reference/wcag-example/dialog.js +324 -0
package/scss/_index.scss
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
////
|
|
2
|
+
/// @group index
|
|
3
|
+
////
|
|
4
|
+
/// Main entry for library as single module use
|
|
5
|
+
/// - All modules get namespaced
|
|
6
|
+
/// @example scss - Example of color modules
|
|
7
|
+
/// // Namespaced
|
|
8
|
+
/// ulu.color-get();
|
|
9
|
+
/// // Versus
|
|
10
|
+
/// color.get();
|
|
11
|
+
///
|
|
12
|
+
|
|
13
|
+
@forward "path" as path-*;
|
|
14
|
+
@forward "cssvar" as cssvar-*;
|
|
15
|
+
@forward "color" as color-*;
|
|
16
|
+
@forward "units" as units-*;
|
|
17
|
+
@forward "calculate" as calculate-*;
|
|
18
|
+
@forward "breakpoint" as breakpoint-*;
|
|
19
|
+
@forward "selector" as selector-*;
|
|
20
|
+
@forward "element" as element-*;
|
|
21
|
+
@forward "typography" as typography-*;
|
|
22
|
+
@forward "button" as button-*;
|
|
23
|
+
@forward "utility" as utility-*;
|
|
24
|
+
@forward "layout" as layout-*;
|
|
25
|
+
@forward "grid" as grid-*;
|
|
26
|
+
@forward "base" as base-*;
|
|
27
|
+
@forward "components" as component-*;
|
|
28
|
+
@forward "helpers" as helper-*;
|
|
29
|
+
@forward "utils" as utils-*;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
////
|
|
2
|
+
/// @group layout
|
|
3
|
+
////
|
|
4
|
+
|
|
5
|
+
@use "sass:map";
|
|
6
|
+
@use "sass:list";
|
|
7
|
+
@use "sass:meta";
|
|
8
|
+
@use "utils";
|
|
9
|
+
@use "calculate";
|
|
10
|
+
@use "breakpoint";
|
|
11
|
+
|
|
12
|
+
/// Module Settings
|
|
13
|
+
/// @type Map
|
|
14
|
+
/// @prop {Number} $config.max-width Common max-width for site
|
|
15
|
+
/// @prop {Number} $config.margin Common margin for site
|
|
16
|
+
/// @prop {Number} $config.z-index-fixed Common z-index, above everything
|
|
17
|
+
/// @prop {Number} $config.z-index-sticky Common z-index for sticky or stuck items
|
|
18
|
+
/// @prop {Number} $config.z-index-above Common z-index, below sticky
|
|
19
|
+
|
|
20
|
+
$config: (
|
|
21
|
+
"max-width": 90rem,
|
|
22
|
+
"margin": 2rem,
|
|
23
|
+
"z-index-sticky": 100,
|
|
24
|
+
"z-index-above": 450,
|
|
25
|
+
"z-index-fixed": 1000
|
|
26
|
+
) !default;
|
|
27
|
+
|
|
28
|
+
/// Change modules $config
|
|
29
|
+
/// @param {Map} $changes Map of changes
|
|
30
|
+
/// @include module-name.set(( "property" : value ));
|
|
31
|
+
@mixin set($changes) {
|
|
32
|
+
$config: map.merge($config, $changes) !global;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/// Get a config option
|
|
36
|
+
/// @param {Map} $name Name of property
|
|
37
|
+
/// @include module-name.get("property");
|
|
38
|
+
|
|
39
|
+
@function get($name) {
|
|
40
|
+
@return utils.require-map-get($config, $name, "layout [config]");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
$containers: (
|
|
44
|
+
"container" : (
|
|
45
|
+
"width" : 100%,
|
|
46
|
+
"max-width" : get("max-width"),
|
|
47
|
+
"padding" : (get("margin") get("margin")),
|
|
48
|
+
"breakpoints" : null,
|
|
49
|
+
"responsive" : false,
|
|
50
|
+
"responsive-amount" : 3vw
|
|
51
|
+
)
|
|
52
|
+
) !default;
|
|
53
|
+
|
|
54
|
+
@mixin set-containers($changes, $deep: false, $overwrite: false) {
|
|
55
|
+
$containers: utils.map-merge-or-overwrite($containers, $changes, $deep, $overwrite) !global;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@function get-container($name, $breakpoint: false) {
|
|
59
|
+
$container: utils.require-map-get($containers, $name, "Layout [get-container]");
|
|
60
|
+
$breakpoints: map.get($container, "breakpoints");
|
|
61
|
+
@if ($breakpoint) {
|
|
62
|
+
@return utils.require-map-get($breakpoints, $breakpoint, "[container breakpoint]");
|
|
63
|
+
} @else {
|
|
64
|
+
@return $container;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/// Returns padding to another property including breakpoints
|
|
68
|
+
/// ie. { top: $containers-padding; }
|
|
69
|
+
@mixin match-container-padding($property, $name: "container", $sides: true) {
|
|
70
|
+
$container: get-container($name);
|
|
71
|
+
$breakpoints: map.get($container, "breakpoints");
|
|
72
|
+
#{ $property }: get-container-padding($name, $sides);
|
|
73
|
+
@if $breakpoints {
|
|
74
|
+
@each $breakpoint, $props in $breakpoints {
|
|
75
|
+
$direction: map.get($props, "direction");
|
|
76
|
+
@include breakpoint.from($breakpoint, $direction) {
|
|
77
|
+
#{ $property }: get-container-padding($name, $sides, $breakpoint);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/// For a given property for every breakpoint in a given container
|
|
84
|
+
/// creates a css calc value that will match the containers side margin
|
|
85
|
+
/// The margin is created via empty space when the container hits the max-width
|
|
86
|
+
/// If passing inlude padding it would be the containers
|
|
87
|
+
/// side (x) + the padding. This accounts for the containers max-width to give an absoute value
|
|
88
|
+
@mixin match-container-margin($property, $name: "container", $include-padding: true) {
|
|
89
|
+
$container: get-container($name);
|
|
90
|
+
$breakpoints: map.get($container, "breakpoints");
|
|
91
|
+
$padding: if($include-padding, get-container-padding($name, true), 0);
|
|
92
|
+
$max: map.get($container, "max-width");
|
|
93
|
+
#{ $property }: max(((100vw - $max) / 2) + $padding, $padding);
|
|
94
|
+
@if $breakpoints {
|
|
95
|
+
@each $breakpoint, $props in $breakpoints {
|
|
96
|
+
$direction: map.get($props, "direction");
|
|
97
|
+
@include breakpoint.from($breakpoint, $direction) {
|
|
98
|
+
$pad: if($include-padding, get-container-padding($name, true, $breakpoint), 0);
|
|
99
|
+
#{ $property }: max(((100vw - $max) / 2) + $pad, $pad);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@function get-container-padding($name, $sides: true, $specific-breakpoint: false) {
|
|
106
|
+
$container: get-container($name, $specific-breakpoint);
|
|
107
|
+
$padding: map.get($container, "padding");
|
|
108
|
+
$is-list: meta.type-of($padding) == "list"; // Else number
|
|
109
|
+
@if (not $is-list) {
|
|
110
|
+
@return $padding;
|
|
111
|
+
} @else {
|
|
112
|
+
@return list.nth($padding, if($sides, 2, 1));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@mixin container-padding($name, $sides: true, $ends: true, $specific-breakpoint: false) {
|
|
117
|
+
$container: get-container($name, $specific-breakpoint);
|
|
118
|
+
$responsive: map.get($container, "responsive");
|
|
119
|
+
$x: get-container-padding-x($name, $specific-breakpoint);
|
|
120
|
+
$y: get-container-padding-y($name, $specific-breakpoint);
|
|
121
|
+
$resp-amount: if(meta.type-of($responsive) == number, $responsive, calculate.get("responsive-change"));
|
|
122
|
+
|
|
123
|
+
@if $responsive {
|
|
124
|
+
@if $sides {
|
|
125
|
+
@include calculate.responsive-property("padding-left", $x, $resp-amount);
|
|
126
|
+
@include calculate.responsive-property("padding-right", $x, $resp-amount);
|
|
127
|
+
}
|
|
128
|
+
@if $ends {
|
|
129
|
+
@include calculate.responsive-property("padding-top", $y, $resp-amount);
|
|
130
|
+
@include calculate.responsive-property("padding-bottom", $y, $resp-amount);
|
|
131
|
+
}
|
|
132
|
+
} @else {
|
|
133
|
+
@if $sides {
|
|
134
|
+
padding-left: $x;
|
|
135
|
+
padding-right: $x;
|
|
136
|
+
}
|
|
137
|
+
@if $ends {
|
|
138
|
+
padding-top: $y;
|
|
139
|
+
padding-bottom: $y;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
@function get-container-padding-x($name, $specific-breakpoint: false) {
|
|
144
|
+
@return get-container-padding($name, true, $specific-breakpoint);
|
|
145
|
+
}
|
|
146
|
+
@function get-container-padding-y($name, $specific-breakpoint: false) {
|
|
147
|
+
@return get-container-padding($name, false, $specific-breakpoint);
|
|
148
|
+
}
|
|
149
|
+
@mixin container-styles($name: "container", $specific-breakpoint: false) {
|
|
150
|
+
$container: get-container($name, $specific-breakpoint);
|
|
151
|
+
$breakpoints: map.get($container, "breakpoints");
|
|
152
|
+
|
|
153
|
+
$width: map.get($container, "width");
|
|
154
|
+
// @debug $specific-breakpoint;
|
|
155
|
+
// @if $specific-breakpoint {
|
|
156
|
+
// @debug $container;
|
|
157
|
+
// }
|
|
158
|
+
@if ($width == null) {
|
|
159
|
+
$width: 100%;
|
|
160
|
+
}
|
|
161
|
+
display: block;
|
|
162
|
+
margin-left: auto;
|
|
163
|
+
margin-right: auto;
|
|
164
|
+
width: $width;
|
|
165
|
+
max-width: map.get($container, "max-width");
|
|
166
|
+
@include container-padding($name, $specific-breakpoint: $specific-breakpoint);
|
|
167
|
+
|
|
168
|
+
// Recursive print other breakpoints
|
|
169
|
+
@if $breakpoints and not $specific-breakpoint {
|
|
170
|
+
@each $breakpoint, $props in $breakpoints {
|
|
171
|
+
$direction: map.get($props, "direction");
|
|
172
|
+
@include breakpoint.from($breakpoint, $direction) {
|
|
173
|
+
@include container-styles($name, $breakpoint);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/// Prints clearfix styles
|
|
180
|
+
|
|
181
|
+
@mixin clearfix() {
|
|
182
|
+
&:before,
|
|
183
|
+
&:after {
|
|
184
|
+
content: "";
|
|
185
|
+
display: table;
|
|
186
|
+
flex-basis: 0; // Flexbox, clear fix for pseudo elements in Safari
|
|
187
|
+
order: 1;
|
|
188
|
+
}
|
|
189
|
+
&:after {
|
|
190
|
+
clear: both;
|
|
191
|
+
}
|
|
192
|
+
*zoom: 1;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/// Removes scrollbar with CSS
|
|
196
|
+
@mixin remove-scrollbar() {
|
|
197
|
+
-ms-overflow-style: none; /* for Internet Explorer, Edge */
|
|
198
|
+
scrollbar-width: none; /* for Firefox */
|
|
199
|
+
&::-webkit-scrollbar {
|
|
200
|
+
display: none; /* for Chrome, Safari, and Opera */
|
|
201
|
+
}
|
|
202
|
+
}
|
package/scss/_path.scss
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
////
|
|
2
|
+
/// @group path
|
|
3
|
+
////
|
|
4
|
+
|
|
5
|
+
@use "sass:map";
|
|
6
|
+
@use "sass:string";
|
|
7
|
+
@use "utils";
|
|
8
|
+
|
|
9
|
+
/// Aliases
|
|
10
|
+
/// @type Map
|
|
11
|
+
/// - Important: alias could be used for directory or file so omit trailing slash for directories
|
|
12
|
+
/// - All aliases must start with "#"
|
|
13
|
+
|
|
14
|
+
$aliases: (
|
|
15
|
+
"#Images" : "/images",
|
|
16
|
+
) !default;
|
|
17
|
+
|
|
18
|
+
/// Set aliases or change defaults
|
|
19
|
+
/// @param {Map} $changes Map of changes
|
|
20
|
+
|
|
21
|
+
@mixin set-aliases($changes) {
|
|
22
|
+
$aliases: map.merge($aliases, $changes) !global;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/// Get an aliase's path
|
|
26
|
+
/// @param {String} Name Name of alias
|
|
27
|
+
|
|
28
|
+
@function get-alias($name) {
|
|
29
|
+
@return utils.require-map-get($aliases, $name, '[path alias]');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/// Resolves a Path
|
|
33
|
+
/// - Checks if path is an alias if so rewrite's it
|
|
34
|
+
/// - Future could include rewrites for easier updating or rearranging of legacy things
|
|
35
|
+
/// - Aliases work by starting with "#", Since it's an illegal uri character, needs to be escaped if used as literal, we felt that it was the safest way to mix aliases in with real URLs (so that a dev of a module using path.resolve can always pass paths through (user input unknown if alias)
|
|
36
|
+
/// @example scss
|
|
37
|
+
/// .img {
|
|
38
|
+
/// background-image: url(path.resolve("#Images/branding/logo"));
|
|
39
|
+
/// }
|
|
40
|
+
///
|
|
41
|
+
|
|
42
|
+
@function resolve($path) {
|
|
43
|
+
$is-alias: string.index($path, "#") == 1;
|
|
44
|
+
$dir-index: string.index($path, "/");
|
|
45
|
+
$resolved-path: $path;
|
|
46
|
+
@if $is-alias {
|
|
47
|
+
// Extract alias
|
|
48
|
+
@if $dir-index {
|
|
49
|
+
$alias: string.slice($path, 1, $dir-index - 1);
|
|
50
|
+
@return "#{ get-alias($alias) }#{ string.slice($path, $dir-index) }";
|
|
51
|
+
// Must just be only an alias
|
|
52
|
+
} @else {
|
|
53
|
+
@return "#{ get-alias($path) }";
|
|
54
|
+
}
|
|
55
|
+
} @else {
|
|
56
|
+
@return $path;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
////
|
|
2
|
+
/// @group selector
|
|
3
|
+
////
|
|
4
|
+
|
|
5
|
+
@use "sass:string";
|
|
6
|
+
@use "sass:map";
|
|
7
|
+
@use "utils";
|
|
8
|
+
|
|
9
|
+
/// Module Settings
|
|
10
|
+
/// - This module can be used for dynamic classnames (used in base and some components). Some components selectors are too complex or coupled for dynamic classnames.
|
|
11
|
+
/// @todo See about documenting when a component doesn't run through the selecotr module to get it's base classname
|
|
12
|
+
/// @type Map
|
|
13
|
+
/// @prop {String} $config.prefix Global prefix for selectors (would be used for classname prefix for example)
|
|
14
|
+
|
|
15
|
+
$config: (
|
|
16
|
+
"prefix" : ""
|
|
17
|
+
) !default;
|
|
18
|
+
|
|
19
|
+
// Map to store class overrides ("button" : "site-button") for example
|
|
20
|
+
$-class-overrides: ();
|
|
21
|
+
$-class-wildcards: ();
|
|
22
|
+
|
|
23
|
+
/// Change modules $config
|
|
24
|
+
/// @param {Map} $changes Map of changes
|
|
25
|
+
/// @example scss - General example, replace module-name with module's name
|
|
26
|
+
/// @include module-name.set(( "property" : value ));
|
|
27
|
+
@mixin set($changes) {
|
|
28
|
+
$config: map.merge($config, $changes) !global;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// Get a config option
|
|
32
|
+
/// @param {Map} $name Name of property
|
|
33
|
+
/// @example scss - General example, replace module-name with module's name
|
|
34
|
+
/// @include module-name.get("property");
|
|
35
|
+
|
|
36
|
+
@function get($name) {
|
|
37
|
+
@return utils.require-map-get($config, $name, "selector [config]");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/// Set the class selector overrides
|
|
41
|
+
/// @param {Map} $changes Changes to merge
|
|
42
|
+
|
|
43
|
+
@mixin set-class-overrides($changes) {
|
|
44
|
+
@each $key, $prop in $changes {
|
|
45
|
+
$index: string.index($key, "*");
|
|
46
|
+
@if ($index) {
|
|
47
|
+
$wild-key: string.slice($key, 1, $index - 1);
|
|
48
|
+
$-class-wildcards: map.set($-class-wildcards, $wild-key, $prop) !global;
|
|
49
|
+
$changes: map.remove($changes, $key);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
$-class-overrides: map.merge($-class-overrides, $changes) !global;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/// Used to allow global prefixing of classes, and also the ability to
|
|
56
|
+
/// Change a class used in the system (ie. like a component for example)
|
|
57
|
+
/// @param {String} $class The classname to set
|
|
58
|
+
|
|
59
|
+
@function class($class, $name-only: false) {
|
|
60
|
+
// Check if it's a wildcard
|
|
61
|
+
$wildcard: get-class-wildcard($class);
|
|
62
|
+
$override: map.get($-class-overrides, $class);
|
|
63
|
+
$updated: if($override, $override, if($wildcard, $wildcard, $class));
|
|
64
|
+
$name: "#{ get("prefix") }#{ $updated }";
|
|
65
|
+
@if $name-only {
|
|
66
|
+
@return $name;
|
|
67
|
+
} @else {
|
|
68
|
+
@return ".#{ $name }";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@function get-class-wildcard($class) {
|
|
73
|
+
$change: $class;
|
|
74
|
+
@each $key, $prop in $-class-wildcards {
|
|
75
|
+
$index: string.index($class, $key);
|
|
76
|
+
@if ($index) {
|
|
77
|
+
$change: utils.string-replace($class, $key, $prop);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
@return $change;
|
|
81
|
+
}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
////
|
|
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.
|
|
4
|
+
//// @version 1.0.2
|
|
5
|
+
////
|
|
6
|
+
|
|
7
|
+
@use "sass:map";
|
|
8
|
+
@use "sass:math";
|
|
9
|
+
@use "sass:meta";
|
|
10
|
+
@use "sass:string";
|
|
11
|
+
|
|
12
|
+
@use "color";
|
|
13
|
+
@use "utils";
|
|
14
|
+
@use "utility";
|
|
15
|
+
@use "calculate";
|
|
16
|
+
@use "breakpoint";
|
|
17
|
+
|
|
18
|
+
/// Module Settings
|
|
19
|
+
/// @type Map
|
|
20
|
+
/// @prop {Number} $config.font-size Default font size (use pixels, converted, is used for rem base)
|
|
21
|
+
/// @prop {Number} $config.font-family Default font family
|
|
22
|
+
/// @prop {Number} $config.font-family-monospace Base font-family for monospace
|
|
23
|
+
/// @prop {Number} $config.line-height Default line height
|
|
24
|
+
/// @prop {Number} $config.line-height-dense Default dense line height
|
|
25
|
+
/// @prop {Number} $config.size-ratio Font size scale when using preset sizes, ratio mixin)
|
|
26
|
+
/// @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
|
|
27
|
+
/// @prop {Number} $config.responsive-change Amount to scale typography by browser's width (use viewport units)
|
|
28
|
+
/// @prop {Number} $config.margin Default margin for typography (like paragraphs)
|
|
29
|
+
|
|
30
|
+
$config: (
|
|
31
|
+
"font-size" : 16px,
|
|
32
|
+
"font-family" : (ui-sans-serif, "Open Sans", Helvetica, Arial, sans-serif),
|
|
33
|
+
"font-family-sans" : (ui-sans-serif, "Open Sans", Helvetica, Arial, sans-serif),
|
|
34
|
+
"font-family-serif" : (Cambria, Georgia, serif),
|
|
35
|
+
"font-family-monospace" : (Menlo, Consolas, Monaco, monospace),
|
|
36
|
+
"font-weight" : inherit,
|
|
37
|
+
"font-weight-headline" : bold,
|
|
38
|
+
"font-weight-light" : 300,
|
|
39
|
+
"font-weight-normal" : normal,
|
|
40
|
+
"font-weight-semibold" : 600,
|
|
41
|
+
"font-weight-bold" : bold,
|
|
42
|
+
"line-height" : 1.5,
|
|
43
|
+
"line-height-dense": 1.3,
|
|
44
|
+
"line-height-spaced": 1.75,
|
|
45
|
+
"size-ratio": 2,
|
|
46
|
+
"size-line-height-ratio": 0.97,
|
|
47
|
+
"scale-steps": 5,
|
|
48
|
+
"responsive-change": 0.05vw,
|
|
49
|
+
"margin-bottom": 1em,
|
|
50
|
+
"margin-top": false,
|
|
51
|
+
"letter-spacing-uppercase" : 0.04em,
|
|
52
|
+
"max-width" : 60rem,
|
|
53
|
+
"max-width-small" : 50rem
|
|
54
|
+
) !default;
|
|
55
|
+
|
|
56
|
+
/// Change modules $config
|
|
57
|
+
/// @param {Map} $changes Map of changes
|
|
58
|
+
/// @include typography.set-options(( "font-size" : 14px ));
|
|
59
|
+
|
|
60
|
+
@mixin set($changes) {
|
|
61
|
+
$config: map.merge($config, $changes) !global;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/// Get a config option
|
|
65
|
+
/// @param {Map} $changes Map of changes
|
|
66
|
+
/// @include typography.set-options(( "font-size" : 14px ));
|
|
67
|
+
|
|
68
|
+
@function get($name) {
|
|
69
|
+
@return utils.require-map-get($config, $name, 'typography [config]');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/// Get scale of the base font-size
|
|
73
|
+
/// @param {Number} $step Current size in the scale you want to calculate
|
|
74
|
+
/// @return {Number} Scaled value
|
|
75
|
+
|
|
76
|
+
@function scale($step) {
|
|
77
|
+
@return calculate.ratio-scale-size(get("font-size"), get("size-ratio"), get("scale-steps"), $step);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/// Get scale of the line-height
|
|
81
|
+
/// @param {Number} $step Current size in the scale you want to calculate
|
|
82
|
+
/// @return {Number} Scaled value
|
|
83
|
+
/// @todo Setup breakpoints
|
|
84
|
+
|
|
85
|
+
@function scale-line-height($step) {
|
|
86
|
+
@return calculate.ratio-scale-size(get("line-height"), get("size-line-height-ratio"), get("scale-steps"), $step);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/// Convert pixel value to rem value based on typography $font-size
|
|
90
|
+
/// @param {Number} $pixels Pixel value to convert from
|
|
91
|
+
/// @return {Number} Rem value
|
|
92
|
+
|
|
93
|
+
@function rem($pixels) {
|
|
94
|
+
@if math.unit($pixels) == "px" {
|
|
95
|
+
@return math.div($pixels, get("font-size")) * 1rem;
|
|
96
|
+
} @else {
|
|
97
|
+
@return $pixels + 1rem;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/// Changes pixels to em
|
|
102
|
+
/// @param {Number} $value Pixel value to convert from
|
|
103
|
+
/// @param {Number} $base Conversion base (defaults to font-size)
|
|
104
|
+
/// @return {Number} Rem value
|
|
105
|
+
|
|
106
|
+
@function em($value, $base: null) {
|
|
107
|
+
@if (math.unit($value) == "px") {
|
|
108
|
+
$base: if($base, $base, get("font-size"));
|
|
109
|
+
@return math.div($base, $value) * 1em;
|
|
110
|
+
} @else {
|
|
111
|
+
@return $value;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/// Break word stradegy
|
|
116
|
+
/// @param {Boolean} $force Force words to break (will have unusual breaks)
|
|
117
|
+
|
|
118
|
+
@mixin word-break($force: false) {
|
|
119
|
+
word-break: if($force, break-all, normal);
|
|
120
|
+
word-break: break-word;
|
|
121
|
+
hyphens: auto;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/// Creates a size map
|
|
125
|
+
/// - This is just an accelerator for creating a size map
|
|
126
|
+
/// - You can pass your own size maps using set-sizes()
|
|
127
|
+
/// @param {Number} $font-size Font size
|
|
128
|
+
/// @param {Number} $line-height Line height
|
|
129
|
+
/// @param {Boolean} $is-headline Is a headline
|
|
130
|
+
|
|
131
|
+
@function new-size($font-size, $line-height: true, $is-headline: false) {
|
|
132
|
+
@return (
|
|
133
|
+
"font-size": $font-size,
|
|
134
|
+
"font-weight" : if($is-headline, get("font-weight-headline"), null),
|
|
135
|
+
"line-height": $line-height,
|
|
136
|
+
"responsive" : true,
|
|
137
|
+
"helper-class" : if($is-headline, false, true),
|
|
138
|
+
"helper-class-prefixed" : true,
|
|
139
|
+
"base-class" : if($is-headline, true, false),
|
|
140
|
+
"base-class-prefixed" : false
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/// Default size presets
|
|
145
|
+
/// @type Map
|
|
146
|
+
/// @prop {Number} $size.name Name of size
|
|
147
|
+
/// @prop {Number} $size.name.font-size Font size in rems or pixels
|
|
148
|
+
/// @prop {Number} $size.name.line-height Line height (unitless)
|
|
149
|
+
/// @prop {Number} $size.name.responsive Apply responsive sizes
|
|
150
|
+
/// @prop {Boolean} $size.name.base-class This style should be included in the base (top can be overriden)
|
|
151
|
+
/// @prop {Boolean} $size.name.helper-class This style should be included in the helpers (overrides)
|
|
152
|
+
/// @todo Add adaptive and use a map of breakpoints and whether it's up or down
|
|
153
|
+
/// @todo Add headlines
|
|
154
|
+
|
|
155
|
+
$sizes: (
|
|
156
|
+
"small-x" : new-size(scale(-2)),
|
|
157
|
+
"small" : new-size(scale(-1)),
|
|
158
|
+
"base" : new-size(scale(0)),
|
|
159
|
+
"large" : new-size(scale(1), scale-line-height(1)),
|
|
160
|
+
"large-x" : new-size(scale(2), scale-line-height(2)),
|
|
161
|
+
"large-xx" : new-size(scale(3), scale-line-height(3)),
|
|
162
|
+
"large-xxx" : new-size(scale(4), scale-line-height(4)),
|
|
163
|
+
"h1" : new-size(scale(6), scale-line-height(6), true),
|
|
164
|
+
"h2" : new-size(scale(5), scale-line-height(5), true),
|
|
165
|
+
"h3" : new-size(scale(4), scale-line-height(4), true),
|
|
166
|
+
"h4" : new-size(scale(3), scale-line-height(3), true),
|
|
167
|
+
"h5" : new-size(scale(2), scale-line-height(2), true),
|
|
168
|
+
"h6" : new-size(scale(1), scale-line-height(1), true)
|
|
169
|
+
) !default;
|
|
170
|
+
|
|
171
|
+
/// Update the typography presets map
|
|
172
|
+
/// @param {Map} $changes A map to merge into the color palette
|
|
173
|
+
/// @param {Map} $deep Use deep merge
|
|
174
|
+
/// @param {Map} $overwrite Overwrite the presets completly (cannot be used with deep)
|
|
175
|
+
/// @example scss Setting the error and type color
|
|
176
|
+
/// @include typography.set((
|
|
177
|
+
/// "small" : 0.8rem
|
|
178
|
+
/// ));
|
|
179
|
+
|
|
180
|
+
@mixin set-sizes($changes, $deep: false, $overwrite: false) {
|
|
181
|
+
$sizes: utils.map-merge-or-overwrite($sizes, $changes, $deep, $overwrite) !global;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/// Get a size's map
|
|
185
|
+
/// @param {String} $name Name of size
|
|
186
|
+
/// @return {Map}
|
|
187
|
+
|
|
188
|
+
@function get-size($name) {
|
|
189
|
+
@return utils.require-map-get($sizes, $name, 'typography [size]');
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/// Print a font-size for a given size
|
|
193
|
+
/// @todo Remove doesn't work for breakpoints or responsive
|
|
194
|
+
/// @param {String} $value Size name
|
|
195
|
+
|
|
196
|
+
@function font-size($name: null) {
|
|
197
|
+
$size: get-size($name);
|
|
198
|
+
$font-size: map.get($size, "font-size");
|
|
199
|
+
@return rem($font-size);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/// Forces conversion to unitless line-height
|
|
203
|
+
/// @param {Number} $line-height Line height size in px, em, or rem
|
|
204
|
+
/// @param {Number} $font-size Font size in px, em, or rem
|
|
205
|
+
|
|
206
|
+
@function unitless-line-height($line-height, $font-size) {
|
|
207
|
+
// Font size is rems, line-height is unkown
|
|
208
|
+
@if (math.is-unitless($line-height)) {
|
|
209
|
+
@return $line-height;
|
|
210
|
+
}
|
|
211
|
+
$unit: math.unit($line-height);
|
|
212
|
+
@if ($unit == "em") {
|
|
213
|
+
@return utility.strip-unit($line-height);
|
|
214
|
+
} @else if ($unit == "pixels" or $unit == "rem") {
|
|
215
|
+
$calc: math.div(rem($line-height), rem($font-size));
|
|
216
|
+
@return utility.strip-unit($calc);
|
|
217
|
+
} @else {
|
|
218
|
+
@error "ULU: Unable to convert to unitless line-height for: #{ $line-height }";
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/// Print a value from the size and convert it (to appropriate unit for framework)
|
|
222
|
+
/// @param {Map} $size Size's map
|
|
223
|
+
/// @param {String} $props The property to get
|
|
224
|
+
|
|
225
|
+
@function get-size-converted-value($size, $prop) {
|
|
226
|
+
// Font size is calculated differently
|
|
227
|
+
$value: map.get($size, $prop);
|
|
228
|
+
$font-size: map.get($size, "font-size");
|
|
229
|
+
$type: meta.type-of($value);
|
|
230
|
+
|
|
231
|
+
@if ($value == false or $value == null) {
|
|
232
|
+
@return null;
|
|
233
|
+
// Numbers and true (default) need to be converted
|
|
234
|
+
} @else if ($value == true or $type == number) {
|
|
235
|
+
// Get default value
|
|
236
|
+
@if ($value == true) {
|
|
237
|
+
$value: get($prop);
|
|
238
|
+
}
|
|
239
|
+
// Force line-height to be unitless
|
|
240
|
+
@if ($prop == "line-height") {
|
|
241
|
+
@return unitless-line-height($value, $font-size);
|
|
242
|
+
}
|
|
243
|
+
// Convert to REM
|
|
244
|
+
@if (math.unit($value) == "px") {
|
|
245
|
+
$value: rem($value);
|
|
246
|
+
}
|
|
247
|
+
@return $value;
|
|
248
|
+
} @else {
|
|
249
|
+
@return $value;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
/// Get a sizes property value that doesn't need conversion
|
|
255
|
+
/// - Reason: Will map to default if user set's size prop to true
|
|
256
|
+
/// @param {Map} $size Size's map
|
|
257
|
+
/// @param {String} $props The property to get
|
|
258
|
+
|
|
259
|
+
@function get-size-value($size, $prop) {
|
|
260
|
+
$value: map.get($size, $prop);
|
|
261
|
+
// Default
|
|
262
|
+
@if ($value == true) {
|
|
263
|
+
$value: get($prop);
|
|
264
|
+
}
|
|
265
|
+
@return $value;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/// Print's the responsive type formula
|
|
269
|
+
/// @param {String} $font-size Name to retrieve from sizes map or a unique size map that follows the API
|
|
270
|
+
/// @param {Map} $changes Modifications to be merged into size before using
|
|
271
|
+
|
|
272
|
+
@mixin font-size-responsive($font-size, $amount: get("responsive-change")) {
|
|
273
|
+
font-size: calc(#{ $font-size } + #{ $amount });
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/// Print a typography size (font-size, line-height)
|
|
277
|
+
/// @param {String} $nameOrMap Name to retrieve from sizes map or a unique size map that follows the API
|
|
278
|
+
/// @param {Map} $changes Modifications to be merged into size before using
|
|
279
|
+
|
|
280
|
+
@mixin size($name, $changes: false, $only-font-size: null) {
|
|
281
|
+
$size: $name;
|
|
282
|
+
// Allow custom maps
|
|
283
|
+
@if (meta.type-of($name) == "string") {
|
|
284
|
+
$size: get-size($name);
|
|
285
|
+
}
|
|
286
|
+
@if ($changes) {
|
|
287
|
+
$size: map.merge($size, $changes);
|
|
288
|
+
}
|
|
289
|
+
$font-size: get-size-converted-value($size, "font-size");
|
|
290
|
+
$breakpoints: map.get($size, "breakpoints");
|
|
291
|
+
$responsive: map.get($size, "responsive");
|
|
292
|
+
$color: map.get($size, "color");
|
|
293
|
+
|
|
294
|
+
font-size: $font-size;
|
|
295
|
+
@if ($responsive) {
|
|
296
|
+
@if (meta.type-of($responsive) == "number") {
|
|
297
|
+
@include font-size-responsive($font-size, $responsive);
|
|
298
|
+
} @else {
|
|
299
|
+
@include font-size-responsive($font-size);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
@if (not $only-font-size) {
|
|
303
|
+
font-weight: get-size-value($size, "font-weight");
|
|
304
|
+
font-family: get-size-value($size, "font-family");
|
|
305
|
+
line-height: get-size-converted-value($size, "line-height");
|
|
306
|
+
margin-top: get-size-converted-value($size, "margin-top");
|
|
307
|
+
margin-bottom: get-size-converted-value($size, "margin-bottom");
|
|
308
|
+
color: if($color, color.get($color), null);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// If they have breakpoints, process them
|
|
312
|
+
@if $breakpoints {
|
|
313
|
+
@each $name, $breakpoint in $breakpoints {
|
|
314
|
+
$direction: map.get($breakpoint, "direction");
|
|
315
|
+
@include breakpoint.from($name, $direction) {
|
|
316
|
+
@include size($breakpoint, null, $only-font-size);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|