uawdijnntqw1x1x1
IP : 216.73.216.110
Hostname : 6.87.74.97.host.secureserver.net
Kernel : Linux 6.87.74.97.host.secureserver.net 4.18.0-553.83.1.el8_10.x86_64 #1 SMP Mon Nov 10 04:22:44 EST 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
emeraadmin
/
www
/
node_modules
/
path-parse
/
..
/
function-bind
/
.github
/
..
/
..
/
..
/
4d695
/
@emotion.tar
/
/
hash/src/index.js000064400000003255151701474420007735 0ustar00// @flow /* eslint-disable */ // Inspired by https://github.com/garycourt/murmurhash-js // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86 export default function murmur2(str: string) { // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. // const m = 0x5bd1e995; // const r = 24; // Initialize the hash var h = 0 // Mix 4 bytes at a time into the hash var k, i = 0, len = str.length for (; len >= 4; ++i, len -= 4) { k = (str.charCodeAt(i) & 0xff) | ((str.charCodeAt(++i) & 0xff) << 8) | ((str.charCodeAt(++i) & 0xff) << 16) | ((str.charCodeAt(++i) & 0xff) << 24) k = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0xe995) << 16) k ^= /* k >>> r: */ k >>> 24 h = /* Math.imul(k, m): */ ((k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0xe995) << 16)) ^ /* Math.imul(h, m): */ ((h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0xe995) << 16)) } // Handle the last few bytes of the input array switch (len) { case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16 case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8 case 1: h ^= str.charCodeAt(i) & 0xff h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0xe995) << 16) } // Do a few final mixes of the hash to ensure the last few // bytes are well-incorporated. h ^= h >>> 13 h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0xe995) << 16) return ((h ^ (h >>> 15)) >>> 0).toString(36) } hash/src/index.d.ts000064400000000074151701474420010165 0ustar00export * from '../types' export { default } from '../types' hash/package.json000064400000003173151701474420007766 0ustar00{ "_from": "@emotion/hash@^0.9.1", "_id": "@emotion/hash@0.9.1", "_inBundle": false, "_integrity": "sha512-gJB6HLm5rYwSLI6PQa+X1t5CFGrv1J1TWG+sOyMCeKz2ojaj6Fnl/rZEspogG+cvqbt4AE/2eIyD2QfLKTBNlQ==", "_location": "/@emotion/hash", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "@emotion/hash@^0.9.1", "name": "@emotion/hash", "escapedName": "@emotion%2fhash", "scope": "@emotion", "rawSpec": "^0.9.1", "saveSpec": null, "fetchSpec": "^0.9.1" }, "_requiredBy": [ "/@emotion/serialize" ], "_resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.1.tgz", "_shasum": "4ffb0055f7ef676ebc3a5a91fb621393294e2f43", "_spec": "@emotion/hash@^0.9.1", "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\@emotion\\serialize", "bundleDependencies": false, "deprecated": false, "description": "A MurmurHash2 implementation", "devDependencies": { "@definitelytyped/dtslint": "0.0.112", "typescript": "^4.5.5" }, "exports": { ".": { "module": "./dist/emotion-hash.esm.js", "import": "./dist/emotion-hash.cjs.mjs", "default": "./dist/emotion-hash.cjs.js" }, "./package.json": "./package.json" }, "files": [ "src", "dist", "types/*.d.ts" ], "license": "MIT", "main": "dist/emotion-hash.cjs.js", "module": "dist/emotion-hash.esm.js", "name": "@emotion/hash", "repository": { "type": "git", "url": "https://github.com/emotion-js/emotion/tree/main/packages/hash" }, "scripts": { "test:typescript": "dtslint types" }, "types": "types/index.d.ts", "version": "0.9.1" } hash/LICENSE000064400000002077151701474420006507 0ustar00MIT License Copyright (c) Emotion team and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. hash/types/index.d.ts000064400000000077151701474420010545 0ustar00export default function murmurhash2_32_gc(str: string): string hash/dist/emotion-hash.esm.js000064400000003167151701474420012162 0ustar00/* eslint-disable */ // Inspired by https://github.com/garycourt/murmurhash-js // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86 function murmur2(str) { // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. // const m = 0x5bd1e995; // const r = 24; // Initialize the hash var h = 0; // Mix 4 bytes at a time into the hash var k, i = 0, len = str.length; for (; len >= 4; ++i, len -= 4) { k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24; k = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16); k ^= /* k >>> r: */ k >>> 24; h = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); } // Handle the last few bytes of the input array switch (len) { case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16; case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8; case 1: h ^= str.charCodeAt(i) & 0xff; h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); } // Do a few final mixes of the hash to ensure the last few // bytes are well-incorporated. h ^= h >>> 13; h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); return ((h ^ h >>> 15) >>> 0).toString(36); } export { murmur2 as default }; hash/dist/emotion-hash.cjs.prod.js000064400000003305151701474420013112 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); /* eslint-disable */ // Inspired by https://github.com/garycourt/murmurhash-js // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86 function murmur2(str) { // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. // const m = 0x5bd1e995; // const r = 24; // Initialize the hash var h = 0; // Mix 4 bytes at a time into the hash var k, i = 0, len = str.length; for (; len >= 4; ++i, len -= 4) { k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24; k = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16); k ^= /* k >>> r: */ k >>> 24; h = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); } // Handle the last few bytes of the input array switch (len) { case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16; case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8; case 1: h ^= str.charCodeAt(i) & 0xff; h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); } // Do a few final mixes of the hash to ensure the last few // bytes are well-incorporated. h ^= h >>> 13; h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); return ((h ^ h >>> 15) >>> 0).toString(36); } exports["default"] = murmur2; hash/dist/emotion-hash.cjs.d.mts000064400000000242151701474420012555 0ustar00export * from "./declarations/src/index.js"; export { _default as default } from "./emotion-hash.cjs.default.js"; //# sourceMappingURL=emotion-hash.cjs.d.mts.map hash/dist/emotion-hash.cjs.d.ts000064400000000215151701474430012401 0ustar00export * from "./declarations/src/index"; export { default } from "./declarations/src/index"; //# sourceMappingURL=emotion-hash.cjs.d.ts.map hash/dist/emotion-hash.cjs.js.flow000064400000000125151701474430013113 0ustar00// @flow export * from "../src/index.js"; export { default } from "../src/index.js"; hash/dist/emotion-hash.cjs.default.js000064400000000075151701474430013574 0ustar00exports._default = require("./emotion-hash.cjs.js").default; hash/dist/emotion-hash.cjs.js000064400000000272151701474430012150 0ustar00'use strict'; if (process.env.NODE_ENV === "production") { module.exports = require("./emotion-hash.cjs.prod.js"); } else { module.exports = require("./emotion-hash.cjs.dev.js"); } hash/dist/emotion-hash.cjs.default.d.ts000064400000000102151701474430014017 0ustar00export { default as _default } from "./declarations/src/index.js" hash/dist/declarations/src/index.d.ts000064400000000074151701474430013601 0ustar00export * from '../types' export { default } from '../types' hash/dist/declarations/types/index.d.ts000064400000000077151701474430014161 0ustar00export default function murmurhash2_32_gc(str: string): string hash/dist/emotion-hash.cjs.mjs000064400000000161151701474430012322 0ustar00export { } from "./emotion-hash.cjs.js"; export { _default as default } from "./emotion-hash.cjs.default.js"; hash/dist/emotion-hash.cjs.d.mts.map000064400000000207151701474430013333 0ustar00{"version":3,"file":"emotion-hash.cjs.d.mts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} hash/dist/emotion-hash.cjs.d.ts.map000064400000000206151701474430013155 0ustar00{"version":3,"file":"emotion-hash.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} hash/dist/emotion-hash.cjs.dev.js000064400000003305151701474430012725 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); /* eslint-disable */ // Inspired by https://github.com/garycourt/murmurhash-js // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86 function murmur2(str) { // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. // const m = 0x5bd1e995; // const r = 24; // Initialize the hash var h = 0; // Mix 4 bytes at a time into the hash var k, i = 0, len = str.length; for (; len >= 4; ++i, len -= 4) { k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24; k = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16); k ^= /* k >>> r: */ k >>> 24; h = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); } // Handle the last few bytes of the input array switch (len) { case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16; case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8; case 1: h ^= str.charCodeAt(i) & 0xff; h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); } // Do a few final mixes of the hash to ensure the last few // bytes are well-incorporated. h ^= h >>> 13; h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); return ((h ^ h >>> 15) >>> 0).toString(36); } exports["default"] = murmur2; hash/README.md000064400000000342151701474430006753 0ustar00# @emotion/hash > A MurmurHash2 implementation ```jsx import hash from '@emotion/hash' hash('some-string') // 12fj1d ``` The source of this is from https://github.com/garycourt/murmurhash-js/blob/master/murmurhash2_gc.js. weak-memoize/src/index.js000064400000000642151701474430011402 0ustar00// @flow let weakMemoize = function <Arg, Return>(func: Arg => Return): Arg => Return { // $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps let cache: WeakMap<Arg, Return> = new WeakMap() return arg => { if (cache.has(arg)) { // $FlowFixMe return cache.get(arg) } let ret = func(arg) cache.set(arg, ret) return ret } } export default weakMemoize weak-memoize/src/index.d.ts000064400000000074151701474430011635 0ustar00export * from '../types' export { default } from '../types' weak-memoize/package.json000064400000003462151701474430011437 0ustar00{ "_from": "@emotion/weak-memoize@^0.3.1", "_id": "@emotion/weak-memoize@0.3.1", "_inBundle": false, "_integrity": "sha512-EsBwpc7hBUJWAsNPBmJy4hxWx12v6bshQsldrVmjxJoc3isbxhOrF2IcCpaXxfvq03NwkI7sbsOLXbYuqF/8Ww==", "_location": "/@emotion/weak-memoize", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "@emotion/weak-memoize@^0.3.1", "name": "@emotion/weak-memoize", "escapedName": "@emotion%2fweak-memoize", "scope": "@emotion", "rawSpec": "^0.3.1", "saveSpec": null, "fetchSpec": "^0.3.1" }, "_requiredBy": [ "/@emotion/cache" ], "_resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.3.1.tgz", "_shasum": "d0fce5d07b0620caa282b5131c297bb60f9d87e6", "_spec": "@emotion/weak-memoize@^0.3.1", "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\@emotion\\cache", "bundleDependencies": false, "deprecated": false, "description": "A memoization function that uses a WeakMap", "devDependencies": { "@definitelytyped/dtslint": "0.0.112", "typescript": "^4.5.5" }, "exports": { ".": { "module": "./dist/emotion-weak-memoize.esm.js", "import": "./dist/emotion-weak-memoize.cjs.mjs", "default": "./dist/emotion-weak-memoize.cjs.js" }, "./package.json": "./package.json" }, "files": [ "src", "dist", "types/*.d.ts" ], "license": "MIT", "main": "dist/emotion-weak-memoize.cjs.js", "module": "dist/emotion-weak-memoize.esm.js", "name": "@emotion/weak-memoize", "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/emotion-js/emotion/tree/main/packages/weak-memoize" }, "scripts": { "test:typescript": "dtslint types" }, "types": "types/index.d.ts", "version": "0.3.1" } weak-memoize/LICENSE000064400000002077151701474430010157 0ustar00MIT License Copyright (c) Emotion team and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. weak-memoize/types/index.d.ts000064400000000304151701474430012206 0ustar00// TypeScript Version: 2.2 type UnaryFn<Arg, Return> = (arg: Arg) => Return export default function weakMemoize<Arg extends object, Return>( func: UnaryFn<Arg, Return> ): UnaryFn<Arg, Return> weak-memoize/dist/emotion-weak-memoize.cjs.dev.js000064400000000711151701474430016041 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var weakMemoize = function weakMemoize(func) { // $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps var cache = new WeakMap(); return function (arg) { if (cache.has(arg)) { // $FlowFixMe return cache.get(arg); } var ret = func(arg); cache.set(arg, ret); return ret; }; }; exports["default"] = weakMemoize; weak-memoize/dist/emotion-weak-memoize.cjs.d.ts.map000064400000000216151701474430016274 0ustar00{"version":3,"file":"emotion-weak-memoize.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} weak-memoize/dist/emotion-weak-memoize.cjs.d.mts.map000064400000000217151701474430016452 0ustar00{"version":3,"file":"emotion-weak-memoize.cjs.d.mts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} weak-memoize/dist/emotion-weak-memoize.cjs.prod.js000064400000000711151701474430016227 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var weakMemoize = function weakMemoize(func) { // $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps var cache = new WeakMap(); return function (arg) { if (cache.has(arg)) { // $FlowFixMe return cache.get(arg); } var ret = func(arg); cache.set(arg, ret); return ret; }; }; exports["default"] = weakMemoize; weak-memoize/dist/emotion-weak-memoize.cjs.js000064400000000312151701474430015261 0ustar00'use strict'; if (process.env.NODE_ENV === "production") { module.exports = require("./emotion-weak-memoize.cjs.prod.js"); } else { module.exports = require("./emotion-weak-memoize.cjs.dev.js"); } weak-memoize/dist/emotion-weak-memoize.cjs.default.d.ts000064400000000102151701474430017135 0ustar00export { default as _default } from "./declarations/src/index.js" weak-memoize/dist/emotion-weak-memoize.cjs.d.mts000064400000000262151701474430015676 0ustar00export * from "./declarations/src/index.js"; export { _default as default } from "./emotion-weak-memoize.cjs.default.js"; //# sourceMappingURL=emotion-weak-memoize.cjs.d.mts.map weak-memoize/dist/emotion-weak-memoize.cjs.js.flow000064400000000125151701474430016231 0ustar00// @flow export * from "../src/index.js"; export { default } from "../src/index.js"; weak-memoize/dist/declarations/src/index.d.ts000064400000000074151701474430015250 0ustar00export * from '../types' export { default } from '../types' weak-memoize/dist/declarations/types/index.d.ts000064400000000304151701474430015621 0ustar00// TypeScript Version: 2.2 type UnaryFn<Arg, Return> = (arg: Arg) => Return export default function weakMemoize<Arg extends object, Return>( func: UnaryFn<Arg, Return> ): UnaryFn<Arg, Return> weak-memoize/dist/emotion-weak-memoize.cjs.d.ts000064400000000225151701474430015520 0ustar00export * from "./declarations/src/index"; export { default } from "./declarations/src/index"; //# sourceMappingURL=emotion-weak-memoize.cjs.d.ts.map weak-memoize/dist/emotion-weak-memoize.esm.js000064400000000573151701474430015277 0ustar00var weakMemoize = function weakMemoize(func) { // $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps var cache = new WeakMap(); return function (arg) { if (cache.has(arg)) { // $FlowFixMe return cache.get(arg); } var ret = func(arg); cache.set(arg, ret); return ret; }; }; export { weakMemoize as default }; weak-memoize/dist/emotion-weak-memoize.cjs.mjs000064400000000201151701474430015433 0ustar00export { } from "./emotion-weak-memoize.cjs.js"; export { _default as default } from "./emotion-weak-memoize.cjs.default.js"; weak-memoize/dist/emotion-weak-memoize.cjs.default.js000064400000000105151701474430016704 0ustar00exports._default = require("./emotion-weak-memoize.cjs.js").default; weak-memoize/README.md000064400000001344151701474430010425 0ustar00# @emotion/weak-memoize > A memoization function that uses a WeakMap ## Install ```bash yarn add @emotion/weak-memoize ``` ## Usage Because @emotion/weak-memoize uses a WeakMap the argument must be a non primitive type, e.g. objects, functions, arrays and etc. The function passed to `weakMemoize` must also only accept a single argument. ```jsx import weakMemoize from '@emotion/weak-memoize' let doThing = weakMemoize(({ someProperty }) => { return { newName: someProperty } }) let obj = { someProperty: true } let firstResult = doThing(obj) let secondResult = doThing(obj) firstResult === secondResult // true let newObj = { someProperty: true } let thirdResult = doThing(newObj) thirdResult === firstResult // false ``` unitless/src/index.js000064400000001664151701474430010663 0ustar00// @flow let unitlessKeys: { [key: string]: 1 } = { animationIterationCount: 1, aspectRatio: 1, borderImageOutset: 1, borderImageSlice: 1, borderImageWidth: 1, boxFlex: 1, boxFlexGroup: 1, boxOrdinalGroup: 1, columnCount: 1, columns: 1, flex: 1, flexGrow: 1, flexPositive: 1, flexShrink: 1, flexNegative: 1, flexOrder: 1, gridRow: 1, gridRowEnd: 1, gridRowSpan: 1, gridRowStart: 1, gridColumn: 1, gridColumnEnd: 1, gridColumnSpan: 1, gridColumnStart: 1, msGridRow: 1, msGridRowSpan: 1, msGridColumn: 1, msGridColumnSpan: 1, fontWeight: 1, lineHeight: 1, opacity: 1, order: 1, orphans: 1, tabSize: 1, widows: 1, zIndex: 1, zoom: 1, WebkitLineClamp: 1, // SVG-related properties fillOpacity: 1, floodOpacity: 1, stopOpacity: 1, strokeDasharray: 1, strokeDashoffset: 1, strokeMiterlimit: 1, strokeOpacity: 1, strokeWidth: 1 } export default unitlessKeys unitless/src/index.d.ts000064400000000074151701474430011111 0ustar00export * from '../types' export { default } from '../types' unitless/package.json000064400000003077151701474430010715 0ustar00{ "_from": "@emotion/unitless@^0.8.1", "_id": "@emotion/unitless@0.8.1", "_inBundle": false, "_integrity": "sha512-KOEGMu6dmJZtpadb476IsZBclKvILjopjUii3V+7MnXIQCYh8W3NgNcgwo21n9LXZX6EDIKvqfjYxXebDwxKmQ==", "_location": "/@emotion/unitless", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "@emotion/unitless@^0.8.1", "name": "@emotion/unitless", "escapedName": "@emotion%2funitless", "scope": "@emotion", "rawSpec": "^0.8.1", "saveSpec": null, "fetchSpec": "^0.8.1" }, "_requiredBy": [ "/@emotion/serialize" ], "_resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.8.1.tgz", "_shasum": "182b5a4704ef8ad91bde93f7a860a88fd92c79a3", "_spec": "@emotion/unitless@^0.8.1", "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\@emotion\\serialize", "bundleDependencies": false, "deprecated": false, "description": "An object of css properties that don't accept values with units", "exports": { ".": { "module": "./dist/emotion-unitless.esm.js", "import": "./dist/emotion-unitless.cjs.mjs", "default": "./dist/emotion-unitless.cjs.js" }, "./package.json": "./package.json" }, "files": [ "src", "dist" ], "license": "MIT", "main": "dist/emotion-unitless.cjs.js", "module": "dist/emotion-unitless.esm.js", "name": "@emotion/unitless", "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/emotion-js/emotion/tree/main/packages/unitless" }, "version": "0.8.1" } unitless/LICENSE000064400000002077151701474430007433 0ustar00MIT License Copyright (c) Emotion team and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. unitless/dist/emotion-unitless.cjs.js.flow000064400000000125151701474430014761 0ustar00// @flow export * from "../src/index.js"; export { default } from "../src/index.js"; unitless/dist/emotion-unitless.cjs.d.mts000064400000000252151701474430014425 0ustar00export * from "./declarations/src/index.js"; export { _default as default } from "./emotion-unitless.cjs.default.js"; //# sourceMappingURL=emotion-unitless.cjs.d.mts.map unitless/dist/emotion-unitless.cjs.default.js000064400000000101151701474430015430 0ustar00exports._default = require("./emotion-unitless.cjs.js").default; unitless/dist/emotion-unitless.esm.js000064400000001634151701474430014026 0ustar00var unitlessKeys = { animationIterationCount: 1, aspectRatio: 1, borderImageOutset: 1, borderImageSlice: 1, borderImageWidth: 1, boxFlex: 1, boxFlexGroup: 1, boxOrdinalGroup: 1, columnCount: 1, columns: 1, flex: 1, flexGrow: 1, flexPositive: 1, flexShrink: 1, flexNegative: 1, flexOrder: 1, gridRow: 1, gridRowEnd: 1, gridRowSpan: 1, gridRowStart: 1, gridColumn: 1, gridColumnEnd: 1, gridColumnSpan: 1, gridColumnStart: 1, msGridRow: 1, msGridRowSpan: 1, msGridColumn: 1, msGridColumnSpan: 1, fontWeight: 1, lineHeight: 1, opacity: 1, order: 1, orphans: 1, tabSize: 1, widows: 1, zIndex: 1, zoom: 1, WebkitLineClamp: 1, // SVG-related properties fillOpacity: 1, floodOpacity: 1, stopOpacity: 1, strokeDasharray: 1, strokeDashoffset: 1, strokeMiterlimit: 1, strokeOpacity: 1, strokeWidth: 1 }; export { unitlessKeys as default }; unitless/dist/emotion-unitless.cjs.d.ts000064400000000221151701474430014244 0ustar00export * from "./declarations/src/index"; export { default } from "./declarations/src/index"; //# sourceMappingURL=emotion-unitless.cjs.d.ts.map unitless/dist/emotion-unitless.cjs.d.mts.map000064400000000213151701474430015176 0ustar00{"version":3,"file":"emotion-unitless.cjs.d.mts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} unitless/dist/emotion-unitless.cjs.d.ts.map000064400000000212151701474430015020 0ustar00{"version":3,"file":"emotion-unitless.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} unitless/dist/emotion-unitless.cjs.dev.js000064400000001752151701474430014577 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var unitlessKeys = { animationIterationCount: 1, aspectRatio: 1, borderImageOutset: 1, borderImageSlice: 1, borderImageWidth: 1, boxFlex: 1, boxFlexGroup: 1, boxOrdinalGroup: 1, columnCount: 1, columns: 1, flex: 1, flexGrow: 1, flexPositive: 1, flexShrink: 1, flexNegative: 1, flexOrder: 1, gridRow: 1, gridRowEnd: 1, gridRowSpan: 1, gridRowStart: 1, gridColumn: 1, gridColumnEnd: 1, gridColumnSpan: 1, gridColumnStart: 1, msGridRow: 1, msGridRowSpan: 1, msGridColumn: 1, msGridColumnSpan: 1, fontWeight: 1, lineHeight: 1, opacity: 1, order: 1, orphans: 1, tabSize: 1, widows: 1, zIndex: 1, zoom: 1, WebkitLineClamp: 1, // SVG-related properties fillOpacity: 1, floodOpacity: 1, stopOpacity: 1, strokeDasharray: 1, strokeDashoffset: 1, strokeMiterlimit: 1, strokeOpacity: 1, strokeWidth: 1 }; exports["default"] = unitlessKeys; unitless/dist/emotion-unitless.cjs.default.d.ts000064400000000102151701474430015665 0ustar00export { default as _default } from "./declarations/src/index.js" unitless/dist/declarations/src/index.d.ts000064400000000074151701474430014524 0ustar00export * from '../types' export { default } from '../types' unitless/dist/emotion-unitless.cjs.mjs000064400000000171151701474430014171 0ustar00export { } from "./emotion-unitless.cjs.js"; export { _default as default } from "./emotion-unitless.cjs.default.js"; unitless/dist/emotion-unitless.cjs.js000064400000000302151701474430014010 0ustar00'use strict'; if (process.env.NODE_ENV === "production") { module.exports = require("./emotion-unitless.cjs.prod.js"); } else { module.exports = require("./emotion-unitless.cjs.dev.js"); } unitless/dist/emotion-unitless.cjs.prod.js000064400000001752151701474430014765 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var unitlessKeys = { animationIterationCount: 1, aspectRatio: 1, borderImageOutset: 1, borderImageSlice: 1, borderImageWidth: 1, boxFlex: 1, boxFlexGroup: 1, boxOrdinalGroup: 1, columnCount: 1, columns: 1, flex: 1, flexGrow: 1, flexPositive: 1, flexShrink: 1, flexNegative: 1, flexOrder: 1, gridRow: 1, gridRowEnd: 1, gridRowSpan: 1, gridRowStart: 1, gridColumn: 1, gridColumnEnd: 1, gridColumnSpan: 1, gridColumnStart: 1, msGridRow: 1, msGridRowSpan: 1, msGridColumn: 1, msGridColumnSpan: 1, fontWeight: 1, lineHeight: 1, opacity: 1, order: 1, orphans: 1, tabSize: 1, widows: 1, zIndex: 1, zoom: 1, WebkitLineClamp: 1, // SVG-related properties fillOpacity: 1, floodOpacity: 1, stopOpacity: 1, strokeDasharray: 1, strokeDashoffset: 1, strokeMiterlimit: 1, strokeOpacity: 1, strokeWidth: 1 }; exports["default"] = unitlessKeys; unitless/README.md000064400000000301151701474430007671 0ustar00# @emotion/unitless > An object of css properties that don't accept values with units ```jsx import unitless from '@emotion/unitless' unitless.flex === 1 unitless.padding === undefined ``` sheet/src/index.js000064400000012035151701474430010117 0ustar00// @flow /* Based off glamor's StyleSheet, thanks Sunil ❤️ high performance StyleSheet for css-in-js systems - uses multiple style tags behind the scenes for millions of rules - uses `insertRule` for appending in production for *much* faster performance // usage import { StyleSheet } from '@emotion/sheet' let styleSheet = new StyleSheet({ key: '', container: document.head }) styleSheet.insert('#box { border: 1px solid red; }') - appends a css rule into the stylesheet styleSheet.flush() - empties the stylesheet of all its contents */ // $FlowFixMe function sheetForTag(tag: HTMLStyleElement): CSSStyleSheet { if (tag.sheet) { // $FlowFixMe return tag.sheet } // this weirdness brought to you by firefox /* istanbul ignore next */ for (let i = 0; i < document.styleSheets.length; i++) { if (document.styleSheets[i].ownerNode === tag) { // $FlowFixMe return document.styleSheets[i] } } } export type Options = { nonce?: string, key: string, container: Node, speedy?: boolean, prepend?: boolean, insertionPoint?: HTMLElement } function createStyleElement(options: { key: string, nonce: string | void }): HTMLStyleElement { let tag = document.createElement('style') tag.setAttribute('data-emotion', options.key) if (options.nonce !== undefined) { tag.setAttribute('nonce', options.nonce) } tag.appendChild(document.createTextNode('')) tag.setAttribute('data-s', '') return tag } export class StyleSheet { isSpeedy: boolean ctr: number tags: HTMLStyleElement[] // Using Node instead of HTMLElement since container may be a ShadowRoot container: Node key: string nonce: string | void prepend: boolean | void before: Element | null insertionPoint: HTMLElement | void constructor(options: Options) { this.isSpeedy = options.speedy === undefined ? process.env.NODE_ENV === 'production' : options.speedy this.tags = [] this.ctr = 0 this.nonce = options.nonce // key is the value of the data-emotion attribute, it's used to identify different sheets this.key = options.key this.container = options.container this.prepend = options.prepend this.insertionPoint = options.insertionPoint this.before = null } _insertTag = (tag: HTMLStyleElement) => { let before if (this.tags.length === 0) { if (this.insertionPoint) { before = this.insertionPoint.nextSibling } else if (this.prepend) { before = this.container.firstChild } else { before = this.before } } else { before = this.tags[this.tags.length - 1].nextSibling } this.container.insertBefore(tag, before) this.tags.push(tag) } hydrate(nodes: HTMLStyleElement[]) { nodes.forEach(this._insertTag) } insert(rule: string) { // the max length is how many rules we have per style tag, it's 65000 in speedy mode // it's 1 in dev because we insert source maps that map a single rule to a location // and you can only have one source map per style tag if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) { this._insertTag(createStyleElement(this)) } const tag = this.tags[this.tags.length - 1] if (process.env.NODE_ENV !== 'production') { const isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105 if (isImportRule && (this: any)._alreadyInsertedOrderInsensitiveRule) { // this would only cause problem in speedy mode // but we don't want enabling speedy to affect the observable behavior // so we report this error at all times console.error( `You're attempting to insert the following rule:\n` + rule + '\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.' ) } ;(this: any)._alreadyInsertedOrderInsensitiveRule = (this: any)._alreadyInsertedOrderInsensitiveRule || !isImportRule } if (this.isSpeedy) { const sheet = sheetForTag(tag) try { // this is the ultrafast version, works across browsers // the big drawback is that the css won't be editable in devtools sheet.insertRule(rule, sheet.cssRules.length) } catch (e) { if ( process.env.NODE_ENV !== 'production' && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test( rule ) ) { console.error( `There was a problem inserting the following rule: "${rule}"`, e ) } } } else { tag.appendChild(document.createTextNode(rule)) } this.ctr++ } flush() { // $FlowFixMe this.tags.forEach(tag => tag.parentNode && tag.parentNode.removeChild(tag)) this.tags = [] this.ctr = 0 if (process.env.NODE_ENV !== 'production') { ;(this: any)._alreadyInsertedOrderInsensitiveRule = false } } } sheet/src/index.d.ts000064400000000074151701474430010353 0ustar00export * from '../types' export { default } from '../types' sheet/package.json000064400000003703151701474430010153 0ustar00{ "_from": "@emotion/sheet@^1.2.2", "_id": "@emotion/sheet@1.2.2", "_inBundle": false, "_integrity": "sha512-0QBtGvaqtWi+nx6doRwDdBIzhNdZrXUppvTM4dtZZWEGTXL/XE/yJxLMGlDT1Gt+UHH5IX1n+jkXyytE/av7OA==", "_location": "/@emotion/sheet", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "@emotion/sheet@^1.2.2", "name": "@emotion/sheet", "escapedName": "@emotion%2fsheet", "scope": "@emotion", "rawSpec": "^1.2.2", "saveSpec": null, "fetchSpec": "^1.2.2" }, "_requiredBy": [ "/@emotion/cache" ], "_resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.2.2.tgz", "_shasum": "d58e788ee27267a14342303e1abb3d508b6d0fec", "_spec": "@emotion/sheet@^1.2.2", "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\@emotion\\cache", "browser": { "./dist/emotion-sheet.esm.js": "./dist/emotion-sheet.browser.esm.js" }, "bundleDependencies": false, "deprecated": false, "description": "emotion's stylesheet", "devDependencies": { "@definitelytyped/dtslint": "0.0.112", "typescript": "^4.5.5" }, "exports": { ".": { "module": { "browser": "./dist/emotion-sheet.browser.esm.js", "default": "./dist/emotion-sheet.esm.js" }, "import": "./dist/emotion-sheet.cjs.mjs", "default": "./dist/emotion-sheet.cjs.js" }, "./package.json": "./package.json" }, "files": [ "src", "dist", "types/*.d.ts" ], "license": "MIT", "main": "dist/emotion-sheet.cjs.js", "module": "dist/emotion-sheet.esm.js", "name": "@emotion/sheet", "preconstruct": { "exports": { "envConditions": [ "browser" ] } }, "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/emotion-js/emotion/tree/main/packages/sheet" }, "scripts": { "test:typescript": "dtslint types" }, "types": "types/index.d.ts", "version": "1.2.2" } sheet/LICENSE000064400000002077151701474430006675 0ustar00MIT License Copyright (c) Emotion team and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. sheet/types/index.d.ts000064400000001116151701474430010726 0ustar00// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun> // TypeScript Version: 2.0 export interface Options { nonce?: string key: string container: Node speedy?: boolean /** @deprecate use `insertionPoint` instead */ prepend?: boolean insertionPoint?: HTMLElement } export class StyleSheet { isSpeedy: boolean ctr: number tags: Array<HTMLStyleElement> container: Node key: string nonce?: string before?: ChildNode | null constructor(options?: Options) insert(rule: string): void flush(): void hydrate(nodes: Array<HTMLStyleElement>): void } sheet/dist/emotion-sheet.cjs.d.ts000064400000000132151701474430012751 0ustar00export * from "./declarations/src/index"; //# sourceMappingURL=emotion-sheet.cjs.d.ts.map sheet/dist/emotion-sheet.browser.esm.js000064400000011250151701474430014207 0ustar00/* Based off glamor's StyleSheet, thanks Sunil ❤️ high performance StyleSheet for css-in-js systems - uses multiple style tags behind the scenes for millions of rules - uses `insertRule` for appending in production for *much* faster performance // usage import { StyleSheet } from '@emotion/sheet' let styleSheet = new StyleSheet({ key: '', container: document.head }) styleSheet.insert('#box { border: 1px solid red; }') - appends a css rule into the stylesheet styleSheet.flush() - empties the stylesheet of all its contents */ // $FlowFixMe function sheetForTag(tag) { if (tag.sheet) { // $FlowFixMe return tag.sheet; } // this weirdness brought to you by firefox /* istanbul ignore next */ for (var i = 0; i < document.styleSheets.length; i++) { if (document.styleSheets[i].ownerNode === tag) { // $FlowFixMe return document.styleSheets[i]; } } } function createStyleElement(options) { var tag = document.createElement('style'); tag.setAttribute('data-emotion', options.key); if (options.nonce !== undefined) { tag.setAttribute('nonce', options.nonce); } tag.appendChild(document.createTextNode('')); tag.setAttribute('data-s', ''); return tag; } var StyleSheet = /*#__PURE__*/function () { // Using Node instead of HTMLElement since container may be a ShadowRoot function StyleSheet(options) { var _this = this; this._insertTag = function (tag) { var before; if (_this.tags.length === 0) { if (_this.insertionPoint) { before = _this.insertionPoint.nextSibling; } else if (_this.prepend) { before = _this.container.firstChild; } else { before = _this.before; } } else { before = _this.tags[_this.tags.length - 1].nextSibling; } _this.container.insertBefore(tag, before); _this.tags.push(tag); }; this.isSpeedy = options.speedy === undefined ? process.env.NODE_ENV === 'production' : options.speedy; this.tags = []; this.ctr = 0; this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets this.key = options.key; this.container = options.container; this.prepend = options.prepend; this.insertionPoint = options.insertionPoint; this.before = null; } var _proto = StyleSheet.prototype; _proto.hydrate = function hydrate(nodes) { nodes.forEach(this._insertTag); }; _proto.insert = function insert(rule) { // the max length is how many rules we have per style tag, it's 65000 in speedy mode // it's 1 in dev because we insert source maps that map a single rule to a location // and you can only have one source map per style tag if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) { this._insertTag(createStyleElement(this)); } var tag = this.tags[this.tags.length - 1]; if (process.env.NODE_ENV !== 'production') { var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105; if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) { // this would only cause problem in speedy mode // but we don't want enabling speedy to affect the observable behavior // so we report this error at all times console.error("You're attempting to insert the following rule:\n" + rule + '\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.'); } this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule; } if (this.isSpeedy) { var sheet = sheetForTag(tag); try { // this is the ultrafast version, works across browsers // the big drawback is that the css won't be editable in devtools sheet.insertRule(rule, sheet.cssRules.length); } catch (e) { if (process.env.NODE_ENV !== 'production' && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(rule)) { console.error("There was a problem inserting the following rule: \"" + rule + "\"", e); } } } else { tag.appendChild(document.createTextNode(rule)); } this.ctr++; }; _proto.flush = function flush() { // $FlowFixMe this.tags.forEach(function (tag) { return tag.parentNode && tag.parentNode.removeChild(tag); }); this.tags = []; this.ctr = 0; if (process.env.NODE_ENV !== 'production') { this._alreadyInsertedOrderInsensitiveRule = false; } }; return StyleSheet; }(); export { StyleSheet }; sheet/dist/emotion-sheet.cjs.js000064400000000274151701474430012524 0ustar00'use strict'; if (process.env.NODE_ENV === "production") { module.exports = require("./emotion-sheet.cjs.prod.js"); } else { module.exports = require("./emotion-sheet.cjs.dev.js"); } sheet/dist/emotion-sheet.esm.js000064400000011250151701474430012525 0ustar00/* Based off glamor's StyleSheet, thanks Sunil ❤️ high performance StyleSheet for css-in-js systems - uses multiple style tags behind the scenes for millions of rules - uses `insertRule` for appending in production for *much* faster performance // usage import { StyleSheet } from '@emotion/sheet' let styleSheet = new StyleSheet({ key: '', container: document.head }) styleSheet.insert('#box { border: 1px solid red; }') - appends a css rule into the stylesheet styleSheet.flush() - empties the stylesheet of all its contents */ // $FlowFixMe function sheetForTag(tag) { if (tag.sheet) { // $FlowFixMe return tag.sheet; } // this weirdness brought to you by firefox /* istanbul ignore next */ for (var i = 0; i < document.styleSheets.length; i++) { if (document.styleSheets[i].ownerNode === tag) { // $FlowFixMe return document.styleSheets[i]; } } } function createStyleElement(options) { var tag = document.createElement('style'); tag.setAttribute('data-emotion', options.key); if (options.nonce !== undefined) { tag.setAttribute('nonce', options.nonce); } tag.appendChild(document.createTextNode('')); tag.setAttribute('data-s', ''); return tag; } var StyleSheet = /*#__PURE__*/function () { // Using Node instead of HTMLElement since container may be a ShadowRoot function StyleSheet(options) { var _this = this; this._insertTag = function (tag) { var before; if (_this.tags.length === 0) { if (_this.insertionPoint) { before = _this.insertionPoint.nextSibling; } else if (_this.prepend) { before = _this.container.firstChild; } else { before = _this.before; } } else { before = _this.tags[_this.tags.length - 1].nextSibling; } _this.container.insertBefore(tag, before); _this.tags.push(tag); }; this.isSpeedy = options.speedy === undefined ? process.env.NODE_ENV === 'production' : options.speedy; this.tags = []; this.ctr = 0; this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets this.key = options.key; this.container = options.container; this.prepend = options.prepend; this.insertionPoint = options.insertionPoint; this.before = null; } var _proto = StyleSheet.prototype; _proto.hydrate = function hydrate(nodes) { nodes.forEach(this._insertTag); }; _proto.insert = function insert(rule) { // the max length is how many rules we have per style tag, it's 65000 in speedy mode // it's 1 in dev because we insert source maps that map a single rule to a location // and you can only have one source map per style tag if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) { this._insertTag(createStyleElement(this)); } var tag = this.tags[this.tags.length - 1]; if (process.env.NODE_ENV !== 'production') { var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105; if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) { // this would only cause problem in speedy mode // but we don't want enabling speedy to affect the observable behavior // so we report this error at all times console.error("You're attempting to insert the following rule:\n" + rule + '\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.'); } this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule; } if (this.isSpeedy) { var sheet = sheetForTag(tag); try { // this is the ultrafast version, works across browsers // the big drawback is that the css won't be editable in devtools sheet.insertRule(rule, sheet.cssRules.length); } catch (e) { if (process.env.NODE_ENV !== 'production' && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(rule)) { console.error("There was a problem inserting the following rule: \"" + rule + "\"", e); } } } else { tag.appendChild(document.createTextNode(rule)); } this.ctr++; }; _proto.flush = function flush() { // $FlowFixMe this.tags.forEach(function (tag) { return tag.parentNode && tag.parentNode.removeChild(tag); }); this.tags = []; this.ctr = 0; if (process.env.NODE_ENV !== 'production') { this._alreadyInsertedOrderInsensitiveRule = false; } }; return StyleSheet; }(); export { StyleSheet }; sheet/dist/emotion-sheet.cjs.mjs000064400000000067151701474430012701 0ustar00export { StyleSheet } from "./emotion-sheet.cjs.js"; sheet/dist/emotion-sheet.cjs.d.mts.map000064400000000210151701474430013677 0ustar00{"version":3,"file":"emotion-sheet.cjs.d.mts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} sheet/dist/emotion-sheet.cjs.prod.js000064400000007107151701474430013471 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); /* Based off glamor's StyleSheet, thanks Sunil ❤️ high performance StyleSheet for css-in-js systems - uses multiple style tags behind the scenes for millions of rules - uses `insertRule` for appending in production for *much* faster performance // usage import { StyleSheet } from '@emotion/sheet' let styleSheet = new StyleSheet({ key: '', container: document.head }) styleSheet.insert('#box { border: 1px solid red; }') - appends a css rule into the stylesheet styleSheet.flush() - empties the stylesheet of all its contents */ // $FlowFixMe function sheetForTag(tag) { if (tag.sheet) { // $FlowFixMe return tag.sheet; } // this weirdness brought to you by firefox /* istanbul ignore next */ for (var i = 0; i < document.styleSheets.length; i++) { if (document.styleSheets[i].ownerNode === tag) { // $FlowFixMe return document.styleSheets[i]; } } } function createStyleElement(options) { var tag = document.createElement('style'); tag.setAttribute('data-emotion', options.key); if (options.nonce !== undefined) { tag.setAttribute('nonce', options.nonce); } tag.appendChild(document.createTextNode('')); tag.setAttribute('data-s', ''); return tag; } var StyleSheet = /*#__PURE__*/function () { // Using Node instead of HTMLElement since container may be a ShadowRoot function StyleSheet(options) { var _this = this; this._insertTag = function (tag) { var before; if (_this.tags.length === 0) { if (_this.insertionPoint) { before = _this.insertionPoint.nextSibling; } else if (_this.prepend) { before = _this.container.firstChild; } else { before = _this.before; } } else { before = _this.tags[_this.tags.length - 1].nextSibling; } _this.container.insertBefore(tag, before); _this.tags.push(tag); }; this.isSpeedy = options.speedy === undefined ? "production" === 'production' : options.speedy; this.tags = []; this.ctr = 0; this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets this.key = options.key; this.container = options.container; this.prepend = options.prepend; this.insertionPoint = options.insertionPoint; this.before = null; } var _proto = StyleSheet.prototype; _proto.hydrate = function hydrate(nodes) { nodes.forEach(this._insertTag); }; _proto.insert = function insert(rule) { // the max length is how many rules we have per style tag, it's 65000 in speedy mode // it's 1 in dev because we insert source maps that map a single rule to a location // and you can only have one source map per style tag if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) { this._insertTag(createStyleElement(this)); } var tag = this.tags[this.tags.length - 1]; if (this.isSpeedy) { var sheet = sheetForTag(tag); try { // this is the ultrafast version, works across browsers // the big drawback is that the css won't be editable in devtools sheet.insertRule(rule, sheet.cssRules.length); } catch (e) { } } else { tag.appendChild(document.createTextNode(rule)); } this.ctr++; }; _proto.flush = function flush() { // $FlowFixMe this.tags.forEach(function (tag) { return tag.parentNode && tag.parentNode.removeChild(tag); }); this.tags = []; this.ctr = 0; }; return StyleSheet; }(); exports.StyleSheet = StyleSheet; sheet/dist/emotion-sheet.cjs.d.mts000064400000000136151701474430013132 0ustar00export * from "./declarations/src/index.js"; //# sourceMappingURL=emotion-sheet.cjs.d.mts.map sheet/dist/declarations/src/index.d.ts000064400000000074151701474430013766 0ustar00export * from '../types' export { default } from '../types' sheet/dist/declarations/types/index.d.ts000064400000001116151701474430014341 0ustar00// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun> // TypeScript Version: 2.0 export interface Options { nonce?: string key: string container: Node speedy?: boolean /** @deprecate use `insertionPoint` instead */ prepend?: boolean insertionPoint?: HTMLElement } export class StyleSheet { isSpeedy: boolean ctr: number tags: Array<HTMLStyleElement> container: Node key: string nonce?: string before?: ChildNode | null constructor(options?: Options) insert(rule: string): void flush(): void hydrate(nodes: Array<HTMLStyleElement>): void } sheet/dist/emotion-sheet.cjs.js.flow000064400000000052151701474430013464 0ustar00// @flow export * from "../src/index.js"; sheet/dist/emotion-sheet.cjs.d.ts.map000064400000000207151701474430013530 0ustar00{"version":3,"file":"emotion-sheet.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} sheet/dist/emotion-sheet.cjs.dev.js000064400000011401151701474430013273 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); /* Based off glamor's StyleSheet, thanks Sunil ❤️ high performance StyleSheet for css-in-js systems - uses multiple style tags behind the scenes for millions of rules - uses `insertRule` for appending in production for *much* faster performance // usage import { StyleSheet } from '@emotion/sheet' let styleSheet = new StyleSheet({ key: '', container: document.head }) styleSheet.insert('#box { border: 1px solid red; }') - appends a css rule into the stylesheet styleSheet.flush() - empties the stylesheet of all its contents */ // $FlowFixMe function sheetForTag(tag) { if (tag.sheet) { // $FlowFixMe return tag.sheet; } // this weirdness brought to you by firefox /* istanbul ignore next */ for (var i = 0; i < document.styleSheets.length; i++) { if (document.styleSheets[i].ownerNode === tag) { // $FlowFixMe return document.styleSheets[i]; } } } function createStyleElement(options) { var tag = document.createElement('style'); tag.setAttribute('data-emotion', options.key); if (options.nonce !== undefined) { tag.setAttribute('nonce', options.nonce); } tag.appendChild(document.createTextNode('')); tag.setAttribute('data-s', ''); return tag; } var StyleSheet = /*#__PURE__*/function () { // Using Node instead of HTMLElement since container may be a ShadowRoot function StyleSheet(options) { var _this = this; this._insertTag = function (tag) { var before; if (_this.tags.length === 0) { if (_this.insertionPoint) { before = _this.insertionPoint.nextSibling; } else if (_this.prepend) { before = _this.container.firstChild; } else { before = _this.before; } } else { before = _this.tags[_this.tags.length - 1].nextSibling; } _this.container.insertBefore(tag, before); _this.tags.push(tag); }; this.isSpeedy = options.speedy === undefined ? process.env.NODE_ENV === 'production' : options.speedy; this.tags = []; this.ctr = 0; this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets this.key = options.key; this.container = options.container; this.prepend = options.prepend; this.insertionPoint = options.insertionPoint; this.before = null; } var _proto = StyleSheet.prototype; _proto.hydrate = function hydrate(nodes) { nodes.forEach(this._insertTag); }; _proto.insert = function insert(rule) { // the max length is how many rules we have per style tag, it's 65000 in speedy mode // it's 1 in dev because we insert source maps that map a single rule to a location // and you can only have one source map per style tag if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) { this._insertTag(createStyleElement(this)); } var tag = this.tags[this.tags.length - 1]; if (process.env.NODE_ENV !== 'production') { var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105; if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) { // this would only cause problem in speedy mode // but we don't want enabling speedy to affect the observable behavior // so we report this error at all times console.error("You're attempting to insert the following rule:\n" + rule + '\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.'); } this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule; } if (this.isSpeedy) { var sheet = sheetForTag(tag); try { // this is the ultrafast version, works across browsers // the big drawback is that the css won't be editable in devtools sheet.insertRule(rule, sheet.cssRules.length); } catch (e) { if (process.env.NODE_ENV !== 'production' && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(rule)) { console.error("There was a problem inserting the following rule: \"" + rule + "\"", e); } } } else { tag.appendChild(document.createTextNode(rule)); } this.ctr++; }; _proto.flush = function flush() { // $FlowFixMe this.tags.forEach(function (tag) { return tag.parentNode && tag.parentNode.removeChild(tag); }); this.tags = []; this.ctr = 0; if (process.env.NODE_ENV !== 'production') { this._alreadyInsertedOrderInsensitiveRule = false; } }; return StyleSheet; }(); exports.StyleSheet = StyleSheet; sheet/README.md000064400000006442151701474430007147 0ustar00# @emotion/sheet > A StyleSheet for css-in-js libraries ```bash yarn add @emotion/sheet ``` ```jsx import { StyleSheet } from '@emotion/sheet' const sheet = new StyleSheet({ key: '', container: document.head }) sheet.insert('html { color: hotpink; }') ``` > **Note:** > This is not useful for server-side rendering, you should implement SSR seperately ## StyleSheet ### Options ```ts type Options = { nonce?: string key: string container: Node speedy?: boolean prepend?: boolean } ``` #### nonce A nonce that will be set on each style tag that the sheet inserts for [Content Security Policies](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP). #### container A DOM Node that the sheet will insert all of it's style tags into, this is useful for inserting styles into iframes. #### key This will be set as the value of the `data-emotion` attribute on the style tags that get inserted. This is useful to identify different sheets. #### speedy This defines how rules are inserted. If it is true, rules will be inserted with [`insertRule`](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/insertRule) which is very fast but doesn't allow rules to be edited in DevTools. If it is false, rules will be inserted by appending text nodes to style elements which is much slower than insertRule but allows rules to be edited in DevTools. By default, speedy is enabled in production and disabled in development. #### prepend **Deprecated:** Please use `insertionPoint` option instead. This defines where rules are inserted into the `container`. By default they are appended but this can be changed by using `prepend: true` option. #### insertionPoint This defines specific dom node after which the rules are inserted into the `container`. You can use a `meta` tag to specify the specific location: ```jsx const head = document.querySelector('head') // <meta name="emotion-insertion-point" content=""> const emotionInsertionPoint = document.createElement('meta') emotionInsertionPoint.setAttribute('name', 'emotion-insertion-point') emotionInsertionPoint.setAttribute('content', '') head.appendChild(emotionInsertionPoint) // the emotion sheets should be inserted right after the meta tag const cache = createCache({ key: 'my-app', insertionPoint: emotionInsertionPoint }) function App() { return ( <CacheProvider value={cache}> <Main /> </CacheProvider> ) } ``` ### Methods #### insert This method inserts a single rule into the document. It **must** be a single rule otherwise an error will be thrown in speedy mode which is enabled by default in production. #### flush This method will remove all style tags that were inserted into the document. #### hydrate This method moves given style elements into sheet's container and put them into internal tags collection. It's can be used for SSRed styles. ### Example with all options ```jsx import { StyleSheet } from '@emotion/sheet' const container = document.createElement('div') document.head.appendChild(container) const sheet = new StyleSheet({ nonce: 'some-nonce', key: 'some-key', container }) sheet.insert('html { color: hotpink; }') sheet.flush() ``` # Thanks This StyleSheet is based on [glamor's StyleSheet](https://github.com/threepointone/glamor) written by [Sunil Pai](https://github.com/threepointone). ❤️ serialize/src/index.js000064400000026603151701474430011004 0ustar00// @flow import type { Interpolation, SerializedStyles, RegisteredCache } from '@emotion/utils' import hashString from '@emotion/hash' import unitless from '@emotion/unitless' import memoize from '@emotion/memoize' const ILLEGAL_ESCAPE_SEQUENCE_ERROR = `You have illegal escape sequence in your template literal, most likely inside content's property value. Because you write your CSS inside a JavaScript string you actually have to do double escaping, so for example "content: '\\00d7';" should become "content: '\\\\00d7';". You can read more about this here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences` const UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key)." let hyphenateRegex = /[A-Z]|^ms/g let animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g const isCustomProperty = (property: string) => property.charCodeAt(1) === 45 const isProcessableValue = value => value != null && typeof value !== 'boolean' const processStyleName = /* #__PURE__ */ memoize((styleName: string) => isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase() ) let processStyleValue = ( key: string, value: string | number ): string | number => { switch (key) { case 'animation': case 'animationName': { if (typeof value === 'string') { return value.replace(animationRegex, (match, p1, p2) => { cursor = { name: p1, styles: p2, next: cursor } return p1 }) } } } if ( unitless[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0 ) { return value + 'px' } return value } if (process.env.NODE_ENV !== 'production') { let contentValuePattern = /(var|attr|counters?|url|element|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/ let contentValues = ['normal', 'none', 'initial', 'inherit', 'unset'] let oldProcessStyleValue = processStyleValue let msPattern = /^-ms-/ let hyphenPattern = /-(.)/g let hyphenatedCache = {} processStyleValue = (key: string, value: string) => { if (key === 'content') { if ( typeof value !== 'string' || (contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || (value.charAt(0) !== '"' && value.charAt(0) !== "'"))) ) { throw new Error( `You seem to be using a value for 'content' without quotes, try replacing it with \`content: '"${value}"'\`` ) } } const processed = oldProcessStyleValue(key, value) if ( processed !== '' && !isCustomProperty(key) && key.indexOf('-') !== -1 && hyphenatedCache[key] === undefined ) { hyphenatedCache[key] = true console.error( `Using kebab-case for css properties in objects is not supported. Did you mean ${key .replace(msPattern, 'ms-') .replace(hyphenPattern, (str, char) => char.toUpperCase())}?` ) } return processed } } const noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.' function handleInterpolation( mergedProps: void | Object, registered: RegisteredCache | void, interpolation: Interpolation ): string | number { if (interpolation == null) { return '' } if (interpolation.__emotion_styles !== undefined) { if ( process.env.NODE_ENV !== 'production' && interpolation.toString() === 'NO_COMPONENT_SELECTOR' ) { throw new Error(noComponentSelectorMessage) } return interpolation } switch (typeof interpolation) { case 'boolean': { return '' } case 'object': { if (interpolation.anim === 1) { cursor = { name: interpolation.name, styles: interpolation.styles, next: cursor } return interpolation.name } if (interpolation.styles !== undefined) { let next = interpolation.next if (next !== undefined) { // not the most efficient thing ever but this is a pretty rare case // and there will be very few iterations of this generally while (next !== undefined) { cursor = { name: next.name, styles: next.styles, next: cursor } next = next.next } } let styles = `${interpolation.styles};` if ( process.env.NODE_ENV !== 'production' && interpolation.map !== undefined ) { styles += interpolation.map } return styles } return createStringFromObject(mergedProps, registered, interpolation) } case 'function': { if (mergedProps !== undefined) { let previousCursor = cursor let result = interpolation(mergedProps) cursor = previousCursor return handleInterpolation(mergedProps, registered, result) } else if (process.env.NODE_ENV !== 'production') { console.error( 'Functions that are interpolated in css calls will be stringified.\n' + 'If you want to have a css call based on props, create a function that returns a css call like this\n' + 'let dynamicStyle = (props) => css`color: ${props.color}`\n' + 'It can be called directly with props or interpolated in a styled call like this\n' + "let SomeComponent = styled('div')`${dynamicStyle}`" ) } break } case 'string': if (process.env.NODE_ENV !== 'production') { const matched = [] const replaced = interpolation.replace( animationRegex, (match, p1, p2) => { const fakeVarName = `animation${matched.length}` matched.push( `const ${fakeVarName} = keyframes\`${p2.replace( /^@keyframes animation-\w+/, '' )}\`` ) return `\${${fakeVarName}}` } ) if (matched.length) { console.error( '`keyframes` output got interpolated into plain string, please wrap it with `css`.\n\n' + 'Instead of doing this:\n\n' + [...matched, `\`${replaced}\``].join('\n') + '\n\nYou should wrap it with `css` like this:\n\n' + `css\`${replaced}\`` ) } } break } // finalize string values (regular strings and functions interpolated into css calls) if (registered == null) { return interpolation } const cached = registered[interpolation] return cached !== undefined ? cached : interpolation } function createStringFromObject( mergedProps: void | Object, registered: RegisteredCache | void, obj: { [key: string]: Interpolation } ): string { let string = '' if (Array.isArray(obj)) { for (let i = 0; i < obj.length; i++) { string += `${handleInterpolation(mergedProps, registered, obj[i])};` } } else { for (let key in obj) { let value = obj[key] if (typeof value !== 'object') { if (registered != null && registered[value] !== undefined) { string += `${key}{${registered[value]}}` } else if (isProcessableValue(value)) { string += `${processStyleName(key)}:${processStyleValue(key, value)};` } } else { if ( key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production' ) { throw new Error(noComponentSelectorMessage) } if ( Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined) ) { for (let i = 0; i < value.length; i++) { if (isProcessableValue(value[i])) { string += `${processStyleName(key)}:${processStyleValue( key, value[i] )};` } } } else { const interpolated = handleInterpolation( mergedProps, registered, value ) switch (key) { case 'animation': case 'animationName': { string += `${processStyleName(key)}:${interpolated};` break } default: { if ( process.env.NODE_ENV !== 'production' && key === 'undefined' ) { console.error(UNDEFINED_AS_OBJECT_KEY_ERROR) } string += `${key}{${interpolated}}` } } } } } } return string } let labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g let sourceMapPattern if (process.env.NODE_ENV !== 'production') { sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g } // this is the cursor for keyframes // keyframes are stored on the SerializedStyles object as a linked list let cursor export const serializeStyles = function ( args: Array<Interpolation>, registered: RegisteredCache | void, mergedProps: void | Object ): SerializedStyles { if ( args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined ) { return args[0] } let stringMode = true let styles = '' cursor = undefined let strings = args[0] if (strings == null || strings.raw === undefined) { stringMode = false styles += handleInterpolation(mergedProps, registered, strings) } else { if (process.env.NODE_ENV !== 'production' && strings[0] === undefined) { console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR) } styles += strings[0] } // we start at 1 since we've already handled the first arg for (let i = 1; i < args.length; i++) { styles += handleInterpolation(mergedProps, registered, args[i]) if (stringMode) { if (process.env.NODE_ENV !== 'production' && strings[i] === undefined) { console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR) } styles += strings[i] } } let sourceMap if (process.env.NODE_ENV !== 'production') { styles = styles.replace(sourceMapPattern, match => { sourceMap = match return '' }) } // using a global regex with .exec is stateful so lastIndex has to be reset each time labelPattern.lastIndex = 0 let identifierName = '' let match // https://esbench.com/bench/5b809c2cf2949800a0f61fb5 while ((match = labelPattern.exec(styles)) !== null) { identifierName += '-' + // $FlowFixMe we know it's not null match[1] } let name = hashString(styles) + identifierName if (process.env.NODE_ENV !== 'production') { // $FlowFixMe SerializedStyles type doesn't have toString property (and we don't want to add it) return { name, styles, map: sourceMap, next: cursor, toString() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)." } } } return { name, styles, next: cursor } } serialize/src/index.d.ts000064400000000074151701474430011232 0ustar00export * from '../types' export { default } from '../types' serialize/package.json000064400000004253151701474430011033 0ustar00{ "_from": "@emotion/serialize@*", "_id": "@emotion/serialize@1.1.4", "_inBundle": false, "_integrity": "sha512-RIN04MBT8g+FnDwgvIUi8czvr1LU1alUMI05LekWB5DGyTm8cCBMCRpq3GqaiyEDRptEXOyXnvZ58GZYu4kBxQ==", "_location": "/@emotion/serialize", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "@emotion/serialize@*", "name": "@emotion/serialize", "escapedName": "@emotion%2fserialize", "scope": "@emotion", "rawSpec": "*", "saveSpec": null, "fetchSpec": "*" }, "_requiredBy": [ "/tss-react" ], "_resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.1.4.tgz", "_shasum": "fc8f6d80c492cfa08801d544a05331d1cc7cd451", "_spec": "@emotion/serialize@*", "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\tss-react", "browser": { "./dist/emotion-serialize.esm.js": "./dist/emotion-serialize.browser.esm.js" }, "bundleDependencies": false, "dependencies": { "@emotion/hash": "^0.9.1", "@emotion/memoize": "^0.8.1", "@emotion/unitless": "^0.8.1", "@emotion/utils": "^1.2.1", "csstype": "^3.0.2" }, "deprecated": false, "description": "serialization utils for emotion", "devDependencies": { "@definitelytyped/dtslint": "0.0.112", "typescript": "^4.5.5" }, "exports": { ".": { "module": { "browser": "./dist/emotion-serialize.browser.esm.js", "default": "./dist/emotion-serialize.esm.js" }, "import": "./dist/emotion-serialize.cjs.mjs", "default": "./dist/emotion-serialize.cjs.js" }, "./package.json": "./package.json" }, "files": [ "src", "dist", "types/*.d.ts" ], "license": "MIT", "main": "dist/emotion-serialize.cjs.js", "module": "dist/emotion-serialize.esm.js", "name": "@emotion/serialize", "preconstruct": { "exports": { "envConditions": [ "browser" ] } }, "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/emotion-js/emotion/tree/main/packages/serialize" }, "scripts": { "test:typescript": "dtslint types" }, "types": "types/index.d.ts", "version": "1.1.4" } serialize/LICENSE000064400000002077151701474430007554 0ustar00MIT License Copyright (c) Emotion team and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. serialize/types/index.d.ts000064400000003240151701474430011605 0ustar00// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun> // TypeScript Version: 2.8 import { RegisteredCache, SerializedStyles } from '@emotion/utils' import * as CSS from 'csstype' export { RegisteredCache, SerializedStyles } export type CSSProperties = CSS.PropertiesFallback<number | string> export type CSSPropertiesWithMultiValues = { [K in keyof CSSProperties]: | CSSProperties[K] | ReadonlyArray<Extract<CSSProperties[K], string>> } export type CSSPseudos = { [K in CSS.Pseudos]?: CSSObject } export interface ArrayCSSInterpolation extends ReadonlyArray<CSSInterpolation> {} export type InterpolationPrimitive = | null | undefined | boolean | number | string | ComponentSelector | Keyframes | SerializedStyles | CSSObject export type CSSInterpolation = InterpolationPrimitive | ArrayCSSInterpolation export interface CSSOthersObject { [propertiesName: string]: CSSInterpolation } export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudos, CSSOthersObject {} export interface ComponentSelector { __emotion_styles: any } export type Keyframes = { name: string styles: string anim: number toString: () => string } & string export interface ArrayInterpolation<Props> extends ReadonlyArray<Interpolation<Props>> {} export interface FunctionInterpolation<Props> { (props: Props): Interpolation<Props> } export type Interpolation<Props> = | InterpolationPrimitive | ArrayInterpolation<Props> | FunctionInterpolation<Props> export function serializeStyles<Props>( args: Array<TemplateStringsArray | Interpolation<Props>>, registered?: RegisteredCache, props?: Props ): SerializedStyles serialize/dist/emotion-serialize.cjs.js.flow000064400000000052151701474430015222 0ustar00// @flow export * from "../src/index.js"; serialize/dist/emotion-serialize.cjs.d.ts.map000064400000000213151701474430015263 0ustar00{"version":3,"file":"emotion-serialize.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} serialize/dist/emotion-serialize.cjs.d.mts.map000064400000000214151701474430015441 0ustar00{"version":3,"file":"emotion-serialize.cjs.d.mts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} serialize/dist/emotion-serialize.cjs.prod.js000064400000014641151701474430015230 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var hashString = require('@emotion/hash'); var unitless = require('@emotion/unitless'); var memoize = require('@emotion/memoize'); function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } var hashString__default = /*#__PURE__*/_interopDefault(hashString); var unitless__default = /*#__PURE__*/_interopDefault(unitless); var memoize__default = /*#__PURE__*/_interopDefault(memoize); var hyphenateRegex = /[A-Z]|^ms/g; var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g; var isCustomProperty = function isCustomProperty(property) { return property.charCodeAt(1) === 45; }; var isProcessableValue = function isProcessableValue(value) { return value != null && typeof value !== 'boolean'; }; var processStyleName = /* #__PURE__ */memoize__default["default"](function (styleName) { return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); }); var processStyleValue = function processStyleValue(key, value) { switch (key) { case 'animation': case 'animationName': { if (typeof value === 'string') { return value.replace(animationRegex, function (match, p1, p2) { cursor = { name: p1, styles: p2, next: cursor }; return p1; }); } } } if (unitless__default["default"][key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) { return value + 'px'; } return value; }; var noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.'; function handleInterpolation(mergedProps, registered, interpolation) { if (interpolation == null) { return ''; } if (interpolation.__emotion_styles !== undefined) { return interpolation; } switch (typeof interpolation) { case 'boolean': { return ''; } case 'object': { if (interpolation.anim === 1) { cursor = { name: interpolation.name, styles: interpolation.styles, next: cursor }; return interpolation.name; } if (interpolation.styles !== undefined) { var next = interpolation.next; if (next !== undefined) { // not the most efficient thing ever but this is a pretty rare case // and there will be very few iterations of this generally while (next !== undefined) { cursor = { name: next.name, styles: next.styles, next: cursor }; next = next.next; } } var styles = interpolation.styles + ";"; return styles; } return createStringFromObject(mergedProps, registered, interpolation); } case 'function': { if (mergedProps !== undefined) { var previousCursor = cursor; var result = interpolation(mergedProps); cursor = previousCursor; return handleInterpolation(mergedProps, registered, result); } break; } } // finalize string values (regular strings and functions interpolated into css calls) if (registered == null) { return interpolation; } var cached = registered[interpolation]; return cached !== undefined ? cached : interpolation; } function createStringFromObject(mergedProps, registered, obj) { var string = ''; if (Array.isArray(obj)) { for (var i = 0; i < obj.length; i++) { string += handleInterpolation(mergedProps, registered, obj[i]) + ";"; } } else { for (var _key in obj) { var value = obj[_key]; if (typeof value !== 'object') { if (registered != null && registered[value] !== undefined) { string += _key + "{" + registered[value] + "}"; } else if (isProcessableValue(value)) { string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";"; } } else { if (_key === 'NO_COMPONENT_SELECTOR' && "production" !== 'production') { throw new Error(noComponentSelectorMessage); } if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) { for (var _i = 0; _i < value.length; _i++) { if (isProcessableValue(value[_i])) { string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";"; } } } else { var interpolated = handleInterpolation(mergedProps, registered, value); switch (_key) { case 'animation': case 'animationName': { string += processStyleName(_key) + ":" + interpolated + ";"; break; } default: { string += _key + "{" + interpolated + "}"; } } } } } } return string; } var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g; // keyframes are stored on the SerializedStyles object as a linked list var cursor; var serializeStyles = function serializeStyles(args, registered, mergedProps) { if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) { return args[0]; } var stringMode = true; var styles = ''; cursor = undefined; var strings = args[0]; if (strings == null || strings.raw === undefined) { stringMode = false; styles += handleInterpolation(mergedProps, registered, strings); } else { styles += strings[0]; } // we start at 1 since we've already handled the first arg for (var i = 1; i < args.length; i++) { styles += handleInterpolation(mergedProps, registered, args[i]); if (stringMode) { styles += strings[i]; } } labelPattern.lastIndex = 0; var identifierName = ''; var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5 while ((match = labelPattern.exec(styles)) !== null) { identifierName += '-' + // $FlowFixMe we know it's not null match[1]; } var name = hashString__default["default"](styles) + identifierName; return { name: name, styles: styles, next: cursor }; }; exports.serializeStyles = serializeStyles; serialize/dist/emotion-serialize.cjs.dev.js000064400000026413151701474430015042 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var hashString = require('@emotion/hash'); var unitless = require('@emotion/unitless'); var memoize = require('@emotion/memoize'); function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } var hashString__default = /*#__PURE__*/_interopDefault(hashString); var unitless__default = /*#__PURE__*/_interopDefault(unitless); var memoize__default = /*#__PURE__*/_interopDefault(memoize); var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key)."; var hyphenateRegex = /[A-Z]|^ms/g; var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g; var isCustomProperty = function isCustomProperty(property) { return property.charCodeAt(1) === 45; }; var isProcessableValue = function isProcessableValue(value) { return value != null && typeof value !== 'boolean'; }; var processStyleName = /* #__PURE__ */memoize__default["default"](function (styleName) { return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); }); var processStyleValue = function processStyleValue(key, value) { switch (key) { case 'animation': case 'animationName': { if (typeof value === 'string') { return value.replace(animationRegex, function (match, p1, p2) { cursor = { name: p1, styles: p2, next: cursor }; return p1; }); } } } if (unitless__default["default"][key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) { return value + 'px'; } return value; }; if (process.env.NODE_ENV !== 'production') { var contentValuePattern = /(var|attr|counters?|url|element|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/; var contentValues = ['normal', 'none', 'initial', 'inherit', 'unset']; var oldProcessStyleValue = processStyleValue; var msPattern = /^-ms-/; var hyphenPattern = /-(.)/g; var hyphenatedCache = {}; processStyleValue = function processStyleValue(key, value) { if (key === 'content') { if (typeof value !== 'string' || contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '"' && value.charAt(0) !== "'")) { throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`"); } } var processed = oldProcessStyleValue(key, value); if (processed !== '' && !isCustomProperty(key) && key.indexOf('-') !== -1 && hyphenatedCache[key] === undefined) { hyphenatedCache[key] = true; console.error("Using kebab-case for css properties in objects is not supported. Did you mean " + key.replace(msPattern, 'ms-').replace(hyphenPattern, function (str, _char) { return _char.toUpperCase(); }) + "?"); } return processed; }; } var noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.'; function handleInterpolation(mergedProps, registered, interpolation) { if (interpolation == null) { return ''; } if (interpolation.__emotion_styles !== undefined) { if (process.env.NODE_ENV !== 'production' && interpolation.toString() === 'NO_COMPONENT_SELECTOR') { throw new Error(noComponentSelectorMessage); } return interpolation; } switch (typeof interpolation) { case 'boolean': { return ''; } case 'object': { if (interpolation.anim === 1) { cursor = { name: interpolation.name, styles: interpolation.styles, next: cursor }; return interpolation.name; } if (interpolation.styles !== undefined) { var next = interpolation.next; if (next !== undefined) { // not the most efficient thing ever but this is a pretty rare case // and there will be very few iterations of this generally while (next !== undefined) { cursor = { name: next.name, styles: next.styles, next: cursor }; next = next.next; } } var styles = interpolation.styles + ";"; if (process.env.NODE_ENV !== 'production' && interpolation.map !== undefined) { styles += interpolation.map; } return styles; } return createStringFromObject(mergedProps, registered, interpolation); } case 'function': { if (mergedProps !== undefined) { var previousCursor = cursor; var result = interpolation(mergedProps); cursor = previousCursor; return handleInterpolation(mergedProps, registered, result); } else if (process.env.NODE_ENV !== 'production') { console.error('Functions that are interpolated in css calls will be stringified.\n' + 'If you want to have a css call based on props, create a function that returns a css call like this\n' + 'let dynamicStyle = (props) => css`color: ${props.color}`\n' + 'It can be called directly with props or interpolated in a styled call like this\n' + "let SomeComponent = styled('div')`${dynamicStyle}`"); } break; } case 'string': if (process.env.NODE_ENV !== 'production') { var matched = []; var replaced = interpolation.replace(animationRegex, function (match, p1, p2) { var fakeVarName = "animation" + matched.length; matched.push("const " + fakeVarName + " = keyframes`" + p2.replace(/^@keyframes animation-\w+/, '') + "`"); return "${" + fakeVarName + "}"; }); if (matched.length) { console.error('`keyframes` output got interpolated into plain string, please wrap it with `css`.\n\n' + 'Instead of doing this:\n\n' + [].concat(matched, ["`" + replaced + "`"]).join('\n') + '\n\nYou should wrap it with `css` like this:\n\n' + ("css`" + replaced + "`")); } } break; } // finalize string values (regular strings and functions interpolated into css calls) if (registered == null) { return interpolation; } var cached = registered[interpolation]; return cached !== undefined ? cached : interpolation; } function createStringFromObject(mergedProps, registered, obj) { var string = ''; if (Array.isArray(obj)) { for (var i = 0; i < obj.length; i++) { string += handleInterpolation(mergedProps, registered, obj[i]) + ";"; } } else { for (var _key in obj) { var value = obj[_key]; if (typeof value !== 'object') { if (registered != null && registered[value] !== undefined) { string += _key + "{" + registered[value] + "}"; } else if (isProcessableValue(value)) { string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";"; } } else { if (_key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') { throw new Error(noComponentSelectorMessage); } if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) { for (var _i = 0; _i < value.length; _i++) { if (isProcessableValue(value[_i])) { string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";"; } } } else { var interpolated = handleInterpolation(mergedProps, registered, value); switch (_key) { case 'animation': case 'animationName': { string += processStyleName(_key) + ":" + interpolated + ";"; break; } default: { if (process.env.NODE_ENV !== 'production' && _key === 'undefined') { console.error(UNDEFINED_AS_OBJECT_KEY_ERROR); } string += _key + "{" + interpolated + "}"; } } } } } } return string; } var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g; var sourceMapPattern; if (process.env.NODE_ENV !== 'production') { sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g; } // this is the cursor for keyframes // keyframes are stored on the SerializedStyles object as a linked list var cursor; var serializeStyles = function serializeStyles(args, registered, mergedProps) { if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) { return args[0]; } var stringMode = true; var styles = ''; cursor = undefined; var strings = args[0]; if (strings == null || strings.raw === undefined) { stringMode = false; styles += handleInterpolation(mergedProps, registered, strings); } else { if (process.env.NODE_ENV !== 'production' && strings[0] === undefined) { console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR); } styles += strings[0]; } // we start at 1 since we've already handled the first arg for (var i = 1; i < args.length; i++) { styles += handleInterpolation(mergedProps, registered, args[i]); if (stringMode) { if (process.env.NODE_ENV !== 'production' && strings[i] === undefined) { console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR); } styles += strings[i]; } } var sourceMap; if (process.env.NODE_ENV !== 'production') { styles = styles.replace(sourceMapPattern, function (match) { sourceMap = match; return ''; }); } // using a global regex with .exec is stateful so lastIndex has to be reset each time labelPattern.lastIndex = 0; var identifierName = ''; var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5 while ((match = labelPattern.exec(styles)) !== null) { identifierName += '-' + // $FlowFixMe we know it's not null match[1]; } var name = hashString__default["default"](styles) + identifierName; if (process.env.NODE_ENV !== 'production') { // $FlowFixMe SerializedStyles type doesn't have toString property (and we don't want to add it) return { name: name, styles: styles, map: sourceMap, next: cursor, toString: function toString() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } }; } return { name: name, styles: styles, next: cursor }; }; exports.serializeStyles = serializeStyles; serialize/dist/emotion-serialize.cjs.d.mts000064400000000142151701474430014665 0ustar00export * from "./declarations/src/index.js"; //# sourceMappingURL=emotion-serialize.cjs.d.mts.map serialize/dist/emotion-serialize.browser.esm.js000064400000025522151701474430015754 0ustar00import hashString from '@emotion/hash'; import unitless from '@emotion/unitless'; import memoize from '@emotion/memoize'; var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key)."; var hyphenateRegex = /[A-Z]|^ms/g; var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g; var isCustomProperty = function isCustomProperty(property) { return property.charCodeAt(1) === 45; }; var isProcessableValue = function isProcessableValue(value) { return value != null && typeof value !== 'boolean'; }; var processStyleName = /* #__PURE__ */memoize(function (styleName) { return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); }); var processStyleValue = function processStyleValue(key, value) { switch (key) { case 'animation': case 'animationName': { if (typeof value === 'string') { return value.replace(animationRegex, function (match, p1, p2) { cursor = { name: p1, styles: p2, next: cursor }; return p1; }); } } } if (unitless[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) { return value + 'px'; } return value; }; if (process.env.NODE_ENV !== 'production') { var contentValuePattern = /(var|attr|counters?|url|element|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/; var contentValues = ['normal', 'none', 'initial', 'inherit', 'unset']; var oldProcessStyleValue = processStyleValue; var msPattern = /^-ms-/; var hyphenPattern = /-(.)/g; var hyphenatedCache = {}; processStyleValue = function processStyleValue(key, value) { if (key === 'content') { if (typeof value !== 'string' || contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '"' && value.charAt(0) !== "'")) { throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`"); } } var processed = oldProcessStyleValue(key, value); if (processed !== '' && !isCustomProperty(key) && key.indexOf('-') !== -1 && hyphenatedCache[key] === undefined) { hyphenatedCache[key] = true; console.error("Using kebab-case for css properties in objects is not supported. Did you mean " + key.replace(msPattern, 'ms-').replace(hyphenPattern, function (str, _char) { return _char.toUpperCase(); }) + "?"); } return processed; }; } var noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.'; function handleInterpolation(mergedProps, registered, interpolation) { if (interpolation == null) { return ''; } if (interpolation.__emotion_styles !== undefined) { if (process.env.NODE_ENV !== 'production' && interpolation.toString() === 'NO_COMPONENT_SELECTOR') { throw new Error(noComponentSelectorMessage); } return interpolation; } switch (typeof interpolation) { case 'boolean': { return ''; } case 'object': { if (interpolation.anim === 1) { cursor = { name: interpolation.name, styles: interpolation.styles, next: cursor }; return interpolation.name; } if (interpolation.styles !== undefined) { var next = interpolation.next; if (next !== undefined) { // not the most efficient thing ever but this is a pretty rare case // and there will be very few iterations of this generally while (next !== undefined) { cursor = { name: next.name, styles: next.styles, next: cursor }; next = next.next; } } var styles = interpolation.styles + ";"; if (process.env.NODE_ENV !== 'production' && interpolation.map !== undefined) { styles += interpolation.map; } return styles; } return createStringFromObject(mergedProps, registered, interpolation); } case 'function': { if (mergedProps !== undefined) { var previousCursor = cursor; var result = interpolation(mergedProps); cursor = previousCursor; return handleInterpolation(mergedProps, registered, result); } else if (process.env.NODE_ENV !== 'production') { console.error('Functions that are interpolated in css calls will be stringified.\n' + 'If you want to have a css call based on props, create a function that returns a css call like this\n' + 'let dynamicStyle = (props) => css`color: ${props.color}`\n' + 'It can be called directly with props or interpolated in a styled call like this\n' + "let SomeComponent = styled('div')`${dynamicStyle}`"); } break; } case 'string': if (process.env.NODE_ENV !== 'production') { var matched = []; var replaced = interpolation.replace(animationRegex, function (match, p1, p2) { var fakeVarName = "animation" + matched.length; matched.push("const " + fakeVarName + " = keyframes`" + p2.replace(/^@keyframes animation-\w+/, '') + "`"); return "${" + fakeVarName + "}"; }); if (matched.length) { console.error('`keyframes` output got interpolated into plain string, please wrap it with `css`.\n\n' + 'Instead of doing this:\n\n' + [].concat(matched, ["`" + replaced + "`"]).join('\n') + '\n\nYou should wrap it with `css` like this:\n\n' + ("css`" + replaced + "`")); } } break; } // finalize string values (regular strings and functions interpolated into css calls) if (registered == null) { return interpolation; } var cached = registered[interpolation]; return cached !== undefined ? cached : interpolation; } function createStringFromObject(mergedProps, registered, obj) { var string = ''; if (Array.isArray(obj)) { for (var i = 0; i < obj.length; i++) { string += handleInterpolation(mergedProps, registered, obj[i]) + ";"; } } else { for (var _key in obj) { var value = obj[_key]; if (typeof value !== 'object') { if (registered != null && registered[value] !== undefined) { string += _key + "{" + registered[value] + "}"; } else if (isProcessableValue(value)) { string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";"; } } else { if (_key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') { throw new Error(noComponentSelectorMessage); } if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) { for (var _i = 0; _i < value.length; _i++) { if (isProcessableValue(value[_i])) { string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";"; } } } else { var interpolated = handleInterpolation(mergedProps, registered, value); switch (_key) { case 'animation': case 'animationName': { string += processStyleName(_key) + ":" + interpolated + ";"; break; } default: { if (process.env.NODE_ENV !== 'production' && _key === 'undefined') { console.error(UNDEFINED_AS_OBJECT_KEY_ERROR); } string += _key + "{" + interpolated + "}"; } } } } } } return string; } var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g; var sourceMapPattern; if (process.env.NODE_ENV !== 'production') { sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g; } // this is the cursor for keyframes // keyframes are stored on the SerializedStyles object as a linked list var cursor; var serializeStyles = function serializeStyles(args, registered, mergedProps) { if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) { return args[0]; } var stringMode = true; var styles = ''; cursor = undefined; var strings = args[0]; if (strings == null || strings.raw === undefined) { stringMode = false; styles += handleInterpolation(mergedProps, registered, strings); } else { if (process.env.NODE_ENV !== 'production' && strings[0] === undefined) { console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR); } styles += strings[0]; } // we start at 1 since we've already handled the first arg for (var i = 1; i < args.length; i++) { styles += handleInterpolation(mergedProps, registered, args[i]); if (stringMode) { if (process.env.NODE_ENV !== 'production' && strings[i] === undefined) { console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR); } styles += strings[i]; } } var sourceMap; if (process.env.NODE_ENV !== 'production') { styles = styles.replace(sourceMapPattern, function (match) { sourceMap = match; return ''; }); } // using a global regex with .exec is stateful so lastIndex has to be reset each time labelPattern.lastIndex = 0; var identifierName = ''; var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5 while ((match = labelPattern.exec(styles)) !== null) { identifierName += '-' + // $FlowFixMe we know it's not null match[1]; } var name = hashString(styles) + identifierName; if (process.env.NODE_ENV !== 'production') { // $FlowFixMe SerializedStyles type doesn't have toString property (and we don't want to add it) return { name: name, styles: styles, map: sourceMap, next: cursor, toString: function toString() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } }; } return { name: name, styles: styles, next: cursor }; }; export { serializeStyles }; serialize/dist/emotion-serialize.cjs.js000064400000000304151701474430014254 0ustar00'use strict'; if (process.env.NODE_ENV === "production") { module.exports = require("./emotion-serialize.cjs.prod.js"); } else { module.exports = require("./emotion-serialize.cjs.dev.js"); } serialize/dist/declarations/src/index.d.ts000064400000000074151701474430014645 0ustar00export * from '../types' export { default } from '../types' serialize/dist/declarations/types/index.d.ts000064400000003240151701474430015220 0ustar00// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun> // TypeScript Version: 2.8 import { RegisteredCache, SerializedStyles } from '@emotion/utils' import * as CSS from 'csstype' export { RegisteredCache, SerializedStyles } export type CSSProperties = CSS.PropertiesFallback<number | string> export type CSSPropertiesWithMultiValues = { [K in keyof CSSProperties]: | CSSProperties[K] | ReadonlyArray<Extract<CSSProperties[K], string>> } export type CSSPseudos = { [K in CSS.Pseudos]?: CSSObject } export interface ArrayCSSInterpolation extends ReadonlyArray<CSSInterpolation> {} export type InterpolationPrimitive = | null | undefined | boolean | number | string | ComponentSelector | Keyframes | SerializedStyles | CSSObject export type CSSInterpolation = InterpolationPrimitive | ArrayCSSInterpolation export interface CSSOthersObject { [propertiesName: string]: CSSInterpolation } export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudos, CSSOthersObject {} export interface ComponentSelector { __emotion_styles: any } export type Keyframes = { name: string styles: string anim: number toString: () => string } & string export interface ArrayInterpolation<Props> extends ReadonlyArray<Interpolation<Props>> {} export interface FunctionInterpolation<Props> { (props: Props): Interpolation<Props> } export type Interpolation<Props> = | InterpolationPrimitive | ArrayInterpolation<Props> | FunctionInterpolation<Props> export function serializeStyles<Props>( args: Array<TemplateStringsArray | Interpolation<Props>>, registered?: RegisteredCache, props?: Props ): SerializedStyles serialize/dist/emotion-serialize.cjs.mjs000064400000000100151701474430014423 0ustar00export { serializeStyles } from "./emotion-serialize.cjs.js"; serialize/dist/emotion-serialize.cjs.d.ts000064400000000136151701474430014513 0ustar00export * from "./declarations/src/index"; //# sourceMappingURL=emotion-serialize.cjs.d.ts.map serialize/dist/emotion-serialize.esm.js000064400000025522151701474430014272 0ustar00import hashString from '@emotion/hash'; import unitless from '@emotion/unitless'; import memoize from '@emotion/memoize'; var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key)."; var hyphenateRegex = /[A-Z]|^ms/g; var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g; var isCustomProperty = function isCustomProperty(property) { return property.charCodeAt(1) === 45; }; var isProcessableValue = function isProcessableValue(value) { return value != null && typeof value !== 'boolean'; }; var processStyleName = /* #__PURE__ */memoize(function (styleName) { return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); }); var processStyleValue = function processStyleValue(key, value) { switch (key) { case 'animation': case 'animationName': { if (typeof value === 'string') { return value.replace(animationRegex, function (match, p1, p2) { cursor = { name: p1, styles: p2, next: cursor }; return p1; }); } } } if (unitless[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) { return value + 'px'; } return value; }; if (process.env.NODE_ENV !== 'production') { var contentValuePattern = /(var|attr|counters?|url|element|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/; var contentValues = ['normal', 'none', 'initial', 'inherit', 'unset']; var oldProcessStyleValue = processStyleValue; var msPattern = /^-ms-/; var hyphenPattern = /-(.)/g; var hyphenatedCache = {}; processStyleValue = function processStyleValue(key, value) { if (key === 'content') { if (typeof value !== 'string' || contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '"' && value.charAt(0) !== "'")) { throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`"); } } var processed = oldProcessStyleValue(key, value); if (processed !== '' && !isCustomProperty(key) && key.indexOf('-') !== -1 && hyphenatedCache[key] === undefined) { hyphenatedCache[key] = true; console.error("Using kebab-case for css properties in objects is not supported. Did you mean " + key.replace(msPattern, 'ms-').replace(hyphenPattern, function (str, _char) { return _char.toUpperCase(); }) + "?"); } return processed; }; } var noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.'; function handleInterpolation(mergedProps, registered, interpolation) { if (interpolation == null) { return ''; } if (interpolation.__emotion_styles !== undefined) { if (process.env.NODE_ENV !== 'production' && interpolation.toString() === 'NO_COMPONENT_SELECTOR') { throw new Error(noComponentSelectorMessage); } return interpolation; } switch (typeof interpolation) { case 'boolean': { return ''; } case 'object': { if (interpolation.anim === 1) { cursor = { name: interpolation.name, styles: interpolation.styles, next: cursor }; return interpolation.name; } if (interpolation.styles !== undefined) { var next = interpolation.next; if (next !== undefined) { // not the most efficient thing ever but this is a pretty rare case // and there will be very few iterations of this generally while (next !== undefined) { cursor = { name: next.name, styles: next.styles, next: cursor }; next = next.next; } } var styles = interpolation.styles + ";"; if (process.env.NODE_ENV !== 'production' && interpolation.map !== undefined) { styles += interpolation.map; } return styles; } return createStringFromObject(mergedProps, registered, interpolation); } case 'function': { if (mergedProps !== undefined) { var previousCursor = cursor; var result = interpolation(mergedProps); cursor = previousCursor; return handleInterpolation(mergedProps, registered, result); } else if (process.env.NODE_ENV !== 'production') { console.error('Functions that are interpolated in css calls will be stringified.\n' + 'If you want to have a css call based on props, create a function that returns a css call like this\n' + 'let dynamicStyle = (props) => css`color: ${props.color}`\n' + 'It can be called directly with props or interpolated in a styled call like this\n' + "let SomeComponent = styled('div')`${dynamicStyle}`"); } break; } case 'string': if (process.env.NODE_ENV !== 'production') { var matched = []; var replaced = interpolation.replace(animationRegex, function (match, p1, p2) { var fakeVarName = "animation" + matched.length; matched.push("const " + fakeVarName + " = keyframes`" + p2.replace(/^@keyframes animation-\w+/, '') + "`"); return "${" + fakeVarName + "}"; }); if (matched.length) { console.error('`keyframes` output got interpolated into plain string, please wrap it with `css`.\n\n' + 'Instead of doing this:\n\n' + [].concat(matched, ["`" + replaced + "`"]).join('\n') + '\n\nYou should wrap it with `css` like this:\n\n' + ("css`" + replaced + "`")); } } break; } // finalize string values (regular strings and functions interpolated into css calls) if (registered == null) { return interpolation; } var cached = registered[interpolation]; return cached !== undefined ? cached : interpolation; } function createStringFromObject(mergedProps, registered, obj) { var string = ''; if (Array.isArray(obj)) { for (var i = 0; i < obj.length; i++) { string += handleInterpolation(mergedProps, registered, obj[i]) + ";"; } } else { for (var _key in obj) { var value = obj[_key]; if (typeof value !== 'object') { if (registered != null && registered[value] !== undefined) { string += _key + "{" + registered[value] + "}"; } else if (isProcessableValue(value)) { string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";"; } } else { if (_key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') { throw new Error(noComponentSelectorMessage); } if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) { for (var _i = 0; _i < value.length; _i++) { if (isProcessableValue(value[_i])) { string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";"; } } } else { var interpolated = handleInterpolation(mergedProps, registered, value); switch (_key) { case 'animation': case 'animationName': { string += processStyleName(_key) + ":" + interpolated + ";"; break; } default: { if (process.env.NODE_ENV !== 'production' && _key === 'undefined') { console.error(UNDEFINED_AS_OBJECT_KEY_ERROR); } string += _key + "{" + interpolated + "}"; } } } } } } return string; } var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g; var sourceMapPattern; if (process.env.NODE_ENV !== 'production') { sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g; } // this is the cursor for keyframes // keyframes are stored on the SerializedStyles object as a linked list var cursor; var serializeStyles = function serializeStyles(args, registered, mergedProps) { if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) { return args[0]; } var stringMode = true; var styles = ''; cursor = undefined; var strings = args[0]; if (strings == null || strings.raw === undefined) { stringMode = false; styles += handleInterpolation(mergedProps, registered, strings); } else { if (process.env.NODE_ENV !== 'production' && strings[0] === undefined) { console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR); } styles += strings[0]; } // we start at 1 since we've already handled the first arg for (var i = 1; i < args.length; i++) { styles += handleInterpolation(mergedProps, registered, args[i]); if (stringMode) { if (process.env.NODE_ENV !== 'production' && strings[i] === undefined) { console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR); } styles += strings[i]; } } var sourceMap; if (process.env.NODE_ENV !== 'production') { styles = styles.replace(sourceMapPattern, function (match) { sourceMap = match; return ''; }); } // using a global regex with .exec is stateful so lastIndex has to be reset each time labelPattern.lastIndex = 0; var identifierName = ''; var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5 while ((match = labelPattern.exec(styles)) !== null) { identifierName += '-' + // $FlowFixMe we know it's not null match[1]; } var name = hashString(styles) + identifierName; if (process.env.NODE_ENV !== 'production') { // $FlowFixMe SerializedStyles type doesn't have toString property (and we don't want to add it) return { name: name, styles: styles, map: sourceMap, next: cursor, toString: function toString() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } }; } return { name: name, styles: styles, next: cursor }; }; export { serializeStyles }; utils/src/types.js000064400000001071151701474430010202 0ustar00// @flow import type { StyleSheet } from '@emotion/sheet' export type RegisteredCache = { [string]: string } export type Interpolation = any export type SerializedStyles = {| name: string, styles: string, map?: string, next?: SerializedStyles |} export type EmotionCache = { inserted: { [string]: string | true }, registered: RegisteredCache, sheet: StyleSheet, key: string, compat?: true, nonce?: string, insert: ( selector: string, serialized: SerializedStyles, sheet: StyleSheet, shouldCache: boolean ) => string | void } utils/src/index.js000064400000004333151701474430010151 0ustar00// @flow import type { RegisteredCache, EmotionCache, SerializedStyles } from './types' const isBrowser = typeof document !== 'undefined' export function getRegisteredStyles( registered: RegisteredCache, registeredStyles: string[], classNames: string ) { let rawClassName = '' classNames.split(' ').forEach(className => { if (registered[className] !== undefined) { registeredStyles.push(`${registered[className]};`) } else { rawClassName += `${className} ` } }) return rawClassName } export const registerStyles = ( cache: EmotionCache, serialized: SerializedStyles, isStringTag: boolean ) => { let className = `${cache.key}-${serialized.name}` if ( // we only need to add the styles to the registered cache if the // class name could be used further down // the tree but if it's a string tag, we know it won't // so we don't have to add it to registered cache. // this improves memory usage since we can avoid storing the whole style string (isStringTag === false || // we need to always store it if we're in compat mode and // in node since emotion-server relies on whether a style is in // the registered cache to know whether a style is global or not // also, note that this check will be dead code eliminated in the browser (isBrowser === false && cache.compat !== undefined)) && cache.registered[className] === undefined ) { cache.registered[className] = serialized.styles } } export const insertStyles = ( cache: EmotionCache, serialized: SerializedStyles, isStringTag: boolean ) => { registerStyles(cache, serialized, isStringTag) let className = `${cache.key}-${serialized.name}` if (cache.inserted[serialized.name] === undefined) { let stylesForSSR = '' let current = serialized do { let maybeStyles = cache.insert( serialized === current ? `.${className}` : '', current, cache.sheet, true ) if (!isBrowser && maybeStyles !== undefined) { stylesForSSR += maybeStyles } current = current.next } while (current !== undefined) if (!isBrowser && stylesForSSR.length !== 0) { return stylesForSSR } } } export * from './types' utils/src/index.d.ts000064400000000031151701474430010374 0ustar00export * from '../types' utils/package.json000064400000004100151701474430010173 0ustar00{ "_from": "@emotion/utils@^1.2.1", "_id": "@emotion/utils@1.2.1", "_inBundle": false, "_integrity": "sha512-Y2tGf3I+XVnajdItskUCn6LX+VUDmP6lTL4fcqsXAv43dnlbZiuW4MWQW38rW/BVWSE7Q/7+XQocmpnRYILUmg==", "_location": "/@emotion/utils", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "@emotion/utils@^1.2.1", "name": "@emotion/utils", "escapedName": "@emotion%2futils", "scope": "@emotion", "rawSpec": "^1.2.1", "saveSpec": null, "fetchSpec": "^1.2.1" }, "_requiredBy": [ "/@emotion/cache", "/@emotion/serialize", "/tss-react" ], "_resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.2.1.tgz", "_shasum": "bbab58465738d31ae4cb3dbb6fc00a5991f755e4", "_spec": "@emotion/utils@^1.2.1", "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\@emotion\\cache", "browser": { "./dist/emotion-utils.esm.js": "./dist/emotion-utils.browser.esm.js" }, "bundleDependencies": false, "deprecated": false, "description": "internal utils for emotion", "devDependencies": { "@definitelytyped/dtslint": "0.0.112", "typescript": "^4.5.5" }, "exports": { ".": { "module": { "worker": "./dist/emotion-utils.worker.esm.js", "browser": "./dist/emotion-utils.browser.esm.js", "default": "./dist/emotion-utils.esm.js" }, "import": "./dist/emotion-utils.cjs.mjs", "default": "./dist/emotion-utils.cjs.js" }, "./package.json": "./package.json" }, "files": [ "src", "dist", "types/*.d.ts" ], "license": "MIT", "main": "dist/emotion-utils.cjs.js", "module": "dist/emotion-utils.esm.js", "name": "@emotion/utils", "preconstruct": { "exports": { "envConditions": [ "browser", "worker" ] } }, "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/emotion-js/emotion/tree/main/packages/utils" }, "scripts": { "test:typescript": "dtslint types" }, "types": "types/index.d.ts", "version": "1.2.1" } utils/LICENSE000064400000002077151701474430006725 0ustar00MIT License Copyright (c) Emotion team and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. utils/types/index.d.ts000064400000002213151701474430010755 0ustar00// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun> // TypeScript Version: 2.2 export interface RegisteredCache { [key: string]: string } export interface StyleSheet { container: HTMLElement nonce?: string key: string insert(rule: string): void flush(): void tags: Array<HTMLStyleElement> } export interface EmotionCache { inserted: { [key: string]: string | true } registered: RegisteredCache sheet: StyleSheet key: string compat?: true nonce?: string insert( selector: string, serialized: SerializedStyles, sheet: StyleSheet, shouldCache: boolean ): string | void } export interface SerializedStyles { name: string styles: string map?: string next?: SerializedStyles } export const isBrowser: boolean export function getRegisteredStyles( registered: RegisteredCache, registeredStyles: Array<string>, classNames: string ): string export function registerStyles( cache: EmotionCache, serialized: SerializedStyles, isStringTag: boolean ): void export function insertStyles( cache: EmotionCache, serialized: SerializedStyles, isStringTag: boolean ): string | void utils/dist/emotion-utils.esm.js000064400000003754151701474430012617 0ustar00var isBrowser = typeof document !== 'undefined'; function getRegisteredStyles(registered, registeredStyles, classNames) { var rawClassName = ''; classNames.split(' ').forEach(function (className) { if (registered[className] !== undefined) { registeredStyles.push(registered[className] + ";"); } else { rawClassName += className + " "; } }); return rawClassName; } var registerStyles = function registerStyles(cache, serialized, isStringTag) { var className = cache.key + "-" + serialized.name; if ( // we only need to add the styles to the registered cache if the // class name could be used further down // the tree but if it's a string tag, we know it won't // so we don't have to add it to registered cache. // this improves memory usage since we can avoid storing the whole style string (isStringTag === false || // we need to always store it if we're in compat mode and // in node since emotion-server relies on whether a style is in // the registered cache to know whether a style is global or not // also, note that this check will be dead code eliminated in the browser isBrowser === false && cache.compat !== undefined) && cache.registered[className] === undefined) { cache.registered[className] = serialized.styles; } }; var insertStyles = function insertStyles(cache, serialized, isStringTag) { registerStyles(cache, serialized, isStringTag); var className = cache.key + "-" + serialized.name; if (cache.inserted[serialized.name] === undefined) { var stylesForSSR = ''; var current = serialized; do { var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true); if (!isBrowser && maybeStyles !== undefined) { stylesForSSR += maybeStyles; } current = current.next; } while (current !== undefined); if (!isBrowser && stylesForSSR.length !== 0) { return stylesForSSR; } } }; export { getRegisteredStyles, insertStyles, registerStyles }; utils/dist/emotion-utils.cjs.d.mts000064400000000136151701474430013212 0ustar00export * from "./declarations/src/index.js"; //# sourceMappingURL=emotion-utils.cjs.d.mts.map utils/dist/emotion-utils.browser.esm.js000064400000003343151701474430014273 0ustar00var isBrowser = "object" !== 'undefined'; function getRegisteredStyles(registered, registeredStyles, classNames) { var rawClassName = ''; classNames.split(' ').forEach(function (className) { if (registered[className] !== undefined) { registeredStyles.push(registered[className] + ";"); } else { rawClassName += className + " "; } }); return rawClassName; } var registerStyles = function registerStyles(cache, serialized, isStringTag) { var className = cache.key + "-" + serialized.name; if ( // we only need to add the styles to the registered cache if the // class name could be used further down // the tree but if it's a string tag, we know it won't // so we don't have to add it to registered cache. // this improves memory usage since we can avoid storing the whole style string (isStringTag === false || // we need to always store it if we're in compat mode and // in node since emotion-server relies on whether a style is in // the registered cache to know whether a style is global or not // also, note that this check will be dead code eliminated in the browser isBrowser === false ) && cache.registered[className] === undefined) { cache.registered[className] = serialized.styles; } }; var insertStyles = function insertStyles(cache, serialized, isStringTag) { registerStyles(cache, serialized, isStringTag); var className = cache.key + "-" + serialized.name; if (cache.inserted[serialized.name] === undefined) { var current = serialized; do { cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true); current = current.next; } while (current !== undefined); } }; export { getRegisteredStyles, insertStyles, registerStyles }; utils/dist/emotion-utils.cjs.js000064400000000274151701474430012604 0ustar00'use strict'; if (process.env.NODE_ENV === "production") { module.exports = require("./emotion-utils.cjs.prod.js"); } else { module.exports = require("./emotion-utils.cjs.dev.js"); } utils/dist/emotion-utils.cjs.d.ts.map000064400000000207151701474430013610 0ustar00{"version":3,"file":"emotion-utils.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} utils/dist/emotion-utils.cjs.d.mts.map000064400000000210151701474430013757 0ustar00{"version":3,"file":"emotion-utils.cjs.d.mts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} utils/dist/emotion-utils.cjs.js.flow000064400000000052151701474430013544 0ustar00// @flow export * from "../src/index.js"; utils/dist/emotion-utils.cjs.d.ts000064400000000132151701474430013031 0ustar00export * from "./declarations/src/index"; //# sourceMappingURL=emotion-utils.cjs.d.ts.map utils/dist/emotion-utils.worker.esm.js000064400000003610151701474430014116 0ustar00function getRegisteredStyles(registered, registeredStyles, classNames) { var rawClassName = ''; classNames.split(' ').forEach(function (className) { if (registered[className] !== undefined) { registeredStyles.push(registered[className] + ";"); } else { rawClassName += className + " "; } }); return rawClassName; } var registerStyles = function registerStyles(cache, serialized, isStringTag) { var className = cache.key + "-" + serialized.name; if ( // we only need to add the styles to the registered cache if the // class name could be used further down // the tree but if it's a string tag, we know it won't // so we don't have to add it to registered cache. // this improves memory usage since we can avoid storing the whole style string (isStringTag === false || // we need to always store it if we're in compat mode and // in node since emotion-server relies on whether a style is in // the registered cache to know whether a style is global or not // also, note that this check will be dead code eliminated in the browser cache.compat !== undefined) && cache.registered[className] === undefined) { cache.registered[className] = serialized.styles; } }; var insertStyles = function insertStyles(cache, serialized, isStringTag) { registerStyles(cache, serialized, isStringTag); var className = cache.key + "-" + serialized.name; if (cache.inserted[serialized.name] === undefined) { var stylesForSSR = ''; var current = serialized; do { var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true); if (maybeStyles !== undefined) { stylesForSSR += maybeStyles; } current = current.next; } while (current !== undefined); if (stylesForSSR.length !== 0) { return stylesForSSR; } } }; export { getRegisteredStyles, insertStyles, registerStyles }; utils/dist/declarations/src/index.d.ts000064400000000031151701474430014007 0ustar00export * from '../types' utils/dist/declarations/types/index.d.ts000064400000002213151701474430014370 0ustar00// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun> // TypeScript Version: 2.2 export interface RegisteredCache { [key: string]: string } export interface StyleSheet { container: HTMLElement nonce?: string key: string insert(rule: string): void flush(): void tags: Array<HTMLStyleElement> } export interface EmotionCache { inserted: { [key: string]: string | true } registered: RegisteredCache sheet: StyleSheet key: string compat?: true nonce?: string insert( selector: string, serialized: SerializedStyles, sheet: StyleSheet, shouldCache: boolean ): string | void } export interface SerializedStyles { name: string styles: string map?: string next?: SerializedStyles } export const isBrowser: boolean export function getRegisteredStyles( registered: RegisteredCache, registeredStyles: Array<string>, classNames: string ): string export function registerStyles( cache: EmotionCache, serialized: SerializedStyles, isStringTag: boolean ): void export function insertStyles( cache: EmotionCache, serialized: SerializedStyles, isStringTag: boolean ): string | void utils/dist/emotion-utils.cjs.prod.js000064400000004176151701474430013554 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var isBrowser = typeof document !== 'undefined'; function getRegisteredStyles(registered, registeredStyles, classNames) { var rawClassName = ''; classNames.split(' ').forEach(function (className) { if (registered[className] !== undefined) { registeredStyles.push(registered[className] + ";"); } else { rawClassName += className + " "; } }); return rawClassName; } var registerStyles = function registerStyles(cache, serialized, isStringTag) { var className = cache.key + "-" + serialized.name; if ( // we only need to add the styles to the registered cache if the // class name could be used further down // the tree but if it's a string tag, we know it won't // so we don't have to add it to registered cache. // this improves memory usage since we can avoid storing the whole style string (isStringTag === false || // we need to always store it if we're in compat mode and // in node since emotion-server relies on whether a style is in // the registered cache to know whether a style is global or not // also, note that this check will be dead code eliminated in the browser isBrowser === false && cache.compat !== undefined) && cache.registered[className] === undefined) { cache.registered[className] = serialized.styles; } }; var insertStyles = function insertStyles(cache, serialized, isStringTag) { registerStyles(cache, serialized, isStringTag); var className = cache.key + "-" + serialized.name; if (cache.inserted[serialized.name] === undefined) { var stylesForSSR = ''; var current = serialized; do { var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true); if (!isBrowser && maybeStyles !== undefined) { stylesForSSR += maybeStyles; } current = current.next; } while (current !== undefined); if (!isBrowser && stylesForSSR.length !== 0) { return stylesForSSR; } } }; exports.getRegisteredStyles = getRegisteredStyles; exports.insertStyles = insertStyles; exports.registerStyles = registerStyles; utils/dist/emotion-utils.cjs.mjs000064400000000142151701474430012753 0ustar00export { getRegisteredStyles, insertStyles, registerStyles } from "./emotion-utils.cjs.js"; utils/dist/emotion-utils.cjs.dev.js000064400000004176151701474430013366 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var isBrowser = typeof document !== 'undefined'; function getRegisteredStyles(registered, registeredStyles, classNames) { var rawClassName = ''; classNames.split(' ').forEach(function (className) { if (registered[className] !== undefined) { registeredStyles.push(registered[className] + ";"); } else { rawClassName += className + " "; } }); return rawClassName; } var registerStyles = function registerStyles(cache, serialized, isStringTag) { var className = cache.key + "-" + serialized.name; if ( // we only need to add the styles to the registered cache if the // class name could be used further down // the tree but if it's a string tag, we know it won't // so we don't have to add it to registered cache. // this improves memory usage since we can avoid storing the whole style string (isStringTag === false || // we need to always store it if we're in compat mode and // in node since emotion-server relies on whether a style is in // the registered cache to know whether a style is global or not // also, note that this check will be dead code eliminated in the browser isBrowser === false && cache.compat !== undefined) && cache.registered[className] === undefined) { cache.registered[className] = serialized.styles; } }; var insertStyles = function insertStyles(cache, serialized, isStringTag) { registerStyles(cache, serialized, isStringTag); var className = cache.key + "-" + serialized.name; if (cache.inserted[serialized.name] === undefined) { var stylesForSSR = ''; var current = serialized; do { var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true); if (!isBrowser && maybeStyles !== undefined) { stylesForSSR += maybeStyles; } current = current.next; } while (current !== undefined); if (!isBrowser && stylesForSSR.length !== 0) { return stylesForSSR; } } }; exports.getRegisteredStyles = getRegisteredStyles; exports.insertStyles = insertStyles; exports.registerStyles = registerStyles; cache/src/types.js000064400000001055151701474430010107 0ustar00// @flow export type StylisElement = { type: string, value: string, props: Array<string>, root: StylisElement | null, children: Array<StylisElement>, line: number, column: number, length: number, return: string } export type StylisPluginCallback = ( element: StylisElement, index: number, children: Array<StylisElement>, callback: StylisPluginCallback ) => string | void export type StylisPlugin = ( element: StylisElement, index: number, children: Array<StylisElement>, callback: StylisPluginCallback ) => string | void cache/src/index.js000064400000020370151701474430010053 0ustar00// @flow import { StyleSheet } from '@emotion/sheet' import { type EmotionCache, type SerializedStyles } from '@emotion/utils' import { serialize, compile, middleware, rulesheet, stringify, COMMENT } from 'stylis' import weakMemoize from '@emotion/weak-memoize' import memoize from '@emotion/memoize' import { compat, removeLabel, createUnsafeSelectorsAlarm, incorrectImportAlarm } from './stylis-plugins' import { prefixer } from './prefixer' import type { StylisPlugin } from './types' let isBrowser = typeof document !== 'undefined' export type Options = { nonce?: string, stylisPlugins?: StylisPlugin[], key: string, container?: HTMLElement, speedy?: boolean, prepend?: boolean, insertionPoint?: HTMLElement } let getServerStylisCache = isBrowser ? undefined : weakMemoize(() => memoize(() => { let cache = {} return name => cache[name] }) ) const defaultStylisPlugins = [prefixer] let createCache = (options: Options): EmotionCache => { let key = options.key if (process.env.NODE_ENV !== 'production' && !key) { throw new Error( "You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + `If multiple caches share the same key they might "fight" for each other's style elements.` ) } if (isBrowser && key === 'css') { const ssrStyles = document.querySelectorAll( `style[data-emotion]:not([data-s])` ) // get SSRed styles out of the way of React's hydration // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be) // note this very very intentionally targets all style elements regardless of the key to ensure // that creating a cache works inside of render of a React component Array.prototype.forEach.call(ssrStyles, (node: HTMLStyleElement) => { // we want to only move elements which have a space in the data-emotion attribute value // because that indicates that it is an Emotion 11 server-side rendered style elements // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes) // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles // will not result in the Emotion 10 styles being destroyed const dataEmotionAttribute = ((node.getAttribute( 'data-emotion' ): any): string) if (dataEmotionAttribute.indexOf(' ') === -1) { return } ;((document.head: any): HTMLHeadElement).appendChild(node) node.setAttribute('data-s', '') }) } const stylisPlugins = options.stylisPlugins || defaultStylisPlugins if (process.env.NODE_ENV !== 'production') { // $FlowFixMe if (/[^a-z-]/.test(key)) { throw new Error( `Emotion key must only contain lower case alphabetical characters and - but "${key}" was passed` ) } } let inserted = {} let container: Node const nodesToHydrate = [] if (isBrowser) { container = options.container || ((document.head: any): HTMLHeadElement) Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which // means that the style elements we're looking at are only Emotion 11 server-rendered style elements document.querySelectorAll(`style[data-emotion^="${key} "]`), (node: HTMLStyleElement) => { const attrib = ((node.getAttribute(`data-emotion`): any): string).split( ' ' ) // $FlowFixMe for (let i = 1; i < attrib.length; i++) { inserted[attrib[i]] = true } nodesToHydrate.push(node) } ) } let insert: ( selector: string, serialized: SerializedStyles, sheet: StyleSheet, shouldCache: boolean ) => string | void const omnipresentPlugins = [compat, removeLabel] if (process.env.NODE_ENV !== 'production') { omnipresentPlugins.push( createUnsafeSelectorsAlarm({ get compat() { return cache.compat } }), incorrectImportAlarm ) } if (isBrowser) { let currentSheet const finalizingPlugins = [ stringify, process.env.NODE_ENV !== 'production' ? element => { if (!element.root) { if (element.return) { currentSheet.insert(element.return) } else if (element.value && element.type !== COMMENT) { // insert empty rule in non-production environments // so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet currentSheet.insert(`${element.value}{}`) } } } : rulesheet(rule => { currentSheet.insert(rule) }) ] const serializer = middleware( omnipresentPlugins.concat(stylisPlugins, finalizingPlugins) ) const stylis = styles => serialize(compile(styles), serializer) insert = ( selector: string, serialized: SerializedStyles, sheet: StyleSheet, shouldCache: boolean ): void => { currentSheet = sheet if ( process.env.NODE_ENV !== 'production' && serialized.map !== undefined ) { currentSheet = { insert: (rule: string) => { sheet.insert(rule + ((serialized.map: any): string)) } } } stylis(selector ? `${selector}{${serialized.styles}}` : serialized.styles) if (shouldCache) { cache.inserted[serialized.name] = true } } } else { const finalizingPlugins = [stringify] const serializer = middleware( omnipresentPlugins.concat(stylisPlugins, finalizingPlugins) ) const stylis = styles => serialize(compile(styles), serializer) // $FlowFixMe let serverStylisCache = getServerStylisCache(stylisPlugins)(key) let getRules = (selector: string, serialized: SerializedStyles): string => { let name = serialized.name if (serverStylisCache[name] === undefined) { serverStylisCache[name] = stylis( selector ? `${selector}{${serialized.styles}}` : serialized.styles ) } return serverStylisCache[name] } insert = ( selector: string, serialized: SerializedStyles, sheet: StyleSheet, shouldCache: boolean ): string | void => { let name = serialized.name let rules = getRules(selector, serialized) if (cache.compat === undefined) { // in regular mode, we don't set the styles on the inserted cache // since we don't need to and that would be wasting memory // we return them so that they are rendered in a style tag if (shouldCache) { cache.inserted[name] = true } if ( // using === development instead of !== production // because if people do ssr in tests, the source maps showing up would be annoying process.env.NODE_ENV === 'development' && serialized.map !== undefined ) { return rules + serialized.map } return rules } else { // in compat mode, we put the styles on the inserted cache so // that emotion-server can pull out the styles // except when we don't want to cache it which was in Global but now // is nowhere but we don't want to do a major right now // and just in case we're going to leave the case here // it's also not affecting client side bundle size // so it's really not a big deal if (shouldCache) { cache.inserted[name] = rules } else { return rules } } } } const cache: EmotionCache = { key, sheet: new StyleSheet({ key, container: ((container: any): Node), nonce: options.nonce, speedy: options.speedy, prepend: options.prepend, insertionPoint: options.insertionPoint }), nonce: options.nonce, inserted, registered: {}, insert } cache.sheet.hydrate(nodesToHydrate) return cache } export default createCache cache/src/prefixer.js000064400000020560151701474430010571 0ustar00/* eslint-disable no-fallthrough */ /* eslint-disable eqeqeq */ import { charat, combine, copy, DECLARATION, hash, indexof, KEYFRAMES, match, MOZ, MS, replace, RULESET, serialize, strlen, WEBKIT } from 'stylis' // this is a copy of stylis@4.0.13 prefixer, the latter version introduced grid prefixing which we don't want function prefix(value, length) { switch (hash(value, length)) { // color-adjust case 5103: return WEBKIT + 'print-' + value + value // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break case 5572: case 6356: case 5844: case 3191: case 6645: case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, case 6391: case 5879: case 5623: case 6135: case 4599: case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) case 4215: case 6389: case 5109: case 5365: case 5621: case 3829: return WEBKIT + value + value // appearance, user-select, transform, hyphens, text-size-adjust case 5349: case 4246: case 4810: case 6968: case 2756: return WEBKIT + value + MOZ + value + MS + value + value // flex, flex-direction case 6828: case 4268: return WEBKIT + value + MS + value + value // order case 6165: return WEBKIT + value + MS + 'flex-' + value + value // align-items case 5187: return ( WEBKIT + value + replace( value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2' ) + value ) // align-self case 5443: return ( WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value ) // align-content case 4675: return ( WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value ) // flex-shrink case 5548: return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value // flex-basis case 5292: return ( WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value ) // flex-grow case 6060: return ( WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value ) // transition case 4554: return ( WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value ) // cursor case 6187: return ( replace( replace( replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1' ), value, '' ) + value ) // background, background-image case 5495: case 3959: return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1') // justify-content case 4968: return ( replace( replace( value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3' ), /s.+-b[^;]+/, 'justify' ) + WEBKIT + value + value ) // (margin|padding)-inline-(start|end) case 4095: case 3583: case 4068: case 2532: return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value // (min|max)?(width|height|inline-size|block-size) case 8116: case 7059: case 5753: case 5535: case 5445: case 5701: case 4933: case 4677: case 5533: case 5789: case 5021: case 4765: // stretch, max-content, min-content, fill-available if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) { // (m)ax-content, (m)in-content case 109: // - if (charat(value, length + 4) !== 45) break // (f)ill-available, (f)it-content case 102: return ( replace( value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3') ) + value ) // (s)tretch case 115: return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value } break // position: sticky case 4949: // (s)ticky? if (charat(value, length + 1) !== 115) break // display: (flex|inline-flex) case 6444: switch ( charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10)) ) { // stic(k)y case 107: return replace(value, ':', ':' + WEBKIT) + value // (inline-)?fl(e)x case 101: return ( replace( value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3' ) + value ) } break // writing-mode case 5936: switch (charat(value, length + 11)) { // vertical-l(r) case 114: return ( WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value ) // vertical-r(l) case 108: return ( WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value ) // horizontal(-)tb case 45: return ( WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value ) } return WEBKIT + value + MS + value + value } return value } export let prefixer = (element, index, children, callback) => { if (element.length > -1) if (!element.return) switch (element.type) { case DECLARATION: element.return = prefix(element.value, element.length) break case KEYFRAMES: return serialize( [ copy(element, { value: replace(element.value, '@', '@' + WEBKIT) }) ], callback ) case RULESET: if (element.length) return combine(element.props, function (value) { switch (match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return serialize( [ copy(element, { props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')] }) ], callback ) // :placeholder case '::placeholder': return serialize( [ copy(element, { props: [ replace( value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1' ) ] }), copy(element, { props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')] }), copy(element, { props: [replace(value, /:(plac\w+)/, MS + 'input-$1')] }) ], callback ) } return '' }) } } cache/src/index.d.ts000064400000000074151701474430010306 0ustar00export * from '../types' export { default } from '../types' cache/src/stylis-plugins.js000064400000016316151701474430011757 0ustar00import { compile, alloc, dealloc, next, delimit, token, char, from, peek, position, slice } from 'stylis' const last = arr => (arr.length ? arr[arr.length - 1] : null) // based on https://github.com/thysultan/stylis.js/blob/e6843c373ebcbbfade25ebcc23f540ed8508da0a/src/Tokenizer.js#L239-L244 const identifierWithPointTracking = (begin, points, index) => { let previous = 0 let character = 0 while (true) { previous = character character = peek() // &\f if (previous === 38 && character === 12) { points[index] = 1 } if (token(character)) { break } next() } return slice(begin, position) } const toRules = (parsed, points) => { // pretend we've started with a comma let index = -1 let character = 44 do { switch (token(character)) { case 0: // &\f if (character === 38 && peek() === 12) { // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings // stylis inserts \f after & to know when & where it should replace this sequence with the context selector // and when it should just concatenate the outer and inner selectors // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here points[index] = 1 } parsed[index] += identifierWithPointTracking( position - 1, points, index ) break case 2: parsed[index] += delimit(character) break case 4: // comma if (character === 44) { // colon parsed[++index] = peek() === 58 ? '&\f' : '' points[index] = parsed[index].length break } // fallthrough default: parsed[index] += from(character) } } while ((character = next())) return parsed } const getRules = (value, points) => dealloc(toRules(alloc(value), points)) // WeakSet would be more appropriate, but only WeakMap is supported in IE11 const fixedElements = /* #__PURE__ */ new WeakMap() export let compat = element => { if ( element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo // negative .length indicates that this rule has been already prefixed element.length < 1 ) { return } let { value, parent } = element let isImplicitRule = element.column === parent.column && element.line === parent.line while (parent.type !== 'rule') { parent = parent.parent if (!parent) return } // short-circuit for the simplest case if ( element.props.length === 1 && value.charCodeAt(0) !== 58 /* colon */ && !fixedElements.get(parent) ) { return } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level) // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent" if (isImplicitRule) { return } fixedElements.set(element, true) const points = [] const rules = getRules(value, points) const parentRules = parent.props for (let i = 0, k = 0; i < rules.length; i++) { for (let j = 0; j < parentRules.length; j++, k++) { element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : `${parentRules[j]} ${rules[i]}` } } } export let removeLabel = element => { if (element.type === 'decl') { var value = element.value if ( // charcode for l value.charCodeAt(0) === 108 && // charcode for b value.charCodeAt(2) === 98 ) { // this ignores label element.return = '' element.value = '' } } } const ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason' const isIgnoringComment = element => element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1 export let createUnsafeSelectorsAlarm = cache => (element, index, children) => { if (element.type !== 'rule' || cache.compat) return const unsafePseudoClasses = element.value.match( /(:first|:nth|:nth-last)-child/g ) if (unsafePseudoClasses) { const isNested = !!element.parent // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent` // // considering this input: // .a { // .b /* comm */ {} // color: hotpink; // } // we get output corresponding to this: // .a { // & { // /* comm */ // color: hotpink; // } // .b {} // } const commentContainer = isNested ? element.parent.children : // global rule at the root level children for (let i = commentContainer.length - 1; i >= 0; i--) { const node = commentContainer[i] if (node.line < element.line) { break } // it is quite weird but comments are *usually* put at `column: element.column - 1` // so we seek *from the end* for the node that is earlier than the rule's `element` and check that // this will also match inputs like this: // .a { // /* comm */ // .b {} // } // // but that is fine // // it would be the easiest to change the placement of the comment to be the first child of the rule: // .a { // .b { /* comm */ } // } // with such inputs we wouldn't have to search for the comment at all // TODO: consider changing this comment placement in the next major version if (node.column < element.column) { if (isIgnoringComment(node)) { return } break } } unsafePseudoClasses.forEach(unsafePseudoClass => { console.error( `The pseudo class "${unsafePseudoClass}" is potentially unsafe when doing server-side rendering. Try changing it to "${ unsafePseudoClass.split('-child')[0] }-of-type".` ) }) } } let isImportRule = element => element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64 const isPrependedWithRegularRules = (index, children) => { for (let i = index - 1; i >= 0; i--) { if (!isImportRule(children[i])) { return true } } return false } // use this to remove incorrect elements from further processing // so they don't get handed to the `sheet` (or anything else) // as that could potentially lead to additional logs which in turn could be overhelming to the user const nullifyElement = element => { element.type = '' element.value = '' element.return = '' element.children = '' element.props = '' } export let incorrectImportAlarm = (element, index, children) => { if (!isImportRule(element)) { return } if (element.parent) { console.error( "`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles." ) nullifyElement(element) } else if (isPrependedWithRegularRules(index, children)) { console.error( "`@import` rules can't be after other rules. Please put your `@import` rules before your other rules." ) nullifyElement(element) } } cache/package.json000064400000004305151701474430010105 0ustar00{ "_from": "@emotion/cache@^11.7.1", "_id": "@emotion/cache@11.11.0", "_inBundle": false, "_integrity": "sha512-P34z9ssTCBi3e9EI1ZsWpNHcfY1r09ZO0rZbRO2ob3ZQMnFI35jB536qoXbkdesr5EUhYi22anuEJuyxifaqAQ==", "_location": "/@emotion/cache", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "@emotion/cache@^11.7.1", "name": "@emotion/cache", "escapedName": "@emotion%2fcache", "scope": "@emotion", "rawSpec": "^11.7.1", "saveSpec": null, "fetchSpec": "^11.7.1" }, "_requiredBy": [ "/mui-datatables", "/tss-react" ], "_resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.11.0.tgz", "_shasum": "809b33ee6b1cb1a625fef7a45bc568ccd9b8f3ff", "_spec": "@emotion/cache@^11.7.1", "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\mui-datatables", "browser": { "./dist/emotion-cache.esm.js": "./dist/emotion-cache.browser.esm.js" }, "bundleDependencies": false, "dependencies": { "@emotion/memoize": "^0.8.1", "@emotion/sheet": "^1.2.2", "@emotion/utils": "^1.2.1", "@emotion/weak-memoize": "^0.3.1", "stylis": "4.2.0" }, "deprecated": false, "description": "emotion's cache", "devDependencies": { "@definitelytyped/dtslint": "0.0.112", "@emotion/hash": "*", "typescript": "^4.5.5" }, "exports": { ".": { "module": { "worker": "./dist/emotion-cache.worker.esm.js", "browser": "./dist/emotion-cache.browser.esm.js", "default": "./dist/emotion-cache.esm.js" }, "import": "./dist/emotion-cache.cjs.mjs", "default": "./dist/emotion-cache.cjs.js" }, "./package.json": "./package.json" }, "files": [ "src", "dist", "types/*.d.ts" ], "license": "MIT", "main": "dist/emotion-cache.cjs.js", "module": "dist/emotion-cache.esm.js", "name": "@emotion/cache", "preconstruct": { "exports": { "envConditions": [ "browser", "worker" ] } }, "repository": { "type": "git", "url": "https://github.com/emotion-js/emotion/tree/main/packages/cache" }, "scripts": { "test:typescript": "dtslint types" }, "types": "types/index.d.ts", "version": "11.11.0" } cache/LICENSE000064400000002077151701474430006630 0ustar00MIT License Copyright (c) Emotion team and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. cache/types/index.d.ts000064400000002047151701474430010665 0ustar00// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun> // TypeScript Version: 2.2 import { EmotionCache } from '@emotion/utils' export { EmotionCache } export interface StylisElement { type: string value: string props: Array<string> | string root: StylisElement | null parent: StylisElement | null children: Array<StylisElement> | string line: number column: number length: number return: string } export type StylisPluginCallback = ( element: StylisElement, index: number, children: Array<StylisElement>, callback: StylisPluginCallback ) => string | void export type StylisPlugin = ( element: StylisElement, index: number, children: Array<StylisElement>, callback: StylisPluginCallback ) => string | void export interface Options { nonce?: string stylisPlugins?: Array<StylisPlugin> key: string container?: Node speedy?: boolean /** @deprecate use `insertionPoint` instead */ prepend?: boolean insertionPoint?: HTMLElement } export default function createCache(options: Options): EmotionCache cache/dist/emotion-cache.cjs.prod.js000064400000040356151701474430013362 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var sheet = require('@emotion/sheet'); var stylis = require('stylis'); var weakMemoize = require('@emotion/weak-memoize'); var memoize = require('@emotion/memoize'); function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } var weakMemoize__default = /*#__PURE__*/_interopDefault(weakMemoize); var memoize__default = /*#__PURE__*/_interopDefault(memoize); var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) { var previous = 0; var character = 0; while (true) { previous = character; character = stylis.peek(); // &\f if (previous === 38 && character === 12) { points[index] = 1; } if (stylis.token(character)) { break; } stylis.next(); } return stylis.slice(begin, stylis.position); }; var toRules = function toRules(parsed, points) { // pretend we've started with a comma var index = -1; var character = 44; do { switch (stylis.token(character)) { case 0: // &\f if (character === 38 && stylis.peek() === 12) { // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings // stylis inserts \f after & to know when & where it should replace this sequence with the context selector // and when it should just concatenate the outer and inner selectors // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here points[index] = 1; } parsed[index] += identifierWithPointTracking(stylis.position - 1, points, index); break; case 2: parsed[index] += stylis.delimit(character); break; case 4: // comma if (character === 44) { // colon parsed[++index] = stylis.peek() === 58 ? '&\f' : ''; points[index] = parsed[index].length; break; } // fallthrough default: parsed[index] += stylis.from(character); } } while (character = stylis.next()); return parsed; }; var getRules = function getRules(value, points) { return stylis.dealloc(toRules(stylis.alloc(value), points)); }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11 var fixedElements = /* #__PURE__ */new WeakMap(); var compat = function compat(element) { if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo // negative .length indicates that this rule has been already prefixed element.length < 1) { return; } var value = element.value, parent = element.parent; var isImplicitRule = element.column === parent.column && element.line === parent.line; while (parent.type !== 'rule') { parent = parent.parent; if (!parent) return; } // short-circuit for the simplest case if (element.props.length === 1 && value.charCodeAt(0) !== 58 /* colon */ && !fixedElements.get(parent)) { return; } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level) // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent" if (isImplicitRule) { return; } fixedElements.set(element, true); var points = []; var rules = getRules(value, points); var parentRules = parent.props; for (var i = 0, k = 0; i < rules.length; i++) { for (var j = 0; j < parentRules.length; j++, k++) { element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i]; } } }; var removeLabel = function removeLabel(element) { if (element.type === 'decl') { var value = element.value; if ( // charcode for l value.charCodeAt(0) === 108 && // charcode for b value.charCodeAt(2) === 98) { // this ignores label element["return"] = ''; element.value = ''; } } }; /* eslint-disable no-fallthrough */ function prefix(value, length) { switch (stylis.hash(value, length)) { // color-adjust case 5103: return stylis.WEBKIT + 'print-' + value + value; // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break case 5572: case 6356: case 5844: case 3191: case 6645: case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, case 6391: case 5879: case 5623: case 6135: case 4599: case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) case 4215: case 6389: case 5109: case 5365: case 5621: case 3829: return stylis.WEBKIT + value + value; // appearance, user-select, transform, hyphens, text-size-adjust case 5349: case 4246: case 4810: case 6968: case 2756: return stylis.WEBKIT + value + stylis.MOZ + value + stylis.MS + value + value; // flex, flex-direction case 6828: case 4268: return stylis.WEBKIT + value + stylis.MS + value + value; // order case 6165: return stylis.WEBKIT + value + stylis.MS + 'flex-' + value + value; // align-items case 5187: return stylis.WEBKIT + value + stylis.replace(value, /(\w+).+(:[^]+)/, stylis.WEBKIT + 'box-$1$2' + stylis.MS + 'flex-$1$2') + value; // align-self case 5443: return stylis.WEBKIT + value + stylis.MS + 'flex-item-' + stylis.replace(value, /flex-|-self/, '') + value; // align-content case 4675: return stylis.WEBKIT + value + stylis.MS + 'flex-line-pack' + stylis.replace(value, /align-content|flex-|-self/, '') + value; // flex-shrink case 5548: return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'shrink', 'negative') + value; // flex-basis case 5292: return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'basis', 'preferred-size') + value; // flex-grow case 6060: return stylis.WEBKIT + 'box-' + stylis.replace(value, '-grow', '') + stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'grow', 'positive') + value; // transition case 4554: return stylis.WEBKIT + stylis.replace(value, /([^-])(transform)/g, '$1' + stylis.WEBKIT + '$2') + value; // cursor case 6187: return stylis.replace(stylis.replace(stylis.replace(value, /(zoom-|grab)/, stylis.WEBKIT + '$1'), /(image-set)/, stylis.WEBKIT + '$1'), value, '') + value; // background, background-image case 5495: case 3959: return stylis.replace(value, /(image-set\([^]*)/, stylis.WEBKIT + '$1' + '$`$1'); // justify-content case 4968: return stylis.replace(stylis.replace(value, /(.+:)(flex-)?(.*)/, stylis.WEBKIT + 'box-pack:$3' + stylis.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + stylis.WEBKIT + value + value; // (margin|padding)-inline-(start|end) case 4095: case 3583: case 4068: case 2532: return stylis.replace(value, /(.+)-inline(.+)/, stylis.WEBKIT + '$1$2') + value; // (min|max)?(width|height|inline-size|block-size) case 8116: case 7059: case 5753: case 5535: case 5445: case 5701: case 4933: case 4677: case 5533: case 5789: case 5021: case 4765: // stretch, max-content, min-content, fill-available if (stylis.strlen(value) - 1 - length > 6) switch (stylis.charat(value, length + 1)) { // (m)ax-content, (m)in-content case 109: // - if (stylis.charat(value, length + 4) !== 45) break; // (f)ill-available, (f)it-content case 102: return stylis.replace(value, /(.+:)(.+)-([^]+)/, '$1' + stylis.WEBKIT + '$2-$3' + '$1' + stylis.MOZ + (stylis.charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value; // (s)tretch case 115: return ~stylis.indexof(value, 'stretch') ? prefix(stylis.replace(value, 'stretch', 'fill-available'), length) + value : value; } break; // position: sticky case 4949: // (s)ticky? if (stylis.charat(value, length + 1) !== 115) break; // display: (flex|inline-flex) case 6444: switch (stylis.charat(value, stylis.strlen(value) - 3 - (~stylis.indexof(value, '!important') && 10))) { // stic(k)y case 107: return stylis.replace(value, ':', ':' + stylis.WEBKIT) + value; // (inline-)?fl(e)x case 101: return stylis.replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + stylis.WEBKIT + (stylis.charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + stylis.WEBKIT + '$2$3' + '$1' + stylis.MS + '$2box$3') + value; } break; // writing-mode case 5936: switch (stylis.charat(value, length + 11)) { // vertical-l(r) case 114: return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value; // vertical-r(l) case 108: return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value; // horizontal(-)tb case 45: return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value; } return stylis.WEBKIT + value + stylis.MS + value + value; } return value; } var prefixer = function prefixer(element, index, children, callback) { if (element.length > -1) if (!element["return"]) switch (element.type) { case stylis.DECLARATION: element["return"] = prefix(element.value, element.length); break; case stylis.KEYFRAMES: return stylis.serialize([stylis.copy(element, { value: stylis.replace(element.value, '@', '@' + stylis.WEBKIT) })], callback); case stylis.RULESET: if (element.length) return stylis.combine(element.props, function (value) { switch (stylis.match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return stylis.serialize([stylis.copy(element, { props: [stylis.replace(value, /:(read-\w+)/, ':' + stylis.MOZ + '$1')] })], callback); // :placeholder case '::placeholder': return stylis.serialize([stylis.copy(element, { props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.WEBKIT + 'input-$1')] }), stylis.copy(element, { props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.MOZ + '$1')] }), stylis.copy(element, { props: [stylis.replace(value, /:(plac\w+)/, stylis.MS + 'input-$1')] })], callback); } return ''; }); } }; var isBrowser = typeof document !== 'undefined'; var getServerStylisCache = isBrowser ? undefined : weakMemoize__default["default"](function () { return memoize__default["default"](function () { var cache = {}; return function (name) { return cache[name]; }; }); }); var defaultStylisPlugins = [prefixer]; var createCache = function createCache(options) { var key = options.key; if (isBrowser && key === 'css') { var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be) // note this very very intentionally targets all style elements regardless of the key to ensure // that creating a cache works inside of render of a React component Array.prototype.forEach.call(ssrStyles, function (node) { // we want to only move elements which have a space in the data-emotion attribute value // because that indicates that it is an Emotion 11 server-side rendered style elements // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes) // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles // will not result in the Emotion 10 styles being destroyed var dataEmotionAttribute = node.getAttribute('data-emotion'); if (dataEmotionAttribute.indexOf(' ') === -1) { return; } document.head.appendChild(node); node.setAttribute('data-s', ''); }); } var stylisPlugins = options.stylisPlugins || defaultStylisPlugins; var inserted = {}; var container; var nodesToHydrate = []; if (isBrowser) { container = options.container || document.head; Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which // means that the style elements we're looking at are only Emotion 11 server-rendered style elements document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) { var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe for (var i = 1; i < attrib.length; i++) { inserted[attrib[i]] = true; } nodesToHydrate.push(node); }); } var _insert; var omnipresentPlugins = [compat, removeLabel]; if (isBrowser) { var currentSheet; var finalizingPlugins = [stylis.stringify, stylis.rulesheet(function (rule) { currentSheet.insert(rule); })]; var serializer = stylis.middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins)); var stylis$1 = function stylis$1(styles) { return stylis.serialize(stylis.compile(styles), serializer); }; _insert = function insert(selector, serialized, sheet, shouldCache) { currentSheet = sheet; stylis$1(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); if (shouldCache) { cache.inserted[serialized.name] = true; } }; } else { var _finalizingPlugins = [stylis.stringify]; var _serializer = stylis.middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins)); var _stylis = function _stylis(styles) { return stylis.serialize(stylis.compile(styles), _serializer); }; // $FlowFixMe var serverStylisCache = getServerStylisCache(stylisPlugins)(key); var getRules = function getRules(selector, serialized) { var name = serialized.name; if (serverStylisCache[name] === undefined) { serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); } return serverStylisCache[name]; }; _insert = function _insert(selector, serialized, sheet, shouldCache) { var name = serialized.name; var rules = getRules(selector, serialized); if (cache.compat === undefined) { // in regular mode, we don't set the styles on the inserted cache // since we don't need to and that would be wasting memory // we return them so that they are rendered in a style tag if (shouldCache) { cache.inserted[name] = true; } return rules; } else { // in compat mode, we put the styles on the inserted cache so // that emotion-server can pull out the styles // except when we don't want to cache it which was in Global but now // is nowhere but we don't want to do a major right now // and just in case we're going to leave the case here // it's also not affecting client side bundle size // so it's really not a big deal if (shouldCache) { cache.inserted[name] = rules; } else { return rules; } } }; } var cache = { key: key, sheet: new sheet.StyleSheet({ key: key, container: container, nonce: options.nonce, speedy: options.speedy, prepend: options.prepend, insertionPoint: options.insertionPoint }), nonce: options.nonce, inserted: inserted, registered: {}, insert: _insert }; cache.sheet.hydrate(nodesToHydrate); return cache; }; exports["default"] = createCache; cache/dist/emotion-cache.cjs.default.d.ts000064400000000102151701474440014260 0ustar00export { default as _default } from "./declarations/src/index.js" cache/dist/emotion-cache.browser.esm.js000064400000044646151701474440014115 0ustar00import { StyleSheet } from '@emotion/sheet'; import { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, stringify, COMMENT, rulesheet, middleware, compile } from 'stylis'; import '@emotion/weak-memoize'; import '@emotion/memoize'; var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) { var previous = 0; var character = 0; while (true) { previous = character; character = peek(); // &\f if (previous === 38 && character === 12) { points[index] = 1; } if (token(character)) { break; } next(); } return slice(begin, position); }; var toRules = function toRules(parsed, points) { // pretend we've started with a comma var index = -1; var character = 44; do { switch (token(character)) { case 0: // &\f if (character === 38 && peek() === 12) { // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings // stylis inserts \f after & to know when & where it should replace this sequence with the context selector // and when it should just concatenate the outer and inner selectors // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here points[index] = 1; } parsed[index] += identifierWithPointTracking(position - 1, points, index); break; case 2: parsed[index] += delimit(character); break; case 4: // comma if (character === 44) { // colon parsed[++index] = peek() === 58 ? '&\f' : ''; points[index] = parsed[index].length; break; } // fallthrough default: parsed[index] += from(character); } } while (character = next()); return parsed; }; var getRules = function getRules(value, points) { return dealloc(toRules(alloc(value), points)); }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11 var fixedElements = /* #__PURE__ */new WeakMap(); var compat = function compat(element) { if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo // negative .length indicates that this rule has been already prefixed element.length < 1) { return; } var value = element.value, parent = element.parent; var isImplicitRule = element.column === parent.column && element.line === parent.line; while (parent.type !== 'rule') { parent = parent.parent; if (!parent) return; } // short-circuit for the simplest case if (element.props.length === 1 && value.charCodeAt(0) !== 58 /* colon */ && !fixedElements.get(parent)) { return; } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level) // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent" if (isImplicitRule) { return; } fixedElements.set(element, true); var points = []; var rules = getRules(value, points); var parentRules = parent.props; for (var i = 0, k = 0; i < rules.length; i++) { for (var j = 0; j < parentRules.length; j++, k++) { element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i]; } } }; var removeLabel = function removeLabel(element) { if (element.type === 'decl') { var value = element.value; if ( // charcode for l value.charCodeAt(0) === 108 && // charcode for b value.charCodeAt(2) === 98) { // this ignores label element["return"] = ''; element.value = ''; } } }; var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason'; var isIgnoringComment = function isIgnoringComment(element) { return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1; }; var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) { return function (element, index, children) { if (element.type !== 'rule' || cache.compat) return; var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g); if (unsafePseudoClasses) { var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent` // // considering this input: // .a { // .b /* comm */ {} // color: hotpink; // } // we get output corresponding to this: // .a { // & { // /* comm */ // color: hotpink; // } // .b {} // } var commentContainer = isNested ? element.parent.children : // global rule at the root level children; for (var i = commentContainer.length - 1; i >= 0; i--) { var node = commentContainer[i]; if (node.line < element.line) { break; } // it is quite weird but comments are *usually* put at `column: element.column - 1` // so we seek *from the end* for the node that is earlier than the rule's `element` and check that // this will also match inputs like this: // .a { // /* comm */ // .b {} // } // // but that is fine // // it would be the easiest to change the placement of the comment to be the first child of the rule: // .a { // .b { /* comm */ } // } // with such inputs we wouldn't have to search for the comment at all // TODO: consider changing this comment placement in the next major version if (node.column < element.column) { if (isIgnoringComment(node)) { return; } break; } } unsafePseudoClasses.forEach(function (unsafePseudoClass) { console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\"."); }); } }; }; var isImportRule = function isImportRule(element) { return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64; }; var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) { for (var i = index - 1; i >= 0; i--) { if (!isImportRule(children[i])) { return true; } } return false; }; // use this to remove incorrect elements from further processing // so they don't get handed to the `sheet` (or anything else) // as that could potentially lead to additional logs which in turn could be overhelming to the user var nullifyElement = function nullifyElement(element) { element.type = ''; element.value = ''; element["return"] = ''; element.children = ''; element.props = ''; }; var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) { if (!isImportRule(element)) { return; } if (element.parent) { console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."); nullifyElement(element); } else if (isPrependedWithRegularRules(index, children)) { console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."); nullifyElement(element); } }; /* eslint-disable no-fallthrough */ function prefix(value, length) { switch (hash(value, length)) { // color-adjust case 5103: return WEBKIT + 'print-' + value + value; // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break case 5572: case 6356: case 5844: case 3191: case 6645: case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, case 6391: case 5879: case 5623: case 6135: case 4599: case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) case 4215: case 6389: case 5109: case 5365: case 5621: case 3829: return WEBKIT + value + value; // appearance, user-select, transform, hyphens, text-size-adjust case 5349: case 4246: case 4810: case 6968: case 2756: return WEBKIT + value + MOZ + value + MS + value + value; // flex, flex-direction case 6828: case 4268: return WEBKIT + value + MS + value + value; // order case 6165: return WEBKIT + value + MS + 'flex-' + value + value; // align-items case 5187: return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value; // align-self case 5443: return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value; // align-content case 4675: return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value; // flex-shrink case 5548: return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value; // flex-basis case 5292: return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value; // flex-grow case 6060: return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value; // transition case 4554: return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value; // cursor case 6187: return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value; // background, background-image case 5495: case 3959: return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1'); // justify-content case 4968: return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value; // (margin|padding)-inline-(start|end) case 4095: case 3583: case 4068: case 2532: return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value; // (min|max)?(width|height|inline-size|block-size) case 8116: case 7059: case 5753: case 5535: case 5445: case 5701: case 4933: case 4677: case 5533: case 5789: case 5021: case 4765: // stretch, max-content, min-content, fill-available if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) { // (m)ax-content, (m)in-content case 109: // - if (charat(value, length + 4) !== 45) break; // (f)ill-available, (f)it-content case 102: return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value; // (s)tretch case 115: return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value; } break; // position: sticky case 4949: // (s)ticky? if (charat(value, length + 1) !== 115) break; // display: (flex|inline-flex) case 6444: switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) { // stic(k)y case 107: return replace(value, ':', ':' + WEBKIT) + value; // (inline-)?fl(e)x case 101: return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value; } break; // writing-mode case 5936: switch (charat(value, length + 11)) { // vertical-l(r) case 114: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value; // vertical-r(l) case 108: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value; // horizontal(-)tb case 45: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value; } return WEBKIT + value + MS + value + value; } return value; } var prefixer = function prefixer(element, index, children, callback) { if (element.length > -1) if (!element["return"]) switch (element.type) { case DECLARATION: element["return"] = prefix(element.value, element.length); break; case KEYFRAMES: return serialize([copy(element, { value: replace(element.value, '@', '@' + WEBKIT) })], callback); case RULESET: if (element.length) return combine(element.props, function (value) { switch (match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return serialize([copy(element, { props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')] })], callback); // :placeholder case '::placeholder': return serialize([copy(element, { props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')] }), copy(element, { props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')] }), copy(element, { props: [replace(value, /:(plac\w+)/, MS + 'input-$1')] })], callback); } return ''; }); } }; var defaultStylisPlugins = [prefixer]; var createCache = function createCache(options) { var key = options.key; if (process.env.NODE_ENV !== 'production' && !key) { throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements."); } if (key === 'css') { var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be) // note this very very intentionally targets all style elements regardless of the key to ensure // that creating a cache works inside of render of a React component Array.prototype.forEach.call(ssrStyles, function (node) { // we want to only move elements which have a space in the data-emotion attribute value // because that indicates that it is an Emotion 11 server-side rendered style elements // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes) // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles // will not result in the Emotion 10 styles being destroyed var dataEmotionAttribute = node.getAttribute('data-emotion'); if (dataEmotionAttribute.indexOf(' ') === -1) { return; } document.head.appendChild(node); node.setAttribute('data-s', ''); }); } var stylisPlugins = options.stylisPlugins || defaultStylisPlugins; if (process.env.NODE_ENV !== 'production') { // $FlowFixMe if (/[^a-z-]/.test(key)) { throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed"); } } var inserted = {}; var container; var nodesToHydrate = []; { container = options.container || document.head; Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which // means that the style elements we're looking at are only Emotion 11 server-rendered style elements document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) { var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe for (var i = 1; i < attrib.length; i++) { inserted[attrib[i]] = true; } nodesToHydrate.push(node); }); } var _insert; var omnipresentPlugins = [compat, removeLabel]; if (process.env.NODE_ENV !== 'production') { omnipresentPlugins.push(createUnsafeSelectorsAlarm({ get compat() { return cache.compat; } }), incorrectImportAlarm); } { var currentSheet; var finalizingPlugins = [stringify, process.env.NODE_ENV !== 'production' ? function (element) { if (!element.root) { if (element["return"]) { currentSheet.insert(element["return"]); } else if (element.value && element.type !== COMMENT) { // insert empty rule in non-production environments // so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet currentSheet.insert(element.value + "{}"); } } } : rulesheet(function (rule) { currentSheet.insert(rule); })]; var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins)); var stylis = function stylis(styles) { return serialize(compile(styles), serializer); }; _insert = function insert(selector, serialized, sheet, shouldCache) { currentSheet = sheet; if (process.env.NODE_ENV !== 'production' && serialized.map !== undefined) { currentSheet = { insert: function insert(rule) { sheet.insert(rule + serialized.map); } }; } stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); if (shouldCache) { cache.inserted[serialized.name] = true; } }; } var cache = { key: key, sheet: new StyleSheet({ key: key, container: container, nonce: options.nonce, speedy: options.speedy, prepend: options.prepend, insertionPoint: options.insertionPoint }), nonce: options.nonce, inserted: inserted, registered: {}, insert: _insert }; cache.sheet.hydrate(nodesToHydrate); return cache; }; export { createCache as default }; cache/dist/emotion-cache.cjs.d.ts.map000064400000000207151701474440013417 0ustar00{"version":3,"file":"emotion-cache.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} cache/dist/emotion-cache.worker.esm.js000064400000042550151701474440013733 0ustar00import { StyleSheet } from '@emotion/sheet'; import { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, middleware, stringify, compile } from 'stylis'; import weakMemoize from '@emotion/weak-memoize'; import memoize from '@emotion/memoize'; var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) { var previous = 0; var character = 0; while (true) { previous = character; character = peek(); // &\f if (previous === 38 && character === 12) { points[index] = 1; } if (token(character)) { break; } next(); } return slice(begin, position); }; var toRules = function toRules(parsed, points) { // pretend we've started with a comma var index = -1; var character = 44; do { switch (token(character)) { case 0: // &\f if (character === 38 && peek() === 12) { // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings // stylis inserts \f after & to know when & where it should replace this sequence with the context selector // and when it should just concatenate the outer and inner selectors // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here points[index] = 1; } parsed[index] += identifierWithPointTracking(position - 1, points, index); break; case 2: parsed[index] += delimit(character); break; case 4: // comma if (character === 44) { // colon parsed[++index] = peek() === 58 ? '&\f' : ''; points[index] = parsed[index].length; break; } // fallthrough default: parsed[index] += from(character); } } while (character = next()); return parsed; }; var getRules = function getRules(value, points) { return dealloc(toRules(alloc(value), points)); }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11 var fixedElements = /* #__PURE__ */new WeakMap(); var compat = function compat(element) { if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo // negative .length indicates that this rule has been already prefixed element.length < 1) { return; } var value = element.value, parent = element.parent; var isImplicitRule = element.column === parent.column && element.line === parent.line; while (parent.type !== 'rule') { parent = parent.parent; if (!parent) return; } // short-circuit for the simplest case if (element.props.length === 1 && value.charCodeAt(0) !== 58 /* colon */ && !fixedElements.get(parent)) { return; } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level) // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent" if (isImplicitRule) { return; } fixedElements.set(element, true); var points = []; var rules = getRules(value, points); var parentRules = parent.props; for (var i = 0, k = 0; i < rules.length; i++) { for (var j = 0; j < parentRules.length; j++, k++) { element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i]; } } }; var removeLabel = function removeLabel(element) { if (element.type === 'decl') { var value = element.value; if ( // charcode for l value.charCodeAt(0) === 108 && // charcode for b value.charCodeAt(2) === 98) { // this ignores label element["return"] = ''; element.value = ''; } } }; var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason'; var isIgnoringComment = function isIgnoringComment(element) { return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1; }; var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) { return function (element, index, children) { if (element.type !== 'rule' || cache.compat) return; var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g); if (unsafePseudoClasses) { var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent` // // considering this input: // .a { // .b /* comm */ {} // color: hotpink; // } // we get output corresponding to this: // .a { // & { // /* comm */ // color: hotpink; // } // .b {} // } var commentContainer = isNested ? element.parent.children : // global rule at the root level children; for (var i = commentContainer.length - 1; i >= 0; i--) { var node = commentContainer[i]; if (node.line < element.line) { break; } // it is quite weird but comments are *usually* put at `column: element.column - 1` // so we seek *from the end* for the node that is earlier than the rule's `element` and check that // this will also match inputs like this: // .a { // /* comm */ // .b {} // } // // but that is fine // // it would be the easiest to change the placement of the comment to be the first child of the rule: // .a { // .b { /* comm */ } // } // with such inputs we wouldn't have to search for the comment at all // TODO: consider changing this comment placement in the next major version if (node.column < element.column) { if (isIgnoringComment(node)) { return; } break; } } unsafePseudoClasses.forEach(function (unsafePseudoClass) { console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\"."); }); } }; }; var isImportRule = function isImportRule(element) { return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64; }; var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) { for (var i = index - 1; i >= 0; i--) { if (!isImportRule(children[i])) { return true; } } return false; }; // use this to remove incorrect elements from further processing // so they don't get handed to the `sheet` (or anything else) // as that could potentially lead to additional logs which in turn could be overhelming to the user var nullifyElement = function nullifyElement(element) { element.type = ''; element.value = ''; element["return"] = ''; element.children = ''; element.props = ''; }; var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) { if (!isImportRule(element)) { return; } if (element.parent) { console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."); nullifyElement(element); } else if (isPrependedWithRegularRules(index, children)) { console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."); nullifyElement(element); } }; /* eslint-disable no-fallthrough */ function prefix(value, length) { switch (hash(value, length)) { // color-adjust case 5103: return WEBKIT + 'print-' + value + value; // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break case 5572: case 6356: case 5844: case 3191: case 6645: case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, case 6391: case 5879: case 5623: case 6135: case 4599: case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) case 4215: case 6389: case 5109: case 5365: case 5621: case 3829: return WEBKIT + value + value; // appearance, user-select, transform, hyphens, text-size-adjust case 5349: case 4246: case 4810: case 6968: case 2756: return WEBKIT + value + MOZ + value + MS + value + value; // flex, flex-direction case 6828: case 4268: return WEBKIT + value + MS + value + value; // order case 6165: return WEBKIT + value + MS + 'flex-' + value + value; // align-items case 5187: return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value; // align-self case 5443: return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value; // align-content case 4675: return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value; // flex-shrink case 5548: return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value; // flex-basis case 5292: return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value; // flex-grow case 6060: return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value; // transition case 4554: return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value; // cursor case 6187: return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value; // background, background-image case 5495: case 3959: return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1'); // justify-content case 4968: return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value; // (margin|padding)-inline-(start|end) case 4095: case 3583: case 4068: case 2532: return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value; // (min|max)?(width|height|inline-size|block-size) case 8116: case 7059: case 5753: case 5535: case 5445: case 5701: case 4933: case 4677: case 5533: case 5789: case 5021: case 4765: // stretch, max-content, min-content, fill-available if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) { // (m)ax-content, (m)in-content case 109: // - if (charat(value, length + 4) !== 45) break; // (f)ill-available, (f)it-content case 102: return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value; // (s)tretch case 115: return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value; } break; // position: sticky case 4949: // (s)ticky? if (charat(value, length + 1) !== 115) break; // display: (flex|inline-flex) case 6444: switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) { // stic(k)y case 107: return replace(value, ':', ':' + WEBKIT) + value; // (inline-)?fl(e)x case 101: return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value; } break; // writing-mode case 5936: switch (charat(value, length + 11)) { // vertical-l(r) case 114: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value; // vertical-r(l) case 108: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value; // horizontal(-)tb case 45: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value; } return WEBKIT + value + MS + value + value; } return value; } var prefixer = function prefixer(element, index, children, callback) { if (element.length > -1) if (!element["return"]) switch (element.type) { case DECLARATION: element["return"] = prefix(element.value, element.length); break; case KEYFRAMES: return serialize([copy(element, { value: replace(element.value, '@', '@' + WEBKIT) })], callback); case RULESET: if (element.length) return combine(element.props, function (value) { switch (match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return serialize([copy(element, { props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')] })], callback); // :placeholder case '::placeholder': return serialize([copy(element, { props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')] }), copy(element, { props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')] }), copy(element, { props: [replace(value, /:(plac\w+)/, MS + 'input-$1')] })], callback); } return ''; }); } }; var getServerStylisCache = weakMemoize(function () { return memoize(function () { var cache = {}; return function (name) { return cache[name]; }; }); }); var defaultStylisPlugins = [prefixer]; var createCache = function createCache(options) { var key = options.key; if (process.env.NODE_ENV !== 'production' && !key) { throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements."); } var stylisPlugins = options.stylisPlugins || defaultStylisPlugins; if (process.env.NODE_ENV !== 'production') { // $FlowFixMe if (/[^a-z-]/.test(key)) { throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed"); } } var inserted = {}; var container; var nodesToHydrate = []; var _insert; var omnipresentPlugins = [compat, removeLabel]; if (process.env.NODE_ENV !== 'production') { omnipresentPlugins.push(createUnsafeSelectorsAlarm({ get compat() { return cache.compat; } }), incorrectImportAlarm); } { var _finalizingPlugins = [stringify]; var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins)); var _stylis = function _stylis(styles) { return serialize(compile(styles), _serializer); }; // $FlowFixMe var serverStylisCache = getServerStylisCache(stylisPlugins)(key); var getRules = function getRules(selector, serialized) { var name = serialized.name; if (serverStylisCache[name] === undefined) { serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); } return serverStylisCache[name]; }; _insert = function _insert(selector, serialized, sheet, shouldCache) { var name = serialized.name; var rules = getRules(selector, serialized); if (cache.compat === undefined) { // in regular mode, we don't set the styles on the inserted cache // since we don't need to and that would be wasting memory // we return them so that they are rendered in a style tag if (shouldCache) { cache.inserted[name] = true; } if ( // using === development instead of !== production // because if people do ssr in tests, the source maps showing up would be annoying process.env.NODE_ENV === 'development' && serialized.map !== undefined) { return rules + serialized.map; } return rules; } else { // in compat mode, we put the styles on the inserted cache so // that emotion-server can pull out the styles // except when we don't want to cache it which was in Global but now // is nowhere but we don't want to do a major right now // and just in case we're going to leave the case here // it's also not affecting client side bundle size // so it's really not a big deal if (shouldCache) { cache.inserted[name] = rules; } else { return rules; } } }; } var cache = { key: key, sheet: new StyleSheet({ key: key, container: container, nonce: options.nonce, speedy: options.speedy, prepend: options.prepend, insertionPoint: options.insertionPoint }), nonce: options.nonce, inserted: inserted, registered: {}, insert: _insert }; cache.sheet.hydrate(nodesToHydrate); return cache; }; export { createCache as default }; cache/dist/emotion-cache.cjs.js.flow000064400000000125151701474440013354 0ustar00// @flow export * from "../src/index.js"; export { default } from "../src/index.js"; cache/dist/emotion-cache.cjs.dev.js000064400000053303151701474440013171 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var sheet = require('@emotion/sheet'); var stylis = require('stylis'); var weakMemoize = require('@emotion/weak-memoize'); var memoize = require('@emotion/memoize'); function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } var weakMemoize__default = /*#__PURE__*/_interopDefault(weakMemoize); var memoize__default = /*#__PURE__*/_interopDefault(memoize); var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) { var previous = 0; var character = 0; while (true) { previous = character; character = stylis.peek(); // &\f if (previous === 38 && character === 12) { points[index] = 1; } if (stylis.token(character)) { break; } stylis.next(); } return stylis.slice(begin, stylis.position); }; var toRules = function toRules(parsed, points) { // pretend we've started with a comma var index = -1; var character = 44; do { switch (stylis.token(character)) { case 0: // &\f if (character === 38 && stylis.peek() === 12) { // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings // stylis inserts \f after & to know when & where it should replace this sequence with the context selector // and when it should just concatenate the outer and inner selectors // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here points[index] = 1; } parsed[index] += identifierWithPointTracking(stylis.position - 1, points, index); break; case 2: parsed[index] += stylis.delimit(character); break; case 4: // comma if (character === 44) { // colon parsed[++index] = stylis.peek() === 58 ? '&\f' : ''; points[index] = parsed[index].length; break; } // fallthrough default: parsed[index] += stylis.from(character); } } while (character = stylis.next()); return parsed; }; var getRules = function getRules(value, points) { return stylis.dealloc(toRules(stylis.alloc(value), points)); }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11 var fixedElements = /* #__PURE__ */new WeakMap(); var compat = function compat(element) { if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo // negative .length indicates that this rule has been already prefixed element.length < 1) { return; } var value = element.value, parent = element.parent; var isImplicitRule = element.column === parent.column && element.line === parent.line; while (parent.type !== 'rule') { parent = parent.parent; if (!parent) return; } // short-circuit for the simplest case if (element.props.length === 1 && value.charCodeAt(0) !== 58 /* colon */ && !fixedElements.get(parent)) { return; } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level) // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent" if (isImplicitRule) { return; } fixedElements.set(element, true); var points = []; var rules = getRules(value, points); var parentRules = parent.props; for (var i = 0, k = 0; i < rules.length; i++) { for (var j = 0; j < parentRules.length; j++, k++) { element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i]; } } }; var removeLabel = function removeLabel(element) { if (element.type === 'decl') { var value = element.value; if ( // charcode for l value.charCodeAt(0) === 108 && // charcode for b value.charCodeAt(2) === 98) { // this ignores label element["return"] = ''; element.value = ''; } } }; var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason'; var isIgnoringComment = function isIgnoringComment(element) { return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1; }; var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) { return function (element, index, children) { if (element.type !== 'rule' || cache.compat) return; var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g); if (unsafePseudoClasses) { var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent` // // considering this input: // .a { // .b /* comm */ {} // color: hotpink; // } // we get output corresponding to this: // .a { // & { // /* comm */ // color: hotpink; // } // .b {} // } var commentContainer = isNested ? element.parent.children : // global rule at the root level children; for (var i = commentContainer.length - 1; i >= 0; i--) { var node = commentContainer[i]; if (node.line < element.line) { break; } // it is quite weird but comments are *usually* put at `column: element.column - 1` // so we seek *from the end* for the node that is earlier than the rule's `element` and check that // this will also match inputs like this: // .a { // /* comm */ // .b {} // } // // but that is fine // // it would be the easiest to change the placement of the comment to be the first child of the rule: // .a { // .b { /* comm */ } // } // with such inputs we wouldn't have to search for the comment at all // TODO: consider changing this comment placement in the next major version if (node.column < element.column) { if (isIgnoringComment(node)) { return; } break; } } unsafePseudoClasses.forEach(function (unsafePseudoClass) { console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\"."); }); } }; }; var isImportRule = function isImportRule(element) { return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64; }; var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) { for (var i = index - 1; i >= 0; i--) { if (!isImportRule(children[i])) { return true; } } return false; }; // use this to remove incorrect elements from further processing // so they don't get handed to the `sheet` (or anything else) // as that could potentially lead to additional logs which in turn could be overhelming to the user var nullifyElement = function nullifyElement(element) { element.type = ''; element.value = ''; element["return"] = ''; element.children = ''; element.props = ''; }; var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) { if (!isImportRule(element)) { return; } if (element.parent) { console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."); nullifyElement(element); } else if (isPrependedWithRegularRules(index, children)) { console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."); nullifyElement(element); } }; /* eslint-disable no-fallthrough */ function prefix(value, length) { switch (stylis.hash(value, length)) { // color-adjust case 5103: return stylis.WEBKIT + 'print-' + value + value; // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break case 5572: case 6356: case 5844: case 3191: case 6645: case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, case 6391: case 5879: case 5623: case 6135: case 4599: case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) case 4215: case 6389: case 5109: case 5365: case 5621: case 3829: return stylis.WEBKIT + value + value; // appearance, user-select, transform, hyphens, text-size-adjust case 5349: case 4246: case 4810: case 6968: case 2756: return stylis.WEBKIT + value + stylis.MOZ + value + stylis.MS + value + value; // flex, flex-direction case 6828: case 4268: return stylis.WEBKIT + value + stylis.MS + value + value; // order case 6165: return stylis.WEBKIT + value + stylis.MS + 'flex-' + value + value; // align-items case 5187: return stylis.WEBKIT + value + stylis.replace(value, /(\w+).+(:[^]+)/, stylis.WEBKIT + 'box-$1$2' + stylis.MS + 'flex-$1$2') + value; // align-self case 5443: return stylis.WEBKIT + value + stylis.MS + 'flex-item-' + stylis.replace(value, /flex-|-self/, '') + value; // align-content case 4675: return stylis.WEBKIT + value + stylis.MS + 'flex-line-pack' + stylis.replace(value, /align-content|flex-|-self/, '') + value; // flex-shrink case 5548: return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'shrink', 'negative') + value; // flex-basis case 5292: return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'basis', 'preferred-size') + value; // flex-grow case 6060: return stylis.WEBKIT + 'box-' + stylis.replace(value, '-grow', '') + stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'grow', 'positive') + value; // transition case 4554: return stylis.WEBKIT + stylis.replace(value, /([^-])(transform)/g, '$1' + stylis.WEBKIT + '$2') + value; // cursor case 6187: return stylis.replace(stylis.replace(stylis.replace(value, /(zoom-|grab)/, stylis.WEBKIT + '$1'), /(image-set)/, stylis.WEBKIT + '$1'), value, '') + value; // background, background-image case 5495: case 3959: return stylis.replace(value, /(image-set\([^]*)/, stylis.WEBKIT + '$1' + '$`$1'); // justify-content case 4968: return stylis.replace(stylis.replace(value, /(.+:)(flex-)?(.*)/, stylis.WEBKIT + 'box-pack:$3' + stylis.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + stylis.WEBKIT + value + value; // (margin|padding)-inline-(start|end) case 4095: case 3583: case 4068: case 2532: return stylis.replace(value, /(.+)-inline(.+)/, stylis.WEBKIT + '$1$2') + value; // (min|max)?(width|height|inline-size|block-size) case 8116: case 7059: case 5753: case 5535: case 5445: case 5701: case 4933: case 4677: case 5533: case 5789: case 5021: case 4765: // stretch, max-content, min-content, fill-available if (stylis.strlen(value) - 1 - length > 6) switch (stylis.charat(value, length + 1)) { // (m)ax-content, (m)in-content case 109: // - if (stylis.charat(value, length + 4) !== 45) break; // (f)ill-available, (f)it-content case 102: return stylis.replace(value, /(.+:)(.+)-([^]+)/, '$1' + stylis.WEBKIT + '$2-$3' + '$1' + stylis.MOZ + (stylis.charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value; // (s)tretch case 115: return ~stylis.indexof(value, 'stretch') ? prefix(stylis.replace(value, 'stretch', 'fill-available'), length) + value : value; } break; // position: sticky case 4949: // (s)ticky? if (stylis.charat(value, length + 1) !== 115) break; // display: (flex|inline-flex) case 6444: switch (stylis.charat(value, stylis.strlen(value) - 3 - (~stylis.indexof(value, '!important') && 10))) { // stic(k)y case 107: return stylis.replace(value, ':', ':' + stylis.WEBKIT) + value; // (inline-)?fl(e)x case 101: return stylis.replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + stylis.WEBKIT + (stylis.charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + stylis.WEBKIT + '$2$3' + '$1' + stylis.MS + '$2box$3') + value; } break; // writing-mode case 5936: switch (stylis.charat(value, length + 11)) { // vertical-l(r) case 114: return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value; // vertical-r(l) case 108: return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value; // horizontal(-)tb case 45: return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value; } return stylis.WEBKIT + value + stylis.MS + value + value; } return value; } var prefixer = function prefixer(element, index, children, callback) { if (element.length > -1) if (!element["return"]) switch (element.type) { case stylis.DECLARATION: element["return"] = prefix(element.value, element.length); break; case stylis.KEYFRAMES: return stylis.serialize([stylis.copy(element, { value: stylis.replace(element.value, '@', '@' + stylis.WEBKIT) })], callback); case stylis.RULESET: if (element.length) return stylis.combine(element.props, function (value) { switch (stylis.match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return stylis.serialize([stylis.copy(element, { props: [stylis.replace(value, /:(read-\w+)/, ':' + stylis.MOZ + '$1')] })], callback); // :placeholder case '::placeholder': return stylis.serialize([stylis.copy(element, { props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.WEBKIT + 'input-$1')] }), stylis.copy(element, { props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.MOZ + '$1')] }), stylis.copy(element, { props: [stylis.replace(value, /:(plac\w+)/, stylis.MS + 'input-$1')] })], callback); } return ''; }); } }; var isBrowser = typeof document !== 'undefined'; var getServerStylisCache = isBrowser ? undefined : weakMemoize__default["default"](function () { return memoize__default["default"](function () { var cache = {}; return function (name) { return cache[name]; }; }); }); var defaultStylisPlugins = [prefixer]; var createCache = function createCache(options) { var key = options.key; if (process.env.NODE_ENV !== 'production' && !key) { throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements."); } if (isBrowser && key === 'css') { var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be) // note this very very intentionally targets all style elements regardless of the key to ensure // that creating a cache works inside of render of a React component Array.prototype.forEach.call(ssrStyles, function (node) { // we want to only move elements which have a space in the data-emotion attribute value // because that indicates that it is an Emotion 11 server-side rendered style elements // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes) // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles // will not result in the Emotion 10 styles being destroyed var dataEmotionAttribute = node.getAttribute('data-emotion'); if (dataEmotionAttribute.indexOf(' ') === -1) { return; } document.head.appendChild(node); node.setAttribute('data-s', ''); }); } var stylisPlugins = options.stylisPlugins || defaultStylisPlugins; if (process.env.NODE_ENV !== 'production') { // $FlowFixMe if (/[^a-z-]/.test(key)) { throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed"); } } var inserted = {}; var container; var nodesToHydrate = []; if (isBrowser) { container = options.container || document.head; Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which // means that the style elements we're looking at are only Emotion 11 server-rendered style elements document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) { var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe for (var i = 1; i < attrib.length; i++) { inserted[attrib[i]] = true; } nodesToHydrate.push(node); }); } var _insert; var omnipresentPlugins = [compat, removeLabel]; if (process.env.NODE_ENV !== 'production') { omnipresentPlugins.push(createUnsafeSelectorsAlarm({ get compat() { return cache.compat; } }), incorrectImportAlarm); } if (isBrowser) { var currentSheet; var finalizingPlugins = [stylis.stringify, process.env.NODE_ENV !== 'production' ? function (element) { if (!element.root) { if (element["return"]) { currentSheet.insert(element["return"]); } else if (element.value && element.type !== stylis.COMMENT) { // insert empty rule in non-production environments // so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet currentSheet.insert(element.value + "{}"); } } } : stylis.rulesheet(function (rule) { currentSheet.insert(rule); })]; var serializer = stylis.middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins)); var stylis$1 = function stylis$1(styles) { return stylis.serialize(stylis.compile(styles), serializer); }; _insert = function insert(selector, serialized, sheet, shouldCache) { currentSheet = sheet; if (process.env.NODE_ENV !== 'production' && serialized.map !== undefined) { currentSheet = { insert: function insert(rule) { sheet.insert(rule + serialized.map); } }; } stylis$1(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); if (shouldCache) { cache.inserted[serialized.name] = true; } }; } else { var _finalizingPlugins = [stylis.stringify]; var _serializer = stylis.middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins)); var _stylis = function _stylis(styles) { return stylis.serialize(stylis.compile(styles), _serializer); }; // $FlowFixMe var serverStylisCache = getServerStylisCache(stylisPlugins)(key); var getRules = function getRules(selector, serialized) { var name = serialized.name; if (serverStylisCache[name] === undefined) { serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); } return serverStylisCache[name]; }; _insert = function _insert(selector, serialized, sheet, shouldCache) { var name = serialized.name; var rules = getRules(selector, serialized); if (cache.compat === undefined) { // in regular mode, we don't set the styles on the inserted cache // since we don't need to and that would be wasting memory // we return them so that they are rendered in a style tag if (shouldCache) { cache.inserted[name] = true; } if ( // using === development instead of !== production // because if people do ssr in tests, the source maps showing up would be annoying process.env.NODE_ENV === 'development' && serialized.map !== undefined) { return rules + serialized.map; } return rules; } else { // in compat mode, we put the styles on the inserted cache so // that emotion-server can pull out the styles // except when we don't want to cache it which was in Global but now // is nowhere but we don't want to do a major right now // and just in case we're going to leave the case here // it's also not affecting client side bundle size // so it's really not a big deal if (shouldCache) { cache.inserted[name] = rules; } else { return rules; } } }; } var cache = { key: key, sheet: new sheet.StyleSheet({ key: key, container: container, nonce: options.nonce, speedy: options.speedy, prepend: options.prepend, insertionPoint: options.insertionPoint }), nonce: options.nonce, inserted: inserted, registered: {}, insert: _insert }; cache.sheet.hydrate(nodesToHydrate); return cache; }; exports["default"] = createCache; cache/dist/emotion-cache.esm.js000064400000051333151701474440012422 0ustar00import { StyleSheet } from '@emotion/sheet'; import { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, stringify, COMMENT, rulesheet, middleware, compile } from 'stylis'; import weakMemoize from '@emotion/weak-memoize'; import memoize from '@emotion/memoize'; var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) { var previous = 0; var character = 0; while (true) { previous = character; character = peek(); // &\f if (previous === 38 && character === 12) { points[index] = 1; } if (token(character)) { break; } next(); } return slice(begin, position); }; var toRules = function toRules(parsed, points) { // pretend we've started with a comma var index = -1; var character = 44; do { switch (token(character)) { case 0: // &\f if (character === 38 && peek() === 12) { // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings // stylis inserts \f after & to know when & where it should replace this sequence with the context selector // and when it should just concatenate the outer and inner selectors // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here points[index] = 1; } parsed[index] += identifierWithPointTracking(position - 1, points, index); break; case 2: parsed[index] += delimit(character); break; case 4: // comma if (character === 44) { // colon parsed[++index] = peek() === 58 ? '&\f' : ''; points[index] = parsed[index].length; break; } // fallthrough default: parsed[index] += from(character); } } while (character = next()); return parsed; }; var getRules = function getRules(value, points) { return dealloc(toRules(alloc(value), points)); }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11 var fixedElements = /* #__PURE__ */new WeakMap(); var compat = function compat(element) { if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo // negative .length indicates that this rule has been already prefixed element.length < 1) { return; } var value = element.value, parent = element.parent; var isImplicitRule = element.column === parent.column && element.line === parent.line; while (parent.type !== 'rule') { parent = parent.parent; if (!parent) return; } // short-circuit for the simplest case if (element.props.length === 1 && value.charCodeAt(0) !== 58 /* colon */ && !fixedElements.get(parent)) { return; } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level) // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent" if (isImplicitRule) { return; } fixedElements.set(element, true); var points = []; var rules = getRules(value, points); var parentRules = parent.props; for (var i = 0, k = 0; i < rules.length; i++) { for (var j = 0; j < parentRules.length; j++, k++) { element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i]; } } }; var removeLabel = function removeLabel(element) { if (element.type === 'decl') { var value = element.value; if ( // charcode for l value.charCodeAt(0) === 108 && // charcode for b value.charCodeAt(2) === 98) { // this ignores label element["return"] = ''; element.value = ''; } } }; var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason'; var isIgnoringComment = function isIgnoringComment(element) { return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1; }; var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) { return function (element, index, children) { if (element.type !== 'rule' || cache.compat) return; var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g); if (unsafePseudoClasses) { var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent` // // considering this input: // .a { // .b /* comm */ {} // color: hotpink; // } // we get output corresponding to this: // .a { // & { // /* comm */ // color: hotpink; // } // .b {} // } var commentContainer = isNested ? element.parent.children : // global rule at the root level children; for (var i = commentContainer.length - 1; i >= 0; i--) { var node = commentContainer[i]; if (node.line < element.line) { break; } // it is quite weird but comments are *usually* put at `column: element.column - 1` // so we seek *from the end* for the node that is earlier than the rule's `element` and check that // this will also match inputs like this: // .a { // /* comm */ // .b {} // } // // but that is fine // // it would be the easiest to change the placement of the comment to be the first child of the rule: // .a { // .b { /* comm */ } // } // with such inputs we wouldn't have to search for the comment at all // TODO: consider changing this comment placement in the next major version if (node.column < element.column) { if (isIgnoringComment(node)) { return; } break; } } unsafePseudoClasses.forEach(function (unsafePseudoClass) { console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\"."); }); } }; }; var isImportRule = function isImportRule(element) { return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64; }; var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) { for (var i = index - 1; i >= 0; i--) { if (!isImportRule(children[i])) { return true; } } return false; }; // use this to remove incorrect elements from further processing // so they don't get handed to the `sheet` (or anything else) // as that could potentially lead to additional logs which in turn could be overhelming to the user var nullifyElement = function nullifyElement(element) { element.type = ''; element.value = ''; element["return"] = ''; element.children = ''; element.props = ''; }; var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) { if (!isImportRule(element)) { return; } if (element.parent) { console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."); nullifyElement(element); } else if (isPrependedWithRegularRules(index, children)) { console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."); nullifyElement(element); } }; /* eslint-disable no-fallthrough */ function prefix(value, length) { switch (hash(value, length)) { // color-adjust case 5103: return WEBKIT + 'print-' + value + value; // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break case 5572: case 6356: case 5844: case 3191: case 6645: case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, case 6391: case 5879: case 5623: case 6135: case 4599: case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) case 4215: case 6389: case 5109: case 5365: case 5621: case 3829: return WEBKIT + value + value; // appearance, user-select, transform, hyphens, text-size-adjust case 5349: case 4246: case 4810: case 6968: case 2756: return WEBKIT + value + MOZ + value + MS + value + value; // flex, flex-direction case 6828: case 4268: return WEBKIT + value + MS + value + value; // order case 6165: return WEBKIT + value + MS + 'flex-' + value + value; // align-items case 5187: return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value; // align-self case 5443: return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value; // align-content case 4675: return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value; // flex-shrink case 5548: return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value; // flex-basis case 5292: return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value; // flex-grow case 6060: return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value; // transition case 4554: return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value; // cursor case 6187: return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value; // background, background-image case 5495: case 3959: return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1'); // justify-content case 4968: return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value; // (margin|padding)-inline-(start|end) case 4095: case 3583: case 4068: case 2532: return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value; // (min|max)?(width|height|inline-size|block-size) case 8116: case 7059: case 5753: case 5535: case 5445: case 5701: case 4933: case 4677: case 5533: case 5789: case 5021: case 4765: // stretch, max-content, min-content, fill-available if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) { // (m)ax-content, (m)in-content case 109: // - if (charat(value, length + 4) !== 45) break; // (f)ill-available, (f)it-content case 102: return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value; // (s)tretch case 115: return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value; } break; // position: sticky case 4949: // (s)ticky? if (charat(value, length + 1) !== 115) break; // display: (flex|inline-flex) case 6444: switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) { // stic(k)y case 107: return replace(value, ':', ':' + WEBKIT) + value; // (inline-)?fl(e)x case 101: return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value; } break; // writing-mode case 5936: switch (charat(value, length + 11)) { // vertical-l(r) case 114: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value; // vertical-r(l) case 108: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value; // horizontal(-)tb case 45: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value; } return WEBKIT + value + MS + value + value; } return value; } var prefixer = function prefixer(element, index, children, callback) { if (element.length > -1) if (!element["return"]) switch (element.type) { case DECLARATION: element["return"] = prefix(element.value, element.length); break; case KEYFRAMES: return serialize([copy(element, { value: replace(element.value, '@', '@' + WEBKIT) })], callback); case RULESET: if (element.length) return combine(element.props, function (value) { switch (match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return serialize([copy(element, { props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')] })], callback); // :placeholder case '::placeholder': return serialize([copy(element, { props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')] }), copy(element, { props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')] }), copy(element, { props: [replace(value, /:(plac\w+)/, MS + 'input-$1')] })], callback); } return ''; }); } }; var isBrowser = typeof document !== 'undefined'; var getServerStylisCache = isBrowser ? undefined : weakMemoize(function () { return memoize(function () { var cache = {}; return function (name) { return cache[name]; }; }); }); var defaultStylisPlugins = [prefixer]; var createCache = function createCache(options) { var key = options.key; if (process.env.NODE_ENV !== 'production' && !key) { throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements."); } if (isBrowser && key === 'css') { var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be) // note this very very intentionally targets all style elements regardless of the key to ensure // that creating a cache works inside of render of a React component Array.prototype.forEach.call(ssrStyles, function (node) { // we want to only move elements which have a space in the data-emotion attribute value // because that indicates that it is an Emotion 11 server-side rendered style elements // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes) // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles // will not result in the Emotion 10 styles being destroyed var dataEmotionAttribute = node.getAttribute('data-emotion'); if (dataEmotionAttribute.indexOf(' ') === -1) { return; } document.head.appendChild(node); node.setAttribute('data-s', ''); }); } var stylisPlugins = options.stylisPlugins || defaultStylisPlugins; if (process.env.NODE_ENV !== 'production') { // $FlowFixMe if (/[^a-z-]/.test(key)) { throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed"); } } var inserted = {}; var container; var nodesToHydrate = []; if (isBrowser) { container = options.container || document.head; Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which // means that the style elements we're looking at are only Emotion 11 server-rendered style elements document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) { var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe for (var i = 1; i < attrib.length; i++) { inserted[attrib[i]] = true; } nodesToHydrate.push(node); }); } var _insert; var omnipresentPlugins = [compat, removeLabel]; if (process.env.NODE_ENV !== 'production') { omnipresentPlugins.push(createUnsafeSelectorsAlarm({ get compat() { return cache.compat; } }), incorrectImportAlarm); } if (isBrowser) { var currentSheet; var finalizingPlugins = [stringify, process.env.NODE_ENV !== 'production' ? function (element) { if (!element.root) { if (element["return"]) { currentSheet.insert(element["return"]); } else if (element.value && element.type !== COMMENT) { // insert empty rule in non-production environments // so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet currentSheet.insert(element.value + "{}"); } } } : rulesheet(function (rule) { currentSheet.insert(rule); })]; var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins)); var stylis = function stylis(styles) { return serialize(compile(styles), serializer); }; _insert = function insert(selector, serialized, sheet, shouldCache) { currentSheet = sheet; if (process.env.NODE_ENV !== 'production' && serialized.map !== undefined) { currentSheet = { insert: function insert(rule) { sheet.insert(rule + serialized.map); } }; } stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); if (shouldCache) { cache.inserted[serialized.name] = true; } }; } else { var _finalizingPlugins = [stringify]; var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins)); var _stylis = function _stylis(styles) { return serialize(compile(styles), _serializer); }; // $FlowFixMe var serverStylisCache = getServerStylisCache(stylisPlugins)(key); var getRules = function getRules(selector, serialized) { var name = serialized.name; if (serverStylisCache[name] === undefined) { serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); } return serverStylisCache[name]; }; _insert = function _insert(selector, serialized, sheet, shouldCache) { var name = serialized.name; var rules = getRules(selector, serialized); if (cache.compat === undefined) { // in regular mode, we don't set the styles on the inserted cache // since we don't need to and that would be wasting memory // we return them so that they are rendered in a style tag if (shouldCache) { cache.inserted[name] = true; } if ( // using === development instead of !== production // because if people do ssr in tests, the source maps showing up would be annoying process.env.NODE_ENV === 'development' && serialized.map !== undefined) { return rules + serialized.map; } return rules; } else { // in compat mode, we put the styles on the inserted cache so // that emotion-server can pull out the styles // except when we don't want to cache it which was in Global but now // is nowhere but we don't want to do a major right now // and just in case we're going to leave the case here // it's also not affecting client side bundle size // so it's really not a big deal if (shouldCache) { cache.inserted[name] = rules; } else { return rules; } } }; } var cache = { key: key, sheet: new StyleSheet({ key: key, container: container, nonce: options.nonce, speedy: options.speedy, prepend: options.prepend, insertionPoint: options.insertionPoint }), nonce: options.nonce, inserted: inserted, registered: {}, insert: _insert }; cache.sheet.hydrate(nodesToHydrate); return cache; }; export { createCache as default }; cache/dist/emotion-cache.cjs.js000064400000000274151701474440012413 0ustar00'use strict'; if (process.env.NODE_ENV === "production") { module.exports = require("./emotion-cache.cjs.prod.js"); } else { module.exports = require("./emotion-cache.cjs.dev.js"); } cache/dist/emotion-cache.cjs.mjs000064400000000163151701474440012565 0ustar00export { } from "./emotion-cache.cjs.js"; export { _default as default } from "./emotion-cache.cjs.default.js"; cache/dist/emotion-cache.cjs.d.ts000064400000000216151701474440012643 0ustar00export * from "./declarations/src/index"; export { default } from "./declarations/src/index"; //# sourceMappingURL=emotion-cache.cjs.d.ts.map cache/dist/emotion-cache.cjs.d.mts.map000064400000000210151701474440013566 0ustar00{"version":3,"file":"emotion-cache.cjs.d.mts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} cache/dist/declarations/src/index.d.ts000064400000000074151701474440013722 0ustar00export * from '../types' export { default } from '../types' cache/dist/declarations/types/index.d.ts000064400000002047151701474440014301 0ustar00// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun> // TypeScript Version: 2.2 import { EmotionCache } from '@emotion/utils' export { EmotionCache } export interface StylisElement { type: string value: string props: Array<string> | string root: StylisElement | null parent: StylisElement | null children: Array<StylisElement> | string line: number column: number length: number return: string } export type StylisPluginCallback = ( element: StylisElement, index: number, children: Array<StylisElement>, callback: StylisPluginCallback ) => string | void export type StylisPlugin = ( element: StylisElement, index: number, children: Array<StylisElement>, callback: StylisPluginCallback ) => string | void export interface Options { nonce?: string stylisPlugins?: Array<StylisPlugin> key: string container?: Node speedy?: boolean /** @deprecate use `insertionPoint` instead */ prepend?: boolean insertionPoint?: HTMLElement } export default function createCache(options: Options): EmotionCache cache/dist/emotion-cache.cjs.d.mts000064400000000244151701474440013021 0ustar00export * from "./declarations/src/index.js"; export { _default as default } from "./emotion-cache.cjs.default.js"; //# sourceMappingURL=emotion-cache.cjs.d.mts.map cache/dist/emotion-cache.cjs.default.js000064400000000076151701474440014036 0ustar00exports._default = require("./emotion-cache.cjs.js").default; cache/README.md000064400000004252151701474440007100 0ustar00# @emotion/cache ### createCache `createCache` allows for low level customization of how styles get inserted by emotion. It's intended to be used with the [`<CacheProvider/>`](https://emotion.sh/docs/cache-provider) component to override the default cache, which is created with sensible defaults for most applications. ```javascript import createCache from '@emotion/cache' export const myCache = createCache({ key: 'my-prefix-key', stylisPlugins: [ /* your plugins here */ ] }) ``` ### Primary use cases - Using emotion in embedded contexts such as an `<iframe/>` - Setting a [nonce](#nonce-string) on any `<style/>` tag emotion creates for security purposes - Using emotion with a developer defined `<style/>` tag - Using emotion with custom Stylis plugins ## Options ### `nonce` `string` A nonce that will be set on each style tag that emotion inserts for [Content Security Policies](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP). ### `stylisPlugins` `Array<Function>` A Stylis plugins that will be run by Stylis during preprocessing. [Read the Stylis docs to find out more](https://github.com/thysultan/stylis.js#middleware). This can be used for many purposes such as RTL. > Note: > > Prefixer is just a plugin which happens to be put in default `stylisPlugins`. If you plan to use custom `stylisPlugins` and you want to have your styles prefixed automatically you must include prefixer in your custom `stylisPlugins`. You can import `prefixer` from the `stylis` module to do that (`import { prefixer } from 'stylis'`); ### `key` `string (Pattern: [^a-z-])` The prefix before class names. It will also be set as the value of the `data-emotion` attribute on the style tags that emotion inserts and it's used in the attribute name that marks style elements in `renderStylesToString` and `renderStylesToNodeStream`. This is **required if using multiple emotion caches in the same app**. ### `container` `Node` A DOM node that emotion will insert all of its style tags into. This is useful for inserting styles into iframes or windows. ### `prepend` `boolean` A boolean representing whether to prepend rather than append style tags into the specified container DOM node. memoize/src/index.js000064400000000341151701474440010452 0ustar00// @flow export default function memoize<V>(fn: string => V): string => V { const cache = Object.create(null) return (arg: string) => { if (cache[arg] === undefined) cache[arg] = fn(arg) return cache[arg] } } memoize/src/index.d.ts000064400000000074151701474440010711 0ustar00export * from '../types' export { default } from '../types' memoize/package.json000064400000003354151701474440010513 0ustar00{ "_from": "@emotion/memoize@^0.8.1", "_id": "@emotion/memoize@0.8.1", "_inBundle": false, "_integrity": "sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA==", "_location": "/@emotion/memoize", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "@emotion/memoize@^0.8.1", "name": "@emotion/memoize", "escapedName": "@emotion%2fmemoize", "scope": "@emotion", "rawSpec": "^0.8.1", "saveSpec": null, "fetchSpec": "^0.8.1" }, "_requiredBy": [ "/@emotion/cache", "/@emotion/serialize" ], "_resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.1.tgz", "_shasum": "c1ddb040429c6d21d38cc945fe75c818cfb68e17", "_spec": "@emotion/memoize@^0.8.1", "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\@emotion\\cache", "bundleDependencies": false, "deprecated": false, "description": "emotion's memoize utility", "devDependencies": { "@definitelytyped/dtslint": "0.0.112", "typescript": "^4.5.5" }, "exports": { ".": { "module": "./dist/emotion-memoize.esm.js", "import": "./dist/emotion-memoize.cjs.mjs", "default": "./dist/emotion-memoize.cjs.js" }, "./package.json": "./package.json" }, "files": [ "src", "dist", "types/*.d.ts" ], "license": "MIT", "main": "dist/emotion-memoize.cjs.js", "module": "dist/emotion-memoize.esm.js", "name": "@emotion/memoize", "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/emotion-js/emotion/tree/main/packages/memoize" }, "scripts": { "test:typescript": "dtslint types" }, "types": "types/index.d.ts", "version": "0.8.1" } memoize/LICENSE000064400000002077151701474440007233 0ustar00MIT License Copyright (c) Emotion team and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. memoize/types/index.d.ts000064400000000126151701474440011264 0ustar00type Fn<T> = (key: string) => T export default function memoize<T>(fn: Fn<T>): Fn<T> memoize/dist/emotion-memoize.cjs.d.ts000064400000000220151701474440013642 0ustar00export * from "./declarations/src/index"; export { default } from "./declarations/src/index"; //# sourceMappingURL=emotion-memoize.cjs.d.ts.map memoize/dist/emotion-memoize.cjs.d.ts.map000064400000000211151701474440014416 0ustar00{"version":3,"file":"emotion-memoize.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} memoize/dist/emotion-memoize.cjs.dev.js000064400000000430151701474440014166 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function memoize(fn) { var cache = Object.create(null); return function (arg) { if (cache[arg] === undefined) cache[arg] = fn(arg); return cache[arg]; }; } exports["default"] = memoize; memoize/dist/emotion-memoize.cjs.js.flow000064400000000125151701474440014360 0ustar00// @flow export * from "../src/index.js"; export { default } from "../src/index.js"; memoize/dist/emotion-memoize.cjs.prod.js000064400000000430151701474440014354 0ustar00'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function memoize(fn) { var cache = Object.create(null); return function (arg) { if (cache[arg] === undefined) cache[arg] = fn(arg); return cache[arg]; }; } exports["default"] = memoize; memoize/dist/emotion-memoize.cjs.default.js000064400000000100151701474440015026 0ustar00exports._default = require("./emotion-memoize.cjs.js").default; memoize/dist/emotion-memoize.cjs.default.d.ts000064400000000102151701474440015264 0ustar00export { default as _default } from "./declarations/src/index.js" memoize/dist/emotion-memoize.esm.js000064400000000312151701474440013415 0ustar00function memoize(fn) { var cache = Object.create(null); return function (arg) { if (cache[arg] === undefined) cache[arg] = fn(arg); return cache[arg]; }; } export { memoize as default }; memoize/dist/emotion-memoize.cjs.mjs000064400000000167151701474440013575 0ustar00export { } from "./emotion-memoize.cjs.js"; export { _default as default } from "./emotion-memoize.cjs.default.js"; memoize/dist/emotion-memoize.cjs.d.mts.map000064400000000212151701474440014574 0ustar00{"version":3,"file":"emotion-memoize.cjs.d.mts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"} memoize/dist/emotion-memoize.cjs.js000064400000000300151701474440013405 0ustar00'use strict'; if (process.env.NODE_ENV === "production") { module.exports = require("./emotion-memoize.cjs.prod.js"); } else { module.exports = require("./emotion-memoize.cjs.dev.js"); } memoize/dist/declarations/src/index.d.ts000064400000000074151701474440014324 0ustar00export * from '../types' export { default } from '../types' memoize/dist/declarations/types/index.d.ts000064400000000126151701474440014677 0ustar00type Fn<T> = (key: string) => T export default function memoize<T>(fn: Fn<T>): Fn<T> memoize/dist/emotion-memoize.cjs.d.mts000064400000000250151701474440014022 0ustar00export * from "./declarations/src/index.js"; export { _default as default } from "./emotion-memoize.cjs.default.js"; //# sourceMappingURL=emotion-memoize.cjs.d.mts.map
/home/emeraadmin/www/node_modules/path-parse/../function-bind/.github/../../../4d695/@emotion.tar