@doodl/slate 1.21.3 → 1.22.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 (37) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/js/dist/accordion/accordion.js +2 -0
  3. package/js/dist/react-components/container/index.js +24 -0
  4. package/js/dist/react-components/grid/grid-item.js +35 -0
  5. package/js/dist/react-components/grid/index.js +43 -0
  6. package/js/dist/react-components/grid/padded-grid.js +27 -0
  7. package/js/dist/react-components/section/index.js +28 -0
  8. package/js/dist/react-components/typography/index.js +39 -0
  9. package/js/dist/scroll-spy/scroll-spy.js +2 -1
  10. package/package.json +7 -1
  11. package/scss/_helpers.scss +200 -0
  12. package/scss/_mixins.scss +197 -65
  13. package/scss/core/_base.scss +4 -3
  14. package/scss/core/_button.scss +34 -16
  15. package/scss/core/_layout.scss +5 -56
  16. package/scss/core/_lists.scss +1 -13
  17. package/scss/core/_typography.scss +2 -14
  18. package/scss/core/global-helpers/_button.scss +11 -0
  19. package/scss/core/parts/_container-safe.scss +20 -0
  20. package/scss/core/parts/_grid-safe.scss +147 -0
  21. package/scss/core/parts/_gutter-safe.scss +16 -0
  22. package/scss/core/parts/_lists-safe.scss +15 -0
  23. package/scss/core/parts/_section-safe.scss +27 -0
  24. package/scss/core/parts/_typography-safe.scss +34 -0
  25. package/scss/css-modules/container.module.scss +2 -0
  26. package/scss/css-modules/grid.module.scss +13 -0
  27. package/scss/css-modules/section.module.scss +2 -0
  28. package/scss/css-modules/typography.module.scss +11 -0
  29. package/scss/css-modules/utils.module.scss +3 -0
  30. package/scss/globalcustoms.scss +1 -0
  31. package/scss/silverstripe/_messages.scss +15 -10
  32. package/scss/variables/_base.scss +3 -2
  33. package/scss/variables/_button.scss +9 -8
  34. package/scss/variables/_colours.scss +21 -1
  35. package/scss/variables/_forms.scss +1 -1
  36. package/scss/variables/_menu-bar.scss +2 -1
  37. package/scss/variables/_silverstripe-messages.scss +4 -4
package/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.22.1](https://bitbucket.org/doodlltd/slate/compare/v1.22.0...v1.22.1) (2021-12-22)
6
+
7
+ ## [1.22.0](https://bitbucket.org/doodlltd/slate/compare/v1.21.5...v1.22.0) (2021-12-16)
8
+
9
+
10
+ ### Features
11
+
12
+ * Add basic style customisation through custom CSS properties ([d549499](https://bitbucket.org/doodlltd/slate/commit/d5494998c7afc634a217dca874ab02b17f31eafc))
13
+ * Add react components with modular styles ([0b5a5eb](https://bitbucket.org/doodlltd/slate/commit/0b5a5eb3f90079bce7c30005881162261dff05eb))
14
+
15
+ ### [1.21.5](https://bitbucket.org/doodlltd/slate/compare/v1.21.4...v1.21.5) (2021-09-01)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Resolve missing accessible name from accordion toggle button ([71d22fa](https://bitbucket.org/doodlltd/slate/commit/71d22fa87461efd1d506e11b3c3610ea7fa57b20))
21
+
22
+ ### [1.21.4](https://bitbucket.org/doodlltd/slate/compare/v1.21.3...v1.21.4) (2021-09-01)
23
+
5
24
  ### [1.21.3](https://bitbucket.org/doodlltd/slate/compare/v1.21.2...v1.21.3) (2021-08-19)
6
25
 
7
26
  ### [1.21.2](https://bitbucket.org/doodlltd/slate/compare/v1.21.1...v1.21.2) (2021-07-08)
@@ -115,6 +115,8 @@ var AccordionRow = /*#__PURE__*/function () {
115
115
  _classPrivateFieldGet(_this, _toggleElement).className = _classPrivateFieldGet(_this, _options).toggleBtnClass;
116
116
  _classPrivateFieldGet(_this, _toggleElement).innerHTML = _classPrivateFieldGet(_this, _options).toggleHTML;
117
117
 
118
+ _classPrivateFieldGet(_this, _toggleElement).setAttribute("aria-label", "Expand Menu");
119
+
118
120
  _classPrivateFieldGet(_this, _toggleElement).addEventListener("click", _this.toggleRow);
119
121
 
120
122
  _this.element.parentNode.appendChild(_classPrivateFieldGet(_this, _toggleElement));
@@ -0,0 +1,24 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import React from 'react';
4
+ import classNames from 'classnames';
5
+ import styles from '../../../../scss/css-modules/container.module.scss';
6
+
7
+ var Container = function Container(props) {
8
+ var _classNames;
9
+
10
+ var children = props.children,
11
+ _props$center = props.center,
12
+ center = _props$center === void 0 ? false : _props$center,
13
+ _props$horizontalPadd = props.horizontalPadding,
14
+ horizontalPadding = _props$horizontalPadd === void 0 ? false : _props$horizontalPadd,
15
+ _props$wide = props.wide,
16
+ wide = _props$wide === void 0 ? false : _props$wide,
17
+ className = props.className;
18
+ var containerClass = classNames(styles['container'], (_classNames = {}, _defineProperty(_classNames, styles['center'], center), _defineProperty(_classNames, styles['horizontal-padding'], horizontalPadding), _defineProperty(_classNames, styles['wide'], wide), _classNames), className);
19
+ return /*#__PURE__*/React.createElement("div", {
20
+ className: containerClass
21
+ }, children);
22
+ };
23
+
24
+ export default Container;
@@ -0,0 +1,35 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
+
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
+
13
+ import React from 'react';
14
+ import classNames from "classnames";
15
+ import styles from '../../../../scss/css-modules/grid.module.scss';
16
+
17
+ var GridItem = function GridItem(props) {
18
+ var children = props.children,
19
+ className = props.className,
20
+ _props$component = props.component,
21
+ Component = _props$component === void 0 ? 'div' : _props$component,
22
+ _props$sizes = props.sizes,
23
+ sizes = _props$sizes === void 0 ? "" : _props$sizes;
24
+ var slateGridClassName = styles.slateGridClassName; // Extract dynamic grid item width classname from styles
25
+
26
+ var gridSizes = sizes.split(" ").map(function (size) {
27
+ return styles["".concat(slateGridClassName, "--item-width-").concat(size)];
28
+ });
29
+ var gridItemClasses = classNames.apply(void 0, _toConsumableArray(gridSizes).concat([className]));
30
+ return /*#__PURE__*/React.createElement(Component, {
31
+ className: gridItemClasses
32
+ }, children);
33
+ };
34
+
35
+ export default GridItem;
@@ -0,0 +1,43 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
+
5
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
+
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+
9
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
10
+
11
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
+
13
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
14
+
15
+ import React from 'react';
16
+ import classNames from 'classnames';
17
+ import styles from '../../../../scss/css-modules/grid.module.scss';
18
+
19
+ var Grid = function Grid(props) {
20
+ var _ref;
21
+
22
+ var children = props.children,
23
+ _props$component = props.component,
24
+ Component = _props$component === void 0 ? 'div' : _props$component,
25
+ _props$center = props.center,
26
+ center = _props$center === void 0 ? false : _props$center,
27
+ gridClassName = props.gridClassName,
28
+ _props$sizes = props.sizes,
29
+ sizes = _props$sizes === void 0 ? "" : _props$sizes,
30
+ _props$verticalCenter = props.verticalCenter,
31
+ verticalCenter = _props$verticalCenter === void 0 ? false : _props$verticalCenter;
32
+ var slateGridClassName = styles.slateGridClassName; // Extract dynamic grid width classname from styles
33
+
34
+ var gridSizes = sizes.split(" ").map(function (size) {
35
+ return styles["".concat(slateGridClassName, "-width-").concat(size)];
36
+ });
37
+ var gridClasses = classNames.apply(void 0, [styles[slateGridClassName]].concat(_toConsumableArray(gridSizes), [(_ref = {}, _defineProperty(_ref, styles['center'], center), _defineProperty(_ref, styles['verticalCenter'], verticalCenter), _ref), gridClassName]));
38
+ return /*#__PURE__*/React.createElement(Component, {
39
+ className: gridClasses
40
+ }, children);
41
+ };
42
+
43
+ export default Grid;
@@ -0,0 +1,27 @@
1
+ var _excluded = ["children", "component", "className", "gridClassName"];
2
+
3
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
+
5
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
+
7
+ import React from 'react';
8
+ import classNames from "classnames";
9
+ import Grid from ".";
10
+ import styles from '../../../../scss/css-modules/grid.module.scss';
11
+
12
+ var PaddedGrid = function PaddedGrid(props) {
13
+ var children = props.children,
14
+ _props$component = props.component,
15
+ Component = _props$component === void 0 ? 'div' : _props$component,
16
+ className = props.className,
17
+ gridClassName = props.gridClassName,
18
+ gridProps = _objectWithoutProperties(props, _excluded);
19
+
20
+ var slatePaddedGridClassName = styles.slatePaddedGridClassName;
21
+ var paddedGridClasses = classNames(styles[slatePaddedGridClassName], className);
22
+ return /*#__PURE__*/React.createElement(Component, {
23
+ className: paddedGridClasses
24
+ }, /*#__PURE__*/React.createElement(Grid, gridProps, children));
25
+ };
26
+
27
+ export default PaddedGrid;
@@ -0,0 +1,28 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import React from 'react';
4
+ import classNames from 'classnames';
5
+ import styles from '../../../../scss/css-modules/section.module.scss';
6
+
7
+ var Section = function Section(props) {
8
+ var _classNames;
9
+
10
+ var children = props.children,
11
+ _props$component = props.component,
12
+ Component = _props$component === void 0 ? 'section' : _props$component,
13
+ className = props.className,
14
+ _props$removeBottomPa = props.removeBottomPadding,
15
+ removeBottomPadding = _props$removeBottomPa === void 0 ? false : _props$removeBottomPa,
16
+ _props$removeTopPaddi = props.removeTopPadding,
17
+ removeTopPadding = _props$removeTopPaddi === void 0 ? false : _props$removeTopPaddi,
18
+ _props$removeLeftPadd = props.removeLeftPadding,
19
+ removeLeftPadding = _props$removeLeftPadd === void 0 ? false : _props$removeLeftPadd,
20
+ _props$removeRightPad = props.removeRightPadding,
21
+ removeRightPadding = _props$removeRightPad === void 0 ? false : _props$removeRightPad;
22
+ var classes = classNames(styles.section, (_classNames = {}, _defineProperty(_classNames, styles['remove-bottom-padding'], removeBottomPadding), _defineProperty(_classNames, styles['remove-top-padding'], removeTopPadding), _defineProperty(_classNames, styles['remove-left-padding'], removeLeftPadding), _defineProperty(_classNames, styles['remove-right-padding'], removeRightPadding), _classNames), className);
23
+ return /*#__PURE__*/React.createElement(Component, {
24
+ className: classes
25
+ }, children);
26
+ };
27
+
28
+ export default Section;
@@ -0,0 +1,39 @@
1
+ var _excluded = ["align", "children", "component", "wide", "fullWidth", "removeHorizontalPadding", "removeVerticalPadding"];
2
+
3
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+
7
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
8
+
9
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
+
11
+ import React from 'react';
12
+ import classNames from 'classnames';
13
+ import styles from '../../../../scss/css-modules/typography.module.scss';
14
+
15
+ var Typography = function Typography(props) {
16
+ var _classNames;
17
+
18
+ var _props$align = props.align,
19
+ align = _props$align === void 0 ? "center" : _props$align,
20
+ children = props.children,
21
+ _props$component = props.component,
22
+ Component = _props$component === void 0 ? 'div' : _props$component,
23
+ _props$wide = props.wide,
24
+ wide = _props$wide === void 0 ? false : _props$wide,
25
+ _props$fullWidth = props.fullWidth,
26
+ fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
27
+ _props$removeHorizont = props.removeHorizontalPadding,
28
+ removeHorizontalPadding = _props$removeHorizont === void 0 ? false : _props$removeHorizont,
29
+ _props$removeVertical = props.removeVerticalPadding,
30
+ removeVerticalPadding = _props$removeVertical === void 0 ? false : _props$removeVertical,
31
+ rest = _objectWithoutProperties(props, _excluded);
32
+
33
+ var typographyClasses = classNames(styles.typography, (_classNames = {}, _defineProperty(_classNames, styles['align-left'], align === "left"), _defineProperty(_classNames, styles['align-right'], align === "right"), _defineProperty(_classNames, styles.wide, wide), _defineProperty(_classNames, styles['full-width'], fullWidth), _defineProperty(_classNames, styles['remove-horizontal-padding'], removeHorizontalPadding), _defineProperty(_classNames, styles['remove-vertical-padding'], removeVerticalPadding), _classNames));
34
+ return /*#__PURE__*/React.createElement(Component, _extends({
35
+ className: typographyClasses
36
+ }, rest), children);
37
+ };
38
+
39
+ export default Typography;
@@ -31,7 +31,8 @@ export default (function () {
31
31
  batchOptions: {
32
32
  start: "top 90%",
33
33
  once: true,
34
- interval: 0.5
34
+ interval: 0.5,
35
+ batchMax: 8
35
36
  }
36
37
  }, options); // Output debug messages to console when config.debug is set
37
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doodl/slate",
3
- "version": "1.21.3",
3
+ "version": "1.22.1",
4
4
  "description": "",
5
5
  "main": "./js/dist/index.js",
6
6
  "module": "./js/dist/index.js",
@@ -28,14 +28,20 @@
28
28
  "homepage": "https://bitbucket.org/doodlltd/slate#readme",
29
29
  "devDependencies": {
30
30
  "@babel/cli": "^7.10.4",
31
+ "@babel/preset-react": "^7.16.5",
31
32
  "@doodl/common-js-config": "^1.7.0",
32
33
  "@doodl/eslint-config": "npm:@doodl/common-js-config@^1.7.0",
33
34
  "standard-version": "^9.1.1"
34
35
  },
35
36
  "dependencies": {
37
+ "classnames": "^2.3.1",
36
38
  "core-js": "^3.6.5",
37
39
  "domready": "^1.0.8",
38
40
  "gsap": "^3.4.2",
39
41
  "lodash": "^4.17.19"
42
+ },
43
+ "peerDependencies": {
44
+ "react": ">=16.13.1 <=18",
45
+ "react-dom": ">=16.13.1 <=18"
40
46
  }
41
47
  }
@@ -0,0 +1,200 @@
1
+ @function _hex-to-dec($string) {
2
+ $hex: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f";
3
+ $string: to-lower-case($string);
4
+
5
+ @if $string == "" {
6
+ $string: "ff";
7
+ }
8
+
9
+ $length: str-length($string);
10
+
11
+ $dec: 0;
12
+ @for $i from 1 through $length {
13
+ $factor: 1 + (15 * ($length - $i));
14
+ $index: index($hex, str-slice($string, $i, $i));
15
+ $dec: $dec + $factor * ($index - 1);
16
+ }
17
+
18
+ @return $dec;
19
+ }
20
+
21
+ @function _from-hex($string) {
22
+ $string-lower: to-lower-case($string);
23
+ $r: ""; $g: ""; $b: ""; $a: "";
24
+ $hex: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f";
25
+ $length: str-length($string);
26
+ $max: if($length == 4, 1, 2);
27
+
28
+ // Check for length accuracy
29
+ @if $length != 4 and $length != 7 and $length != 9 {
30
+ @debug "Not accurate";
31
+ @return $string;
32
+ }
33
+
34
+ // Loop from the second character (omitting #)
35
+ @for $i from 2 through $length {
36
+ $c: str-slice($string-lower, $i, $i);
37
+
38
+ // If wrong character, return
39
+ @if index($hex, $c) == null {
40
+ @debug "Wrong character";
41
+ @return $string;
42
+ }
43
+
44
+ @if str-length($r) < $max {
45
+ $r: $r + $c;
46
+ } @else if str-length($g) < $max {
47
+ $g: $g + $c;
48
+ } @else if str-length($b) < $max {
49
+ $b: $b + $c;
50
+ } @else if str-length($a) < $max {
51
+ $a: $a + $c;
52
+ }
53
+ }
54
+
55
+ @if $length == 4 {
56
+ $r: $r + $r;
57
+ $g: $g + $g;
58
+ $b: $b + $b;
59
+ }
60
+
61
+ @return rgba(_hex-to-dec($r), _hex-to-dec($g), _hex-to-dec($b),_hex-to-dec($a));
62
+ }
63
+
64
+ @function is-property($string) {
65
+ @return type-of($string) == "string" and str-index($string, "var") and str-index($string, ",");
66
+ }
67
+
68
+ @function str-trim($string) {
69
+ @if (str-slice($string, 1, 1) == ' ') {
70
+ @return str-trim(str-slice($string, 2));
71
+ } @else if (str-slice($string, str-length($string), -1) == ' ') {
72
+ @return str-trim(str-slice($string, 1, -2));
73
+ } @else {
74
+ @return $string;
75
+ }
76
+ }
77
+
78
+ @function extract-value($string) {
79
+
80
+ @if type-of($string) == "map" {
81
+ @return map-get($string,default);
82
+ }
83
+
84
+ @if not is-property($string) {
85
+ @return $string;
86
+ }
87
+ $result: str-slice($string,str-index($string,",")+1,str-index($string,")")-1);
88
+
89
+ @return str-trim($result);
90
+ }
91
+
92
+ @function extract-property($string) {
93
+
94
+ @if type-of($string) == "map" {
95
+ @return map-get($string,property);
96
+ }
97
+
98
+ @if not is-property($string) {
99
+ @return $string;
100
+ }
101
+ $result: str-slice($string, str-index($string,"--"),str-index($string,",")-1);
102
+
103
+ @return str-trim($result);
104
+ }
105
+
106
+ @function guarantee-colour-value($string) {
107
+ @if is-property($string) {
108
+ $original: extract-value($string);
109
+ @return _from-hex($original);
110
+ }
111
+
112
+ @return $string;
113
+ }
114
+
115
+ @function build-colour-map($key, $colour) {
116
+ @return (
117
+ 100: (property: --#{$key}--100, default: scale-color($colour,$lightness: -40%)),
118
+ 200: (property: --#{$key}--200, default: scale-color($colour,$lightness: -30%)),
119
+ 300: (property: --#{$key}--300, default: scale-color($colour,$lightness: -20%)),
120
+ 400: (property: --#{$key}--400, default: scale-color($colour,$lightness: -10%)),
121
+ 500: (property: --#{$key}, default: $colour),
122
+ 600: (property: --#{$key}--600, default: scale-color($colour,$lightness: 10%)),
123
+ 700: (property: --#{$key}--700, default: scale-color($colour,$lightness: 20%)),
124
+ 800: (property: --#{$key}--800, default: scale-color($colour,$lightness: 30%)),
125
+ 900: (property: --#{$key}--900, default: scale-color($colour,$lightness: 40%)),
126
+ muted: (property: --#{$key}--muted, default: change-color($colour,$lightness: 94%)),
127
+ muted2: (property: --#{$key}--muted2, default: change-color($colour,$lightness: 90%))
128
+ );
129
+ }
130
+
131
+ @function colour-property-from-map($map,$tint: 500) {
132
+ @return var(#{map-get($map,$tint,property)},#{map-get($map,$tint,default)});
133
+ }
134
+
135
+ @mixin define-global-property-alias($key, $property) {
136
+ @if is-property($property) or type-of($property) == "map" {
137
+ $_property: extract-property($property);
138
+ @at-root {
139
+ :root {
140
+ #{$key}: var(#{$_property});
141
+ }
142
+ }
143
+ }
144
+ }
145
+
146
+ @mixin define-global-property-alias-from-map($map,$keyPrefix: "", $keySuffix: "") {
147
+ @each $value, $key in $map {
148
+ @include define-global-property-alias(#{$keyPrefix}#{$key}#{$keySuffix},$value);
149
+ }
150
+ }
151
+
152
+ @mixin assign-variable-property($property, $value, $key, $keyPrefix: "",$keySuffix: "") {
153
+
154
+ $_value: #{extract-value($value)};
155
+
156
+ // Fallback for browsers that don't support custom CSS properties
157
+ #{$property}: $_value;
158
+ @if variable-exists(slate-include-custom-properties) {
159
+ @if $key != 0 {
160
+ // Set value equal to generated custom property name, falling back to $_value if not defined
161
+ #{$property}: var(#{$keyPrefix}#{$key}#{$keySuffix}, $_value);
162
+ // Alias CSS custom property in :root so that values cascade by default
163
+ @if variable-exists(slate-autogenerate-global-property-aliases) {
164
+ @include define-global-property-alias(#{$keyPrefix}#{$key}#{$keySuffix},$value);
165
+ }
166
+ } @else if is-property($value) {
167
+ // Assign the CSS custom property so that the value is inherited
168
+ $_customProperty: #{extract-property($value)};
169
+ #{$property}: var(#{$_customProperty}, $_value);
170
+ }
171
+ }
172
+ }
173
+
174
+ @mixin assign-variable-property-map($property,$map,$keyPrefix: "", $keySuffix:"") {
175
+
176
+ $fallback: ();
177
+ $output: ();
178
+
179
+ @each $value, $key in $map {
180
+
181
+ $_value: extract-value($value);
182
+
183
+ @if $key {
184
+ $output: append($output,var(#{$keyPrefix}#{$key}#{$keySuffix},#{$_value}));
185
+ @if variable-exists(slate-autogenerate-global-property-aliases) {
186
+ // Alias CSS custom property in :root so that values cascade
187
+ @include define-global-property-alias(#{$keyPrefix}#{$key}#{$keySuffix},$value);
188
+ }
189
+ } @else {
190
+ $output: append($output,#{$_value});
191
+ }
192
+
193
+ $fallback: append($fallback,#{$_value});
194
+ }
195
+
196
+ #{$property}: $fallback;
197
+ @if variable-exists(slate-include-custom-properties) {
198
+ #{$property}: $output;
199
+ }
200
+ }