@emotion/cache
Advanced tools
Comparing version 11.10.3 to 11.10.5
import { StyleSheet } from '@emotion/sheet'; | ||
import { dealloc, alloc, next, token, from, peek, delimit, slice, position, stringify, COMMENT, rulesheet, middleware, prefixer, serialize, compile } from 'stylis'; | ||
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'; | ||
@@ -239,2 +239,214 @@ import '@emotion/memoize'; | ||
/* 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]; | ||
@@ -241,0 +453,0 @@ |
@@ -248,2 +248,214 @@ 'use strict'; | ||
/* 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'; | ||
@@ -258,3 +470,3 @@ var getServerStylisCache = isBrowser ? undefined : weakMemoize__default['default'](function () { | ||
}); | ||
var defaultStylisPlugins = [stylis.prefixer]; | ||
var defaultStylisPlugins = [prefixer]; | ||
@@ -261,0 +473,0 @@ var createCache = function createCache(options) { |
@@ -140,2 +140,214 @@ 'use strict'; | ||
/* 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'; | ||
@@ -150,3 +362,3 @@ var getServerStylisCache = isBrowser ? undefined : weakMemoize__default['default'](function () { | ||
}); | ||
var defaultStylisPlugins = [stylis.prefixer]; | ||
var defaultStylisPlugins = [prefixer]; | ||
@@ -153,0 +365,0 @@ var createCache = function createCache(options) { |
import { StyleSheet } from '@emotion/sheet'; | ||
import { dealloc, alloc, next, token, from, peek, delimit, slice, position, stringify, COMMENT, rulesheet, middleware, prefixer, serialize, compile } from 'stylis'; | ||
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'; | ||
@@ -239,2 +239,214 @@ import memoize from '@emotion/memoize'; | ||
/* 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'; | ||
@@ -241,0 +453,0 @@ var getServerStylisCache = isBrowser ? undefined : weakMemoize(function () { |
import { StyleSheet } from '@emotion/sheet'; | ||
import { dealloc, alloc, next, token, from, peek, delimit, slice, position, middleware, prefixer, stringify, serialize, compile } from 'stylis'; | ||
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'; | ||
@@ -239,2 +239,214 @@ import memoize from '@emotion/memoize'; | ||
/* 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 () { | ||
@@ -241,0 +453,0 @@ return memoize(function () { |
{ | ||
"name": "@emotion/cache", | ||
"version": "11.10.3", | ||
"version": "11.10.5", | ||
"description": "emotion's cache", | ||
@@ -29,6 +29,6 @@ "main": "dist/emotion-cache.cjs.js", | ||
"@emotion/memoize": "^0.8.0", | ||
"@emotion/sheet": "^1.2.0", | ||
"@emotion/sheet": "^1.2.1", | ||
"@emotion/utils": "^1.2.0", | ||
"@emotion/weak-memoize": "^0.3.0", | ||
"stylis": "4.0.13" | ||
"stylis": "4.1.3" | ||
}, | ||
@@ -35,0 +35,0 @@ "devDependencies": { |
@@ -10,3 +10,2 @@ // @flow | ||
stringify, | ||
prefixer, | ||
COMMENT | ||
@@ -22,2 +21,3 @@ } from 'stylis' | ||
} from './stylis-plugins' | ||
import { prefixer } from './prefixer' | ||
import type { StylisPlugin } from './types' | ||
@@ -24,0 +24,0 @@ |
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
128606
19
3350
+ Addedstylis@4.1.3(transitive)
- Removedstylis@4.0.13(transitive)
Updated@emotion/sheet@^1.2.1
Updatedstylis@4.1.3