@codecademy/gamut-styles 14.0.3-alpha.4d61d4.0 → 14.0.3-alpha.712f83.0
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/dist/AssetProvider.js +6 -23
- package/dist/Background.js +45 -42
- package/dist/ColorMode.d.ts +224 -224
- package/dist/ColorMode.js +37 -38
- package/dist/GamutProvider.js +18 -67
- package/dist/cache/createEmotionCache.js +22 -6
- package/dist/cache/stylisPlugins/focusVisible.js +1 -6
- package/dist/globals/Reboot.js +2 -10
- package/dist/globals/Typography.js +3 -14
- package/dist/globals/Variables.js +26 -27
- package/dist/remoteAssets/fonts.js +6 -6
- package/dist/styles/boxShadow.js +18 -8
- package/dist/styles/fontSmoothing.d.ts +1 -1
- package/dist/styles/pxRem.js +1 -2
- package/dist/styles/transitionConcat.js +4 -8
- package/dist/themes/admin.d.ts +10 -10
- package/dist/themes/core.d.ts +6 -6
- package/dist/themes/core.js +2 -2
- package/dist/themes/platform.d.ts +12 -12
- package/dist/variables/colors.js +8 -3
- package/dist/variables/deprecated-colors.js +7 -2
- package/dist/variables/responsive.js +1 -1
- package/dist/variables/timing.js +3 -3
- package/dist/variance/config.js +17 -10
- package/dist/variance/props.d.ts +15 -15
- package/dist/variance/utils.js +15 -13
- package/package.json +11 -3
- package/CHANGELOG.md +0 -1256
- package/babel.config.js +0 -23
- package/project.json +0 -31
- package/tsconfig.json +0 -29
- package/tsconfig.lib.json +0 -26
- package/tsconfig.spec.json +0 -21
package/dist/AssetProvider.js
CHANGED
|
@@ -1,39 +1,22 @@
|
|
|
1
|
-
var _jsxFileName = "/home/circleci/repo/packages/gamut-styles/src/AssetProvider.tsx",
|
|
2
|
-
_this = this;
|
|
3
|
-
|
|
4
|
-
import "core-js/modules/es.array.flat-map.js";
|
|
5
|
-
import "core-js/modules/es.array.unscopables.flat-map.js";
|
|
6
|
-
import "core-js/modules/es.object.to-string.js";
|
|
7
|
-
import "core-js/modules/es.array.map.js";
|
|
8
1
|
import React from 'react';
|
|
9
2
|
import { Helmet } from 'react-helmet';
|
|
10
3
|
import { webFonts } from './remoteAssets/fonts';
|
|
11
|
-
import { jsxDEV as _jsxDEV } from "@emotion/react/jsx-dev-runtime";
|
|
12
4
|
export var createFontLinks = function createFontLinks() {
|
|
13
5
|
return webFonts.flatMap(function (_ref) {
|
|
14
6
|
var filePath = _ref.filePath,
|
|
15
7
|
extensions = _ref.extensions;
|
|
16
8
|
return extensions.map(function (ext) {
|
|
17
|
-
return
|
|
9
|
+
return /*#__PURE__*/React.createElement("link", {
|
|
10
|
+
key: "".concat(filePath, "-").concat(ext),
|
|
18
11
|
rel: "preload",
|
|
19
|
-
href: filePath
|
|
12
|
+
href: "".concat(filePath, ".").concat(ext),
|
|
20
13
|
crossOrigin: "anonymous",
|
|
21
14
|
as: "font",
|
|
22
|
-
type: "font/"
|
|
23
|
-
}
|
|
24
|
-
fileName: _jsxFileName,
|
|
25
|
-
lineNumber: 9,
|
|
26
|
-
columnNumber: 7
|
|
27
|
-
}, _this);
|
|
15
|
+
type: "font/".concat(ext)
|
|
16
|
+
});
|
|
28
17
|
});
|
|
29
18
|
});
|
|
30
19
|
};
|
|
31
20
|
export var AssetProvider = function AssetProvider() {
|
|
32
|
-
return
|
|
33
|
-
children: createFontLinks()
|
|
34
|
-
}, void 0, false, {
|
|
35
|
-
fileName: _jsxFileName,
|
|
36
|
-
lineNumber: 21,
|
|
37
|
-
columnNumber: 10
|
|
38
|
-
}, _this);
|
|
21
|
+
return /*#__PURE__*/React.createElement(Helmet, null, createFontLinks());
|
|
39
22
|
};
|
package/dist/Background.js
CHANGED
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
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 _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
|
|
13
|
+
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); }
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
18
|
+
|
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
+
|
|
21
|
+
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; }
|
|
22
|
+
|
|
23
|
+
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; }
|
|
24
|
+
|
|
24
25
|
import { getContrast } from 'polished';
|
|
25
26
|
import React, { forwardRef, useCallback, useMemo } from 'react';
|
|
26
27
|
import { ColorMode, useColorModes } from './ColorMode';
|
|
27
|
-
import { jsxDEV as _jsxDEV } from "@emotion/react/jsx-dev-runtime";
|
|
28
28
|
|
|
29
29
|
var isColorAlias = function isColorAlias(mode, color) {
|
|
30
30
|
return Object.keys(mode).includes(color);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
export var Background = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
33
|
+
export var Background = /*#__PURE__*/forwardRef(function Background(_ref, ref) {
|
|
34
34
|
var bg = _ref.bg,
|
|
35
|
-
rest =
|
|
35
|
+
rest = _objectWithoutProperties(_ref, ["bg"]);
|
|
36
36
|
|
|
37
37
|
var _useColorModes = useColorModes(),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
_useColorModes2 = _slicedToArray(_useColorModes, 4),
|
|
39
|
+
active = _useColorModes2[0],
|
|
40
|
+
activeColors = _useColorModes2[1],
|
|
41
|
+
modes = _useColorModes2[2],
|
|
42
|
+
getColorValue = _useColorModes2[3];
|
|
42
43
|
/** If a color alias was used then look up the true color key from the active mode */
|
|
43
44
|
|
|
44
45
|
|
|
@@ -64,7 +65,7 @@ export var Background = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
64
65
|
|
|
65
66
|
var accessibleMode = useMemo(function () {
|
|
66
67
|
var activeMode = modes[active],
|
|
67
|
-
otherModes =
|
|
68
|
+
otherModes = _objectWithoutProperties(modes, [active].map(_toPropertyKey));
|
|
68
69
|
|
|
69
70
|
var possibleModes = Object.entries(otherModes);
|
|
70
71
|
/**
|
|
@@ -77,25 +78,27 @@ export var Background = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
77
78
|
*/
|
|
78
79
|
|
|
79
80
|
var _possibleModes$reduce = possibleModes.reduce(function (_ref2, _ref3) {
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
var _ref4 = _slicedToArray(_ref2, 2),
|
|
82
|
+
prevMode = _ref4[0],
|
|
83
|
+
prevContrast = _ref4[1];
|
|
84
|
+
|
|
85
|
+
var _ref5 = _slicedToArray(_ref3, 2),
|
|
86
|
+
mode = _ref5[0],
|
|
87
|
+
text = _ref5[1].text;
|
|
88
|
+
|
|
84
89
|
var contrast = getTextContrast(text); // Keep the higher contrast mode.
|
|
85
90
|
|
|
91
|
+
// Keep the higher contrast mode.
|
|
86
92
|
return contrast > prevContrast ? [mode, contrast] : [prevMode, prevContrast];
|
|
87
93
|
}, [active, getTextContrast(activeMode.text)]),
|
|
88
|
-
|
|
94
|
+
_possibleModes$reduce2 = _slicedToArray(_possibleModes$reduce, 1),
|
|
95
|
+
highestContrastMode = _possibleModes$reduce2[0];
|
|
89
96
|
|
|
90
97
|
return highestContrastMode;
|
|
91
98
|
}, [modes, active, getTextContrast]);
|
|
92
|
-
return
|
|
99
|
+
return /*#__PURE__*/React.createElement(ColorMode, _extends({}, rest, {
|
|
93
100
|
mode: accessibleMode,
|
|
94
101
|
bg: bg,
|
|
95
102
|
ref: ref
|
|
96
|
-
})
|
|
97
|
-
fileName: _jsxFileName,
|
|
98
|
-
lineNumber: 86,
|
|
99
|
-
columnNumber: 12
|
|
100
|
-
}, _this);
|
|
103
|
+
}));
|
|
101
104
|
});
|