@css-hooks/qwik 4.0.0-next.5 → 4.0.0-next.50

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.5/.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.50/.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.5/.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.50/.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.5"><img src="https://img.shields.io/badge/tag-v4.0.0--next.5-ffd700" alt="tag v4.0.0-next.5"></a>
12
- <a href="https://www.npmjs.com/package/@css-hooks/qwik/v/4.0.0-next.5"><img src="https://img.shields.io/badge/npm-v4.0.0--next.5-ffd700" alt="npm version"></a>
13
- <a href="https://github.com/css-hooks/css-hooks/blob/v4.0.0-next.5/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.50"><img src="https://img.shields.io/badge/tag-v4.0.0--next.50-ffd700" alt="tag v4.0.0-next.50"></a>
12
+ <a href="https://www.npmjs.com/package/@css-hooks/qwik/v/4.0.0-next.50"><img src="https://img.shields.io/badge/npm-v4.0.0--next.50-ffd700" alt="npm version"></a>
13
+ <a href="https://github.com/css-hooks/css-hooks/blob/v4.0.0-next.50/LICENSE"><img src="https://img.shields.io/badge/license-MIT-ffd700" alt="license"></a>
14
14
  </div>
15
15
 
16
16
  ---
@@ -101,9 +101,9 @@ experience without runtime style injection or build steps.
101
101
 
102
102
  ### Browser support
103
103
 
104
- | <img src="https://dl.svgcdn.com/svg/logos/chrome.svg" alt="Chrome" width="24" height="24" /><br/>Chrome | <img src="https://dl.svgcdn.com/svg/logos/microsoft-edge.svg" alt="Edge" width="24" height="24" /><br/>Edge | <img src="https://dl.svgcdn.com/svg/logos/safari.svg" alt="Safari" width="24" height="24" /><br/>Safari | <img src="https://dl.svgcdn.com/svg/logos/firefox.svg" alt="Firefox" width="24" height="24" /><br/>Firefox | <img src="https://dl.svgcdn.com/svg/logos/opera.svg" alt="Opera" width="24" height="24" /><br/>Opera |
105
- | :-----------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------: |
106
- | 99+ | 99+ | 15.4+ | 97+ | 85+ |
104
+ | <img src="https://cdnjs.cloudflare.com/ajax/libs/browser-logos/74.1.0/chrome/chrome_24x24.png" alt="Chrome" /><br/>Chrome | <img src="https://cdnjs.cloudflare.com/ajax/libs/browser-logos/74.1.0/edge/edge_24x24.png" alt="Edge" /><br/>Edge | <img src="https://cdnjs.cloudflare.com/ajax/libs/browser-logos/74.1.0/safari/safari_24x24.png" alt="Safari" /><br/>Safari | <img src="https://cdnjs.cloudflare.com/ajax/libs/browser-logos/74.1.0/firefox/firefox_24x24.png" alt="Firefox" /><br/>Firefox | <img src="https://cdnjs.cloudflare.com/ajax/libs/browser-logos/74.1.0/opera/opera_24x24.png" alt="Opera" /><br/>Opera |
105
+ | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
106
+ | <div align="center">111+</div> | <div align="center">111+</div> | <div align="center">18+</div> | <div align="center">151+</div> | <div align="center">98+</div> |
107
107
 
108
108
  ## Documentation
109
109
 
package/cjs/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * @packageDocumentation
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports._unitlessNumbers = exports.createHooks = void 0;
8
+ exports._unitlessNumbers = exports.mergeStyles = exports.createHooks = void 0;
9
9
  exports._stringifyValue = _stringifyValue;
10
10
  const core_1 = require("@css-hooks/core");
11
11
  /** @internal */
@@ -19,13 +19,16 @@ function _stringifyValue(value, propertyName) {
19
19
  return null;
20
20
  }
21
21
  }
22
+ const hooksSystem = (0, core_1.createHooksSystem)(_stringifyValue);
22
23
  /**
23
- * A {@link @css-hooks/core#CreateHooksFn} configured to use Qwik's
24
- * `CSSProperties` type and logic for converting CSS values into strings
24
+ * A hook factory configured to use Qwik's `CSSProperties` type and logic for
25
+ * converting CSS values into strings
25
26
  *
26
27
  * @public
27
28
  */
28
- exports.createHooks = (0, core_1.buildHooksSystem)(_stringifyValue);
29
+ exports.createHooks = hooksSystem.createHooks;
30
+ /** A style merger configured to use Qwik's `CSSProperties` type. @public */
31
+ exports.mergeStyles = hooksSystem.mergeStyles;
29
32
  /**
30
33
  * Following code (c) Builder.io. Source modified to account for custom
31
34
  * properties.
@@ -82,5 +85,11 @@ exports._unitlessNumbers = new Set([
82
85
  "WebkitLineClamp",
83
86
  ]);
84
87
  function isUnitlessNumber(name) {
85
- return /^--/.test(name) || exports._unitlessNumbers.has(name);
88
+ if (name.startsWith("--")) {
89
+ return true;
90
+ }
91
+ const camelCaseName = name
92
+ .replace(/^-ms-/, "ms-")
93
+ .replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
94
+ return exports._unitlessNumbers.has(camelCaseName);
86
95
  }
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
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,13 +1,13 @@
1
1
  {
2
2
  "name": "@css-hooks/qwik",
3
3
  "description": "CSS Hooks for Qwik",
4
- "version": "4.0.0-next.5",
4
+ "version": "4.0.0-next.50",
5
5
  "author": "Nick Saunders",
6
6
  "dependencies": {
7
- "@css-hooks/core": "4.0.0-next.5"
7
+ "@css-hooks/core": "4.0.0-next.50"
8
8
  },
9
9
  "devDependencies": {
10
- "@builder.io/qwik": "^1.9.0",
10
+ "@qwik.dev/core": "^2.0.0-beta.30",
11
11
  "remeda": "^2.45.0"
12
12
  },
13
13
  "files": [
@@ -18,18 +18,20 @@
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",
@@ -49,7 +51,7 @@
49
51
  ]
50
52
  },
51
53
  "build": {
52
- "command": "tsc && tsc --project tsconfig.cjs.json",
54
+ "command": "tsc && tsc --project tsconfig.cjs.json && node -e \"require('node:fs').writeFileSync('cjs/package.json', JSON.stringify({type:'commonjs'}))\"",
53
55
  "dependencies": [
54
56
  "../core:build"
55
57
  ]
@@ -1,4 +1,8 @@
1
- /** A map of conflicting CSS property names */
1
+ /**
2
+ * A map of conflicting CSS property names
3
+ *
4
+ * @public
5
+ */
2
6
  export type CSSPropertyConflicts = {
3
7
  "-webkit-align-content": "WebkitAlignContent" | "align-content" | "alignContent" | "all" | "place-content" | "placeContent";
4
8
  "-webkit-align-items": "WebkitAlignItems" | "align-items" | "alignItems" | "all" | "place-items" | "placeItems";
package/types/index.d.ts CHANGED
@@ -3,19 +3,24 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
- import type { CSSProperties } from "@builder.io/qwik";
7
- import type { CreateHooksFn } from "@css-hooks/core";
6
+ import type { CSSProperties } from "@qwik.dev/core";
8
7
  import type { CSSPropertyConflicts } from "./css-property-conflicts.ts";
9
8
  export type * from "@css-hooks/core";
9
+ export type { CSSPropertyConflicts } from "./css-property-conflicts.ts";
10
10
  /** @internal */
11
11
  export declare function _stringifyValue(value: unknown, propertyName: string): string | null;
12
12
  /**
13
- * A {@link @css-hooks/core#CreateHooksFn} configured to use Qwik's
14
- * `CSSProperties` type and logic for converting CSS values into strings
13
+ * A hook factory configured to use Qwik's `CSSProperties` type and logic for
14
+ * converting CSS values into strings
15
15
  *
16
16
  * @public
17
17
  */
18
- export declare const createHooks: CreateHooksFn<CSSProperties, CSSPropertyConflicts>;
18
+ export declare const createHooks: import("@css-hooks/core").CreateHooksFn<CSSProperties, CSSPropertyConflicts>;
19
+ /** A style merger configured to use Qwik's `CSSProperties` type. @public */
20
+ export declare const mergeStyles: <const OverrideStyle extends CSSProperties, Style extends CSSProperties>(overrideStyle: OverrideStyle | null | undefined) => {
21
+ <ActualStyle extends CSSProperties>(style: ActualStyle): Omit<ActualStyle, keyof OverrideStyle> & OverrideStyle;
22
+ (style: CSSProperties & Style): Omit<Style, keyof OverrideStyle> & OverrideStyle;
23
+ };
19
24
  /**
20
25
  * Following code (c) Builder.io. Source modified to account for custom
21
26
  * properties.