Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

create-emotion

Package Overview
Dependencies
Maintainers
3
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-emotion - npm Package Compare versions

Comparing version 11.0.0-next.8 to 11.0.0-next.10

6

CHANGELOG.md
# create-emotion
## 11.0.0-next.10
### Major Changes
- [`b8476e08`](https://github.com/emotion-js/emotion/commit/b8476e08af4a2e8de94a112cb0daf6e8e4d56fe1) [#1600](https://github.com/emotion-js/emotion/pull/1600) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - Move create `create-emotion` to `@emotion/css/create-instance`. Please change any imports of `create-emotion` to import `@emotion/css/create-instance` or use the `@emotion/pkg-renaming` ESLint rule from `@emotion/eslint-plugin`.
## 11.0.0-next.8

@@ -4,0 +10,0 @@

149

dist/create-emotion.cjs.dev.js
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var createCache = _interopDefault(require('@emotion/cache'));
var serialize = require('@emotion/serialize');
var utils = require('@emotion/utils');
function insertWithoutScoping(cache, serialized) {
if (cache.inserted[serialized.name] === undefined) {
return cache.insert('', serialized, cache.sheet, true);
}
}
function merge(registered, css, className) {
var registeredStyles = [];
var rawClassName = utils.getRegisteredStyles(registered, registeredStyles, className);
if (registeredStyles.length < 2) {
return className;
}
return rawClassName + css(registeredStyles);
}
var createEmotion = function createEmotion(options) {
var cache = createCache(options); // $FlowFixMe
cache.sheet.speedy = function (value) {
if (process.env.NODE_ENV !== 'production' && this.ctr !== 0) {
throw new Error('speedy must be changed before any rules are inserted');
}
this.isSpeedy = value;
};
cache.compat = true;
var css = function css() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var serialized = serialize.serializeStyles(args, cache.registered, undefined);
utils.insertStyles(cache, serialized, false);
return cache.key + "-" + serialized.name;
};
var keyframes = function keyframes() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
var serialized = serialize.serializeStyles(args, cache.registered);
var animation = "animation-" + serialized.name;
insertWithoutScoping(cache, {
name: serialized.name,
styles: "@keyframes " + animation + "{" + serialized.styles + "}"
});
return animation;
};
var injectGlobal = function injectGlobal() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
var serialized = serialize.serializeStyles(args, cache.registered);
insertWithoutScoping(cache, serialized);
};
var cx = function cx() {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
return merge(cache.registered, css, classnames(args));
};
return {
css: css,
cx: cx,
injectGlobal: injectGlobal,
keyframes: keyframes,
hydrate: function hydrate(ids) {
ids.forEach(function (key) {
cache.inserted[key] = true;
});
},
flush: function flush() {
cache.registered = {};
cache.inserted = {};
cache.sheet.flush();
},
// $FlowFixMe
sheet: cache.sheet,
cache: cache,
getRegisteredStyles: utils.getRegisteredStyles.bind(null, cache.registered),
merge: merge.bind(null, cache.registered, css)
};
};
var classnames = function classnames(args) {
var cls = '';
for (var i = 0; i < args.length; i++) {
var arg = args[i];
if (arg == null) continue;
var toAdd = void 0;
switch (typeof arg) {
case 'boolean':
break;
case 'object':
{
if (Array.isArray(arg)) {
toAdd = classnames(arg);
} else {
toAdd = '';
for (var k in arg) {
if (arg[k] && k) {
toAdd && (toAdd += ' ');
toAdd += k;
}
}
}
break;
}
default:
{
toAdd = arg;
}
}
if (toAdd) {
cls && (cls += ' ');
cls += toAdd;
}
}
return cls;
};
exports.default = createEmotion;
throw new Error("The `create-emotion` package has been moved to `@emotion/css/create-instance`. Please import it like this `import createEmotion from '@emotion/css/create-instance'`.");
"use strict";
function _interopDefault(ex) {
return ex && "object" == typeof ex && "default" in ex ? ex.default : ex;
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var createCache = _interopDefault(require("@emotion/cache")), serialize = require("@emotion/serialize"), utils = require("@emotion/utils");
function insertWithoutScoping(cache, serialized) {
if (void 0 === cache.inserted[serialized.name]) return cache.insert("", serialized, cache.sheet, !0);
}
function merge(registered, css, className) {
var registeredStyles = [], rawClassName = utils.getRegisteredStyles(registered, registeredStyles, className);
return registeredStyles.length < 2 ? className : rawClassName + css(registeredStyles);
}
var createEmotion = function(options) {
var cache = createCache(options);
cache.sheet.speedy = function(value) {
this.isSpeedy = value;
}, cache.compat = !0;
var css = function() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
var serialized = serialize.serializeStyles(args, cache.registered, void 0);
return utils.insertStyles(cache, serialized, !1), cache.key + "-" + serialized.name;
};
return {
css: css,
cx: function() {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) args[_key4] = arguments[_key4];
return merge(cache.registered, css, classnames(args));
},
injectGlobal: function() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) args[_key3] = arguments[_key3];
var serialized = serialize.serializeStyles(args, cache.registered);
insertWithoutScoping(cache, serialized);
},
keyframes: function() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) args[_key2] = arguments[_key2];
var serialized = serialize.serializeStyles(args, cache.registered), animation = "animation-" + serialized.name;
return insertWithoutScoping(cache, {
name: serialized.name,
styles: "@keyframes " + animation + "{" + serialized.styles + "}"
}), animation;
},
hydrate: function(ids) {
ids.forEach((function(key) {
cache.inserted[key] = !0;
}));
},
flush: function() {
cache.registered = {}, cache.inserted = {}, cache.sheet.flush();
},
sheet: cache.sheet,
cache: cache,
getRegisteredStyles: utils.getRegisteredStyles.bind(null, cache.registered),
merge: merge.bind(null, cache.registered, css)
};
}, classnames = function classnames(args) {
for (var cls = "", i = 0; i < args.length; i++) {
var arg = args[i];
if (null != arg) {
var toAdd = void 0;
switch (typeof arg) {
case "boolean":
break;
case "object":
if (Array.isArray(arg)) toAdd = classnames(arg); else for (var k in toAdd = "",
arg) arg[k] && k && (toAdd && (toAdd += " "), toAdd += k);
break;
default:
toAdd = arg;
}
toAdd && (cls && (cls += " "), cls += toAdd);
}
}
return cls;
};
exports.default = createEmotion;
throw new Error("The `create-emotion` package has been moved to `@emotion/css/create-instance`. Please import it like this `import createEmotion from '@emotion/css/create-instance'`.");
{
"name": "create-emotion",
"version": "11.0.0-next.8",
"version": "11.0.0-next.10",
"description": "The Next Generation of CSS-in-JS.",
"main": "dist/create-emotion.cjs.js",
"module": "dist/create-emotion.esm.js",
"types": "types/index.d.ts",
"files": [

@@ -14,19 +12,8 @@ "src",

"scripts": {
"test:typescript": "dtslint types"
"test:typescript": "exit 0"
},
"dependencies": {
"@emotion/cache": "^11.0.0-next.6",
"@emotion/serialize": "^0.12.0-next.3",
"@emotion/sheet": "0.10.0-next.0",
"@emotion/utils": "0.11.2"
},
"devDependencies": {
"babel-plugin-transform-define": "^1.3.0",
"create-emotion-server": "11.0.0-next.0",
"dtslint": "^0.3.0"
},
"author": "Kye Hohenberger",
"homepage": "https://emotion.sh",
"license": "MIT",
"repository": "https://github.com/emotion-js/emotion/tree/master/packages/create-emotion",
"repository": "https://github.com/emotion-js/emotion/tree/master/removed-packages/create-emotion",
"keywords": [

@@ -41,7 +28,3 @@ "styles",

"url": "https://github.com/emotion-js/emotion/issues"
},
"browser": {
"./dist/create-emotion.cjs.js": "./dist/create-emotion.browser.cjs.js",
"./dist/create-emotion.esm.js": "./dist/create-emotion.browser.esm.js"
}
}

@@ -1,161 +0,3 @@

// @flow
import createCache from '@emotion/cache'
import { serializeStyles } from '@emotion/serialize'
import {
insertStyles,
getRegisteredStyles,
type EmotionCache,
type SerializedStyles
} from '@emotion/utils'
function insertWithoutScoping(cache, serialized: SerializedStyles) {
if (cache.inserted[serialized.name] === undefined) {
return cache.insert('', serialized, cache.sheet, true)
}
}
function merge(registered: Object, css: (*) => string, className: string) {
const registeredStyles = []
const rawClassName = getRegisteredStyles(
registered,
registeredStyles,
className
)
if (registeredStyles.length < 2) {
return className
}
return rawClassName + css(registeredStyles)
}
export type Interpolation = any
export type Interpolations = Array<Interpolation>
type CreateStyles<ReturnValue> = (...args: Interpolations) => ReturnValue
type ClassNameArg =
| string
| boolean
| { [key: string]: boolean | void | null }
| Array<ClassNameArg>
| void
| null
declare class StyleSheet {
insert(rule: string): void;
flush(): void;
speedy(newVal: boolean): void;
tags: Array<HTMLStyleElement>;
isSpeedy: number;
ctr: number;
}
export type Emotion = {
css: CreateStyles<string>,
cx: (...classNames: Array<ClassNameArg>) => string,
flush: () => void,
hydrate: (ids: Array<string>) => void,
injectGlobal: CreateStyles<void>,
keyframes: CreateStyles<string>,
sheet: StyleSheet,
cache: EmotionCache,
merge: *,
getRegisteredStyles: *
}
let createEmotion = (options: *): Emotion => {
let cache = createCache(options)
// $FlowFixMe
cache.sheet.speedy = function(value: boolean) {
if (process.env.NODE_ENV !== 'production' && this.ctr !== 0) {
throw new Error('speedy must be changed before any rules are inserted')
}
this.isSpeedy = value
}
cache.compat = true
let css = (...args) => {
let serialized = serializeStyles(args, cache.registered, undefined)
insertStyles(cache, serialized, false)
return `${cache.key}-${serialized.name}`
}
let keyframes = (...args) => {
let serialized = serializeStyles(args, cache.registered)
let animation = `animation-${serialized.name}`
insertWithoutScoping(cache, {
name: serialized.name,
styles: `@keyframes ${animation}{${serialized.styles}}`
})
return animation
}
let injectGlobal = (...args) => {
let serialized = serializeStyles(args, cache.registered)
insertWithoutScoping(cache, serialized)
}
let cx = (...args) => {
return merge(cache.registered, css, classnames(args))
}
return {
css,
cx,
injectGlobal,
keyframes,
hydrate(ids: Array<string>) {
ids.forEach(key => {
cache.inserted[key] = true
})
},
flush() {
cache.registered = {}
cache.inserted = {}
cache.sheet.flush()
},
// $FlowFixMe
sheet: cache.sheet,
cache,
getRegisteredStyles: getRegisteredStyles.bind(null, cache.registered),
merge: merge.bind(null, cache.registered, css)
}
}
let classnames = args => {
let cls = ''
for (let i = 0; i < args.length; i++) {
let arg = args[i]
if (arg == null) continue
let toAdd
switch (typeof arg) {
case 'boolean':
break
case 'object': {
if (Array.isArray(arg)) {
toAdd = classnames(arg)
} else {
toAdd = ''
for (const k in arg) {
if (arg[k] && k) {
toAdd && (toAdd += ' ')
toAdd += k
}
}
}
break
}
default: {
toAdd = arg
}
}
if (toAdd) {
cls && (cls += ' ')
cls += toAdd
}
}
return cls
}
export default createEmotion
throw new Error(
"The `create-emotion` package has been moved to `@emotion/css/create-instance`. Please import it like this `import createEmotion from '@emotion/css/create-instance'`."
)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc