@css-hooks/core 1.5.1 → 1.5.3

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 CHANGED
@@ -186,29 +186,25 @@ function buildHooksSystem(stringify = genericStringify) {
186
186
  }
187
187
  return v;
188
188
  });
189
- for (const propertyName in innerProperties) {
189
+ for (const propertyNameStr in innerProperties) {
190
+ const propertyName = propertyNameStr;
190
191
  const v1 = stringifyImpl(propertyName, innerProperties[propertyName]);
191
192
  if (v1 !== null) {
192
193
  let v0 = fallback(propertyName);
193
194
  if (v0 === null) {
194
195
  v0 = fallbackKeyword;
195
196
  }
196
- /* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-explicit-any */
197
- properties[propertyName] =
198
- `var(--${hookId(hookName)}-1, ${v1}) var(--${hookId(hookName)}-0, ${v0})`;
199
- /* eslint-enable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-explicit-any */
197
+ properties[propertyName] = `var(--${hookId(hookName)}-1, ${v1}) var(--${hookId(hookName)}-0, ${v0})`;
200
198
  }
201
199
  }
202
200
  delete properties[hookName];
203
201
  });
204
202
  return properties;
205
203
  }
206
- return [
207
- `*{${hooks.init}}${hooks.rule}`,
208
- function css(properties) {
209
- return cssImpl(JSON.parse(JSON.stringify(properties)));
210
- },
211
- ];
204
+ function css(properties) {
205
+ return cssImpl(JSON.parse(JSON.stringify(properties)));
206
+ }
207
+ return [`*{${hooks.init}}${hooks.rule}`, css];
212
208
  };
213
209
  }
214
210
  exports.buildHooksSystem = buildHooksSystem;
package/esm/index.js CHANGED
@@ -182,29 +182,25 @@ export function buildHooksSystem(stringify = genericStringify) {
182
182
  }
183
183
  return v;
184
184
  });
185
- for (const propertyName in innerProperties) {
185
+ for (const propertyNameStr in innerProperties) {
186
+ const propertyName = propertyNameStr;
186
187
  const v1 = stringifyImpl(propertyName, innerProperties[propertyName]);
187
188
  if (v1 !== null) {
188
189
  let v0 = fallback(propertyName);
189
190
  if (v0 === null) {
190
191
  v0 = fallbackKeyword;
191
192
  }
192
- /* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-explicit-any */
193
- properties[propertyName] =
194
- `var(--${hookId(hookName)}-1, ${v1}) var(--${hookId(hookName)}-0, ${v0})`;
195
- /* eslint-enable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-explicit-any */
193
+ properties[propertyName] = `var(--${hookId(hookName)}-1, ${v1}) var(--${hookId(hookName)}-0, ${v0})`;
196
194
  }
197
195
  }
198
196
  delete properties[hookName];
199
197
  });
200
198
  return properties;
201
199
  }
202
- return [
203
- `*{${hooks.init}}${hooks.rule}`,
204
- function css(properties) {
205
- return cssImpl(JSON.parse(JSON.stringify(properties)));
206
- },
207
- ];
200
+ function css(properties) {
201
+ return cssImpl(JSON.parse(JSON.stringify(properties)));
202
+ }
203
+ return [`*{${hooks.init}}${hooks.rule}`, css];
208
204
  };
209
205
  }
210
206
  /**
package/package.json CHANGED
@@ -1,19 +1,17 @@
1
1
  {
2
2
  "name": "@css-hooks/core",
3
3
  "description": "CSS Hooks core library",
4
- "version": "1.5.1",
4
+ "version": "1.5.3",
5
5
  "author": "Nick Saunders",
6
6
  "devDependencies": {
7
7
  "@tsconfig/strictest": "^2.0.1",
8
8
  "@types/css-tree": "^2.3.2",
9
- "@types/jest": "^29.5.3",
10
9
  "@typescript-eslint/eslint-plugin": "^6.3.0",
11
10
  "@typescript-eslint/parser": "^6.3.0",
12
11
  "css-tree": "^2.3.1",
13
12
  "eslint": "^8.47.0",
14
- "jest": "^29.6.2",
15
13
  "rimraf": "^5.0.1",
16
- "ts-jest": "^29.1.1",
14
+ "tsc-watch": "^6.0.4",
17
15
  "typescript": "^5.1.6"
18
16
  },
19
17
  "files": [
@@ -24,6 +22,7 @@
24
22
  "license": "MIT",
25
23
  "main": "cjs",
26
24
  "module": "esm",
25
+ "type": "module",
27
26
  "private": false,
28
27
  "repository": {
29
28
  "type": "git",
@@ -31,11 +30,18 @@
31
30
  "directory": "packages/core"
32
31
  },
33
32
  "scripts": {
34
- "clean": "rimraf cjs esm types",
35
- "compile": "tsc",
36
- "lint": "eslint __tests__ src .*.*js *.*js",
33
+ "clean": "rimraf cjs esm out types",
34
+ "lint": "eslint src .*.*js *.*js",
37
35
  "prepublishOnly": "tsc -p tsconfig.dist.json --outDir esm --module es6 && tsc -p tsconfig.dist.json --outDir cjs --module commonjs && tsc -p tsconfig.dist.json --outDir types --declaration --emitDeclarationOnly",
38
- "test": "jest"
36
+ "test": "tsc && node --test",
37
+ "test.watch": "tsc-watch --onSuccess 'node --test'"
39
38
  },
40
- "types": "types"
39
+ "types": "types",
40
+ "exports": {
41
+ ".": {
42
+ "import": "./esm/index.js",
43
+ "require": "./cjs/index.js",
44
+ "types": "./types/index.d.ts"
45
+ }
46
+ }
41
47
  }
package/types/index.d.ts CHANGED
@@ -18,7 +18,7 @@ export declare function buildHooksSystem<Properties = Record<string, unknown>>(s
18
18
  /** @internal */ hookNameToId?: (hookName: string) => string;
19
19
  }) & {
20
20
  fallback?: "unset" | "revert-layer";
21
- }) | undefined) => readonly [`*{${string}}undefined` | `*{${string}}${string}`, (properties: WithHooks<HookProperties, Properties>) => Properties];
21
+ }) | undefined) => [string, (properties: WithHooks<HookProperties, Properties>) => Properties];
22
22
  /**
23
23
  * A list of hooks offered as a "sensible default" to solve the most common use cases.
24
24
  *