@codecademy/gamut-styles 17.11.3 → 17.11.4-alpha.c42e1a.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/GamutProvider.js +9 -1
- package/package.json +3 -2
package/dist/GamutProvider.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CacheProvider, ThemeProvider } from '@emotion/react';
|
|
2
|
-
import {
|
|
2
|
+
import { setNonce } from 'get-nonce';
|
|
3
|
+
import { useContext, useEffect, useRef } from 'react';
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import { createEmotionCache } from './cache';
|
|
5
6
|
import { Reboot, Typography } from './globals';
|
|
@@ -27,6 +28,13 @@ export const GamutProvider = ({
|
|
|
27
28
|
const shouldCreateCache = useCache && !hasCache;
|
|
28
29
|
const shouldInsertGlobals = useGlobals && !hasGlobals;
|
|
29
30
|
|
|
31
|
+
// Feed nonce to get-nonce singleton so react-style-singleton (e.g. via react-aria-components) can set it on injected style tags for CSP
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (nonce) {
|
|
34
|
+
setNonce(nonce);
|
|
35
|
+
}
|
|
36
|
+
}, [nonce]);
|
|
37
|
+
|
|
30
38
|
// Do not initialize a new cache if one has been provided as props
|
|
31
39
|
const activeCache = useRef(shouldCreateCache && (cache ?? createEmotionCache(nonce ? {
|
|
32
40
|
nonce
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/gamut-styles",
|
|
3
3
|
"description": "Styleguide & Component library for codecademy.com",
|
|
4
|
-
"version": "17.11.
|
|
4
|
+
"version": "17.11.4-alpha.c42e1a.0",
|
|
5
5
|
"author": "Jake Hiller <jake@codecademy.com>",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@codecademy/variance": "0.25.2",
|
|
8
8
|
"@emotion/is-prop-valid": "^1.1.0",
|
|
9
|
+
"get-nonce": "^1.0.0",
|
|
9
10
|
"polished": "^4.1.2"
|
|
10
11
|
},
|
|
11
12
|
"files": [
|
|
@@ -34,5 +35,5 @@
|
|
|
34
35
|
"scripts": {
|
|
35
36
|
"build": "nx build @codecademy/gamut-styles"
|
|
36
37
|
},
|
|
37
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "c5f3fe0eac9f42896b650d96ab0e07994e71c14f"
|
|
38
39
|
}
|