@css-hooks/solid 0.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/cjs/index.js +35 -0
- package/esm/index.js +31 -0
- package/package.json +49 -0
- package/types/index.d.ts +46 -0
package/cjs/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.recommended = exports.createHooks = exports.stringifyValue = void 0;
|
|
4
|
+
const core_1 = require("@css-hooks/core");
|
|
5
|
+
/** @internal */
|
|
6
|
+
function stringifyValue(_, value) {
|
|
7
|
+
if (typeof value === "string") {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
if (typeof value === "number") {
|
|
11
|
+
return `${value}`;
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
exports.stringifyValue = stringifyValue;
|
|
16
|
+
/**
|
|
17
|
+
* Creates the hooks specified in the configuration.
|
|
18
|
+
*
|
|
19
|
+
* @param config - The hooks to build
|
|
20
|
+
*
|
|
21
|
+
* @returns The CSS required to enable the configured hooks, along with the corresponding `hooks` function for use in components.
|
|
22
|
+
*/
|
|
23
|
+
exports.createHooks = (0, core_1.buildHooksSystem)(stringifyValue);
|
|
24
|
+
function keybab(r) {
|
|
25
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return,@typescript-eslint/no-explicit-any */
|
|
26
|
+
return Object.fromEntries(Object.entries(r).map(([key, value]) => [
|
|
27
|
+
key.replace(/[A-Z]/g, x => `-${x.toLowerCase()}`),
|
|
28
|
+
value,
|
|
29
|
+
]));
|
|
30
|
+
/* eslint-enable @typescript-eslint/no-unsafe-return,@typescript-eslint/no-explicit-any */
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A list of hooks offered as a "sensible default" to solve the most common use cases.
|
|
34
|
+
*/
|
|
35
|
+
exports.recommended = keybab(core_1.recommended);
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { buildHooksSystem, recommended as coreRecommended, } from "@css-hooks/core";
|
|
2
|
+
/** @internal */
|
|
3
|
+
export function stringifyValue(_, value) {
|
|
4
|
+
if (typeof value === "string") {
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
if (typeof value === "number") {
|
|
8
|
+
return `${value}`;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates the hooks specified in the configuration.
|
|
14
|
+
*
|
|
15
|
+
* @param config - The hooks to build
|
|
16
|
+
*
|
|
17
|
+
* @returns The CSS required to enable the configured hooks, along with the corresponding `hooks` function for use in components.
|
|
18
|
+
*/
|
|
19
|
+
export const createHooks = buildHooksSystem(stringifyValue);
|
|
20
|
+
function keybab(r) {
|
|
21
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return,@typescript-eslint/no-explicit-any */
|
|
22
|
+
return Object.fromEntries(Object.entries(r).map(([key, value]) => [
|
|
23
|
+
key.replace(/[A-Z]/g, x => `-${x.toLowerCase()}`),
|
|
24
|
+
value,
|
|
25
|
+
]));
|
|
26
|
+
/* eslint-enable @typescript-eslint/no-unsafe-return,@typescript-eslint/no-explicit-any */
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A list of hooks offered as a "sensible default" to solve the most common use cases.
|
|
30
|
+
*/
|
|
31
|
+
export const recommended = keybab(coreRecommended);
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@css-hooks/solid",
|
|
3
|
+
"description": "CSS Hooks for Solid",
|
|
4
|
+
"version": "0.6.0",
|
|
5
|
+
"author": "Nick Saunders",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@css-hooks/core": "^0.6.0",
|
|
8
|
+
"ts-toolbelt": "^9.6.0"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@tsconfig/node-lts": "^18.12.3",
|
|
12
|
+
"@tsconfig/strictest": "^2.0.1",
|
|
13
|
+
"@types/jest": "^29.5.3",
|
|
14
|
+
"@typescript-eslint/eslint-plugin": "^6.3.0",
|
|
15
|
+
"@typescript-eslint/parser": "^6.3.0",
|
|
16
|
+
"eslint": "^8.47.0",
|
|
17
|
+
"jest": "^29.6.2",
|
|
18
|
+
"rimraf": "^5.0.1",
|
|
19
|
+
"solid-js": "^1.7.11",
|
|
20
|
+
"ts-jest": "^29.1.1",
|
|
21
|
+
"typescript": "^5.1.6"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"cjs",
|
|
25
|
+
"esm",
|
|
26
|
+
"types"
|
|
27
|
+
],
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"main": "cjs",
|
|
30
|
+
"module": "esm",
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"solid-js": ">=1.0.0 <2.0.0"
|
|
33
|
+
},
|
|
34
|
+
"private": false,
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/css-hooks/css-hooks.git",
|
|
38
|
+
"directory": "packages/solid"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"clean": "rimraf cjs esm types",
|
|
42
|
+
"lint": "eslint __tests__ src .*.*js *.*js",
|
|
43
|
+
"postversion": "npm install @css-hooks/core@^$npm_package_version --force",
|
|
44
|
+
"prepublishOnly": "tsc -p tsconfig.dist.json --outDir cjs --module commonjs && tsc -p tsconfig.dist.json --outDir esm --module es6 && tsc -p tsconfig.dist.json --declaration --emitDeclarationOnly --outDir types",
|
|
45
|
+
"test": "jest"
|
|
46
|
+
},
|
|
47
|
+
"type": "module",
|
|
48
|
+
"types": "types"
|
|
49
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
/** @internal */
|
|
3
|
+
export declare function stringifyValue(_: string, value: unknown): string | null;
|
|
4
|
+
/**
|
|
5
|
+
* Creates the hooks specified in the configuration.
|
|
6
|
+
*
|
|
7
|
+
* @param config - The hooks to build
|
|
8
|
+
*
|
|
9
|
+
* @returns The CSS required to enable the configured hooks, along with the corresponding `hooks` function for use in components.
|
|
10
|
+
*/
|
|
11
|
+
export declare const createHooks: <HookProperties extends string | number | symbol>(config: Record<HookProperties, `@container ${string}` | `@media ${string}` | `:${string}` | `${string}&${string}`>) => readonly [string, (properties: import("@css-hooks/core").WithHooks<HookProperties, JSX.CSSProperties>) => JSX.CSSProperties];
|
|
12
|
+
/**
|
|
13
|
+
* A list of hooks offered as a "sensible default" to solve the most common use cases.
|
|
14
|
+
*/
|
|
15
|
+
export declare const recommended: {
|
|
16
|
+
active: ":active";
|
|
17
|
+
autofill: ":autofill";
|
|
18
|
+
checked: ":checked";
|
|
19
|
+
default: ":default";
|
|
20
|
+
disabled: ":disabled";
|
|
21
|
+
empty: ":empty";
|
|
22
|
+
enabled: ":enabled";
|
|
23
|
+
"even-child": ":nth-child(even)";
|
|
24
|
+
"first-child": ":first-child";
|
|
25
|
+
"first-of-type": ":first-of-type";
|
|
26
|
+
focus: ":focus";
|
|
27
|
+
"focus-visible": ":focus-visible";
|
|
28
|
+
"focus-within": ":focus-within";
|
|
29
|
+
hover: ":hover";
|
|
30
|
+
"in-range": ":in-range";
|
|
31
|
+
indeterminate: ":indeterminate";
|
|
32
|
+
invalid: ":invalid";
|
|
33
|
+
"last-child": ":last-child";
|
|
34
|
+
"last-of-type": ":last-of-type";
|
|
35
|
+
"odd-child": ":nth-child(odd)";
|
|
36
|
+
"only-child": ":only-child";
|
|
37
|
+
"only-of-type": ":only-of-type";
|
|
38
|
+
"out-of-range": ":out-of-range";
|
|
39
|
+
"placeholder-shown": ":placeholder-shown";
|
|
40
|
+
"read-only": ":read-only";
|
|
41
|
+
"read-write": ":read-write";
|
|
42
|
+
required: ":required";
|
|
43
|
+
target: ":target";
|
|
44
|
+
valid: ":valid";
|
|
45
|
+
visited: ":visited";
|
|
46
|
+
};
|