@compiled/react
Advanced tools
Comparing version 0.10.1 to 0.10.2
@@ -0,1 +1,2 @@ | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { keyframes } from '@compiled/react'; | ||
@@ -2,0 +3,0 @@ export var fadeOut = keyframes({ |
@@ -1,5 +0,9 @@ | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -13,3 +17,3 @@ var selectorsToWarn = [':first-child', ':nth-child']; | ||
} | ||
return console.error.apply(console, __spreadArray(["\n \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557\n\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551\n\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\n \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D\n\n @compiled/react/runtime - DEV WARNING\n\n " + str + "\n"], args)); | ||
return console.error.apply(console, __spreadArray(["\n \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557\n\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551\n\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\n \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D\n\n @compiled/react/runtime - DEV WARNING\n\n ".concat(str, "\n")], args, false)); | ||
}; | ||
@@ -22,3 +26,3 @@ export var analyzeCssInDev = function (sheet) { | ||
if (shouldWarnAboutSelectors) { | ||
warn("Selectors \"" + selectorsToWarn.join(', ') + "\" are dangerous to use when server side rendering.\n Alternatively try and use \":nth-of-type\", or placing data attributes and targetting those instead.\n Read https://compiledcssinjs.com/docs/server-side-rendering for more advice."); | ||
warn("Selectors \"".concat(selectorsToWarn.join(', '), "\" are dangerous to use when server side rendering.\n Alternatively try and use \":nth-of-type\", or placing data attributes and targetting those instead.\n Read https://compiledcssinjs.com/docs/server-side-rendering for more advice.")); | ||
} | ||
@@ -25,0 +29,0 @@ hasWarned[sheet] = true; |
@@ -14,6 +14,4 @@ /** | ||
export var isNodeEnvironment = function () { | ||
var _a; | ||
// https://nodejs.org/api/process.html#process_process_release | ||
return typeof process !== 'undefined' && ((_a = process === null || process === void 0 ? void 0 : process.release) === null || _a === void 0 ? void 0 : _a.name) === 'node'; | ||
return typeof window === 'undefined'; | ||
}; | ||
//# sourceMappingURL=is-node.js.map |
@@ -0,1 +1,2 @@ | ||
import { isCacheDisabled } from './cache'; | ||
/** | ||
@@ -73,4 +74,7 @@ * Ordered style buckets using their short psuedo name. | ||
tag.appendChild(document.createTextNode('')); | ||
document.head.insertBefore(tag, nextBucketFromCache); | ||
if (isCacheDisabled()) { | ||
return tag; | ||
} | ||
styleBucketsInHead[bucketName] = tag; | ||
document.head.insertBefore(tag, nextBucketFromCache); | ||
} | ||
@@ -77,0 +81,0 @@ return styleBucketsInHead[bucketName]; |
import * as React from 'react'; | ||
import { createContext, useContext } from 'react'; | ||
import { isCacheDisabled } from './cache'; | ||
import { isNodeEnvironment } from './is-node'; | ||
@@ -25,2 +26,5 @@ /** | ||
export var useCache = function () { | ||
if (isCacheDisabled()) { | ||
return {}; | ||
} | ||
if (false) { | ||
@@ -27,0 +31,0 @@ // On the server we use React Context to we don't leak the cache between SSR calls. |
@@ -6,5 +6,5 @@ "use strict"; | ||
function ClassNames(_props) { | ||
throw error_1.createSetupError(); | ||
throw (0, error_1.createSetupError)(); | ||
} | ||
exports.ClassNames = ClassNames; | ||
//# sourceMappingURL=index.js.map |
@@ -10,5 +10,5 @@ "use strict"; | ||
} | ||
throw error_1.createSetupError(); | ||
throw (0, error_1.createSetupError)(); | ||
} | ||
exports.default = css; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.namedFadeOut = exports.fadeOut = void 0; | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
var react_1 = require("@compiled/react"); | ||
exports.fadeOut = react_1.keyframes({ | ||
exports.fadeOut = (0, react_1.keyframes)({ | ||
from: { | ||
@@ -7,0 +8,0 @@ opacity: 1, |
@@ -10,5 +10,5 @@ "use strict"; | ||
} | ||
throw error_1.createSetupError(); | ||
throw (0, error_1.createSetupError)(); | ||
} | ||
exports.keyframes = keyframes; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -16,3 +20,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
} | ||
return console.error.apply(console, __spreadArray(["\n \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557\n\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551\n\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\n \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D\n\n @compiled/react/runtime - DEV WARNING\n\n " + str + "\n"], args)); | ||
return console.error.apply(console, __spreadArray(["\n \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557\n\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551\n\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\n \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D\n\n @compiled/react/runtime - DEV WARNING\n\n ".concat(str, "\n")], args, false)); | ||
}; | ||
@@ -25,3 +29,3 @@ var analyzeCssInDev = function (sheet) { | ||
if (shouldWarnAboutSelectors) { | ||
warn("Selectors \"" + selectorsToWarn.join(', ') + "\" are dangerous to use when server side rendering.\n Alternatively try and use \":nth-of-type\", or placing data attributes and targetting those instead.\n Read https://compiledcssinjs.com/docs/server-side-rendering for more advice."); | ||
warn("Selectors \"".concat(selectorsToWarn.join(', '), "\" are dangerous to use when server side rendering.\n Alternatively try and use \":nth-of-type\", or placing data attributes and targetting those instead.\n Read https://compiledcssinjs.com/docs/server-side-rendering for more advice.")); | ||
} | ||
@@ -28,0 +32,0 @@ hasWarned[sheet] = true; |
@@ -17,7 +17,5 @@ "use strict"; | ||
var isNodeEnvironment = function () { | ||
var _a; | ||
// https://nodejs.org/api/process.html#process_process_release | ||
return typeof process !== 'undefined' && ((_a = process === null || process === void 0 ? void 0 : process.release) === null || _a === void 0 ? void 0 : _a.name) === 'node'; | ||
return typeof window === 'undefined'; | ||
}; | ||
exports.isNodeEnvironment = isNodeEnvironment; | ||
//# sourceMappingURL=is-node.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getStyleBucketName = exports.styleBucketOrdering = void 0; | ||
var cache_1 = require("./cache"); | ||
/** | ||
@@ -76,4 +77,7 @@ * Ordered style buckets using their short psuedo name. | ||
tag.appendChild(document.createTextNode('')); | ||
document.head.insertBefore(tag, nextBucketFromCache); | ||
if (false) { | ||
return tag; | ||
} | ||
styleBucketsInHead[bucketName] = tag; | ||
document.head.insertBefore(tag, nextBucketFromCache); | ||
} | ||
@@ -126,3 +130,3 @@ return styleBucketsInHead[bucketName]; | ||
function insertRule(css, opts) { | ||
var bucketName = exports.getStyleBucketName(css); | ||
var bucketName = (0, exports.getStyleBucketName)(css); | ||
var style = lazyAddStyleBucketToHead(bucketName, opts); | ||
@@ -129,0 +133,0 @@ if (process.env.NODE_ENV === 'production') { |
@@ -25,2 +25,3 @@ "use strict"; | ||
var react_1 = require("react"); | ||
var cache_1 = require("./cache"); | ||
var is_node_1 = require("./is-node"); | ||
@@ -31,4 +32,4 @@ /** | ||
*/ | ||
var Cache = is_node_1.isNodeEnvironment() ? react_1.createContext(null) : {}; | ||
if (!is_node_1.isNodeEnvironment()) { | ||
var Cache = (0, is_node_1.isNodeEnvironment)() ? (0, react_1.createContext)(null) : {}; | ||
if (!(0, is_node_1.isNodeEnvironment)()) { | ||
/** | ||
@@ -49,7 +50,10 @@ * Iterates through all found style elements generated when server side rendering. | ||
var useCache = function () { | ||
if (is_node_1.isNodeEnvironment()) { | ||
if (false) { | ||
return {}; | ||
} | ||
if ((0, is_node_1.isNodeEnvironment)()) { | ||
// On the server we use React Context to we don't leak the cache between SSR calls. | ||
// During runtime this hook isn't conditionally called - it is at build time that the flow gets decided. | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
return react_1.useContext(Cache) || {}; | ||
return (0, react_1.useContext)(Cache) || {}; | ||
} | ||
@@ -67,6 +71,6 @@ // On the client we use the object singleton. | ||
var StyleCacheProvider = function (props) { | ||
if (is_node_1.isNodeEnvironment()) { | ||
if ((0, is_node_1.isNodeEnvironment)()) { | ||
// This code path isn't conditionally called at build time - safe to ignore. | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
var inserted = exports.useCache(); | ||
var inserted = (0, exports.useCache)(); | ||
return React.createElement(Cache.Provider, { value: inserted }, props.children); | ||
@@ -73,0 +77,0 @@ } |
@@ -31,3 +31,3 @@ "use strict"; | ||
function Style(props) { | ||
var inserted = style_cache_1.useCache(); | ||
var inserted = (0, style_cache_1.useCache)(); | ||
if (process.env.NODE_ENV === 'development') { | ||
@@ -37,3 +37,3 @@ props.children.forEach(dev_warnings_1.analyzeCssInDev); | ||
if (props.children.length) { | ||
if (is_node_1.isNodeEnvironment()) { | ||
if ((0, is_node_1.isNodeEnvironment)()) { | ||
var bucketedSheets_1 = {}; | ||
@@ -50,3 +50,3 @@ var hasSheets = false; | ||
} | ||
var bucketName = sheet_1.getStyleBucketName(sheet); | ||
var bucketName = (0, sheet_1.getStyleBucketName)(sheet); | ||
bucketedSheets_1[bucketName] = (bucketedSheets_1[bucketName] || '') + sheet; | ||
@@ -68,3 +68,3 @@ } | ||
inserted[sheet] = true; | ||
sheet_1.default(sheet, props); | ||
(0, sheet_1.default)(sheet, props); | ||
} | ||
@@ -71,0 +71,0 @@ } |
@@ -51,3 +51,3 @@ "use strict"; | ||
// This code won't ever be executed when setup correctly. | ||
throw error_1.createSetupError(); | ||
throw (0, error_1.createSetupError)(); | ||
}; | ||
@@ -54,0 +54,0 @@ }, |
@@ -0,1 +1,2 @@ | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { keyframes } from '@compiled/react'; | ||
@@ -2,0 +3,0 @@ export var fadeOut = keyframes({ |
@@ -1,5 +0,9 @@ | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -13,3 +17,3 @@ var selectorsToWarn = [':first-child', ':nth-child']; | ||
} | ||
return console.error.apply(console, __spreadArray(["\n \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557\n\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551\n\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\n \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D\n\n @compiled/react/runtime - DEV WARNING\n\n " + str + "\n"], args)); | ||
return console.error.apply(console, __spreadArray(["\n \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557\n\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551\n\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551\n\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\n \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D\n\n @compiled/react/runtime - DEV WARNING\n\n ".concat(str, "\n")], args, false)); | ||
}; | ||
@@ -22,3 +26,3 @@ export var analyzeCssInDev = function (sheet) { | ||
if (shouldWarnAboutSelectors) { | ||
warn("Selectors \"" + selectorsToWarn.join(', ') + "\" are dangerous to use when server side rendering.\n Alternatively try and use \":nth-of-type\", or placing data attributes and targetting those instead.\n Read https://compiledcssinjs.com/docs/server-side-rendering for more advice."); | ||
warn("Selectors \"".concat(selectorsToWarn.join(', '), "\" are dangerous to use when server side rendering.\n Alternatively try and use \":nth-of-type\", or placing data attributes and targetting those instead.\n Read https://compiledcssinjs.com/docs/server-side-rendering for more advice.")); | ||
} | ||
@@ -25,0 +29,0 @@ hasWarned[sheet] = true; |
@@ -14,6 +14,4 @@ /** | ||
export var isNodeEnvironment = function () { | ||
var _a; | ||
// https://nodejs.org/api/process.html#process_process_release | ||
return typeof process !== 'undefined' && ((_a = process === null || process === void 0 ? void 0 : process.release) === null || _a === void 0 ? void 0 : _a.name) === 'node'; | ||
return typeof window === 'undefined'; | ||
}; | ||
//# sourceMappingURL=is-node.js.map |
@@ -0,1 +1,2 @@ | ||
import { isCacheDisabled } from './cache'; | ||
/** | ||
@@ -73,4 +74,7 @@ * Ordered style buckets using their short psuedo name. | ||
tag.appendChild(document.createTextNode('')); | ||
document.head.insertBefore(tag, nextBucketFromCache); | ||
if (false) { | ||
return tag; | ||
} | ||
styleBucketsInHead[bucketName] = tag; | ||
document.head.insertBefore(tag, nextBucketFromCache); | ||
} | ||
@@ -77,0 +81,0 @@ return styleBucketsInHead[bucketName]; |
import * as React from 'react'; | ||
import { createContext, useContext } from 'react'; | ||
import { isCacheDisabled } from './cache'; | ||
import { isNodeEnvironment } from './is-node'; | ||
@@ -25,2 +26,5 @@ /** | ||
export var useCache = function () { | ||
if (false) { | ||
return {}; | ||
} | ||
if (isNodeEnvironment()) { | ||
@@ -27,0 +31,0 @@ // On the server we use React Context to we don't leak the cache between SSR calls. |
{ | ||
"name": "@compiled/react", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"description": "A familiar and performant compile time CSS-in-JS library for React.", | ||
@@ -78,4 +78,5 @@ "keywords": [ | ||
"devDependencies": { | ||
"@compiled/benchmark": "^1.0.1", | ||
"@testing-library/react": "^11.2.7", | ||
"@types/react-dom": "^17.0.10", | ||
"@types/react-dom": "^17.0.11", | ||
"react": "^17.0.2", | ||
@@ -82,0 +83,0 @@ "react-dom": "^17.0.2" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
298965
323
5725
0
5
6