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

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,23 @@
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"];
package/esm/index.js CHANGED
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
- import { buildHooksSystem } from "@css-hooks/core";
6
+ import { createHooksSystem } from "@css-hooks/core";
7
+ /** Unitless properties observed in Chromium, Firefox, and WebKit */
8
+ const UNITLESS = /^(--|(Moz(ForceBrokenImageIcon|TabSize)|lineHeight|tabSize|font(SizeAdjus|Weigh)t|widows|scale|(s|WebkitS)hapeImageThreshold|((border|WebkitMaskBox)Image|maskBorder)(Outset|Slice|Width)?|(Moz|Webkit)Bo(rderImage|x(Flex|OrdinalGroup))|stroke(Dash(array|offset)|Miterlimit|Width)|mathDepth|hyphenateLimit(Char|Line)s|readingOrder|Webkit(BoxFlexGroup|HyphenateLimit(After|Before|Lines)|LineClamp|Perspective)|aspectRatio|(i|WebkitI)nitialLetter|flexLineCount|(a|(Moz|Webkit)A)nimation(IterationCount)?|(c|WebkitC)olumn(s|Count)|(f|WebkitF)lex(Grow|Shrink)?|(o|WebkitO)(pacity|rder)|grid(Area|(Column|Row)(End|Start)?)|(fill|flood|stop|stroke)Opacity|orphans|z(Index|oom))$)/;
7
9
  /** @internal */
8
10
  export function _stringifyValue(value, propertyName) {
9
11
  switch (typeof value) {
@@ -15,68 +17,22 @@ export function _stringifyValue(value, propertyName) {
15
17
  return null;
16
18
  }
17
19
  }
20
+ const hooksSystem = createHooksSystem(_stringifyValue);
18
21
  /**
19
- * A {@link @css-hooks/core#CreateHooksFn} configured to use Qwik's
20
- * `CSSProperties` type and logic for converting CSS values into strings
22
+ * A hook factory configured to use Qwik’s `CSSProperties` type and logic for
23
+ * converting CSS values into strings
21
24
  *
22
25
  * @public
23
26
  */
24
- export const createHooks = buildHooksSystem(_stringifyValue);
25
- /**
26
- * Following code (c) Builder.io. Source modified to account for custom
27
- * properties.
28
- */
29
- /**
30
- * CSS properties which accept numbers but are not in units of "px".
31
- *
32
- * @internal
33
- */
34
- export const _unitlessNumbers = new Set([
35
- "animationIterationCount",
36
- "aspectRatio",
37
- "borderImageOutset",
38
- "borderImageSlice",
39
- "borderImageWidth",
40
- "boxFlex",
41
- "boxFlexGroup",
42
- "boxOrdinalGroup",
43
- "columnCount",
44
- "columns",
45
- "flex",
46
- "flexGrow",
47
- "flexShrink",
48
- "gridArea",
49
- "gridRow",
50
- "gridRowEnd",
51
- "gridRowStart",
52
- "gridColumn",
53
- "gridColumnEnd",
54
- "gridColumnStart",
55
- "fontWeight",
56
- "lineClamp",
57
- "lineHeight",
58
- "opacity",
59
- "order",
60
- "orphans",
61
- "scale",
62
- "tabSize",
63
- "widows",
64
- "zIndex",
65
- "zoom",
66
- "MozAnimationIterationCount", // Known Prefixed Properties
67
- "MozBoxFlex", // TODO: Remove these since they shouldn't be used in modern code
68
- "msFlex",
69
- "msFlexPositive",
70
- "WebkitAnimationIterationCount",
71
- "WebkitBoxFlex",
72
- "WebkitBoxOrdinalGroup",
73
- "WebkitColumnCount",
74
- "WebkitColumns",
75
- "WebkitFlex",
76
- "WebkitFlexGrow",
77
- "WebkitFlexShrink",
78
- "WebkitLineClamp",
79
- ]);
27
+ export const createHooks = hooksSystem.createHooks;
28
+ /** A style merger configured to use Qwik’s `CSSProperties` type. @public */
29
+ export const mergeStyles = hooksSystem.mergeStyles;
80
30
  function isUnitlessNumber(name) {
81
- return /^--/.test(name) || _unitlessNumbers.has(name);
31
+ if (name.startsWith("--")) {
32
+ return true;
33
+ }
34
+ const camelCaseName = name
35
+ .replace(/^-ms-/, "ms-")
36
+ .replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
37
+ return UNITLESS.test(camelCaseName);
82
38
  }
package/package.json CHANGED
@@ -1,47 +1,56 @@
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.93",
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.93"
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",
11
+ "@test/css-property-inventory": "4.0.0-next.93",
12
+ "@test/quickstart": "4.0.0-next.93"
12
13
  },
13
14
  "files": [
14
15
  "cjs",
15
16
  "esm",
16
- "types",
17
17
  "tsdoc-metadata.json",
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
+ "sideEffects": false,
24
25
  "peerDependencies": {
25
- "@builder.io/qwik": ">=1.2.0 <2"
26
+ "@qwik.dev/core": ">=2.0.0-beta.30 <3"
26
27
  },
27
28
  "peerDependenciesMeta": {
28
- "@builder.io/qwik": {
29
+ "@qwik.dev/core": {
29
30
  "optional": true
30
31
  }
31
32
  },
32
33
  "private": false,
34
+ "homepage": "https://next.css-hooks.com",
33
35
  "repository": {
34
36
  "type": "git",
35
37
  "url": "https://github.com/css-hooks/css-hooks.git",
36
38
  "directory": "packages/qwik"
37
39
  },
38
40
  "scripts": {
41
+ "attw": "wireit",
39
42
  "build": "wireit",
40
43
  "codegen": "npm run --silent start -w @scripts/css-property-conflicts -- --casing camel --casing kebab > src/css-property-conflicts.ts",
41
44
  "prepublishOnly": "wireit",
42
- "test": "node --conditions @css-hooks/source --test src/index.test.ts"
45
+ "test": "tsc && node --conditions @css-hooks/source --test test/index.ts test/quickstart.ts"
43
46
  },
44
47
  "wireit": {
48
+ "attw": {
49
+ "command": "attw --pack .",
50
+ "dependencies": [
51
+ "build"
52
+ ]
53
+ },
45
54
  "apix": {
46
55
  "command": "api-extractor run",
47
56
  "dependencies": [
@@ -49,7 +58,7 @@
49
58
  ]
50
59
  },
51
60
  "build": {
52
- "command": "tsc && tsc --project tsconfig.cjs.json",
61
+ "command": "tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json && node -e \"require('node:fs').writeFileSync('cjs/package.json', JSON.stringify({type:'commonjs'}))\"",
53
62
  "dependencies": [
54
63
  "../core:build"
55
64
  ]
@@ -60,13 +69,12 @@
60
69
  ]
61
70
  }
62
71
  },
63
- "types": "types",
72
+ "types": "./esm/index.d.ts",
64
73
  "exports": {
65
74
  ".": {
66
75
  "@css-hooks/source": "./src/index.ts",
67
76
  "import": "./esm/index.js",
68
- "require": "./cjs/index.js",
69
- "types": "./types/index.d.ts"
77
+ "require": "./cjs/index.js"
70
78
  }
71
79
  }
72
80
  }
package/types/index.d.ts DELETED
@@ -1,29 +0,0 @@
1
- /**
2
- * CSS Hooks for {@link https://qwik.dev | Qwik}
3
- *
4
- * @packageDocumentation
5
- */
6
- import type { CSSProperties } from "@builder.io/qwik";
7
- import type { CreateHooksFn } from "@css-hooks/core";
8
- import type { CSSPropertyConflicts } from "./css-property-conflicts.ts";
9
- export type * from "@css-hooks/core";
10
- export type { CSSPropertyConflicts } from "./css-property-conflicts.ts";
11
- /** @internal */
12
- export declare function _stringifyValue(value: unknown, propertyName: string): string | null;
13
- /**
14
- * A {@link @css-hooks/core#CreateHooksFn} configured to use Qwik's
15
- * `CSSProperties` type and logic for converting CSS values into strings
16
- *
17
- * @public
18
- */
19
- export declare const createHooks: CreateHooksFn<CSSProperties, CSSPropertyConflicts>;
20
- /**
21
- * Following code (c) Builder.io. Source modified to account for custom
22
- * properties.
23
- */
24
- /**
25
- * CSS properties which accept numbers but are not in units of "px".
26
- *
27
- * @internal
28
- */
29
- export declare const _unitlessNumbers: Set<string>;
File without changes