@css-hooks/preact 0.6.0 → 0.8.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/LICENSE +21 -0
- package/README.md +64 -0
- package/package.json +2 -2
- package/types/index.d.ts +3 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Nick Saunders
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://css-hooks.com/#gh-dark-mode-only" target="_blank">
|
|
3
|
+
<img alt="CSS Hooks" src="https://raw.githubusercontent.com/css-hooks/css-hooks/HEAD/.github/logo-dark.svg" width="310" height="64" style="max-width: 100%;">
|
|
4
|
+
</a>
|
|
5
|
+
<a href="https://css-hooks.com/#gh-light-mode-only" target="_blank">
|
|
6
|
+
<img alt="CSS Hooks" src="https://raw.githubusercontent.com/css-hooks/css-hooks/HEAD/.github/logo-light.svg" width="310" height="64" style="max-width: 100%;">
|
|
7
|
+
</a>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<a href="https://github.com/css-hooks/css-hooks/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/css-hooks/css-hooks/ci.yml?branch=master" alt="Build Status"></a>
|
|
12
|
+
<a href="https://github.com/css-hooks/css-hooks/releases"><img src="https://img.shields.io/npm/v/@css-hooks%2Fcore.svg" alt="Latest Release"></a>
|
|
13
|
+
<a href="https://github.com/css-hooks/css-hooks/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/css-hooks.svg" alt="License"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Overview
|
|
19
|
+
|
|
20
|
+
Hooks bring CSS features to native inline styles, enabling you to target various
|
|
21
|
+
states such as hover, focus, and active, all without leaving the `style` prop.
|
|
22
|
+
For example, hooks can easily solve the common use case of applying state-driven
|
|
23
|
+
styles to a link:
|
|
24
|
+
|
|
25
|
+
```jsx
|
|
26
|
+
<a
|
|
27
|
+
href="https://css-hooks.com/"
|
|
28
|
+
style={hooks({
|
|
29
|
+
color: "#03f",
|
|
30
|
+
hover: {
|
|
31
|
+
color: "#09f",
|
|
32
|
+
},
|
|
33
|
+
active: {
|
|
34
|
+
color: "#e33",
|
|
35
|
+
},
|
|
36
|
+
})}
|
|
37
|
+
>
|
|
38
|
+
Hooks
|
|
39
|
+
</a>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Notably, the `hooks` function is pure. It simply returns a flat style object
|
|
43
|
+
that is compatible with the `style` prop, creating dynamic property values that
|
|
44
|
+
change under various conditions through CSS variables.
|
|
45
|
+
|
|
46
|
+
## Documentation
|
|
47
|
+
|
|
48
|
+
Please visit [css-hooks.com](https://css-hooks.com) to get started.
|
|
49
|
+
|
|
50
|
+
## Packages
|
|
51
|
+
|
|
52
|
+
- [@css-hooks/react](packages/react): React framework integration
|
|
53
|
+
- [@css-hooks/solid](packages/solid): Solid framework integration
|
|
54
|
+
- [@css-hooks/preact](packages/preact): Preact framework integration
|
|
55
|
+
- [@css-hooks/core](packages/core): Core CSS Hooks package (internal use only)
|
|
56
|
+
|
|
57
|
+
## Contributing
|
|
58
|
+
|
|
59
|
+
Contributions are welcome. Please see the
|
|
60
|
+
[contributing guidelines](CONTRIBUTING.md) for more information.
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
CSS Hooks is offered under the [MIT license](LICENSE).
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@css-hooks/preact",
|
|
3
3
|
"description": "CSS Hooks for Preact",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"author": "Nick Saunders",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@css-hooks/core": "^0.
|
|
7
|
+
"@css-hooks/core": "^0.8.0"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"@tsconfig/node-lts": "^18.12.3",
|
package/types/index.d.ts
CHANGED
|
@@ -25,5 +25,7 @@ export declare function stringifyValue(propertyName: string | number | symbol, v
|
|
|
25
25
|
*
|
|
26
26
|
* @returns The CSS required to enable the configured hooks, along with the corresponding `hooks` function for use in components.
|
|
27
27
|
*/
|
|
28
|
-
export declare const createHooks: <HookProperties extends string | number | symbol>(config: Record<HookProperties, `@container ${string}` | `@media ${string}` | `:${string}` | `${string}&${string}
|
|
28
|
+
export declare const createHooks: <HookProperties extends string | number | symbol>(config: Record<HookProperties, `@container ${string}` | `@media ${string}` | `:${string}` | `${string}&${string}` | {
|
|
29
|
+
or: readonly ((`@container ${string}` | `@media ${string}` | `:${string}` | `${string}&${string}` | any) & string)[];
|
|
30
|
+
}>) => readonly [string, (properties: import("@css-hooks/core").WithHooks<HookProperties, CSSProperties>) => CSSProperties];
|
|
29
31
|
export { recommended };
|