@codecademy/gamut-styles 17.9.1-alpha.2ea313.0 → 17.9.1-alpha.3e8b72.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/package.json +3 -3
- package/dist/AssetProvider.d.ts +0 -2
- package/dist/AssetProvider.js +0 -20
- package/dist/Background.d.ts +0 -6
- package/dist/Background.js +0 -66
- package/dist/ColorMode.d.ts +0 -1312
- package/dist/ColorMode.js +0 -134
- package/dist/GamutProvider.d.ts +0 -23
- package/dist/GamutProvider.js +0 -64
- package/dist/cache/createEmotionCache.d.ts +0 -4
- package/dist/cache/createEmotionCache.js +0 -25
- package/dist/cache/index.d.ts +0 -1
- package/dist/cache/index.js +0 -1
- package/dist/cache/stylisPlugins/focusVisible.d.ts +0 -2
- package/dist/cache/stylisPlugins/focusVisible.js +0 -10
- package/dist/cache/stylisPlugins/index.d.ts +0 -1
- package/dist/cache/stylisPlugins/index.js +0 -1
- package/dist/globals/Reboot.d.ts +0 -1
- package/dist/globals/Reboot.js +0 -7
- package/dist/globals/Typography.d.ts +0 -1
- package/dist/globals/Typography.js +0 -20
- package/dist/globals/Variables.d.ts +0 -5
- package/dist/globals/Variables.js +0 -15
- package/dist/globals/index.d.ts +0 -2
- package/dist/globals/index.js +0 -2
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -13
- package/dist/remoteAssets/fonts.d.ts +0 -26
- package/dist/remoteAssets/fonts.js +0 -34
- package/dist/styles/boxShadow.d.ts +0 -26
- package/dist/styles/boxShadow.js +0 -34
- package/dist/styles/fontSmoothing.d.ts +0 -29
- package/dist/styles/fontSmoothing.js +0 -27
- package/dist/styles/index.d.ts +0 -7
- package/dist/styles/index.js +0 -7
- package/dist/styles/noSelect.d.ts +0 -1
- package/dist/styles/noSelect.js +0 -11
- package/dist/styles/pxRem.d.ts +0 -1
- package/dist/styles/pxRem.js +0 -4
- package/dist/styles/responsive.d.ts +0 -6
- package/dist/styles/responsive.js +0 -12
- package/dist/styles/screenReaderOnly.d.ts +0 -2
- package/dist/styles/screenReaderOnly.js +0 -20
- package/dist/styles/transitionConcat.d.ts +0 -3
- package/dist/styles/transitionConcat.js +0 -6
- package/dist/themes/admin.d.ts +0 -966
- package/dist/themes/admin.js +0 -15
- package/dist/themes/core.d.ts +0 -519
- package/dist/themes/core.js +0 -132
- package/dist/themes/index.d.ts +0 -4
- package/dist/themes/index.js +0 -4
- package/dist/themes/lxStudio.d.ts +0 -1080
- package/dist/themes/lxStudio.js +0 -54
- package/dist/themes/platform.d.ts +0 -1157
- package/dist/themes/platform.js +0 -78
- package/dist/typings/theme.d.ts +0 -6
- package/dist/utilities/index.d.ts +0 -1
- package/dist/utilities/index.js +0 -1
- package/dist/utilities/themed.d.ts +0 -14
- package/dist/utilities/themed.js +0 -16
- package/dist/variables/borderRadii.d.ts +0 -8
- package/dist/variables/borderRadii.js +0 -8
- package/dist/variables/colors.d.ts +0 -310
- package/dist/variables/colors.js +0 -170
- package/dist/variables/deprecated-colors.d.ts +0 -156
- package/dist/variables/deprecated-colors.js +0 -156
- package/dist/variables/elements.d.ts +0 -11
- package/dist/variables/elements.js +0 -11
- package/dist/variables/index.d.ts +0 -8
- package/dist/variables/index.js +0 -9
- package/dist/variables/responsive.d.ts +0 -28
- package/dist/variables/responsive.js +0 -28
- package/dist/variables/spacing.d.ts +0 -13
- package/dist/variables/spacing.js +0 -14
- package/dist/variables/timing.d.ts +0 -12
- package/dist/variables/timing.js +0 -12
- package/dist/variables/typography.d.ts +0 -32
- package/dist/variables/typography.js +0 -39
- package/dist/variance/config.d.ts +0 -1052
- package/dist/variance/config.js +0 -514
- package/dist/variance/index.d.ts +0 -3
- package/dist/variance/index.js +0 -3
- package/dist/variance/props.d.ts +0 -1963
- package/dist/variance/props.js +0 -24
- package/dist/variance/utils.d.ts +0 -29
- package/dist/variance/utils.js +0 -34
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/gamut-styles",
|
|
3
3
|
"description": "Styleguide & Component library for codecademy.com",
|
|
4
|
-
"version": "17.9.1-alpha.
|
|
4
|
+
"version": "17.9.1-alpha.3e8b72.0",
|
|
5
5
|
"author": "Jake Hiller <jake@codecademy.com>",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@codecademy/variance": "0.24.1-alpha.
|
|
7
|
+
"@codecademy/variance": "0.24.1-alpha.3e8b72.0",
|
|
8
8
|
"@emotion/is-prop-valid": "^1.1.0",
|
|
9
9
|
"polished": "^4.1.2"
|
|
10
10
|
},
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "nx build @codecademy/gamut-styles"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "3eab6a6745552c0c03fb049875d22255f5a34a13"
|
|
38
38
|
}
|
package/dist/AssetProvider.d.ts
DELETED
package/dist/AssetProvider.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { webFonts } from './remoteAssets/fonts';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Only preload woff2 fonts, since woff1 are only included as fallbacks.
|
|
5
|
-
*/
|
|
6
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
|
-
export const createFontLinks = () => webFonts.filter(f => f.extensions.includes('woff2')).map(({
|
|
8
|
-
filePath
|
|
9
|
-
}) => /*#__PURE__*/_jsx("link", {
|
|
10
|
-
as: "font",
|
|
11
|
-
crossOrigin: "anonymous",
|
|
12
|
-
href: `${filePath}.woff2`,
|
|
13
|
-
rel: "preload",
|
|
14
|
-
type: "font/woff2"
|
|
15
|
-
}, filePath));
|
|
16
|
-
export const AssetProvider = () => {
|
|
17
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
18
|
-
children: createFontLinks()
|
|
19
|
-
});
|
|
20
|
-
};
|
package/dist/Background.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
2
|
-
import { ColorMode, Colors } from './ColorMode';
|
|
3
|
-
export interface BackgroundProps extends Omit<ComponentProps<typeof ColorMode>, 'mode' | 'alwaysSetVariables' | 'bg'> {
|
|
4
|
-
bg: Colors;
|
|
5
|
-
}
|
|
6
|
-
export declare const Background: import("react").ForwardRefExoticComponent<Omit<BackgroundProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/Background.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { getContrast } from 'polished';
|
|
2
|
-
import { forwardRef, useCallback, useMemo } from 'react';
|
|
3
|
-
import { ColorMode, useColorModes } from './ColorMode';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
const isColorAlias = (mode, color) => {
|
|
6
|
-
return Object.keys(mode).includes(color);
|
|
7
|
-
};
|
|
8
|
-
export const Background = /*#__PURE__*/forwardRef(({
|
|
9
|
-
bg,
|
|
10
|
-
...rest
|
|
11
|
-
}, ref) => {
|
|
12
|
-
const [active, activeColors, modes, getColorValue] = useColorModes();
|
|
13
|
-
|
|
14
|
-
/** If a color alias was used then look up the true color key from the active mode */
|
|
15
|
-
const trueColor = useMemo(() => {
|
|
16
|
-
if (isColorAlias(activeColors, bg)) {
|
|
17
|
-
return activeColors[bg];
|
|
18
|
-
}
|
|
19
|
-
return bg;
|
|
20
|
-
}, [bg, activeColors]);
|
|
21
|
-
const getTextContrast = useCallback(foreground => {
|
|
22
|
-
return getContrast(getColorValue(foreground), getColorValue(trueColor));
|
|
23
|
-
}, [trueColor, getColorValue]);
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* This compares the contrast of the selected background color
|
|
27
|
-
* and each color modes body text and returns the mode that has
|
|
28
|
-
* the highest contrast standard. This is not perfect as it is
|
|
29
|
-
* probable that certain color modes will never be reachable if
|
|
30
|
-
* there are more than 2 color modes.
|
|
31
|
-
*
|
|
32
|
-
* This does not guarantee a level of A/AA/AA compliance.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
const accessibleMode = useMemo(() => {
|
|
36
|
-
const {
|
|
37
|
-
[active]: activeMode,
|
|
38
|
-
...otherModes
|
|
39
|
-
} = modes;
|
|
40
|
-
const possibleModes = Object.entries(otherModes);
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Reduce all remaining modes to the mode key with the highest contrast
|
|
44
|
-
* value.
|
|
45
|
-
*
|
|
46
|
-
* TODO: Add a tiebreaker. This could possibly have other dimensions as
|
|
47
|
-
* it will likely fail to return a mode outside of the lightest and
|
|
48
|
-
* darkest versions.
|
|
49
|
-
*/
|
|
50
|
-
const [highestContrastMode] = possibleModes.reduce(([prevMode, prevContrast], [mode, {
|
|
51
|
-
text
|
|
52
|
-
}]) => {
|
|
53
|
-
const contrast = getTextContrast(text);
|
|
54
|
-
|
|
55
|
-
// Keep the higher contrast mode.
|
|
56
|
-
return contrast > prevContrast ? [mode, contrast] : [prevMode, prevContrast];
|
|
57
|
-
}, [active, getTextContrast(activeMode.text)]);
|
|
58
|
-
return highestContrastMode;
|
|
59
|
-
}, [modes, active, getTextContrast]);
|
|
60
|
-
return /*#__PURE__*/_jsx(ColorMode, {
|
|
61
|
-
...rest,
|
|
62
|
-
bg: bg,
|
|
63
|
-
mode: accessibleMode,
|
|
64
|
-
ref: ref
|
|
65
|
-
});
|
|
66
|
-
});
|