@css-hooks/core 3.1.3-next.1 → 3.2.0-next.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/README.md +5 -5
- package/cjs/index.js +4 -1
- package/esm/index.js +4 -1
- 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
|
+
<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.0/.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.
|
|
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.0/.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.
|
|
12
|
-
<a href="https://www.npmjs.com/package/@css-hooks/core/v/3.
|
|
13
|
-
<a href="https://github.com/css-hooks/css-hooks/blob/v3.
|
|
11
|
+
<a href="https://github.com/css-hooks/css-hooks/tree/v3.2.0-next.0"><img src="https://img.shields.io/badge/tag-v3.2.0--next.0-ffd700" alt="tag v3.2.0-next.0"></a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/@css-hooks/core/v/3.2.0-next.0"><img src="https://img.shields.io/badge/npm-v3.2.0--next.0-ffd700" alt="npm version"></a>
|
|
13
|
+
<a href="https://github.com/css-hooks/css-hooks/blob/v3.2.0-next.0/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,8 +59,11 @@ 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, conditionalStyleOrFn) {
|
|
63
63
|
return fallbackStyle => {
|
|
64
|
+
const conditionalStyle = conditionalStyleOrFn instanceof Function
|
|
65
|
+
? conditionalStyleOrFn(fallbackStyle)
|
|
66
|
+
: conditionalStyleOrFn;
|
|
64
67
|
const style = { ...fallbackStyle };
|
|
65
68
|
for (const property in conditionalStyle) {
|
|
66
69
|
const conditionalValue = stringify(conditionalStyle[property], property);
|
package/esm/index.js
CHANGED
|
@@ -56,8 +56,11 @@ 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, conditionalStyleOrFn) {
|
|
60
60
|
return fallbackStyle => {
|
|
61
|
+
const conditionalStyle = conditionalStyleOrFn instanceof Function
|
|
62
|
+
? conditionalStyleOrFn(fallbackStyle)
|
|
63
|
+
: conditionalStyleOrFn;
|
|
61
64
|
const style = { ...fallbackStyle };
|
|
62
65
|
for (const property in conditionalStyle) {
|
|
63
66
|
const conditionalValue = stringify(conditionalStyle[property], property);
|
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) => EnhanceStyleFn<CSSProperties>;
|
|
80
|
+
on: (condition: Condition<S>, style: CSSProperties | ((style: CSSProperties) => 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.
|