@css-hooks/core 3.2.0-next.8 → 3.2.0-next.9
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/README.md +5 -5
- package/cjs/index.js +5 -8
- package/esm/index.js +5 -8
- package/package.json +1 -1
- package/types/index.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<a id="logomark" href="https://next.css-hooks.com"><img alt="CSS Hooks" src="https://github.com/css-hooks/css-hooks/raw/v3.2.0-next.
|
|
2
|
+
<a id="logomark" href="https://next.css-hooks.com"><img alt="CSS Hooks" src="https://github.com/css-hooks/css-hooks/raw/v3.2.0-next.9/.github/logomark.svg" height="128" /></a><br/><br/>
|
|
3
3
|
<div id="wordmark">
|
|
4
|
-
<a href="https://next.css-hooks.com"><img alt="CSS Hooks" src="https://github.com/css-hooks/css-hooks/raw/v3.2.0-next.
|
|
4
|
+
<a href="https://next.css-hooks.com"><img alt="CSS Hooks" src="https://github.com/css-hooks/css-hooks/raw/v3.2.0-next.9/.github/wordmark-dark.svg" width="256"></a>
|
|
5
5
|
</div>
|
|
6
6
|
</div>
|
|
7
7
|
|
|
8
8
|
<br/>
|
|
9
9
|
|
|
10
10
|
<div align="center" id="badges">
|
|
11
|
-
<a href="https://github.com/css-hooks/css-hooks/tree/v3.2.0-next.
|
|
12
|
-
<a href="https://www.npmjs.com/package/@css-hooks/core/v/3.2.0-next.
|
|
13
|
-
<a href="https://github.com/css-hooks/css-hooks/blob/v3.2.0-next.
|
|
11
|
+
<a href="https://github.com/css-hooks/css-hooks/tree/v3.2.0-next.9"><img src="https://img.shields.io/badge/tag-v3.2.0--next.9-ffd700" alt="tag v3.2.0-next.9"></a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/@css-hooks/core/v/3.2.0-next.9"><img src="https://img.shields.io/badge/npm-v3.2.0--next.9-ffd700" alt="npm version"></a>
|
|
13
|
+
<a href="https://github.com/css-hooks/css-hooks/blob/v3.2.0-next.9/LICENSE"><img src="https://img.shields.io/badge/license-MIT-ffd700" alt="license"></a>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
---
|
package/cjs/index.js
CHANGED
|
@@ -59,15 +59,12 @@ function buildHooksSystem(stringify = String) {
|
|
|
59
59
|
and: (...and) => ({ and }),
|
|
60
60
|
or: (...or) => ({ or }),
|
|
61
61
|
not: not => ({ not }),
|
|
62
|
-
on(condition,
|
|
62
|
+
on(condition, overrideStyle) {
|
|
63
63
|
return fallbackStyle => {
|
|
64
|
-
const conditionalStyle = conditionalStyleOrFn instanceof Function
|
|
65
|
-
? conditionalStyleOrFn(fallbackStyle)
|
|
66
|
-
: conditionalStyleOrFn;
|
|
67
64
|
const style = { ...fallbackStyle };
|
|
68
|
-
for (const property in
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
65
|
+
for (const property in overrideStyle) {
|
|
66
|
+
const overrideValue = stringify(overrideStyle[property], property);
|
|
67
|
+
if (overrideValue === null) {
|
|
71
68
|
continue;
|
|
72
69
|
}
|
|
73
70
|
let fallbackValue = "revert-layer";
|
|
@@ -77,7 +74,7 @@ function buildHooksSystem(stringify = String) {
|
|
|
77
74
|
fallbackValue = fv;
|
|
78
75
|
}
|
|
79
76
|
}
|
|
80
|
-
const [value, extraDecls] = buildExpression(condition,
|
|
77
|
+
const [value, extraDecls] = buildExpression(condition, overrideValue, fallbackValue);
|
|
81
78
|
Object.assign(style, { [property]: value }, extraDecls);
|
|
82
79
|
}
|
|
83
80
|
return style;
|
package/esm/index.js
CHANGED
|
@@ -56,15 +56,12 @@ export function buildHooksSystem(stringify = String) {
|
|
|
56
56
|
and: (...and) => ({ and }),
|
|
57
57
|
or: (...or) => ({ or }),
|
|
58
58
|
not: not => ({ not }),
|
|
59
|
-
on(condition,
|
|
59
|
+
on(condition, overrideStyle) {
|
|
60
60
|
return fallbackStyle => {
|
|
61
|
-
const conditionalStyle = conditionalStyleOrFn instanceof Function
|
|
62
|
-
? conditionalStyleOrFn(fallbackStyle)
|
|
63
|
-
: conditionalStyleOrFn;
|
|
64
61
|
const style = { ...fallbackStyle };
|
|
65
|
-
for (const property in
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
62
|
+
for (const property in overrideStyle) {
|
|
63
|
+
const overrideValue = stringify(overrideStyle[property], property);
|
|
64
|
+
if (overrideValue === null) {
|
|
68
65
|
continue;
|
|
69
66
|
}
|
|
70
67
|
let fallbackValue = "revert-layer";
|
|
@@ -74,7 +71,7 @@ export function buildHooksSystem(stringify = String) {
|
|
|
74
71
|
fallbackValue = fv;
|
|
75
72
|
}
|
|
76
73
|
}
|
|
77
|
-
const [value, extraDecls] = buildExpression(condition,
|
|
74
|
+
const [value, extraDecls] = buildExpression(condition, overrideValue, fallbackValue);
|
|
78
75
|
Object.assign(style, { [property]: value }, extraDecls);
|
|
79
76
|
}
|
|
80
77
|
return style;
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -77,7 +77,7 @@ export interface CreateHooksResult<S, CSSProperties> {
|
|
|
77
77
|
/**
|
|
78
78
|
* Enhances a style object with conditional styles.
|
|
79
79
|
*/
|
|
80
|
-
on: (condition: Condition<S>, style: CSSProperties
|
|
80
|
+
on: (condition: Condition<S>, style: CSSProperties) => EnhanceStyleFn<CSSProperties>;
|
|
81
81
|
/**
|
|
82
82
|
* Combines a list of conditions into a single condition which is true when
|
|
83
83
|
* all of the specified conditions are true.
|