@codecademy/gamut-styles 14.0.2 → 14.0.3-alpha.4d61d4.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/babel.config.js +12 -4
  3. package/dist/AssetProvider.js +23 -6
  4. package/dist/Background.js +42 -45
  5. package/dist/ColorMode.d.ts +224 -224
  6. package/dist/ColorMode.js +38 -37
  7. package/dist/GamutProvider.js +67 -18
  8. package/dist/cache/createEmotionCache.js +6 -22
  9. package/dist/cache/stylisPlugins/focusVisible.js +6 -1
  10. package/dist/globals/Reboot.js +10 -2
  11. package/dist/globals/Typography.js +14 -3
  12. package/dist/globals/Variables.js +27 -26
  13. package/dist/remoteAssets/fonts.js +6 -6
  14. package/dist/styles/boxShadow.js +8 -18
  15. package/dist/styles/fontSmoothing.d.ts +1 -1
  16. package/dist/styles/pxRem.js +2 -1
  17. package/dist/styles/transitionConcat.js +8 -4
  18. package/dist/themes/admin.d.ts +10 -10
  19. package/dist/themes/core.d.ts +6 -6
  20. package/dist/themes/core.js +2 -2
  21. package/dist/themes/platform.d.ts +12 -12
  22. package/dist/variables/colors.js +3 -8
  23. package/dist/variables/deprecated-colors.js +2 -7
  24. package/dist/variables/responsive.js +1 -1
  25. package/dist/variables/timing.js +3 -3
  26. package/dist/variance/config.js +10 -17
  27. package/dist/variance/props.d.ts +15 -15
  28. package/dist/variance/utils.js +13 -15
  29. package/package.json +3 -3
  30. package/project.json +12 -3
  31. package/tsconfig.json +25 -3
  32. package/tsconfig.lib.json +26 -0
  33. package/tsconfig.spec.json +21 -0
  34. package/dist/AssetProvider.js.map +0 -1
  35. package/dist/Background.js.map +0 -1
  36. package/dist/ColorMode.js.map +0 -1
  37. package/dist/GamutProvider.js.map +0 -1
  38. package/dist/__tests__/Background-test.d.ts +0 -1
  39. package/dist/__tests__/GamutProvider-test.d.ts +0 -1
  40. package/dist/cache/__tests__/createEmotionCache-test.d.ts +0 -1
  41. package/dist/cache/createEmotionCache.js.map +0 -1
  42. package/dist/cache/index.js.map +0 -1
  43. package/dist/cache/stylisPlugins/focusVisible.js.map +0 -1
  44. package/dist/cache/stylisPlugins/index.js.map +0 -1
  45. package/dist/globals/Reboot.js.map +0 -1
  46. package/dist/globals/Typography.js.map +0 -1
  47. package/dist/globals/Variables.js.map +0 -1
  48. package/dist/globals/index.js.map +0 -1
  49. package/dist/index.js.map +0 -1
  50. package/dist/remoteAssets/fonts.js.map +0 -1
  51. package/dist/styles/boxShadow.js.map +0 -1
  52. package/dist/styles/fontSmoothing.js.map +0 -1
  53. package/dist/styles/index.js.map +0 -1
  54. package/dist/styles/noSelect.js.map +0 -1
  55. package/dist/styles/pxRem.js.map +0 -1
  56. package/dist/styles/responsive.js.map +0 -1
  57. package/dist/styles/screenReaderOnly.js.map +0 -1
  58. package/dist/styles/transitionConcat.js.map +0 -1
  59. package/dist/themes/__tests__/theme-test.d.ts +0 -1
  60. package/dist/themes/admin.js.map +0 -1
  61. package/dist/themes/core.js.map +0 -1
  62. package/dist/themes/index.js.map +0 -1
  63. package/dist/themes/platform.js.map +0 -1
  64. package/dist/utilities/__tests__/themed-test.d.ts +0 -1
  65. package/dist/utilities/index.js.map +0 -1
  66. package/dist/utilities/themed.js.map +0 -1
  67. package/dist/variables/colors.js.map +0 -1
  68. package/dist/variables/deprecated-colors.js.map +0 -1
  69. package/dist/variables/elements.js.map +0 -1
  70. package/dist/variables/index.js.map +0 -1
  71. package/dist/variables/responsive.js.map +0 -1
  72. package/dist/variables/spacing.js.map +0 -1
  73. package/dist/variables/timing.js.map +0 -1
  74. package/dist/variables/typography.js.map +0 -1
  75. package/dist/variance/config.js.map +0 -1
  76. package/dist/variance/index.js.map +0 -1
  77. package/dist/variance/props.js.map +0 -1
  78. package/dist/variance/utils.js.map +0 -1
  79. package/jest.config.js +0 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ### [14.0.3-alpha.4d61d4.0](https://github.com/Codecademy/gamut/compare/@codecademy/gamut-styles@14.0.2...@codecademy/gamut-styles@14.0.3-alpha.4d61d4.0) (2022-08-01)
7
+
8
+ **Note:** Version bump only for package @codecademy/gamut-styles
9
+
10
+
11
+
12
+
13
+
6
14
  ### [14.0.2](https://github.com/Codecademy/gamut/compare/@codecademy/gamut-styles@14.0.1...@codecademy/gamut-styles@14.0.2) (2022-07-29)
7
15
 
8
16
  **Note:** Version bump only for package @codecademy/gamut-styles
package/babel.config.js CHANGED
@@ -1,8 +1,18 @@
1
1
  module.exports = {
2
- presets: ['codecademy', '@babel/preset-typescript'],
2
+ extends: '../../babel.defaults.js',
3
+ presets: [
4
+ [
5
+ '@nrwl/react/babel',
6
+ {
7
+ runtime: 'automatic',
8
+ useBuiltIns: 'usage',
9
+ importSource: '@emotion/react',
10
+ },
11
+ ],
12
+ ],
3
13
  plugins: [
4
14
  [
5
- '@emotion',
15
+ '@emotion/babel-plugin',
6
16
  {
7
17
  sourceMap: true,
8
18
  autoLabel: 'always',
@@ -10,6 +20,4 @@ module.exports = {
10
20
  },
11
21
  ],
12
22
  ],
13
- include: ['./src/**/*'],
14
- ignore: ['__tests__', './**/*.d.ts'],
15
23
  };
@@ -1,22 +1,39 @@
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";
1
8
  import React from 'react';
2
9
  import { Helmet } from 'react-helmet';
3
10
  import { webFonts } from './remoteAssets/fonts';
11
+ import { jsxDEV as _jsxDEV } from "@emotion/react/jsx-dev-runtime";
4
12
  export var createFontLinks = function createFontLinks() {
5
13
  return webFonts.flatMap(function (_ref) {
6
14
  var filePath = _ref.filePath,
7
15
  extensions = _ref.extensions;
8
16
  return extensions.map(function (ext) {
9
- return /*#__PURE__*/React.createElement("link", {
10
- key: "".concat(filePath, "-").concat(ext),
17
+ return _jsxDEV("link", {
11
18
  rel: "preload",
12
- href: "".concat(filePath, ".").concat(ext),
19
+ href: filePath + "." + ext,
13
20
  crossOrigin: "anonymous",
14
21
  as: "font",
15
- type: "font/".concat(ext)
16
- });
22
+ type: "font/" + ext
23
+ }, filePath + "-" + ext, false, {
24
+ fileName: _jsxFileName,
25
+ lineNumber: 9,
26
+ columnNumber: 7
27
+ }, _this);
17
28
  });
18
29
  });
19
30
  };
20
31
  export var AssetProvider = function AssetProvider() {
21
- return /*#__PURE__*/React.createElement(Helmet, null, createFontLinks());
32
+ return _jsxDEV(Helmet, {
33
+ children: createFontLinks()
34
+ }, void 0, false, {
35
+ fileName: _jsxFileName,
36
+ lineNumber: 21,
37
+ columnNumber: 10
38
+ }, _this);
22
39
  };
@@ -1,45 +1,44 @@
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
-
1
+ import "core-js/modules/es.symbol.to-primitive.js";
2
+ import "core-js/modules/es.date.to-primitive.js";
3
+ import "core-js/modules/es.symbol.js";
4
+ import "core-js/modules/es.symbol.description.js";
5
+ import "core-js/modules/es.number.constructor.js";
6
+ import _objectWithoutPropertiesLoose from "/home/circleci/repo/node_modules/@nrwl/web/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js";
7
+ var _excluded = ["bg"];
8
+
9
+ var _jsxFileName = "/home/circleci/repo/packages/gamut-styles/src/Background.tsx",
10
+ _this = this;
11
+
12
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
13
+
14
+ 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); }
15
+
16
+ import "core-js/modules/es.array.includes.js";
17
+ import "core-js/modules/es.string.includes.js";
18
+ import "core-js/modules/es.object.keys.js";
19
+ import "core-js/modules/es.array.map.js";
20
+ import "core-js/modules/es.object.entries.js";
21
+ import "core-js/modules/es.array.reduce.js";
22
+ import "core-js/modules/es.object.to-string.js";
23
+ import "core-js/modules/es.object.assign.js";
25
24
  import { getContrast } from 'polished';
26
25
  import React, { forwardRef, useCallback, useMemo } from 'react';
27
26
  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 Background(_ref, ref) {
33
+ export var Background = /*#__PURE__*/forwardRef(function (_ref, ref) {
34
34
  var bg = _ref.bg,
35
- rest = _objectWithoutProperties(_ref, ["bg"]);
35
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
36
36
 
37
37
  var _useColorModes = useColorModes(),
38
- _useColorModes2 = _slicedToArray(_useColorModes, 4),
39
- active = _useColorModes2[0],
40
- activeColors = _useColorModes2[1],
41
- modes = _useColorModes2[2],
42
- getColorValue = _useColorModes2[3];
38
+ active = _useColorModes[0],
39
+ activeColors = _useColorModes[1],
40
+ modes = _useColorModes[2],
41
+ getColorValue = _useColorModes[3];
43
42
  /** If a color alias was used then look up the true color key from the active mode */
44
43
 
45
44
 
@@ -65,7 +64,7 @@ export var Background = /*#__PURE__*/forwardRef(function Background(_ref, ref) {
65
64
 
66
65
  var accessibleMode = useMemo(function () {
67
66
  var activeMode = modes[active],
68
- otherModes = _objectWithoutProperties(modes, [active].map(_toPropertyKey));
67
+ otherModes = _objectWithoutPropertiesLoose(modes, [active].map(_toPropertyKey));
69
68
 
70
69
  var possibleModes = Object.entries(otherModes);
71
70
  /**
@@ -78,27 +77,25 @@ export var Background = /*#__PURE__*/forwardRef(function Background(_ref, ref) {
78
77
  */
79
78
 
80
79
  var _possibleModes$reduce = possibleModes.reduce(function (_ref2, _ref3) {
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
-
80
+ var prevMode = _ref2[0],
81
+ prevContrast = _ref2[1];
82
+ var mode = _ref3[0],
83
+ text = _ref3[1].text;
89
84
  var contrast = getTextContrast(text); // Keep the higher contrast mode.
90
85
 
91
- // Keep the higher contrast mode.
92
86
  return contrast > prevContrast ? [mode, contrast] : [prevMode, prevContrast];
93
87
  }, [active, getTextContrast(activeMode.text)]),
94
- _possibleModes$reduce2 = _slicedToArray(_possibleModes$reduce, 1),
95
- highestContrastMode = _possibleModes$reduce2[0];
88
+ highestContrastMode = _possibleModes$reduce[0];
96
89
 
97
90
  return highestContrastMode;
98
91
  }, [modes, active, getTextContrast]);
99
- return /*#__PURE__*/React.createElement(ColorMode, _extends({}, rest, {
92
+ return _jsxDEV(ColorMode, Object.assign({}, rest, {
100
93
  mode: accessibleMode,
101
94
  bg: bg,
102
95
  ref: ref
103
- }));
96
+ }), void 0, false, {
97
+ fileName: _jsxFileName,
98
+ lineNumber: 86,
99
+ columnNumber: 12
100
+ }, _this);
104
101
  });