@css-hooks/preact 4.0.0-next.27 → 4.0.0-next.29

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 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.27/.github/logomark.svg" height="128" /></a><br/><br/>
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.29/.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.27/.github/wordmark-dark.svg" width="256"></a>
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.29/.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.27"><img src="https://img.shields.io/badge/tag-v4.0.0--next.27-ffd700" alt="tag v4.0.0-next.27"></a>
12
- <a href="https://www.npmjs.com/package/@css-hooks/preact/v/4.0.0-next.27"><img src="https://img.shields.io/badge/npm-v4.0.0--next.27-ffd700" alt="npm version"></a>
13
- <a href="https://github.com/css-hooks/css-hooks/blob/v4.0.0-next.27/LICENSE"><img src="https://img.shields.io/badge/license-MIT-ffd700" alt="license"></a>
11
+ <a href="https://github.com/css-hooks/css-hooks/tree/v4.0.0-next.29"><img src="https://img.shields.io/badge/tag-v4.0.0--next.29-ffd700" alt="tag v4.0.0-next.29"></a>
12
+ <a href="https://www.npmjs.com/package/@css-hooks/preact/v/4.0.0-next.29"><img src="https://img.shields.io/badge/npm-v4.0.0--next.29-ffd700" alt="npm version"></a>
13
+ <a href="https://github.com/css-hooks/css-hooks/blob/v4.0.0-next.29/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
@@ -10,6 +10,7 @@ exports._stringifyValue = _stringifyValue;
10
10
  const core_1 = require("@css-hooks/core");
11
11
  var core_2 = require("@css-hooks/core");
12
12
  Object.defineProperty(exports, "mergeStyles", { enumerable: true, get: function () { return core_2.mergeStyles; } });
13
+ const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
13
14
  /**
14
15
  * A {@link @css-hooks/core#CreateHooksFn} configured to use Preact's
15
16
  * `CSSProperties` type and logic for converting CSS values into strings
@@ -18,12 +19,12 @@ Object.defineProperty(exports, "mergeStyles", { enumerable: true, get: function
18
19
  */
19
20
  exports.createHooks = (0, core_1.buildHooksSystem)(_stringifyValue);
20
21
  /** @internal */
21
- function _stringifyValue(value, _propertyName) {
22
+ function _stringifyValue(value, propertyName) {
22
23
  switch (typeof value) {
23
24
  case "string":
24
25
  return value;
25
26
  case "number":
26
- return String(value);
27
+ return `${value}${IS_NON_DIMENSIONAL.test(propertyName) ? "" : "px"}`;
27
28
  default:
28
29
  return null;
29
30
  }
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
package/esm/index.js CHANGED
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { buildHooksSystem } from "@css-hooks/core";
7
7
  export { mergeStyles } from "@css-hooks/core";
8
+ const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
8
9
  /**
9
10
  * A {@link @css-hooks/core#CreateHooksFn} configured to use Preact's
10
11
  * `CSSProperties` type and logic for converting CSS values into strings
@@ -13,12 +14,12 @@ export { mergeStyles } from "@css-hooks/core";
13
14
  */
14
15
  export const createHooks = buildHooksSystem(_stringifyValue);
15
16
  /** @internal */
16
- export function _stringifyValue(value, _propertyName) {
17
+ export function _stringifyValue(value, propertyName) {
17
18
  switch (typeof value) {
18
19
  case "string":
19
20
  return value;
20
21
  case "number":
21
- return String(value);
22
+ return `${value}${IS_NON_DIMENSIONAL.test(propertyName) ? "" : "px"}`;
22
23
  default:
23
24
  return null;
24
25
  }
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": "4.0.0-next.27",
4
+ "version": "4.0.0-next.29",
5
5
  "author": "Nick Saunders",
6
6
  "dependencies": {
7
- "@css-hooks/core": "4.0.0-next.27"
7
+ "@css-hooks/core": "4.0.0-next.29"
8
8
  },
9
9
  "devDependencies": {
10
10
  "preact": "^11.0.0-0",
@@ -18,8 +18,8 @@
18
18
  "!**/*.test.*"
19
19
  ],
20
20
  "license": "MIT",
21
- "main": "cjs",
22
- "module": "esm",
21
+ "main": "./cjs/index.js",
22
+ "module": "./esm/index.js",
23
23
  "type": "module",
24
24
  "peerDependencies": {
25
25
  "preact": "^10.27.2 || ^11.0.0-0"
@@ -49,7 +49,7 @@
49
49
  ]
50
50
  },
51
51
  "build": {
52
- "command": "tsc && tsc --project tsconfig.cjs.json",
52
+ "command": "tsc && tsc --project tsconfig.cjs.json && node -e \"require('node:fs').writeFileSync('cjs/package.json', JSON.stringify({type:'commonjs'}))\"",
53
53
  "dependencies": [
54
54
  "../core:build"
55
55
  ]
package/types/index.d.ts CHANGED
@@ -17,4 +17,4 @@ export type { CSSPropertyConflicts } from "./css-property-conflicts.ts";
17
17
  */
18
18
  export declare const createHooks: CreateHooksFn<CSSProperties, CSSPropertyConflicts>;
19
19
  /** @internal */
20
- export declare function _stringifyValue(value: unknown, _propertyName: string): string | null;
20
+ export declare function _stringifyValue(value: unknown, propertyName: string): string | null;