@css-hooks/react 1.8.2 → 2.0.0
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 +69 -37
- package/cjs/index.js +101 -31
- package/esm/index.js +97 -24
- package/package.json +13 -5
- package/types/index.d.ts +19 -30
- package/cjs/isUnitlessNumber.js +0 -93
- package/esm/isUnitlessNumber.js +0 -89
- package/types/isUnitlessNumber.d.ts +0 -14
package/README.md
CHANGED
|
@@ -15,55 +15,87 @@
|
|
|
15
15
|
|
|
16
16
|
## Overview
|
|
17
17
|
|
|
18
|
-
Hooks
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
Hooks add CSS features to native inline styles, enabling you to apply styles
|
|
19
|
+
conditionally based on pseudo-classes, custom selectors, media queries, and
|
|
20
|
+
more—all without leaving the `style` prop. By exploiting the hidden
|
|
21
|
+
programmability of CSS Variables, CSS Hooks delivers a flexible CSS-in-JS
|
|
22
|
+
experience without runtime style injection or build steps.
|
|
23
|
+
|
|
24
|
+
## Feature highlights
|
|
25
|
+
|
|
26
|
+
### Pseudo-classes
|
|
22
27
|
|
|
23
28
|
```jsx
|
|
24
|
-
<
|
|
25
|
-
href="https://css-hooks.com/"
|
|
29
|
+
<button
|
|
26
30
|
style={css({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
31
|
+
background: "#004982",
|
|
32
|
+
color: "#eeeff0",
|
|
33
|
+
on: $ => [
|
|
34
|
+
$("&:hover", {
|
|
35
|
+
background: "#1b659c",
|
|
36
|
+
}),
|
|
37
|
+
$("&:active", {
|
|
38
|
+
background: "#9f3131",
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
38
41
|
})}
|
|
39
42
|
>
|
|
40
|
-
|
|
41
|
-
</
|
|
43
|
+
Save changes
|
|
44
|
+
</button>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Selectors
|
|
48
|
+
|
|
49
|
+
```jsx
|
|
50
|
+
<label>
|
|
51
|
+
<input type="checkbox" checked />
|
|
52
|
+
<span
|
|
53
|
+
style={css({
|
|
54
|
+
on: $ => [
|
|
55
|
+
$(":checked + &", {
|
|
56
|
+
textDecoration: "line-through",
|
|
57
|
+
}),
|
|
58
|
+
],
|
|
59
|
+
})}
|
|
60
|
+
>
|
|
61
|
+
Simplify CSS architecture
|
|
62
|
+
</span>
|
|
63
|
+
</label>
|
|
42
64
|
```
|
|
43
65
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
66
|
+
### Responsive design
|
|
67
|
+
|
|
68
|
+
```jsx
|
|
69
|
+
<>
|
|
70
|
+
<span
|
|
71
|
+
style={css({
|
|
72
|
+
on: ($, { not }) => [
|
|
73
|
+
$(not("@container sm"), {
|
|
74
|
+
display: "none",
|
|
75
|
+
}),
|
|
76
|
+
],
|
|
77
|
+
})}
|
|
78
|
+
>
|
|
79
|
+
sm
|
|
80
|
+
</span>
|
|
81
|
+
<span
|
|
82
|
+
style={css({
|
|
83
|
+
on: ($, { not }) => [
|
|
84
|
+
$(not("@container lg"), {
|
|
85
|
+
display: "none",
|
|
86
|
+
}),
|
|
87
|
+
],
|
|
88
|
+
})}
|
|
89
|
+
>
|
|
90
|
+
lg
|
|
91
|
+
</span>
|
|
92
|
+
</>
|
|
93
|
+
```
|
|
47
94
|
|
|
48
95
|
## Documentation
|
|
49
96
|
|
|
50
97
|
Please visit [css-hooks.com](https://css-hooks.com) to get started.
|
|
51
98
|
|
|
52
|
-
## Packages
|
|
53
|
-
|
|
54
|
-
- [@css-hooks/recommended](packages/recommended): Recommended hook configuration
|
|
55
|
-
with sensible defaults
|
|
56
|
-
- [@css-hooks/react](https://github.com/css-hooks/css-hooks/tree/master/packages/react):
|
|
57
|
-
React framework integration
|
|
58
|
-
- [@css-hooks/preact](https://github.com/css-hooks/css-hooks/tree/master/packages/preact):
|
|
59
|
-
Preact framework integration
|
|
60
|
-
- [@css-hooks/solid](https://github.com/css-hooks/css-hooks/tree/master/packages/solid):
|
|
61
|
-
Solid framework integration
|
|
62
|
-
- [@css-hooks/qwik](https://github.com/css-hooks/css-hooks/tree/master/packages/qwik):
|
|
63
|
-
Qwik framework integration
|
|
64
|
-
- [@css-hooks/core](https://github.com/css-hooks/css-hooks/tree/master/packages/core):
|
|
65
|
-
Core package (internal / advanced use cases)
|
|
66
|
-
|
|
67
99
|
## Contributing
|
|
68
100
|
|
|
69
101
|
Contributions are welcome. Please see the
|
package/cjs/index.js
CHANGED
|
@@ -1,34 +1,104 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
function stringifyValue(propertyName, value) {
|
|
18
|
-
if (typeof value === "string") {
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
if (typeof value === "number") {
|
|
22
|
-
return `${value}${(0, isUnitlessNumber_js_1.default)(propertyName) ? "" : "px"}`;
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
1
|
+
'use strict';
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
4
|
+
const { buildHooksSystem } = require("@css-hooks/core");
|
|
5
|
+
|
|
6
|
+
// See https://github.com/facebook/react/blob/main/packages/react-dom-bindings/src/client/CSSPropertyOperations.js
|
|
7
|
+
function _stringifyValue(propertyName, value) {
|
|
8
|
+
switch (typeof value) {
|
|
9
|
+
case "string":
|
|
10
|
+
return value;
|
|
11
|
+
case "number":
|
|
12
|
+
return `${value}${isUnitlessNumber(propertyName) ? "" : "px"}`;
|
|
13
|
+
default:
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
25
16
|
}
|
|
26
|
-
exports.
|
|
17
|
+
exports._stringifyValue = _stringifyValue
|
|
18
|
+
|
|
19
|
+
const createHooks = buildHooksSystem(_stringifyValue);
|
|
20
|
+
exports.createHooks = createHooks;
|
|
21
|
+
|
|
27
22
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @param config - The hooks to build
|
|
31
|
-
*
|
|
32
|
-
* @returns The `hooks` CSS required to enable the configured hooks, along with the corresponding `css` function for use in components.
|
|
23
|
+
* Following code (c) Meta Platforms, Inc. and affiliates.
|
|
24
|
+
* Source modified to account for custom properties.
|
|
33
25
|
*/
|
|
34
|
-
|
|
26
|
+
|
|
27
|
+
const _unitlessNumbers = new Set([
|
|
28
|
+
"animationIterationCount",
|
|
29
|
+
"aspectRatio",
|
|
30
|
+
"borderImageOutset",
|
|
31
|
+
"borderImageSlice",
|
|
32
|
+
"borderImageWidth",
|
|
33
|
+
"boxFlex",
|
|
34
|
+
"boxFlexGroup",
|
|
35
|
+
"boxOrdinalGroup",
|
|
36
|
+
"columnCount",
|
|
37
|
+
"columns",
|
|
38
|
+
"flex",
|
|
39
|
+
"flexGrow",
|
|
40
|
+
"flexPositive",
|
|
41
|
+
"flexShrink",
|
|
42
|
+
"flexNegative",
|
|
43
|
+
"flexOrder",
|
|
44
|
+
"gridArea",
|
|
45
|
+
"gridRow",
|
|
46
|
+
"gridRowEnd",
|
|
47
|
+
"gridRowSpan",
|
|
48
|
+
"gridRowStart",
|
|
49
|
+
"gridColumn",
|
|
50
|
+
"gridColumnEnd",
|
|
51
|
+
"gridColumnSpan",
|
|
52
|
+
"gridColumnStart",
|
|
53
|
+
"fontWeight",
|
|
54
|
+
"lineClamp",
|
|
55
|
+
"lineHeight",
|
|
56
|
+
"opacity",
|
|
57
|
+
"order",
|
|
58
|
+
"orphans",
|
|
59
|
+
"scale",
|
|
60
|
+
"tabSize",
|
|
61
|
+
"widows",
|
|
62
|
+
"zIndex",
|
|
63
|
+
"zoom",
|
|
64
|
+
"fillOpacity", // SVG-related properties
|
|
65
|
+
"floodOpacity",
|
|
66
|
+
"stopOpacity",
|
|
67
|
+
"strokeDasharray",
|
|
68
|
+
"strokeDashoffset",
|
|
69
|
+
"strokeMiterlimit",
|
|
70
|
+
"strokeOpacity",
|
|
71
|
+
"strokeWidth",
|
|
72
|
+
"MozAnimationIterationCount", // Known Prefixed Properties
|
|
73
|
+
"MozBoxFlex", // TODO: Remove these since they shouldn't be used in modern code
|
|
74
|
+
"MozBoxFlexGroup",
|
|
75
|
+
"MozLineClamp",
|
|
76
|
+
"msAnimationIterationCount",
|
|
77
|
+
"msFlex",
|
|
78
|
+
"msZoom",
|
|
79
|
+
"msFlexGrow",
|
|
80
|
+
"msFlexNegative",
|
|
81
|
+
"msFlexOrder",
|
|
82
|
+
"msFlexPositive",
|
|
83
|
+
"msFlexShrink",
|
|
84
|
+
"msGridColumn",
|
|
85
|
+
"msGridColumnSpan",
|
|
86
|
+
"msGridRow",
|
|
87
|
+
"msGridRowSpan",
|
|
88
|
+
"WebkitAnimationIterationCount",
|
|
89
|
+
"WebkitBoxFlex",
|
|
90
|
+
"WebKitBoxFlexGroup",
|
|
91
|
+
"WebkitBoxOrdinalGroup",
|
|
92
|
+
"WebkitColumnCount",
|
|
93
|
+
"WebkitColumns",
|
|
94
|
+
"WebkitFlex",
|
|
95
|
+
"WebkitFlexGrow",
|
|
96
|
+
"WebkitFlexPositive",
|
|
97
|
+
"WebkitFlexShrink",
|
|
98
|
+
"WebkitLineClamp",
|
|
99
|
+
]);
|
|
100
|
+
exports._unitlessNumbers = _unitlessNumbers;
|
|
101
|
+
|
|
102
|
+
function isUnitlessNumber(name) {
|
|
103
|
+
return /^--/.test(name) || _unitlessNumbers.has(name);
|
|
104
|
+
}
|
package/esm/index.js
CHANGED
|
@@ -1,27 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return `${value}${isUnitlessNumber(propertyName) ? "" : "px"}`;
|
|
16
|
-
}
|
|
17
|
-
return null;
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
import { buildHooksSystem } from "@css-hooks/core";
|
|
4
|
+
|
|
5
|
+
// See https://github.com/facebook/react/blob/main/packages/react-dom-bindings/src/client/CSSPropertyOperations.js
|
|
6
|
+
export function _stringifyValue(propertyName, value) {
|
|
7
|
+
switch (typeof value) {
|
|
8
|
+
case "string":
|
|
9
|
+
return value;
|
|
10
|
+
case "number":
|
|
11
|
+
return `${value}${isUnitlessNumber(propertyName) ? "" : "px"}`;
|
|
12
|
+
default:
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
18
15
|
}
|
|
16
|
+
|
|
17
|
+
export const createHooks = buildHooksSystem(_stringifyValue);
|
|
18
|
+
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @param config - The hooks to build
|
|
23
|
-
*
|
|
24
|
-
* @returns The `hooks` CSS required to enable the configured hooks, along with the corresponding `css` function for use in components.
|
|
20
|
+
* Following code (c) Meta Platforms, Inc. and affiliates.
|
|
21
|
+
* Source modified to account for custom properties.
|
|
25
22
|
*/
|
|
26
|
-
|
|
27
|
-
export
|
|
23
|
+
|
|
24
|
+
export const _unitlessNumbers = new Set([
|
|
25
|
+
"animationIterationCount",
|
|
26
|
+
"aspectRatio",
|
|
27
|
+
"borderImageOutset",
|
|
28
|
+
"borderImageSlice",
|
|
29
|
+
"borderImageWidth",
|
|
30
|
+
"boxFlex",
|
|
31
|
+
"boxFlexGroup",
|
|
32
|
+
"boxOrdinalGroup",
|
|
33
|
+
"columnCount",
|
|
34
|
+
"columns",
|
|
35
|
+
"flex",
|
|
36
|
+
"flexGrow",
|
|
37
|
+
"flexPositive",
|
|
38
|
+
"flexShrink",
|
|
39
|
+
"flexNegative",
|
|
40
|
+
"flexOrder",
|
|
41
|
+
"gridArea",
|
|
42
|
+
"gridRow",
|
|
43
|
+
"gridRowEnd",
|
|
44
|
+
"gridRowSpan",
|
|
45
|
+
"gridRowStart",
|
|
46
|
+
"gridColumn",
|
|
47
|
+
"gridColumnEnd",
|
|
48
|
+
"gridColumnSpan",
|
|
49
|
+
"gridColumnStart",
|
|
50
|
+
"fontWeight",
|
|
51
|
+
"lineClamp",
|
|
52
|
+
"lineHeight",
|
|
53
|
+
"opacity",
|
|
54
|
+
"order",
|
|
55
|
+
"orphans",
|
|
56
|
+
"scale",
|
|
57
|
+
"tabSize",
|
|
58
|
+
"widows",
|
|
59
|
+
"zIndex",
|
|
60
|
+
"zoom",
|
|
61
|
+
"fillOpacity", // SVG-related properties
|
|
62
|
+
"floodOpacity",
|
|
63
|
+
"stopOpacity",
|
|
64
|
+
"strokeDasharray",
|
|
65
|
+
"strokeDashoffset",
|
|
66
|
+
"strokeMiterlimit",
|
|
67
|
+
"strokeOpacity",
|
|
68
|
+
"strokeWidth",
|
|
69
|
+
"MozAnimationIterationCount", // Known Prefixed Properties
|
|
70
|
+
"MozBoxFlex", // TODO: Remove these since they shouldn't be used in modern code
|
|
71
|
+
"MozBoxFlexGroup",
|
|
72
|
+
"MozLineClamp",
|
|
73
|
+
"msAnimationIterationCount",
|
|
74
|
+
"msFlex",
|
|
75
|
+
"msZoom",
|
|
76
|
+
"msFlexGrow",
|
|
77
|
+
"msFlexNegative",
|
|
78
|
+
"msFlexOrder",
|
|
79
|
+
"msFlexPositive",
|
|
80
|
+
"msFlexShrink",
|
|
81
|
+
"msGridColumn",
|
|
82
|
+
"msGridColumnSpan",
|
|
83
|
+
"msGridRow",
|
|
84
|
+
"msGridRowSpan",
|
|
85
|
+
"WebkitAnimationIterationCount",
|
|
86
|
+
"WebkitBoxFlex",
|
|
87
|
+
"WebKitBoxFlexGroup",
|
|
88
|
+
"WebkitBoxOrdinalGroup",
|
|
89
|
+
"WebkitColumnCount",
|
|
90
|
+
"WebkitColumns",
|
|
91
|
+
"WebkitFlex",
|
|
92
|
+
"WebkitFlexGrow",
|
|
93
|
+
"WebkitFlexPositive",
|
|
94
|
+
"WebkitFlexShrink",
|
|
95
|
+
"WebkitLineClamp",
|
|
96
|
+
]);
|
|
97
|
+
|
|
98
|
+
function isUnitlessNumber(name) {
|
|
99
|
+
return /^--/.test(name) || _unitlessNumbers.has(name);
|
|
100
|
+
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@css-hooks/react",
|
|
3
3
|
"description": "CSS Hooks for React",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"author": "Nick Saunders",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@css-hooks/core": "^
|
|
7
|
+
"@css-hooks/core": "^2.0.0"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
+
"@microsoft/api-extractor": "^7.39.4",
|
|
10
11
|
"@tsconfig/strictest": "^2.0.1",
|
|
11
12
|
"@types/react": "^18.2.20",
|
|
12
13
|
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
|
13
14
|
"@typescript-eslint/parser": "^6.7.2",
|
|
15
|
+
"ascjs": "^6.0.3",
|
|
14
16
|
"eslint": "^8.50.0",
|
|
17
|
+
"eslint-plugin-compat": "^4.2.0",
|
|
15
18
|
"rimraf": "^5.0.1",
|
|
16
19
|
"ts-watch": "^1.0.8",
|
|
17
20
|
"typescript": "^5.1.6"
|
|
@@ -19,7 +22,8 @@
|
|
|
19
22
|
"files": [
|
|
20
23
|
"cjs",
|
|
21
24
|
"esm",
|
|
22
|
-
"types"
|
|
25
|
+
"types",
|
|
26
|
+
"tsdoc-metadata.json"
|
|
23
27
|
],
|
|
24
28
|
"license": "MIT",
|
|
25
29
|
"main": "cjs",
|
|
@@ -40,10 +44,11 @@
|
|
|
40
44
|
"directory": "packages/react"
|
|
41
45
|
},
|
|
42
46
|
"scripts": {
|
|
47
|
+
"api": "node -e \"var path=require('path').resolve,fs=require('fs'),cp=fs.cpSync;cp(path('src', 'index.d.ts'),path('types','index.d.ts'))\" && api-extractor run",
|
|
43
48
|
"clean": "rimraf cjs esm out types",
|
|
44
49
|
"lint": "eslint src .*.*js *.*js",
|
|
45
50
|
"postversion": "npm install @css-hooks/core@^$npm_package_version --force",
|
|
46
|
-
"prepublishOnly": "
|
|
51
|
+
"prepublishOnly": "node -e \"var path=require('path').resolve,fs=require('fs'),cp=fs.cpSync,mkdir=fs.mkdirSync;cp(path('src', 'index.d.ts'),path('types','index.d.ts'));cp(path('src','index.js'),path('esm','index.js'));mkdir(path('cjs'),{recursive:true})\" && ascjs src/index.js cjs/index.js",
|
|
47
52
|
"test": "tsc && node --test",
|
|
48
53
|
"test.watch": "tsc-watch --onSuccess 'node --test'"
|
|
49
54
|
},
|
|
@@ -54,5 +59,8 @@
|
|
|
54
59
|
"require": "./cjs/index.js",
|
|
55
60
|
"types": "./types/index.d.ts"
|
|
56
61
|
}
|
|
57
|
-
}
|
|
62
|
+
},
|
|
63
|
+
"browserslist": [
|
|
64
|
+
"supports css-variables"
|
|
65
|
+
]
|
|
58
66
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,36 +1,25 @@
|
|
|
1
|
-
import type { CSSProperties } from "react";
|
|
2
|
-
import { recommended } from "@css-hooks/core";
|
|
3
1
|
/**
|
|
4
|
-
* @
|
|
2
|
+
* CSS Hooks for {@link https://react.dev | React}
|
|
5
3
|
*
|
|
6
|
-
* @
|
|
7
|
-
* Theoretically this should line up with the behavior of
|
|
8
|
-
* {@link https://github.com/facebook/react/blob/main/packages/react-dom-bindings/src/client/CSSPropertyOperations.js}.
|
|
4
|
+
* @packageDocumentation
|
|
9
5
|
*/
|
|
10
|
-
|
|
6
|
+
|
|
7
|
+
import type { CSSProperties } from "react";
|
|
8
|
+
import { CreateHooksFn } from "@css-hooks/core";
|
|
9
|
+
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @param config - The hooks to build
|
|
11
|
+
* A {@link @css-hooks/core#CreateHooksFn} configured to use React's
|
|
12
|
+
* `CSSProperties` type and logic for converting CSS values into strings.
|
|
15
13
|
*
|
|
16
|
-
* @
|
|
14
|
+
* @public
|
|
17
15
|
*/
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
hookNameToId?: undefined;
|
|
29
|
-
} | {
|
|
30
|
-
debug?: undefined;
|
|
31
|
-
hookNameToId?: (hookName: string) => string;
|
|
32
|
-
}) & {
|
|
33
|
-
fallback?: "unset" | "revert-layer";
|
|
34
|
-
sort?: boolean;
|
|
35
|
-
}) | undefined) => [string, (properties_0: import("@css-hooks/core").WithHooks<HookProperties, CSSProperties>, ...properties_1: (import("@css-hooks/core").WithHooks<HookProperties, CSSProperties> | undefined)[]) => CSSProperties];
|
|
36
|
-
export { recommended };
|
|
16
|
+
export const createHooks: CreateHooksFn<CSSProperties>;
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
declare function _stringifyValue(
|
|
20
|
+
propertyName: string,
|
|
21
|
+
value: unknown,
|
|
22
|
+
): string | null;
|
|
23
|
+
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const _unitlessNumbers: Set<string>;
|
package/cjs/isUnitlessNumber.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.unitlessNumbers = void 0;
|
|
10
|
-
/**
|
|
11
|
-
* CSS properties which accept numbers but are not in units of "px".
|
|
12
|
-
*
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
exports.unitlessNumbers = new Set([
|
|
16
|
-
"animationIterationCount",
|
|
17
|
-
"aspectRatio",
|
|
18
|
-
"borderImageOutset",
|
|
19
|
-
"borderImageSlice",
|
|
20
|
-
"borderImageWidth",
|
|
21
|
-
"boxFlex",
|
|
22
|
-
"boxFlexGroup",
|
|
23
|
-
"boxOrdinalGroup",
|
|
24
|
-
"columnCount",
|
|
25
|
-
"columns",
|
|
26
|
-
"flex",
|
|
27
|
-
"flexGrow",
|
|
28
|
-
"flexPositive",
|
|
29
|
-
"flexShrink",
|
|
30
|
-
"flexNegative",
|
|
31
|
-
"flexOrder",
|
|
32
|
-
"gridArea",
|
|
33
|
-
"gridRow",
|
|
34
|
-
"gridRowEnd",
|
|
35
|
-
"gridRowSpan",
|
|
36
|
-
"gridRowStart",
|
|
37
|
-
"gridColumn",
|
|
38
|
-
"gridColumnEnd",
|
|
39
|
-
"gridColumnSpan",
|
|
40
|
-
"gridColumnStart",
|
|
41
|
-
"fontWeight",
|
|
42
|
-
"lineClamp",
|
|
43
|
-
"lineHeight",
|
|
44
|
-
"opacity",
|
|
45
|
-
"order",
|
|
46
|
-
"orphans",
|
|
47
|
-
"scale",
|
|
48
|
-
"tabSize",
|
|
49
|
-
"widows",
|
|
50
|
-
"zIndex",
|
|
51
|
-
"zoom",
|
|
52
|
-
"fillOpacity", // SVG-related properties
|
|
53
|
-
"floodOpacity",
|
|
54
|
-
"stopOpacity",
|
|
55
|
-
"strokeDasharray",
|
|
56
|
-
"strokeDashoffset",
|
|
57
|
-
"strokeMiterlimit",
|
|
58
|
-
"strokeOpacity",
|
|
59
|
-
"strokeWidth",
|
|
60
|
-
"MozAnimationIterationCount", // Known Prefixed Properties
|
|
61
|
-
"MozBoxFlex", // TODO: Remove these since they shouldn't be used in modern code
|
|
62
|
-
"MozBoxFlexGroup",
|
|
63
|
-
"MozLineClamp",
|
|
64
|
-
"msAnimationIterationCount",
|
|
65
|
-
"msFlex",
|
|
66
|
-
"msZoom",
|
|
67
|
-
"msFlexGrow",
|
|
68
|
-
"msFlexNegative",
|
|
69
|
-
"msFlexOrder",
|
|
70
|
-
"msFlexPositive",
|
|
71
|
-
"msFlexShrink",
|
|
72
|
-
"msGridColumn",
|
|
73
|
-
"msGridColumnSpan",
|
|
74
|
-
"msGridRow",
|
|
75
|
-
"msGridRowSpan",
|
|
76
|
-
"WebkitAnimationIterationCount",
|
|
77
|
-
"WebkitBoxFlex",
|
|
78
|
-
"WebKitBoxFlexGroup",
|
|
79
|
-
"WebkitBoxOrdinalGroup",
|
|
80
|
-
"WebkitColumnCount",
|
|
81
|
-
"WebkitColumns",
|
|
82
|
-
"WebkitFlex",
|
|
83
|
-
"WebkitFlexGrow",
|
|
84
|
-
"WebkitFlexPositive",
|
|
85
|
-
"WebkitFlexShrink",
|
|
86
|
-
"WebkitLineClamp",
|
|
87
|
-
]);
|
|
88
|
-
/** @internal */
|
|
89
|
-
function default_1(name) {
|
|
90
|
-
// modified from Meta's source to account for custom properties
|
|
91
|
-
return /^--/.test(name) || exports.unitlessNumbers.has(name);
|
|
92
|
-
}
|
|
93
|
-
exports.default = default_1;
|
package/esm/isUnitlessNumber.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* CSS properties which accept numbers but are not in units of "px".
|
|
9
|
-
*
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export const unitlessNumbers = new Set([
|
|
13
|
-
"animationIterationCount",
|
|
14
|
-
"aspectRatio",
|
|
15
|
-
"borderImageOutset",
|
|
16
|
-
"borderImageSlice",
|
|
17
|
-
"borderImageWidth",
|
|
18
|
-
"boxFlex",
|
|
19
|
-
"boxFlexGroup",
|
|
20
|
-
"boxOrdinalGroup",
|
|
21
|
-
"columnCount",
|
|
22
|
-
"columns",
|
|
23
|
-
"flex",
|
|
24
|
-
"flexGrow",
|
|
25
|
-
"flexPositive",
|
|
26
|
-
"flexShrink",
|
|
27
|
-
"flexNegative",
|
|
28
|
-
"flexOrder",
|
|
29
|
-
"gridArea",
|
|
30
|
-
"gridRow",
|
|
31
|
-
"gridRowEnd",
|
|
32
|
-
"gridRowSpan",
|
|
33
|
-
"gridRowStart",
|
|
34
|
-
"gridColumn",
|
|
35
|
-
"gridColumnEnd",
|
|
36
|
-
"gridColumnSpan",
|
|
37
|
-
"gridColumnStart",
|
|
38
|
-
"fontWeight",
|
|
39
|
-
"lineClamp",
|
|
40
|
-
"lineHeight",
|
|
41
|
-
"opacity",
|
|
42
|
-
"order",
|
|
43
|
-
"orphans",
|
|
44
|
-
"scale",
|
|
45
|
-
"tabSize",
|
|
46
|
-
"widows",
|
|
47
|
-
"zIndex",
|
|
48
|
-
"zoom",
|
|
49
|
-
"fillOpacity", // SVG-related properties
|
|
50
|
-
"floodOpacity",
|
|
51
|
-
"stopOpacity",
|
|
52
|
-
"strokeDasharray",
|
|
53
|
-
"strokeDashoffset",
|
|
54
|
-
"strokeMiterlimit",
|
|
55
|
-
"strokeOpacity",
|
|
56
|
-
"strokeWidth",
|
|
57
|
-
"MozAnimationIterationCount", // Known Prefixed Properties
|
|
58
|
-
"MozBoxFlex", // TODO: Remove these since they shouldn't be used in modern code
|
|
59
|
-
"MozBoxFlexGroup",
|
|
60
|
-
"MozLineClamp",
|
|
61
|
-
"msAnimationIterationCount",
|
|
62
|
-
"msFlex",
|
|
63
|
-
"msZoom",
|
|
64
|
-
"msFlexGrow",
|
|
65
|
-
"msFlexNegative",
|
|
66
|
-
"msFlexOrder",
|
|
67
|
-
"msFlexPositive",
|
|
68
|
-
"msFlexShrink",
|
|
69
|
-
"msGridColumn",
|
|
70
|
-
"msGridColumnSpan",
|
|
71
|
-
"msGridRow",
|
|
72
|
-
"msGridRowSpan",
|
|
73
|
-
"WebkitAnimationIterationCount",
|
|
74
|
-
"WebkitBoxFlex",
|
|
75
|
-
"WebKitBoxFlexGroup",
|
|
76
|
-
"WebkitBoxOrdinalGroup",
|
|
77
|
-
"WebkitColumnCount",
|
|
78
|
-
"WebkitColumns",
|
|
79
|
-
"WebkitFlex",
|
|
80
|
-
"WebkitFlexGrow",
|
|
81
|
-
"WebkitFlexPositive",
|
|
82
|
-
"WebkitFlexShrink",
|
|
83
|
-
"WebkitLineClamp",
|
|
84
|
-
]);
|
|
85
|
-
/** @internal */
|
|
86
|
-
export default function (name) {
|
|
87
|
-
// modified from Meta's source to account for custom properties
|
|
88
|
-
return /^--/.test(name) || unitlessNumbers.has(name);
|
|
89
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* CSS properties which accept numbers but are not in units of "px".
|
|
9
|
-
*
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export declare const unitlessNumbers: Set<string>;
|
|
13
|
-
/** @internal */
|
|
14
|
-
export default function (name: string): boolean;
|