@xstyled/core
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -120,2 +120,33 @@ 'use strict'; | ||
var __defProp = Object.defineProperty; | ||
var __defProps = Object.defineProperties; | ||
var __getOwnPropDescs = Object.getOwnPropertyDescriptors; | ||
var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __spreadValues = (a, b) => { | ||
for (var prop in b || (b = {})) | ||
if (__hasOwnProp.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
if (__getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(b)) { | ||
if (__propIsEnum.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
} | ||
return a; | ||
}; | ||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); | ||
var __objRest = (source, exclude) => { | ||
var target = {}; | ||
for (var prop in source) | ||
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) | ||
target[prop] = source[prop]; | ||
if (source != null && __getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(source)) { | ||
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) | ||
target[prop] = source[prop]; | ||
} | ||
return target; | ||
}; | ||
const STORAGE_KEY = "xstyled-color-mode"; | ||
@@ -150,6 +181,5 @@ const isLocalStorageAvailable = typeof window !== "undefined" && (() => { | ||
function getModeTheme(theme, mode) { | ||
return { | ||
...theme, | ||
colors: { ...theme.colors, ...theme.colors.modes[mode] } | ||
}; | ||
return __spreadProps(__spreadValues({}, theme), { | ||
colors: __spreadValues(__spreadValues({}, theme.colors), theme.colors.modes[mode]) | ||
}); | ||
} | ||
@@ -183,3 +213,3 @@ const getMediaQuery = (query) => `@media ${query}`; | ||
return null; | ||
const { modes, ...colors } = theme.colors; | ||
const _a = theme.colors, { modes } = _a, colors = __objRest(_a, ["modes"]); | ||
const colorKeys = getUsedColorKeys(modes); | ||
@@ -189,4 +219,4 @@ let styles = toCustomPropertiesDeclarations(colors, theme, colorKeys, XSTYLED_COLORS_PREFIX); | ||
const modeTheme = getModeTheme(theme, mode); | ||
const { modes: modes2, ...colors2 } = modeTheme.colors; | ||
return toCustomPropertiesDeclarations({ ...colors2, ...modes2[mode] }, modeTheme, colorKeys, XSTYLED_COLORS_PREFIX); | ||
const _a2 = modeTheme.colors, { modes: modes2 } = _a2, colors2 = __objRest(_a2, ["modes"]); | ||
return toCustomPropertiesDeclarations(__spreadValues(__spreadValues({}, colors2), modes2[mode]), modeTheme, colorKeys, XSTYLED_COLORS_PREFIX); | ||
} | ||
@@ -318,13 +348,10 @@ if (theme.useColorSchemeMediaQuery !== false) { | ||
return theme; | ||
const { modes, ...colors } = theme.colors; | ||
const _a = theme.colors, { modes } = _a, colors = __objRest(_a, ["modes"]); | ||
const colorKeys = getUsedColorKeys(modes); | ||
return { | ||
...theme, | ||
colors: { | ||
...colors, | ||
...toCustomPropertiesReferences(colors, theme, colorKeys, XSTYLED_COLORS_PREFIX), | ||
return __spreadProps(__spreadValues({}, theme), { | ||
colors: __spreadProps(__spreadValues(__spreadValues({}, colors), toCustomPropertiesReferences(colors, theme, colorKeys, XSTYLED_COLORS_PREFIX)), { | ||
modes | ||
}, | ||
}), | ||
__rawColors: theme.colors | ||
}; | ||
}); | ||
}, [initialMode, theme]); | ||
@@ -339,13 +366,9 @@ const swapModeTheme = React__namespace.useMemo(() => { | ||
if (mode === getInitialColorModeName(theme)) { | ||
return { ...theme, __colorMode: mode }; | ||
return __spreadProps(__spreadValues({}, theme), { __colorMode: mode }); | ||
} | ||
return { | ||
...theme, | ||
colors: { | ||
...theme.colors, | ||
...theme.colors.modes[mode] | ||
}, | ||
return __spreadProps(__spreadValues({}, theme), { | ||
colors: __spreadValues(__spreadValues({}, theme.colors), theme.colors.modes[mode]), | ||
__colorMode: mode, | ||
__rawColors: theme.colors | ||
}; | ||
}); | ||
}, [theme, mode]); | ||
@@ -352,0 +375,0 @@ return customPropertiesTheme || swapModeTheme; |
{ | ||
"name": "@xstyled/core", | ||
"description": "xstyled core utilities.", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"sideEffects": false, | ||
@@ -26,5 +26,5 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@xstyled/system": "^3.0.0" | ||
"@xstyled/system": "^3.0.1" | ||
}, | ||
"gitHead": "2bdc5ffc3d45eea4d7f8e84ca389f8622ccdfbd5" | ||
"gitHead": "dfdddc0acb1439bb3d3801405eafcfa662ef410f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
116064
1195
Updated@xstyled/system@^3.0.1