@css-hooks/qwik 4.0.0-next.9 → 4.0.0-next.90

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/esm/index.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * CSS Hooks for {@link https://qwik.dev | Qwik}
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import type { HooksSystem } from "@css-hooks/core";
7
+ import type { CSSProperties } from "@qwik.dev/core" with {
8
+ "resolution-mode": "import"
9
+ };
10
+ import type { CSSPropertyConflicts } from "./css-property-conflicts.ts";
11
+ export type * from "@css-hooks/core";
12
+ export type { CSSPropertyConflicts } from "./css-property-conflicts.ts";
13
+ /** @internal */
14
+ export declare function _stringifyValue(value: unknown, propertyName: string): string | null;
15
+ /**
16
+ * A hook factory configured to use Qwik’s `CSSProperties` type and logic for
17
+ * converting CSS values into strings
18
+ *
19
+ * @public
20
+ */
21
+ export declare const createHooks: import("@css-hooks/core").CreateHooksFn<CSSProperties>;
22
+ /** A style merger configured to use Qwik’s `CSSProperties` type. @public */
23
+ export declare const mergeStyles: HooksSystem<CSSProperties, CSSPropertyConflicts>["mergeStyles"];
24
+ /**
25
+ * Following code (c) Builder.io. Source modified to account for custom
26
+ * properties.
27
+ */
28
+ /**
29
+ * CSS properties which accept numbers but are not in units of "px".
30
+ *
31
+ * @internal
32
+ */
33
+ export declare const _unitlessNumbers: Set<string>;
package/esm/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
- import { buildHooksSystem } from "@css-hooks/core";
6
+ import { createHooksSystem } from "@css-hooks/core";
7
7
  /** @internal */
8
8
  export function _stringifyValue(value, propertyName) {
9
9
  switch (typeof value) {
@@ -15,13 +15,16 @@ export function _stringifyValue(value, propertyName) {
15
15
  return null;
16
16
  }
17
17
  }
18
+ const hooksSystem = createHooksSystem(_stringifyValue);
18
19
  /**
19
- * A {@link @css-hooks/core#CreateHooksFn} configured to use Qwik's
20
- * `CSSProperties` type and logic for converting CSS values into strings
20
+ * A hook factory configured to use Qwik’s `CSSProperties` type and logic for
21
+ * converting CSS values into strings
21
22
  *
22
23
  * @public
23
24
  */
24
- export const createHooks = buildHooksSystem(_stringifyValue);
25
+ export const createHooks = hooksSystem.createHooks;
26
+ /** A style merger configured to use Qwik’s `CSSProperties` type. @public */
27
+ export const mergeStyles = hooksSystem.mergeStyles;
25
28
  /**
26
29
  * Following code (c) Builder.io. Source modified to account for custom
27
30
  * properties.
@@ -78,5 +81,11 @@ export const _unitlessNumbers = new Set([
78
81
  "WebkitLineClamp",
79
82
  ]);
80
83
  function isUnitlessNumber(name) {
81
- return /^--/.test(name) || _unitlessNumbers.has(name);
84
+ if (name.startsWith("--")) {
85
+ return true;
86
+ }
87
+ const camelCaseName = name
88
+ .replace(/^-ms-/, "ms-")
89
+ .replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
90
+ return _unitlessNumbers.has(camelCaseName);
82
91
  }
package/package.json CHANGED
@@ -1,47 +1,54 @@
1
1
  {
2
2
  "name": "@css-hooks/qwik",
3
3
  "description": "CSS Hooks for Qwik",
4
- "version": "4.0.0-next.9",
4
+ "version": "4.0.0-next.90",
5
5
  "author": "Nick Saunders",
6
6
  "dependencies": {
7
- "@css-hooks/core": "4.0.0-next.9"
7
+ "@css-hooks/core": "4.0.0-next.90"
8
8
  },
9
9
  "devDependencies": {
10
- "@builder.io/qwik": "^1.9.0",
11
- "remeda": "^2.45.0"
10
+ "@qwik.dev/core": "^2.0.0-beta.30"
12
11
  },
13
12
  "files": [
14
13
  "cjs",
15
14
  "esm",
16
- "types",
17
15
  "tsdoc-metadata.json",
18
16
  "!**/*.test.*"
19
17
  ],
20
18
  "license": "MIT",
21
- "main": "cjs",
22
- "module": "esm",
19
+ "main": "./cjs/index.js",
20
+ "module": "./esm/index.js",
23
21
  "type": "module",
22
+ "sideEffects": false,
24
23
  "peerDependencies": {
25
- "@builder.io/qwik": ">=1.2.0 <2"
24
+ "@qwik.dev/core": ">=2.0.0-beta.30 <3"
26
25
  },
27
26
  "peerDependenciesMeta": {
28
- "@builder.io/qwik": {
27
+ "@qwik.dev/core": {
29
28
  "optional": true
30
29
  }
31
30
  },
32
31
  "private": false,
32
+ "homepage": "https://next.css-hooks.com",
33
33
  "repository": {
34
34
  "type": "git",
35
35
  "url": "https://github.com/css-hooks/css-hooks.git",
36
36
  "directory": "packages/qwik"
37
37
  },
38
38
  "scripts": {
39
+ "attw": "wireit",
39
40
  "build": "wireit",
40
41
  "codegen": "npm run --silent start -w @scripts/css-property-conflicts -- --casing camel --casing kebab > src/css-property-conflicts.ts",
41
42
  "prepublishOnly": "wireit",
42
43
  "test": "node --conditions @css-hooks/source --test src/index.test.ts"
43
44
  },
44
45
  "wireit": {
46
+ "attw": {
47
+ "command": "attw --pack .",
48
+ "dependencies": [
49
+ "build"
50
+ ]
51
+ },
45
52
  "apix": {
46
53
  "command": "api-extractor run",
47
54
  "dependencies": [
@@ -49,7 +56,7 @@
49
56
  ]
50
57
  },
51
58
  "build": {
52
- "command": "tsc && tsc --project tsconfig.cjs.json",
59
+ "command": "tsc && tsc --project tsconfig.cjs.json && node -e \"require('node:fs').writeFileSync('cjs/package.json', JSON.stringify({type:'commonjs'}))\"",
53
60
  "dependencies": [
54
61
  "../core:build"
55
62
  ]
@@ -60,13 +67,12 @@
60
67
  ]
61
68
  }
62
69
  },
63
- "types": "types",
70
+ "types": "./esm/index.d.ts",
64
71
  "exports": {
65
72
  ".": {
66
73
  "@css-hooks/source": "./src/index.ts",
67
74
  "import": "./esm/index.js",
68
- "require": "./cjs/index.js",
69
- "types": "./types/index.d.ts"
75
+ "require": "./cjs/index.js"
70
76
  }
71
77
  }
72
78
  }
File without changes