@css-hooks/core 4.0.0-next.24 → 4.0.0-next.26
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 +30 -0
- package/esm/index.js +29 -0
- package/package.json +1 -1
- package/types/index.d.ts +16 -0
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/v4.0.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/v4.0.0-next.26/.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/v4.0.0-next.
|
|
4
|
+
<a href="https://next.css-hooks.com"><img alt="CSS Hooks" src="https://github.com/css-hooks/css-hooks/raw/v4.0.0-next.26/.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/v4.0.0-next.
|
|
12
|
-
<a href="https://www.npmjs.com/package/@css-hooks/core/v/4.0.0-next.
|
|
13
|
-
<a href="https://github.com/css-hooks/css-hooks/blob/v4.0.0-next.
|
|
11
|
+
<a href="https://github.com/css-hooks/css-hooks/tree/v4.0.0-next.26"><img src="https://img.shields.io/badge/tag-v4.0.0--next.26-ffd700" alt="tag v4.0.0-next.26"></a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/@css-hooks/core/v/4.0.0-next.26"><img src="https://img.shields.io/badge/npm-v4.0.0--next.26-ffd700" alt="npm version"></a>
|
|
13
|
+
<a href="https://github.com/css-hooks/css-hooks/blob/v4.0.0-next.26/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
|
@@ -5,7 +5,37 @@
|
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.mergeStyles = mergeStyles;
|
|
8
9
|
exports.buildHooksSystem = buildHooksSystem;
|
|
10
|
+
/**
|
|
11
|
+
* Merges an override style prop into a base style.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Override properties are moved to the end of the resulting object so their
|
|
15
|
+
* declaration order takes precedence over properties in the base style.
|
|
16
|
+
*
|
|
17
|
+
* @typeParam OverrideStyle - The type of the override style prop
|
|
18
|
+
*
|
|
19
|
+
* @param overrideStyle - The style whose properties should take precedence
|
|
20
|
+
*
|
|
21
|
+
* @returns A curried function that merges `overrideStyle` with a base style
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
function mergeStyles(overrideStyle) {
|
|
26
|
+
return (style) => {
|
|
27
|
+
if (!overrideStyle) {
|
|
28
|
+
return style;
|
|
29
|
+
}
|
|
30
|
+
const result = { ...style };
|
|
31
|
+
for (const property of Reflect.ownKeys(overrideStyle)) {
|
|
32
|
+
if (Object.prototype.propertyIsEnumerable.call(overrideStyle, property)) {
|
|
33
|
+
Reflect.deleteProperty(result, property);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return Object.assign(result, overrideStyle);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
9
39
|
/**
|
|
10
40
|
* Creates a flavor of CSS Hooks tailored to a specific app framework.
|
|
11
41
|
*
|
package/esm/index.js
CHANGED
|
@@ -3,6 +3,35 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Merges an override style prop into a base style.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Override properties are moved to the end of the resulting object so their
|
|
11
|
+
* declaration order takes precedence over properties in the base style.
|
|
12
|
+
*
|
|
13
|
+
* @typeParam OverrideStyle - The type of the override style prop
|
|
14
|
+
*
|
|
15
|
+
* @param overrideStyle - The style whose properties should take precedence
|
|
16
|
+
*
|
|
17
|
+
* @returns A curried function that merges `overrideStyle` with a base style
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export function mergeStyles(overrideStyle) {
|
|
22
|
+
return (style) => {
|
|
23
|
+
if (!overrideStyle) {
|
|
24
|
+
return style;
|
|
25
|
+
}
|
|
26
|
+
const result = { ...style };
|
|
27
|
+
for (const property of Reflect.ownKeys(overrideStyle)) {
|
|
28
|
+
if (Object.prototype.propertyIsEnumerable.call(overrideStyle, property)) {
|
|
29
|
+
Reflect.deleteProperty(result, property);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return Object.assign(result, overrideStyle);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
6
35
|
/**
|
|
7
36
|
* Creates a flavor of CSS Hooks tailored to a specific app framework.
|
|
8
37
|
*
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -144,6 +144,22 @@ export interface CreateHooksResult<S, CSSProperties, CSSPropertyConflicts extend
|
|
|
144
144
|
* @public
|
|
145
145
|
*/
|
|
146
146
|
export type CreateHooksFn<CSSProperties, CSSPropertyConflicts extends object = object> = <S extends Selector>(...selectors: S[]) => CreateHooksResult<S, CSSProperties, CSSPropertyConflicts>;
|
|
147
|
+
/**
|
|
148
|
+
* Merges an override style prop into a base style.
|
|
149
|
+
*
|
|
150
|
+
* @remarks
|
|
151
|
+
* Override properties are moved to the end of the resulting object so their
|
|
152
|
+
* declaration order takes precedence over properties in the base style.
|
|
153
|
+
*
|
|
154
|
+
* @typeParam OverrideStyle - The type of the override style prop
|
|
155
|
+
*
|
|
156
|
+
* @param overrideStyle - The style whose properties should take precedence
|
|
157
|
+
*
|
|
158
|
+
* @returns A curried function that merges `overrideStyle` with a base style
|
|
159
|
+
*
|
|
160
|
+
* @public
|
|
161
|
+
*/
|
|
162
|
+
export declare function mergeStyles<const OverrideStyle extends object>(overrideStyle: OverrideStyle | null | undefined): <Style extends object>(style: Style) => Omit<Style, keyof OverrideStyle> & OverrideStyle;
|
|
147
163
|
/**
|
|
148
164
|
* Creates a flavor of CSS Hooks tailored to a specific app framework.
|
|
149
165
|
*
|