@emotion/serialize
Advanced tools
Comparing version 0.11.15-next.2 to 0.11.15
# @emotion/serialize | ||
## 0.11.15-next.2 | ||
## 0.11.15 | ||
### Patch Changes | ||
- [`5c55fd17`](https://github.com/emotion-js/emotion/commit/5c55fd17dcaec84d1f5d5d13ae90dd336d7e4403) [#1600](https://github.com/emotion-js/emotion/pull/1600) Thanks [@Andarist](https://github.com/Andarist)! - Fix to what location generated source maps are pointing in case of composed styles. | ||
- [`4c62ae9`](https://github.com/emotion-js/emotion/commit/4c62ae9447959d438928e1a26f76f1487983c968) [#1698](https://github.com/emotion-js/emotion/pull/1698) Thanks [@Andarist](https://github.com/Andarist)! - Add LICENSE file | ||
- Updated dependencies [[`4c62ae9`](https://github.com/emotion-js/emotion/commit/4c62ae9447959d438928e1a26f76f1487983c968)]: | ||
- @emotion/hash@0.7.4 | ||
- @emotion/memoize@0.7.4 | ||
- @emotion/unitless@0.7.5 | ||
- @emotion/utils@0.11.3 | ||
* [`729ef9d8`](https://github.com/emotion-js/emotion/commit/729ef9d8408af82c7a63effc1b8728f79c66bed1) [#1600](https://github.com/emotion-js/emotion/pull/1600) Thanks [@Andarist](https://github.com/Andarist)! - Update `csstype` dependency. | ||
## 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 | ||
@@ -56,0 +15,0 @@ |
@@ -24,5 +24,3 @@ 'use strict'; | ||
var processStyleName = | ||
/* #__PURE__ */ | ||
memoize(function (styleName) { | ||
var processStyleName = memoize(function (styleName) { | ||
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); | ||
@@ -67,3 +65,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) !== "'")) { | ||
throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`"); | ||
console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`"); | ||
} | ||
@@ -251,3 +249,3 @@ } | ||
if (process.env.NODE_ENV !== 'production') { | ||
sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g; | ||
sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//; | ||
} // this is the cursor for keyframes | ||
@@ -254,0 +252,0 @@ // keyframes are stored on the SerializedStyles object as a linked list |
@@ -18,5 +18,3 @@ import hashString from '@emotion/hash'; | ||
var processStyleName = | ||
/* #__PURE__ */ | ||
memoize(function (styleName) { | ||
var processStyleName = memoize(function (styleName) { | ||
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); | ||
@@ -61,3 +59,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) !== "'")) { | ||
throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`"); | ||
console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`"); | ||
} | ||
@@ -245,3 +243,3 @@ } | ||
if (process.env.NODE_ENV !== 'production') { | ||
sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g; | ||
sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//; | ||
} // this is the cursor for keyframes | ||
@@ -248,0 +246,0 @@ // keyframes are stored on the SerializedStyles object as a linked list |
@@ -24,5 +24,3 @@ 'use strict'; | ||
var processStyleName = | ||
/* #__PURE__ */ | ||
memoize(function (styleName) { | ||
var processStyleName = memoize(function (styleName) { | ||
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); | ||
@@ -67,3 +65,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) !== "'")) { | ||
throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`"); | ||
console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`"); | ||
} | ||
@@ -251,3 +249,3 @@ } | ||
if (process.env.NODE_ENV !== 'production') { | ||
sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g; | ||
sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//; | ||
} // this is the cursor for keyframes | ||
@@ -254,0 +252,0 @@ // keyframes are stored on the SerializedStyles object as a linked list |
@@ -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,5 +18,3 @@ import hashString from '@emotion/hash'; | ||
var processStyleName = | ||
/* #__PURE__ */ | ||
memoize(function (styleName) { | ||
var processStyleName = memoize(function (styleName) { | ||
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); | ||
@@ -61,3 +59,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) !== "'")) { | ||
throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`"); | ||
console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`"); | ||
} | ||
@@ -245,3 +243,3 @@ } | ||
if (process.env.NODE_ENV !== 'production') { | ||
sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g; | ||
sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//; | ||
} // this is the cursor for keyframes | ||
@@ -248,0 +246,0 @@ // keyframes are stored on the SerializedStyles object as a linked list |
{ | ||
"name": "@emotion/serialize", | ||
"version": "0.11.15-next.2", | ||
"version": "0.11.15", | ||
"description": "serialization utils for emotion", | ||
@@ -17,7 +17,7 @@ "main": "dist/serialize.cjs.js", | ||
"dependencies": { | ||
"@emotion/hash": "0.7.3", | ||
"@emotion/memoize": "0.7.3", | ||
"@emotion/unitless": "0.7.4", | ||
"@emotion/utils": "0.11.2", | ||
"csstype": "^2.6.7" | ||
"@emotion/hash": "0.7.4", | ||
"@emotion/memoize": "0.7.4", | ||
"@emotion/unitless": "0.7.5", | ||
"@emotion/utils": "0.11.3", | ||
"csstype": "^2.5.7" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
@@ -25,3 +25,3 @@ // @flow | ||
const processStyleName = /* #__PURE__ */ memoize( | ||
const processStyleName = memoize( | ||
(styleName: string) => | ||
@@ -95,3 +95,3 @@ isCustomProperty(styleName) | ||
) { | ||
throw new Error( | ||
console.error( | ||
`You seem to be using a value for 'content' without quotes, try replacing it with \`content: '"${value}"'\`` | ||
@@ -337,3 +337,3 @@ ) | ||
if (process.env.NODE_ENV !== 'production') { | ||
sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g | ||
sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\// | ||
} | ||
@@ -340,0 +340,0 @@ |
@@ -7,2 +7,4 @@ // Definitions by: Junyoung Clare Jang <https://github.com/Ailrun> | ||
import { Equal } from './helper' | ||
export { RegisteredCache, SerializedStyles } | ||
@@ -65,8 +67,5 @@ | ||
CSSOthersObject<MP> {} | ||
export type FunctionInterpolation<MP> = (mergedProps: MP) => Interpolation<MP> | ||
export interface FunctionInterpolation<MergedProps> { | ||
(mergedProps: MergedProps): Interpolation<MergedProps> | ||
} | ||
export type Interpolation<MergedProps = undefined> = | ||
export type Interpolation<MP = undefined> = | ||
| null | ||
@@ -80,5 +79,5 @@ | undefined | ||
| SerializedStyles | ||
| ArrayInterpolation<MergedProps> | ||
| ObjectInterpolation<MergedProps> | ||
| FunctionInterpolation<MergedProps> | ||
| ArrayInterpolation<MP> | ||
| ObjectInterpolation<MP> | ||
| Equal<MP, undefined, never, FunctionInterpolation<MP>> | ||
@@ -85,0 +84,0 @@ export function serializeStyles<MP>( |
@@ -19,17 +19,21 @@ 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( | ||
{}, | ||
[ | ||
@@ -42,7 +46,6 @@ 'display: block;', | ||
], | ||
{}, | ||
{} | ||
) | ||
// $ExpectType SerializedStyles | ||
serializeStyles([testTemplateStringsArray, 5, '4px'], {}, {}) | ||
serializeStyles({}, [testTemplateStringsArray, 5, '4px'], {}) | ||
@@ -49,0 +52,0 @@ // $ExpectError |
@@ -8,6 +8,4 @@ { | ||
], | ||
"semicolon": false, | ||
"no-null-undefined-union": false, | ||
"callable-types": false | ||
"semicolon": false | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16
73904
1713
+ Added@emotion/hash@0.7.4(transitive)
+ Added@emotion/memoize@0.7.4(transitive)
+ Added@emotion/unitless@0.7.5(transitive)
+ Added@emotion/utils@0.11.3(transitive)
- Removed@emotion/hash@0.7.3(transitive)
- Removed@emotion/memoize@0.7.3(transitive)
- Removed@emotion/unitless@0.7.4(transitive)
- Removed@emotion/utils@0.11.2(transitive)
Updated@emotion/hash@0.7.4
Updated@emotion/memoize@0.7.4
Updated@emotion/unitless@0.7.5
Updated@emotion/utils@0.11.3
Updatedcsstype@^2.5.7