@emotion/cache
Advanced tools
Comparing version 11.4.0 to 11.5.0
# @emotion/cache | ||
## 11.5.0 | ||
### Patch Changes | ||
- [#2498](https://github.com/emotion-js/emotion/pull/2498) [`e5beae8e`](https://github.com/emotion-js/emotion/commit/e5beae8e320f3d1455e45efecdfeb7d757687a43) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an edge case issue with incorrect rules being generated. When a context selector (`&`) was used not at the beginning of a selector (which is not valid SCSS but is allowed by the Stylis parser that we are using) within a group of selectors containing a pseudoclass then it was not replaced correctly with the current context selector. | ||
* [#2493](https://github.com/emotion-js/emotion/pull/2493) [`9ae4a91a`](https://github.com/emotion-js/emotion/commit/9ae4a91a08a6f7c5ca26a585f1c271a179db4623) Thanks [@Andarist](https://github.com/Andarist)! - Improved the declared types related to Stylis. This should improve the compatibility with the types published in `@types/stylis`. | ||
* Updated dependencies [[`f2eda829`](https://github.com/emotion-js/emotion/commit/f2eda8295429dd1892a06cbc9496321f2a55c10a)]: | ||
- @emotion/sheet@1.0.3 | ||
## 11.4.0 | ||
@@ -4,0 +15,0 @@ |
@@ -12,2 +12,25 @@ 'use strict'; | ||
return arr.length ? arr[arr.length - 1] : null; | ||
}; // based on https://github.com/thysultan/stylis.js/blob/e6843c373ebcbbfade25ebcc23f540ed8508da0a/src/Tokenizer.js#L239-L244 | ||
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); | ||
}; | ||
@@ -32,3 +55,3 @@ | ||
parsed[index] += stylis.identifier(stylis.position - 1); | ||
parsed[index] += identifierWithPointTracking(stylis.position - 1, points, index); | ||
break; | ||
@@ -35,0 +58,0 @@ |
import { StyleSheet } from '@emotion/sheet'; | ||
import { dealloc, alloc, next, token, from, peek, delimit, identifier, position, stringify, COMMENT, rulesheet, middleware, prefixer, serialize, compile } from 'stylis'; | ||
import { dealloc, alloc, next, token, from, peek, delimit, slice, position, stringify, COMMENT, rulesheet, middleware, prefixer, serialize, compile } from 'stylis'; | ||
import '@emotion/weak-memoize'; | ||
@@ -8,2 +8,25 @@ import '@emotion/memoize'; | ||
return arr.length ? arr[arr.length - 1] : null; | ||
}; // based on https://github.com/thysultan/stylis.js/blob/e6843c373ebcbbfade25ebcc23f540ed8508da0a/src/Tokenizer.js#L239-L244 | ||
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); | ||
}; | ||
@@ -28,3 +51,3 @@ | ||
parsed[index] += identifier(position - 1); | ||
parsed[index] += identifierWithPointTracking(position - 1, points, index); | ||
break; | ||
@@ -31,0 +54,0 @@ |
@@ -17,2 +17,25 @@ 'use strict'; | ||
return arr.length ? arr[arr.length - 1] : null; | ||
}; // based on https://github.com/thysultan/stylis.js/blob/e6843c373ebcbbfade25ebcc23f540ed8508da0a/src/Tokenizer.js#L239-L244 | ||
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); | ||
}; | ||
@@ -37,3 +60,3 @@ | ||
parsed[index] += stylis.identifier(stylis.position - 1); | ||
parsed[index] += identifierWithPointTracking(stylis.position - 1, points, index); | ||
break; | ||
@@ -40,0 +63,0 @@ |
@@ -17,2 +17,6 @@ "use strict"; | ||
return arr.length ? arr[arr.length - 1] : null; | ||
}, identifierWithPointTracking = function(begin, points, index) { | ||
for (var previous = 0, character = 0; previous = character, character = stylis.peek(), | ||
38 === previous && 12 === character && (points[index] = 1), !stylis.token(character); ) stylis.next(); | ||
return stylis.slice(begin, stylis.position); | ||
}, toRules = function(parsed, points) { | ||
@@ -23,3 +27,3 @@ var index = -1, character = 44; | ||
case 0: | ||
38 === character && 12 === stylis.peek() && (points[index] = 1), parsed[index] += stylis.identifier(stylis.position - 1); | ||
38 === character && 12 === stylis.peek() && (points[index] = 1), parsed[index] += identifierWithPointTracking(stylis.position - 1, points, index); | ||
break; | ||
@@ -26,0 +30,0 @@ |
import { StyleSheet } from '@emotion/sheet'; | ||
import { dealloc, alloc, next, token, from, peek, delimit, identifier, position, stringify, COMMENT, rulesheet, middleware, prefixer, serialize, compile } from 'stylis'; | ||
import { dealloc, alloc, next, token, from, peek, delimit, slice, position, stringify, COMMENT, rulesheet, middleware, prefixer, serialize, compile } from 'stylis'; | ||
import weakMemoize from '@emotion/weak-memoize'; | ||
@@ -8,2 +8,25 @@ import memoize from '@emotion/memoize'; | ||
return arr.length ? arr[arr.length - 1] : null; | ||
}; // based on https://github.com/thysultan/stylis.js/blob/e6843c373ebcbbfade25ebcc23f540ed8508da0a/src/Tokenizer.js#L239-L244 | ||
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); | ||
}; | ||
@@ -28,3 +51,3 @@ | ||
parsed[index] += identifier(position - 1); | ||
parsed[index] += identifierWithPointTracking(position - 1, points, index); | ||
break; | ||
@@ -31,0 +54,0 @@ |
{ | ||
"name": "@emotion/cache", | ||
"version": "11.4.0", | ||
"version": "11.5.0", | ||
"description": "emotion's cache", | ||
@@ -19,6 +19,6 @@ "main": "dist/emotion-cache.cjs.js", | ||
"@emotion/memoize": "^0.7.4", | ||
"@emotion/sheet": "^1.0.0", | ||
"@emotion/sheet": "^1.0.3", | ||
"@emotion/utils": "^1.0.0", | ||
"@emotion/weak-memoize": "^0.2.5", | ||
"stylis": "^4.0.3" | ||
"stylis": "^4.0.10" | ||
}, | ||
@@ -25,0 +25,0 @@ "devDependencies": { |
@@ -10,5 +10,5 @@ import { | ||
from, | ||
identifier, | ||
peek, | ||
position | ||
position, | ||
slice | ||
} from 'stylis' | ||
@@ -18,2 +18,26 @@ | ||
// 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) => { | ||
@@ -35,3 +59,7 @@ // pretend we've started with a comma | ||
} | ||
parsed[index] += identifier(position - 1) | ||
parsed[index] += identifierWithPointTracking( | ||
position - 1, | ||
points, | ||
index | ||
) | ||
break | ||
@@ -38,0 +66,0 @@ case 2: |
@@ -10,5 +10,6 @@ // Definitions by: Junyoung Clare Jang <https://github.com/Ailrun> | ||
value: string | ||
props: Array<string> | ||
props: Array<string> | string | ||
root: StylisElement | null | ||
children: Array<StylisElement> | ||
parent: StylisElement | null | ||
children: Array<StylisElement> | string | ||
line: number | ||
@@ -24,3 +25,3 @@ column: number | ||
callback: StylisPluginCallback | ||
) => string | undefined | ||
) => string | void | ||
@@ -32,3 +33,3 @@ export type StylisPlugin = ( | ||
callback: StylisPluginCallback | ||
) => string | undefined | ||
) => string | void | ||
@@ -35,0 +36,0 @@ export interface Options { |
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
94830
1814
Updated@emotion/sheet@^1.0.3
Updatedstylis@^4.0.10