@css-hooks/core 1.4.0 → 1.4.2
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 +2 -0
- package/cjs/index.js +3 -2
- package/esm/index.js +3 -2
- package/package.json +1 -1
- package/types/index.d.ts +4 -2
package/README.md
CHANGED
|
@@ -51,6 +51,8 @@ Please visit [css-hooks.com](https://css-hooks.com) to get started.
|
|
|
51
51
|
|
|
52
52
|
## Packages
|
|
53
53
|
|
|
54
|
+
- [@css-hooks/recommended](packages/recommended): Recommended hook configuration
|
|
55
|
+
with sensible defaults
|
|
54
56
|
- [@css-hooks/react](packages/react): React framework integration
|
|
55
57
|
- [@css-hooks/solid](packages/solid): Solid framework integration
|
|
56
58
|
- [@css-hooks/preact](packages/preact): Preact framework integration
|
package/cjs/index.js
CHANGED
|
@@ -44,6 +44,7 @@ function hash(obj) {
|
|
|
44
44
|
}
|
|
45
45
|
function buildHooksSystem(stringify = genericStringify) {
|
|
46
46
|
return function createHooks(config, options) {
|
|
47
|
+
const fallbackKeyword = (options === null || options === void 0 ? void 0 : options.fallback) || "unset";
|
|
47
48
|
const stringifyImpl = (propertyName, value) => {
|
|
48
49
|
return typeof value === "string" && value.startsWith("var(")
|
|
49
50
|
? value
|
|
@@ -181,7 +182,7 @@ function buildHooksSystem(stringify = genericStringify) {
|
|
|
181
182
|
v = fallback(propertyName);
|
|
182
183
|
}
|
|
183
184
|
if (v === null) {
|
|
184
|
-
v =
|
|
185
|
+
v = fallbackKeyword;
|
|
185
186
|
}
|
|
186
187
|
return v;
|
|
187
188
|
});
|
|
@@ -190,7 +191,7 @@ function buildHooksSystem(stringify = genericStringify) {
|
|
|
190
191
|
if (v1 !== null) {
|
|
191
192
|
let v0 = fallback(propertyName);
|
|
192
193
|
if (v0 === null) {
|
|
193
|
-
v0 =
|
|
194
|
+
v0 = fallbackKeyword;
|
|
194
195
|
}
|
|
195
196
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-explicit-any */
|
|
196
197
|
properties[propertyName] =
|
package/esm/index.js
CHANGED
|
@@ -40,6 +40,7 @@ function hash(obj) {
|
|
|
40
40
|
}
|
|
41
41
|
export function buildHooksSystem(stringify = genericStringify) {
|
|
42
42
|
return function createHooks(config, options) {
|
|
43
|
+
const fallbackKeyword = (options === null || options === void 0 ? void 0 : options.fallback) || "unset";
|
|
43
44
|
const stringifyImpl = (propertyName, value) => {
|
|
44
45
|
return typeof value === "string" && value.startsWith("var(")
|
|
45
46
|
? value
|
|
@@ -177,7 +178,7 @@ export function buildHooksSystem(stringify = genericStringify) {
|
|
|
177
178
|
v = fallback(propertyName);
|
|
178
179
|
}
|
|
179
180
|
if (v === null) {
|
|
180
|
-
v =
|
|
181
|
+
v = fallbackKeyword;
|
|
181
182
|
}
|
|
182
183
|
return v;
|
|
183
184
|
});
|
|
@@ -186,7 +187,7 @@ export function buildHooksSystem(stringify = genericStringify) {
|
|
|
186
187
|
if (v1 !== null) {
|
|
187
188
|
let v0 = fallback(propertyName);
|
|
188
189
|
if (v0 === null) {
|
|
189
|
-
v0 =
|
|
190
|
+
v0 = fallbackKeyword;
|
|
190
191
|
}
|
|
191
192
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-explicit-any */
|
|
192
193
|
properties[propertyName] =
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -10,13 +10,15 @@ type WithHooksImpl<Properties, HookProperties, HookPropertiesSub extends HookPro
|
|
|
10
10
|
} : never>>;
|
|
11
11
|
/** @internal */
|
|
12
12
|
export declare function genericStringify(_: unknown, value: unknown): string | null;
|
|
13
|
-
export declare function buildHooksSystem<Properties = Record<string, unknown>>(stringify?: (propertyName: keyof Properties, value: unknown) => string | null): <HookProperties extends string>(config: Record<HookProperties, HookSpec>, options?: {
|
|
13
|
+
export declare function buildHooksSystem<Properties = Record<string, unknown>>(stringify?: (propertyName: keyof Properties, value: unknown) => string | null): <HookProperties extends string>(config: Record<HookProperties, HookSpec>, options?: (({
|
|
14
14
|
debug?: boolean; /** @internal */
|
|
15
15
|
hookNameToId?: undefined;
|
|
16
16
|
} | {
|
|
17
17
|
debug?: undefined;
|
|
18
18
|
/** @internal */ hookNameToId?: (hookName: string) => string;
|
|
19
|
-
}
|
|
19
|
+
}) & {
|
|
20
|
+
fallback?: "unset" | "revert-layer";
|
|
21
|
+
}) | undefined) => readonly [`*{${string}}undefined` | `*{${string}}${string}`, (properties: WithHooks<HookProperties, Properties>) => Properties];
|
|
20
22
|
/**
|
|
21
23
|
* A list of hooks offered as a "sensible default" to solve the most common use cases.
|
|
22
24
|
*
|