@react-hive/honey-style 1.5.0 → 1.6.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.
- package/dist/at-rules/index.d.ts +1 -0
- package/dist/at-rules/media-query.d.ts +77 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.dev.cjs +102 -43
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/css.types.d.ts +0 -56
- package/dist/utils.d.ts +14 -20
- package/package.json +8 -8
package/dist/index.dev.cjs
CHANGED
|
@@ -1164,6 +1164,80 @@ function filter (array, pattern) {
|
|
|
1164
1164
|
}
|
|
1165
1165
|
|
|
1166
1166
|
|
|
1167
|
+
/***/ }),
|
|
1168
|
+
|
|
1169
|
+
/***/ "./src/at-rules/index.ts":
|
|
1170
|
+
/*!*******************************!*\
|
|
1171
|
+
!*** ./src/at-rules/index.ts ***!
|
|
1172
|
+
\*******************************/
|
|
1173
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1174
|
+
|
|
1175
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1176
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1177
|
+
/* harmony export */ mediaQuery: () => (/* reexport safe */ _media_query__WEBPACK_IMPORTED_MODULE_0__.mediaQuery)
|
|
1178
|
+
/* harmony export */ });
|
|
1179
|
+
/* harmony import */ var _media_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./media-query */ "./src/at-rules/media-query.ts");
|
|
1180
|
+
|
|
1181
|
+
|
|
1182
|
+
|
|
1183
|
+
/***/ }),
|
|
1184
|
+
|
|
1185
|
+
/***/ "./src/at-rules/media-query.ts":
|
|
1186
|
+
/*!*************************************!*\
|
|
1187
|
+
!*** ./src/at-rules/media-query.ts ***!
|
|
1188
|
+
\*************************************/
|
|
1189
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1190
|
+
|
|
1191
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1192
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1193
|
+
/* harmony export */ mediaQuery: () => (/* binding */ mediaQuery)
|
|
1194
|
+
/* harmony export */ });
|
|
1195
|
+
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils */ "./src/utils.ts");
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* Constructs a complete `@media` query string from an array of media rule objects.
|
|
1199
|
+
* Each rule defines conditions such as screen size, orientation, or resolution,
|
|
1200
|
+
* which are converted into standard CSS media query syntax.
|
|
1201
|
+
*
|
|
1202
|
+
* @param rules - An array of media rule objects used to generate individual media queries.
|
|
1203
|
+
*
|
|
1204
|
+
* @returns A string containing a full `@media` query that can be used in CSS or injected into a stylesheet.
|
|
1205
|
+
*
|
|
1206
|
+
* @example
|
|
1207
|
+
* ```ts
|
|
1208
|
+
* atMedia([
|
|
1209
|
+
* { minWidth: '768px', orientation: 'landscape' },
|
|
1210
|
+
* { mediaType: 'print' }
|
|
1211
|
+
* ]);
|
|
1212
|
+
* // Returns: "@media screen and (min-width: 768px) and (orientation: landscape), print"
|
|
1213
|
+
* ```
|
|
1214
|
+
*/
|
|
1215
|
+
const mediaQuery = (rules) => {
|
|
1216
|
+
const mediaRules = rules.map(rule => {
|
|
1217
|
+
const rulesConfig = [
|
|
1218
|
+
rule.width && ['width', rule.width],
|
|
1219
|
+
rule.minWidth && ['min-width', rule.minWidth],
|
|
1220
|
+
rule.maxWidth && ['max-width', rule.maxWidth],
|
|
1221
|
+
rule.height && ['height', rule.height],
|
|
1222
|
+
rule.minHeight && ['min-height', rule.minHeight],
|
|
1223
|
+
rule.maxHeight && ['max-height', rule.maxHeight],
|
|
1224
|
+
rule.orientation && ['orientation', rule.orientation],
|
|
1225
|
+
rule.minResolution && ['min-resolution', rule.minResolution],
|
|
1226
|
+
rule.maxResolution && ['max-resolution', rule.maxResolution],
|
|
1227
|
+
rule.resolution && ['resolution', rule.resolution],
|
|
1228
|
+
rule.update && ['update', rule.update],
|
|
1229
|
+
];
|
|
1230
|
+
const conditions = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.boolFilter)(rulesConfig)
|
|
1231
|
+
.map(ruleConfig => `(${ruleConfig[0]}: ${ruleConfig[1]})`)
|
|
1232
|
+
.join(' and ');
|
|
1233
|
+
const operatorPart = rule.operator ? `${rule.operator} ` : '';
|
|
1234
|
+
const conditionsPart = conditions ? ` and ${conditions}` : '';
|
|
1235
|
+
return `${operatorPart}${rule.mediaType ?? 'screen'}${conditionsPart}`;
|
|
1236
|
+
});
|
|
1237
|
+
return `@media ${mediaRules.join(', ')}`;
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
|
|
1167
1241
|
/***/ }),
|
|
1168
1242
|
|
|
1169
1243
|
/***/ "./src/constants.ts":
|
|
@@ -1255,6 +1329,7 @@ const VALID_HTML_ATTRS = new Set([
|
|
|
1255
1329
|
'muted',
|
|
1256
1330
|
'poster',
|
|
1257
1331
|
'preload',
|
|
1332
|
+
'role',
|
|
1258
1333
|
'src',
|
|
1259
1334
|
'srcSet',
|
|
1260
1335
|
'useMap',
|
|
@@ -1429,6 +1504,16 @@ const VALID_EVENT_ATTRS = new Set([
|
|
|
1429
1504
|
// Image
|
|
1430
1505
|
'onLoad',
|
|
1431
1506
|
'onError',
|
|
1507
|
+
// Transition
|
|
1508
|
+
'onTransitionEnd',
|
|
1509
|
+
'onTransitionStart',
|
|
1510
|
+
'onTransitionRun',
|
|
1511
|
+
'onTransitionCancel',
|
|
1512
|
+
// Animation
|
|
1513
|
+
'onAnimationStart',
|
|
1514
|
+
'onAnimationEnd',
|
|
1515
|
+
'onAnimationIteration',
|
|
1516
|
+
'onAnimationCancel',
|
|
1432
1517
|
]);
|
|
1433
1518
|
const VALID_DOM_ELEMENT_ATTRS = new Set([
|
|
1434
1519
|
...VALID_HTML_ATTRS,
|
|
@@ -1889,6 +1974,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1889
1974
|
__webpack_require__.r(__webpack_exports__);
|
|
1890
1975
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1891
1976
|
/* harmony export */ assert: () => (/* binding */ assert),
|
|
1977
|
+
/* harmony export */ boolFilter: () => (/* binding */ boolFilter),
|
|
1892
1978
|
/* harmony export */ combineClassNames: () => (/* binding */ combineClassNames),
|
|
1893
1979
|
/* harmony export */ filterNonHtmlAttrs: () => (/* binding */ filterNonHtmlAttrs),
|
|
1894
1980
|
/* harmony export */ generateId: () => (/* binding */ generateId),
|
|
@@ -1897,7 +1983,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1897
1983
|
/* harmony export */ isObject: () => (/* binding */ isObject),
|
|
1898
1984
|
/* harmony export */ isString: () => (/* binding */ isString),
|
|
1899
1985
|
/* harmony export */ isStyledComponent: () => (/* binding */ isStyledComponent),
|
|
1900
|
-
/* harmony export */ mediaQuery: () => (/* binding */ mediaQuery),
|
|
1901
1986
|
/* harmony export */ processCss: () => (/* binding */ processCss),
|
|
1902
1987
|
/* harmony export */ resolveClassName: () => (/* binding */ resolveClassName),
|
|
1903
1988
|
/* harmony export */ toKebabCase: () => (/* binding */ toKebabCase)
|
|
@@ -1925,6 +2010,19 @@ const isFunction = (value) => typeof value === 'function';
|
|
|
1925
2010
|
* @returns `true` if the value is `null` or `undefined`, otherwise `false`.
|
|
1926
2011
|
*/
|
|
1927
2012
|
const isNil = (value) => value === undefined || value === null;
|
|
2013
|
+
/**
|
|
2014
|
+
* Filters out `null`, `undefined`, and other falsy values from an array,
|
|
2015
|
+
* returning a typed array of only truthy `Item` values.
|
|
2016
|
+
*
|
|
2017
|
+
* Useful when working with optional or nullable items that need to be sanitized.
|
|
2018
|
+
*
|
|
2019
|
+
* @template T - The type of the items in the array.
|
|
2020
|
+
*
|
|
2021
|
+
* @param array - An array of items that may include `null`, `undefined`, or falsy values.
|
|
2022
|
+
*
|
|
2023
|
+
* @returns A new array containing only truthy `Item` values.
|
|
2024
|
+
*/
|
|
2025
|
+
const boolFilter = (array) => array.filter(Boolean);
|
|
1928
2026
|
/**
|
|
1929
2027
|
* Generates a short, consistent hash string from an input string using a DJB2-inspired algorithm.
|
|
1930
2028
|
*
|
|
@@ -1991,48 +2089,6 @@ const filterNonHtmlAttrs = (attrs) => Object.entries(attrs).reduce((allowedAttrs
|
|
|
1991
2089
|
}
|
|
1992
2090
|
return allowedAttrs;
|
|
1993
2091
|
}, {});
|
|
1994
|
-
/**
|
|
1995
|
-
* Constructs a complete `@media` query string from an array of media rule objects.
|
|
1996
|
-
* Each rule defines conditions such as screen size, orientation, or resolution,
|
|
1997
|
-
* which are converted into standard CSS media query syntax.
|
|
1998
|
-
*
|
|
1999
|
-
* @param rules - An array of media rule objects used to generate individual media queries.
|
|
2000
|
-
*
|
|
2001
|
-
* @returns A string containing a full `@media` query that can be used in CSS or injected into a stylesheet.
|
|
2002
|
-
*
|
|
2003
|
-
* @example
|
|
2004
|
-
* ```ts
|
|
2005
|
-
* atMedia([
|
|
2006
|
-
* { minWidth: '768px', orientation: 'landscape' },
|
|
2007
|
-
* { mediaType: 'print' }
|
|
2008
|
-
* ]);
|
|
2009
|
-
* // Returns: "@media screen and (min-width: 768px) and (orientation: landscape), print"
|
|
2010
|
-
* ```
|
|
2011
|
-
*/
|
|
2012
|
-
const mediaQuery = (rules) => {
|
|
2013
|
-
const mediaRules = rules.map(rule => {
|
|
2014
|
-
const conditions = [
|
|
2015
|
-
rule.width && ['width', rule.width],
|
|
2016
|
-
rule.minWidth && ['min-width', rule.minWidth],
|
|
2017
|
-
rule.maxWidth && ['max-width', rule.maxWidth],
|
|
2018
|
-
rule.height && ['height', rule.height],
|
|
2019
|
-
rule.minHeight && ['min-height', rule.minHeight],
|
|
2020
|
-
rule.maxHeight && ['max-height', rule.maxHeight],
|
|
2021
|
-
rule.orientation && ['orientation', rule.orientation],
|
|
2022
|
-
rule.minResolution && ['min-resolution', rule.minResolution],
|
|
2023
|
-
rule.maxResolution && ['max-resolution', rule.maxResolution],
|
|
2024
|
-
rule.resolution && ['resolution', rule.resolution],
|
|
2025
|
-
rule.update && ['update', rule.update],
|
|
2026
|
-
]
|
|
2027
|
-
.filter(Boolean)
|
|
2028
|
-
.map(r => r && `(${r[0]}: ${r[1]})`)
|
|
2029
|
-
.join(' and ');
|
|
2030
|
-
const operatorPart = rule.operator ? `${rule.operator} ` : '';
|
|
2031
|
-
const conditionsPart = conditions ? ` and ${conditions}` : '';
|
|
2032
|
-
return `${operatorPart}${rule.mediaType ?? 'screen'}${conditionsPart}`;
|
|
2033
|
-
});
|
|
2034
|
-
return `@media ${mediaRules.join(', ')}`;
|
|
2035
|
-
};
|
|
2036
2092
|
|
|
2037
2093
|
|
|
2038
2094
|
/***/ }),
|
|
@@ -2133,6 +2189,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2133
2189
|
/* harmony export */ __DEV__: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.__DEV__),
|
|
2134
2190
|
/* harmony export */ createGlobalStyle: () => (/* reexport safe */ _global_style__WEBPACK_IMPORTED_MODULE_6__.createGlobalStyle),
|
|
2135
2191
|
/* harmony export */ css: () => (/* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_5__.css),
|
|
2192
|
+
/* harmony export */ mediaQuery: () => (/* reexport safe */ _at_rules__WEBPACK_IMPORTED_MODULE_8__.mediaQuery),
|
|
2136
2193
|
/* harmony export */ styled: () => (/* reexport safe */ _styled__WEBPACK_IMPORTED_MODULE_7__.styled),
|
|
2137
2194
|
/* harmony export */ useHoneyStyle: () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_3__.useHoneyStyle)
|
|
2138
2195
|
/* harmony export */ });
|
|
@@ -2144,6 +2201,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2144
2201
|
/* harmony import */ var _css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./css */ "./src/css.ts");
|
|
2145
2202
|
/* harmony import */ var _global_style__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./global-style */ "./src/global-style.ts");
|
|
2146
2203
|
/* harmony import */ var _styled__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./styled */ "./src/styled.ts");
|
|
2204
|
+
/* harmony import */ var _at_rules__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./at-rules */ "./src/at-rules/index.ts");
|
|
2205
|
+
|
|
2147
2206
|
|
|
2148
2207
|
|
|
2149
2208
|
|