Socket
Socket
Sign inDemoInstall

@emotion/serialize

Package Overview
Dependencies
Maintainers
3
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@emotion/serialize - npm Package Compare versions

Comparing version 0.11.14 to 0.11.15-next.1

44

CHANGELOG.md
# @emotion/serialize
## 0.11.15-next.1
### Patch Changes
- [`8a896a31`](https://github.com/emotion-js/emotion/commit/8a896a31434a1d2f69e1f1467c446c884c929387) [#1600](https://github.com/emotion-js/emotion/pull/1600) Thanks [@Andarist](https://github.com/Andarist)! - Throw error about invalid content property values instead of just logging error to the console.
* [`a085003d`](https://github.com/emotion-js/emotion/commit/a085003d4c8ca284c116668d7217fb747802ed85) [#1600](https://github.com/emotion-js/emotion/pull/1600) Thanks [@Andarist](https://github.com/Andarist)! - Add missing `#__PURE__` annotations
## 1.0.0-next.0
### Major Changes
- [`1eaa3a38`](https://github.com/emotion-js/emotion/commit/1eaa3a389876d4a623ce66735dc6db093cb2a8e6) [#1600](https://github.com/emotion-js/emotion/pull/1600) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - TypeScript types have been restructured. These changes:
- Reduce build times when using emotion
- In many cases remove the need for manually specifying generic parameters for your emotion components.
If you encounter build issues after upgrade, try removing any manually specified generic types and let them be inferred. Otherwise refer to the breaking changes list below.
## Improvements
- useTheme added to EmotionTheming interface and can now create your own closed variation of withTheme. More information in the docs under the theming section.
- Union types as props are better supported and should be inferred properly
- Build times should be reduced significantly in larger projects.
## Breaking changes
- withTheme can now have the Theme type specified when calling it. For example `withTheme<MyTheme>(MyComponent)`
**Breaking change:** Generic argument changed, if you were specifying the ComponentType you will need to remove the generic parameter. Recommend following example setup in the TypeScript docs under theming section
- `css` function has been restricted to prevent passing of invalid types
- `CreateStyled` functions no longer take a second `ExtraProps` argument. Instead move it to after the create styled call. For example
`styled<typeof MyComponent, ExtraProps>(MyComponent)({})`
to
`styled(MyComponent)<ExtraProps>({})`
- `StyledComponent` type no longer supports the third generic `Theme` parameter. Instead add the `theme` prop to the first `Props` argument. For example:
`StyledComponent<Props, {}, MyTheme>`
to
`StyledComponent<Props & { theme?: MyTheme }>`
## 0.11.14

@@ -4,0 +48,0 @@

6

dist/serialize.browser.cjs.js

@@ -24,3 +24,5 @@ 'use strict';

var processStyleName = memoize(function (styleName) {
var processStyleName =
/* #__PURE__ */
memoize(function (styleName) {
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();

@@ -65,3 +67,3 @@ });

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) !== "'")) {
console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
}

@@ -68,0 +70,0 @@ }

@@ -18,3 +18,5 @@ import hashString from '@emotion/hash';

var processStyleName = memoize(function (styleName) {
var processStyleName =
/* #__PURE__ */
memoize(function (styleName) {
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();

@@ -59,3 +61,3 @@ });

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) !== "'")) {
console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
}

@@ -62,0 +64,0 @@ }

@@ -24,3 +24,5 @@ 'use strict';

var processStyleName = memoize(function (styleName) {
var processStyleName =
/* #__PURE__ */
memoize(function (styleName) {
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();

@@ -65,3 +67,3 @@ });

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) !== "'")) {
console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
}

@@ -68,0 +70,0 @@ }

@@ -15,9 +15,9 @@ "use strict";

return null != value && "boolean" != typeof value;
}, processStyleName = memoize(function(styleName) {
}, processStyleName = memoize((function(styleName) {
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, "-$&").toLowerCase();
}), processStyleValue = function(key, value) {
})), processStyleValue = function(key, value) {
switch (key) {
case "animation":
case "animationName":
if ("string" == typeof value) return value.replace(animationRegex, function(match, p1, p2) {
if ("string" == typeof value) return value.replace(animationRegex, (function(match, p1, p2) {
return cursor = {

@@ -28,3 +28,3 @@ name: p1,

}, p1;
});
}));
}

@@ -31,0 +31,0 @@ return 1 === unitless[key] || isCustomProperty(key) || "number" != typeof value || 0 === value ? value : value + "px";

@@ -18,3 +18,5 @@ import hashString from '@emotion/hash';

var processStyleName = memoize(function (styleName) {
var processStyleName =
/* #__PURE__ */
memoize(function (styleName) {
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();

@@ -59,3 +61,3 @@ });

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) !== "'")) {
console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
}

@@ -62,0 +64,0 @@ }

{
"name": "@emotion/serialize",
"version": "0.11.14",
"version": "0.11.15-next.1",
"description": "serialization utils for emotion",

@@ -5,0 +5,0 @@ "main": "dist/serialize.cjs.js",

@@ -25,3 +25,3 @@ // @flow

const processStyleName = memoize(
const processStyleName = /* #__PURE__ */ memoize(
(styleName: string) =>

@@ -95,3 +95,3 @@ isCustomProperty(styleName)

) {
console.error(
throw new Error(
`You seem to be using a value for 'content' without quotes, try replacing it with \`content: '"${value}"'\``

@@ -98,0 +98,0 @@ )

@@ -7,4 +7,2 @@ // Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>

import { Equal } from './helper'
export { RegisteredCache, SerializedStyles }

@@ -67,5 +65,8 @@

CSSOthersObject<MP> {}
export type FunctionInterpolation<MP> = (mergedProps: MP) => Interpolation<MP>
export type Interpolation<MP = undefined> =
export interface FunctionInterpolation<MergedProps> {
(mergedProps: MergedProps): Interpolation<MergedProps>
}
export type Interpolation<MergedProps = undefined> =
| null

@@ -79,5 +80,5 @@ | undefined

| SerializedStyles
| ArrayInterpolation<MP>
| ObjectInterpolation<MP>
| Equal<MP, undefined, never, FunctionInterpolation<MP>>
| ArrayInterpolation<MergedProps>
| ObjectInterpolation<MergedProps>
| FunctionInterpolation<MergedProps>

@@ -84,0 +85,0 @@ export function serializeStyles<MP>(

@@ -19,21 +19,17 @@ import {

// $ExpectType SerializedStyles
serializeStyles({}, [])
serializeStyles([], {})
// $ExpectType SerializedStyles
serializeStyles(
{
'emotion-cache': 'width: 200px'
},
[]
)
serializeStyles([], {
'emotion-cache': 'width: 200px'
})
// $ExpectType SerializedStyles
serializeStyles({}, [], {})
serializeStyles([], {}, {})
// $ExpectType SerializedStyles
serializeStyles({}, ['abc'], {})
serializeStyles(['abc'], {}, {})
// $ExpectType SerializedStyles
serializeStyles({}, ['width: 200px;'], {})
serializeStyles(['width: 200px;'], {}, {})
// $ExpectType SerializedStyles
serializeStyles({}, [() => 'height: 300px;'], {})
serializeStyles([() => 'height: 300px;'], {}, {})
// $ExpectType SerializedStyles
serializeStyles(
{},
[

@@ -46,6 +42,7 @@ 'display: block;',

],
{},
{}
)
// $ExpectType SerializedStyles
serializeStyles({}, [testTemplateStringsArray, 5, '4px'], {})
serializeStyles([testTemplateStringsArray, 5, '4px'], {}, {})

@@ -52,0 +49,0 @@ // $ExpectError

@@ -8,4 +8,6 @@ {

],
"semicolon": false
"semicolon": false,
"no-null-undefined-union": false,
"callable-types": false
}
}
}
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