@react-hive/honey-style 2.0.0 → 2.1.0

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.
@@ -1462,80 +1462,6 @@ function filter (array, pattern) {
1462
1462
  }
1463
1463
 
1464
1464
 
1465
- /***/ }),
1466
-
1467
- /***/ "./src/at-rules/index.ts":
1468
- /*!*******************************!*\
1469
- !*** ./src/at-rules/index.ts ***!
1470
- \*******************************/
1471
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1472
-
1473
- __webpack_require__.r(__webpack_exports__);
1474
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1475
- /* harmony export */ mediaQuery: () => (/* reexport safe */ _media_query__WEBPACK_IMPORTED_MODULE_0__.mediaQuery)
1476
- /* harmony export */ });
1477
- /* harmony import */ var _media_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./media-query */ "./src/at-rules/media-query.ts");
1478
-
1479
-
1480
-
1481
- /***/ }),
1482
-
1483
- /***/ "./src/at-rules/media-query.ts":
1484
- /*!*************************************!*\
1485
- !*** ./src/at-rules/media-query.ts ***!
1486
- \*************************************/
1487
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1488
-
1489
- __webpack_require__.r(__webpack_exports__);
1490
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1491
- /* harmony export */ mediaQuery: () => (/* binding */ mediaQuery)
1492
- /* harmony export */ });
1493
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils */ "./src/utils.ts");
1494
-
1495
- /**
1496
- * Constructs a complete `@media` query string from an array of media rule objects.
1497
- * Each rule defines conditions such as screen size, orientation, or resolution,
1498
- * which are converted into standard CSS media query syntax.
1499
- *
1500
- * @param rules - An array of media rule objects used to generate individual media queries.
1501
- *
1502
- * @returns A string containing a full `@media` query that can be used in CSS or injected into a stylesheet.
1503
- *
1504
- * @example
1505
- * ```ts
1506
- * atMedia([
1507
- * { minWidth: '768px', orientation: 'landscape' },
1508
- * { mediaType: 'print' }
1509
- * ]);
1510
- * // Returns: "@media screen and (min-width: 768px) and (orientation: landscape), print"
1511
- * ```
1512
- */
1513
- const mediaQuery = (rules) => {
1514
- const mediaRules = rules.map(rule => {
1515
- const rulesConfig = [
1516
- rule.width && ['width', rule.width],
1517
- rule.minWidth && ['min-width', rule.minWidth],
1518
- rule.maxWidth && ['max-width', rule.maxWidth],
1519
- rule.height && ['height', rule.height],
1520
- rule.minHeight && ['min-height', rule.minHeight],
1521
- rule.maxHeight && ['max-height', rule.maxHeight],
1522
- rule.orientation && ['orientation', rule.orientation],
1523
- rule.minResolution && ['min-resolution', rule.minResolution],
1524
- rule.maxResolution && ['max-resolution', rule.maxResolution],
1525
- rule.resolution && ['resolution', rule.resolution],
1526
- rule.update && ['update', rule.update],
1527
- ];
1528
- const conditions = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.boolFilter)(rulesConfig)
1529
- .map(ruleConfig => `(${ruleConfig[0]}: ${ruleConfig[1]})`)
1530
- .join(' and ');
1531
- const operatorPart = rule.operator ? `${rule.operator} ` : '';
1532
- const conditionsPart = conditions ? ` and ${conditions}` : '';
1533
- return `${operatorPart}${rule.mediaType ?? 'screen'}${conditionsPart}`;
1534
- });
1535
- return `@media ${mediaRules.join(', ')}`;
1536
- };
1537
-
1538
-
1539
1465
  /***/ }),
1540
1466
 
1541
1467
  /***/ "./src/constants.ts":
@@ -1855,6 +1781,80 @@ __webpack_require__.r(__webpack_exports__);
1855
1781
 
1856
1782
 
1857
1783
 
1784
+ /***/ }),
1785
+
1786
+ /***/ "./src/css/at-rules/index.ts":
1787
+ /*!***********************************!*\
1788
+ !*** ./src/css/at-rules/index.ts ***!
1789
+ \***********************************/
1790
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1791
+
1792
+ __webpack_require__.r(__webpack_exports__);
1793
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1794
+ /* harmony export */ mediaQuery: () => (/* reexport safe */ _media_query__WEBPACK_IMPORTED_MODULE_0__.mediaQuery)
1795
+ /* harmony export */ });
1796
+ /* harmony import */ var _media_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./media-query */ "./src/css/at-rules/media-query.ts");
1797
+
1798
+
1799
+
1800
+ /***/ }),
1801
+
1802
+ /***/ "./src/css/at-rules/media-query.ts":
1803
+ /*!*****************************************!*\
1804
+ !*** ./src/css/at-rules/media-query.ts ***!
1805
+ \*****************************************/
1806
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1807
+
1808
+ __webpack_require__.r(__webpack_exports__);
1809
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1810
+ /* harmony export */ mediaQuery: () => (/* binding */ mediaQuery)
1811
+ /* harmony export */ });
1812
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils */ "./src/utils.ts");
1813
+
1814
+ /**
1815
+ * Constructs a complete `@media` query string from an array of media rule objects.
1816
+ * Each rule defines conditions such as screen size, orientation, or resolution,
1817
+ * which are converted into standard CSS media query syntax.
1818
+ *
1819
+ * @param rules - An array of media rule objects used to generate individual media queries.
1820
+ *
1821
+ * @returns A string containing a full `@media` query that can be used in CSS or injected into a stylesheet.
1822
+ *
1823
+ * @example
1824
+ * ```ts
1825
+ * atMedia([
1826
+ * { minWidth: '768px', orientation: 'landscape' },
1827
+ * { mediaType: 'print' }
1828
+ * ]);
1829
+ * // Returns: "@media screen and (min-width: 768px) and (orientation: landscape), print"
1830
+ * ```
1831
+ */
1832
+ const mediaQuery = (rules) => {
1833
+ const mediaRules = rules.map(rule => {
1834
+ const rulesConfig = [
1835
+ rule.width && ['width', rule.width],
1836
+ rule.minWidth && ['min-width', rule.minWidth],
1837
+ rule.maxWidth && ['max-width', rule.maxWidth],
1838
+ rule.height && ['height', rule.height],
1839
+ rule.minHeight && ['min-height', rule.minHeight],
1840
+ rule.maxHeight && ['max-height', rule.maxHeight],
1841
+ rule.orientation && ['orientation', rule.orientation],
1842
+ rule.minResolution && ['min-resolution', rule.minResolution],
1843
+ rule.maxResolution && ['max-resolution', rule.maxResolution],
1844
+ rule.resolution && ['resolution', rule.resolution],
1845
+ rule.update && ['update', rule.update],
1846
+ ];
1847
+ const conditions = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.boolFilter)(rulesConfig)
1848
+ .map(ruleConfig => `(${ruleConfig[0]}: ${ruleConfig[1]})`)
1849
+ .join(' and ');
1850
+ const operatorPart = rule.operator ? `${rule.operator} ` : '';
1851
+ const conditionsPart = conditions ? ` and ${conditions}` : '';
1852
+ return `${operatorPart}${rule.mediaType ?? 'screen'}${conditionsPart}`;
1853
+ });
1854
+ return `@media ${mediaRules.join(', ')}`;
1855
+ };
1856
+
1857
+
1858
1858
  /***/ }),
1859
1859
 
1860
1860
  /***/ "./src/css/constants.ts":
@@ -1958,6 +1958,7 @@ __webpack_require__.r(__webpack_exports__);
1958
1958
  /* harmony export */ CSS_SPACING_PROPERTIES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.CSS_SPACING_PROPERTIES),
1959
1959
  /* harmony export */ createSpacingMiddleware: () => (/* reexport safe */ _middlewares__WEBPACK_IMPORTED_MODULE_2__.createSpacingMiddleware),
1960
1960
  /* harmony export */ css: () => (/* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_4__.css),
1961
+ /* harmony export */ mediaQuery: () => (/* reexport safe */ _at_rules__WEBPACK_IMPORTED_MODULE_5__.mediaQuery),
1961
1962
  /* harmony export */ processCss: () => (/* reexport safe */ _processor__WEBPACK_IMPORTED_MODULE_3__.processCss)
1962
1963
  /* harmony export */ });
1963
1964
  /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./src/css/types.ts");
@@ -1965,6 +1966,8 @@ __webpack_require__.r(__webpack_exports__);
1965
1966
  /* harmony import */ var _middlewares__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./middlewares */ "./src/css/middlewares.ts");
1966
1967
  /* harmony import */ var _processor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processor */ "./src/css/processor.ts");
1967
1968
  /* harmony import */ var _css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./css */ "./src/css/css.ts");
1969
+ /* harmony import */ var _at_rules__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./at-rules */ "./src/css/at-rules/index.ts");
1970
+
1968
1971
 
1969
1972
 
1970
1973
 
@@ -1986,12 +1989,14 @@ __webpack_require__.r(__webpack_exports__);
1986
1989
  /* harmony export */ });
1987
1990
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ "./src/css/constants.ts");
1988
1991
 
1992
+ const toKebabCase = (str) => str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
1993
+ const KEBAB_CASE_SPACING_PROPERTIES = _constants__WEBPACK_IMPORTED_MODULE_0__.CSS_SPACING_PROPERTIES.map(toKebabCase);
1989
1994
  const createSpacingMiddleware = ({ spacingMultiplier }) => element => {
1990
1995
  if (!spacingMultiplier || element.type !== 'decl') {
1991
1996
  return;
1992
1997
  }
1993
1998
  if (typeof element.props === 'string' &&
1994
- _constants__WEBPACK_IMPORTED_MODULE_0__.CSS_SPACING_PROPERTIES.includes(element.props) &&
1999
+ KEBAB_CASE_SPACING_PROPERTIES.includes(element.props) &&
1995
2000
  typeof element.children === 'string') {
1996
2001
  const transformed = element.children
1997
2002
  .split(/\s+/)
@@ -2378,18 +2383,6 @@ const styled = (target, defaultProps) => {
2378
2383
  };
2379
2384
 
2380
2385
 
2381
- /***/ }),
2382
-
2383
- /***/ "./src/types/css.types.ts":
2384
- /*!********************************!*\
2385
- !*** ./src/types/css.types.ts ***!
2386
- \********************************/
2387
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2388
-
2389
- __webpack_require__.r(__webpack_exports__);
2390
-
2391
-
2392
-
2393
2386
  /***/ }),
2394
2387
 
2395
2388
  /***/ "./src/types/index.ts":
@@ -2399,19 +2392,17 @@ __webpack_require__.r(__webpack_exports__);
2399
2392
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2400
2393
 
2401
2394
  __webpack_require__.r(__webpack_exports__);
2402
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./src/types/types.ts");
2403
- /* harmony import */ var _utility_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utility.types */ "./src/types/utility.types.ts");
2404
- /* harmony import */ var _css_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./css.types */ "./src/types/css.types.ts");
2405
-
2395
+ /* harmony import */ var _theme__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./theme */ "./src/types/theme.ts");
2396
+ /* harmony import */ var _utility__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utility */ "./src/types/utility.ts");
2406
2397
 
2407
2398
 
2408
2399
 
2409
2400
 
2410
2401
  /***/ }),
2411
2402
 
2412
- /***/ "./src/types/types.ts":
2403
+ /***/ "./src/types/theme.ts":
2413
2404
  /*!****************************!*\
2414
- !*** ./src/types/types.ts ***!
2405
+ !*** ./src/types/theme.ts ***!
2415
2406
  \****************************/
2416
2407
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2417
2408
 
@@ -2422,10 +2413,10 @@ __webpack_require__.r(__webpack_exports__);
2422
2413
 
2423
2414
  /***/ }),
2424
2415
 
2425
- /***/ "./src/types/utility.types.ts":
2426
- /*!************************************!*\
2427
- !*** ./src/types/utility.types.ts ***!
2428
- \************************************/
2416
+ /***/ "./src/types/utility.ts":
2417
+ /*!******************************!*\
2418
+ !*** ./src/types/utility.ts ***!
2419
+ \******************************/
2429
2420
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2430
2421
 
2431
2422
  __webpack_require__.r(__webpack_exports__);
@@ -2800,31 +2791,31 @@ __webpack_require__.r(__webpack_exports__);
2800
2791
  /* harmony export */ HoneyStyleProvider: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_2__.HoneyStyleProvider),
2801
2792
  /* harmony export */ VALID_DOM_ELEMENT_ATTRS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.VALID_DOM_ELEMENT_ATTRS),
2802
2793
  /* harmony export */ __DEV__: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.__DEV__),
2803
- /* harmony export */ assert: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.assert),
2804
- /* harmony export */ boolFilter: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.boolFilter),
2805
- /* harmony export */ checkIsThemeColorValue: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.checkIsThemeColorValue),
2806
- /* harmony export */ combineClassNames: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.combineClassNames),
2807
- /* harmony export */ convertHexToHexWithAlpha: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.convertHexToHexWithAlpha),
2794
+ /* harmony export */ assert: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.assert),
2795
+ /* harmony export */ boolFilter: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.boolFilter),
2796
+ /* harmony export */ checkIsThemeColorValue: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.checkIsThemeColorValue),
2797
+ /* harmony export */ combineClassNames: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.combineClassNames),
2798
+ /* harmony export */ convertHexToHexWithAlpha: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.convertHexToHexWithAlpha),
2808
2799
  /* harmony export */ createGlobalStyle: () => (/* reexport safe */ _global_style__WEBPACK_IMPORTED_MODULE_6__.createGlobalStyle),
2809
2800
  /* harmony export */ createSpacingMiddleware: () => (/* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_5__.createSpacingMiddleware),
2810
2801
  /* harmony export */ css: () => (/* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_5__.css),
2811
- /* harmony export */ filterNonHtmlAttrs: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.filterNonHtmlAttrs),
2812
- /* harmony export */ generateId: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.generateId),
2813
- /* harmony export */ isFunction: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.isFunction),
2814
- /* harmony export */ isNil: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.isNil),
2815
- /* harmony export */ isObject: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.isObject),
2816
- /* harmony export */ isString: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.isString),
2817
- /* harmony export */ isStyledComponent: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.isStyledComponent),
2818
- /* harmony export */ mediaQuery: () => (/* reexport safe */ _at_rules__WEBPACK_IMPORTED_MODULE_8__.mediaQuery),
2802
+ /* harmony export */ filterNonHtmlAttrs: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.filterNonHtmlAttrs),
2803
+ /* harmony export */ generateId: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.generateId),
2804
+ /* harmony export */ isFunction: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.isFunction),
2805
+ /* harmony export */ isNil: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.isNil),
2806
+ /* harmony export */ isObject: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.isObject),
2807
+ /* harmony export */ isString: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.isString),
2808
+ /* harmony export */ isStyledComponent: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.isStyledComponent),
2809
+ /* harmony export */ mediaQuery: () => (/* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_5__.mediaQuery),
2819
2810
  /* harmony export */ processCss: () => (/* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_5__.processCss),
2820
- /* harmony export */ pxToRem: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.pxToRem),
2821
- /* harmony export */ resolveClassName: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.resolveClassName),
2822
- /* harmony export */ resolveColor: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.resolveColor),
2823
- /* harmony export */ resolveDimension: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.resolveDimension),
2824
- /* harmony export */ resolveFont: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.resolveFont),
2825
- /* harmony export */ resolveSpacing: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.resolveSpacing),
2811
+ /* harmony export */ pxToRem: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.pxToRem),
2812
+ /* harmony export */ resolveClassName: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.resolveClassName),
2813
+ /* harmony export */ resolveColor: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.resolveColor),
2814
+ /* harmony export */ resolveDimension: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.resolveDimension),
2815
+ /* harmony export */ resolveFont: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.resolveFont),
2816
+ /* harmony export */ resolveSpacing: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.resolveSpacing),
2826
2817
  /* harmony export */ styled: () => (/* reexport safe */ _styled__WEBPACK_IMPORTED_MODULE_7__.styled),
2827
- /* harmony export */ toKebabCase: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.toKebabCase),
2818
+ /* harmony export */ toKebabCase: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.toKebabCase),
2828
2819
  /* harmony export */ useHoneyStyle: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_3__.useHoneyStyle)
2829
2820
  /* harmony export */ });
2830
2821
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ "./src/constants.ts");
@@ -2835,9 +2826,7 @@ __webpack_require__.r(__webpack_exports__);
2835
2826
  /* harmony import */ var _css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./css */ "./src/css/index.ts");
2836
2827
  /* harmony import */ var _global_style__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./global-style */ "./src/global-style.ts");
2837
2828
  /* harmony import */ var _styled__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./styled */ "./src/styled.ts");
2838
- /* harmony import */ var _at_rules__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./at-rules */ "./src/at-rules/index.ts");
2839
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils */ "./src/utils.ts");
2840
-
2829
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils */ "./src/utils.ts");
2841
2830
 
2842
2831
 
2843
2832