@hypergood/css-core 0.1.0 → 0.1.1
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/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -25
- package/dist/index.d.ts +3 -25
- package/dist/index.js.map +1 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js.map +1 -1
- package/package.json +1 -1
- package/src/css-properties.ts +4 -29
- package/src/runtime.ts +6 -1
package/src/css-properties.ts
CHANGED
|
@@ -1,43 +1,18 @@
|
|
|
1
1
|
import type * as CSS from "csstype";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
* A value allowed inside a {@link CSSProperties} object: a string, a number, an
|
|
5
|
-
* array of strings/numbers (e.g. for fallback values), or a nested
|
|
6
|
-
* {@link CSSProperties} object (e.g. for selectors, media queries, or
|
|
7
|
-
* at-rules).
|
|
8
|
-
*/
|
|
9
|
-
export type CSSValue =
|
|
10
|
-
| string
|
|
11
|
-
| number
|
|
12
|
-
| Array<string | number>
|
|
13
|
-
| CSSProperties;
|
|
3
|
+
export type CSSValue = string | number | Array<string | number> | CSSProperties;
|
|
14
4
|
|
|
15
|
-
/**
|
|
16
|
-
* The value type for a *known* CSS property.
|
|
17
|
-
*
|
|
18
|
-
* We deliberately do NOT union in a bare `string` here: csstype's own property
|
|
19
|
-
* types already permit any string via the `(string & {})` trick, which keeps
|
|
20
|
-
* the literal value suggestions (e.g. `"center"` for `alignItems`) visible in
|
|
21
|
-
* IntelliSense. Adding a bare `string` would collapse that union and suppress
|
|
22
|
-
* the autocomplete. We still allow numbers, fallback arrays, and nested objects.
|
|
23
|
-
*/
|
|
24
5
|
type KnownCSSValue<K extends keyof CSS.Properties> =
|
|
25
6
|
| CSS.Properties[K]
|
|
26
7
|
| number
|
|
27
8
|
| Array<string | number>
|
|
28
9
|
| CSSProperties;
|
|
29
10
|
|
|
30
|
-
/**
|
|
31
|
-
* The shape of the style objects passed to `css()`, `variants()`, and
|
|
32
|
-
* `styled()`.
|
|
33
|
-
*
|
|
34
|
-
* Known camelCase CSS properties (sourced from `csstype`) offer autocomplete
|
|
35
|
-
* for both the property name and its value, but any other key is accepted
|
|
36
|
-
* without a type error so that selectors, media queries, custom properties, and
|
|
37
|
-
* other arbitrary keys can be used freely.
|
|
38
|
-
*/
|
|
39
11
|
export type CSSProperties = {
|
|
40
12
|
[K in keyof CSS.Properties]?: KnownCSSValue<K>;
|
|
41
13
|
} & {
|
|
42
14
|
[key: string]: CSSValue;
|
|
43
15
|
};
|
|
16
|
+
|
|
17
|
+
export type CSSPropItem = string | boolean | CSSProperties | null | undefined;
|
|
18
|
+
export type CSSProp = CSSPropItem | CSSPropItem[];
|
package/src/runtime.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { CSSProperties } from "./css-properties.js";
|
|
2
2
|
|
|
3
|
-
export type {
|
|
3
|
+
export type {
|
|
4
|
+
CSSProp,
|
|
5
|
+
CSSProperties,
|
|
6
|
+
CSSPropItem,
|
|
7
|
+
CSSValue,
|
|
8
|
+
} from "./css-properties.js";
|
|
4
9
|
|
|
5
10
|
/**
|
|
6
11
|
* The style object accepted by `styled()`: top-level CSS properties plus the
|