@react-hive/honey-style 4.0.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/at-rules/media-query.d.ts +3 -2
- package/dist/css/process-css.d.ts +2 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.dev.cjs +36 -19
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.dev.cjs
CHANGED
|
@@ -964,8 +964,8 @@ const createMediaAtRuleTransformer = ({ theme }) => (0,_create_at_rule_transform
|
|
|
964
964
|
return [];
|
|
965
965
|
}
|
|
966
966
|
const tokens = rawParams.split(/\s+/);
|
|
967
|
-
let orientation;
|
|
968
|
-
let mediaType;
|
|
967
|
+
let orientation = null;
|
|
968
|
+
let mediaType = null;
|
|
969
969
|
const rules = [];
|
|
970
970
|
for (const token of tokens) {
|
|
971
971
|
if (isOrientationToken(token)) {
|
|
@@ -1007,14 +1007,29 @@ const createMediaAtRuleTransformer = ({ theme }) => (0,_create_at_rule_transform
|
|
|
1007
1007
|
rules.push(rule);
|
|
1008
1008
|
}
|
|
1009
1009
|
}
|
|
1010
|
-
|
|
1010
|
+
let finalRules = [];
|
|
1011
|
+
if (rules.length) {
|
|
1012
|
+
finalRules = rules.map(rule => ({
|
|
1013
|
+
...rule,
|
|
1014
|
+
orientation,
|
|
1015
|
+
mediaType,
|
|
1016
|
+
}));
|
|
1017
|
+
}
|
|
1018
|
+
else {
|
|
1019
|
+
if (mediaType) {
|
|
1020
|
+
finalRules.push({
|
|
1021
|
+
mediaType,
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
if (orientation) {
|
|
1025
|
+
finalRules.push({
|
|
1026
|
+
orientation,
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
if (!finalRules.length) {
|
|
1011
1031
|
return [];
|
|
1012
1032
|
}
|
|
1013
|
-
const finalRules = rules.map(rule => ({
|
|
1014
|
-
...rule,
|
|
1015
|
-
orientation,
|
|
1016
|
-
mediaType,
|
|
1017
|
-
}));
|
|
1018
1033
|
const fullMedia = (0,_at_rules__WEBPACK_IMPORTED_MODULE_3__.mediaQuery)(finalRules);
|
|
1019
1034
|
return [
|
|
1020
1035
|
{
|
|
@@ -1267,7 +1282,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1267
1282
|
|
|
1268
1283
|
|
|
1269
1284
|
|
|
1270
|
-
const processCss = (rawCss,
|
|
1285
|
+
const processCss = (rawCss, { theme, selector } = {}) => {
|
|
1271
1286
|
const scopedCss = selector ? (0,_css__WEBPACK_IMPORTED_MODULE_1__.createCssRule)(selector, rawCss) : rawCss;
|
|
1272
1287
|
const ast = (0,_react_hive_honey_css__WEBPACK_IMPORTED_MODULE_0__.parseCss)(scopedCss);
|
|
1273
1288
|
const transformers = [
|
|
@@ -1626,7 +1641,7 @@ const createGlobalStyle = (strings, ...interpolations) => {
|
|
|
1626
1641
|
const { theme } = (0,_hooks__WEBPACK_IMPORTED_MODULE_4__.useHoneyStyle)();
|
|
1627
1642
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useInsertionEffect)(() => {
|
|
1628
1643
|
const rawCss = computeCss({ theme });
|
|
1629
|
-
const processedCss = (0,_css__WEBPACK_IMPORTED_MODULE_2__.processCss)(rawCss);
|
|
1644
|
+
const processedCss = (0,_css__WEBPACK_IMPORTED_MODULE_2__.processCss)(rawCss, { theme });
|
|
1630
1645
|
const styleElement = document.createElement('style');
|
|
1631
1646
|
styleElement.id = styleId;
|
|
1632
1647
|
styleElement.innerHTML = processedCss;
|
|
@@ -1891,8 +1906,9 @@ const styled = (target, defaultProps, { omitProps } = {}) => {
|
|
|
1891
1906
|
const rawCss = computeCss(context);
|
|
1892
1907
|
const baseClassName = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.resolveClassName)(rawCss);
|
|
1893
1908
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useInsertionEffect)(() => {
|
|
1894
|
-
const baseCss = (0,_css__WEBPACK_IMPORTED_MODULE_4__.processCss)(rawCss,
|
|
1909
|
+
const baseCss = (0,_css__WEBPACK_IMPORTED_MODULE_4__.processCss)(rawCss, {
|
|
1895
1910
|
theme,
|
|
1911
|
+
selector: `.${baseClassName}`,
|
|
1896
1912
|
});
|
|
1897
1913
|
return (0,_mount_style__WEBPACK_IMPORTED_MODULE_5__.mountStyle)(baseClassName, baseCss, __compositionDepth);
|
|
1898
1914
|
}, [baseClassName]);
|
|
@@ -1901,8 +1917,9 @@ const styled = (target, defaultProps, { omitProps } = {}) => {
|
|
|
1901
1917
|
const cssPropClassName = cssPropString ? (0,_utils__WEBPACK_IMPORTED_MODULE_3__.resolveClassName)(cssPropString) : '';
|
|
1902
1918
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useInsertionEffect)(() => {
|
|
1903
1919
|
if (cssPropClassName) {
|
|
1904
|
-
const overrideCss = (0,_css__WEBPACK_IMPORTED_MODULE_4__.processCss)(cssPropString,
|
|
1920
|
+
const overrideCss = (0,_css__WEBPACK_IMPORTED_MODULE_4__.processCss)(cssPropString, {
|
|
1905
1921
|
theme,
|
|
1922
|
+
selector: `.${cssPropClassName}`,
|
|
1906
1923
|
});
|
|
1907
1924
|
return (0,_mount_style__WEBPACK_IMPORTED_MODULE_5__.mountStyle)(cssPropClassName, overrideCss, 1);
|
|
1908
1925
|
}
|
|
@@ -2022,7 +2039,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2022
2039
|
|
|
2023
2040
|
|
|
2024
2041
|
|
|
2025
|
-
const generateId = (prefix) => `${prefix}-${
|
|
2042
|
+
const generateId = (prefix) => `${prefix}-${(0,_react_hive_honey_utils__WEBPACK_IMPORTED_MODULE_0__.generateEphemeralId)()}`;
|
|
2026
2043
|
/**
|
|
2027
2044
|
* Combines multiple class names into a single space-separated string
|
|
2028
2045
|
*
|
|
@@ -2354,12 +2371,6 @@ const e=e=>new Blob([e],{type:e.type}),t=e=>new DOMRect(e.offsetLeft,e.offsetTop
|
|
|
2354
2371
|
/******/ if (cachedModule !== undefined) {
|
|
2355
2372
|
/******/ return cachedModule.exports;
|
|
2356
2373
|
/******/ }
|
|
2357
|
-
/******/ // Check if module exists (development only)
|
|
2358
|
-
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
2359
|
-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
2360
|
-
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
2361
|
-
/******/ throw e;
|
|
2362
|
-
/******/ }
|
|
2363
2374
|
/******/ // Create a new module (and put it into the cache)
|
|
2364
2375
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
2365
2376
|
/******/ // no module.id needed
|
|
@@ -2368,6 +2379,12 @@ const e=e=>new Blob([e],{type:e.type}),t=e=>new DOMRect(e.offsetLeft,e.offsetTop
|
|
|
2368
2379
|
/******/ };
|
|
2369
2380
|
/******/
|
|
2370
2381
|
/******/ // Execute the module function
|
|
2382
|
+
/******/ if (!(moduleId in __webpack_modules__)) {
|
|
2383
|
+
/******/ delete __webpack_module_cache__[moduleId];
|
|
2384
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
2385
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
2386
|
+
/******/ throw e;
|
|
2387
|
+
/******/ }
|
|
2371
2388
|
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
2372
2389
|
/******/
|
|
2373
2390
|
/******/ // Return the exports of the module
|