@webstudio-is/css-engine 0.91.0 → 0.93.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/lib/__generated__/types.js +1 -0
- package/lib/core/compare-media.js +2 -4
- package/{src/core/compare-media.test.ts → lib/core/compare-media.test.js} +7 -9
- package/lib/core/create-css-engine.js +2 -4
- package/lib/core/css-engine.js +2 -4
- package/lib/core/css-engine.stories.js +48 -0
- package/{src/core/css-engine.test.ts → lib/core/css-engine.test.js} +51 -88
- package/lib/core/equal-media.js +2 -4
- package/{src/core/equal-media.test.ts → lib/core/equal-media.test.js} +1 -3
- package/lib/core/find-applicable-media.js +2 -4
- package/{src/core/find-applicable-media.test.ts → lib/core/find-applicable-media.test.js} +7 -8
- package/lib/core/index.js +2 -4
- package/lib/core/match-media.js +2 -4
- package/{src/core/match-media.test.ts → lib/core/match-media.test.js} +1 -3
- package/lib/core/rules.js +5 -10
- package/lib/core/style-element.js +2 -4
- package/lib/core/style-sheet.js +2 -4
- package/lib/core/to-property.js +2 -4
- package/{src/core/to-property.test.ts → lib/core/to-property.test.js} +1 -1
- package/lib/core/to-value.js +2 -4
- package/{src/core/to-value.test.ts → lib/core/to-value.test.js} +21 -32
- package/lib/index.js +2 -0
- package/lib/schema.js +98 -0
- package/lib/types/__generated__/types.d.ts +2 -0
- package/lib/types/core/css-engine.d.ts +1 -1
- package/lib/types/core/rules.d.ts +2 -2
- package/lib/types/core/to-property.d.ts +1 -1
- package/lib/types/core/to-value.d.ts +1 -1
- package/lib/types/index.d.ts +2 -0
- package/lib/types/schema.d.ts +3233 -0
- package/package.json +12 -15
- package/lib/cjs/core/compare-media.js +0 -38
- package/lib/cjs/core/create-css-engine.js +0 -27
- package/lib/cjs/core/css-engine.js +0 -122
- package/lib/cjs/core/equal-media.js +0 -26
- package/lib/cjs/core/find-applicable-media.js +0 -33
- package/lib/cjs/core/index.js +0 -32
- package/lib/cjs/core/match-media.js +0 -28
- package/lib/cjs/core/rules.js +0 -187
- package/lib/cjs/core/style-element.js +0 -61
- package/lib/cjs/core/style-sheet.js +0 -36
- package/lib/cjs/core/to-property.js +0 -40
- package/lib/cjs/core/to-value.js +0 -98
- package/lib/cjs/index.js +0 -18
- package/lib/cjs/package.json +0 -1
- package/src/core/compare-media.ts +0 -30
- package/src/core/create-css-engine.ts +0 -5
- package/src/core/css-engine.stories.tsx +0 -48
- package/src/core/css-engine.ts +0 -128
- package/src/core/equal-media.ts +0 -5
- package/src/core/find-applicable-media.ts +0 -20
- package/src/core/index.ts +0 -15
- package/src/core/match-media.ts +0 -8
- package/src/core/rules.ts +0 -182
- package/src/core/style-element.ts +0 -38
- package/src/core/style-sheet.ts +0 -15
- package/src/core/to-property.ts +0 -12
- package/src/core/to-value.ts +0 -108
- package/src/index.ts +0 -1
package/lib/core/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
export { CssEngine } from "./css-engine";
|
|
2
3
|
export * from "./create-css-engine";
|
|
3
4
|
export * from "./to-value";
|
|
4
5
|
export * from "./to-property";
|
|
@@ -6,6 +7,3 @@ export * from "./match-media";
|
|
|
6
7
|
export * from "./equal-media";
|
|
7
8
|
export * from "./compare-media";
|
|
8
9
|
export * from "./find-applicable-media";
|
|
9
|
-
export {
|
|
10
|
-
CssEngine
|
|
11
|
-
};
|
package/lib/core/match-media.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
export const matchMedia = (options, width) => {
|
|
2
3
|
const minWidth = options.minWidth ?? Number.MIN_SAFE_INTEGER;
|
|
3
4
|
const maxWidth = options.maxWidth ?? Number.MAX_SAFE_INTEGER;
|
|
4
5
|
return width >= minWidth && width <= maxWidth;
|
|
5
6
|
};
|
|
6
|
-
export {
|
|
7
|
-
matchMedia
|
|
8
|
-
};
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
import { describe, expect, test } from "@jest/globals";
|
|
2
3
|
import { matchMedia } from "./match-media";
|
|
3
|
-
|
|
4
4
|
describe("matchMedia", () => {
|
|
5
5
|
test("minWidth", () => {
|
|
6
6
|
expect(matchMedia({ minWidth: 100 }, 10)).toBe(false);
|
|
7
7
|
expect(matchMedia({ minWidth: 100 }, 100)).toBe(true);
|
|
8
8
|
expect(matchMedia({ minWidth: 100 }, 101)).toBe(true);
|
|
9
9
|
});
|
|
10
|
-
|
|
11
10
|
test("maxWidth", () => {
|
|
12
11
|
expect(matchMedia({ maxWidth: 100 }, 101)).toBe(false);
|
|
13
12
|
expect(matchMedia({ maxWidth: 100 }, 100)).toBe(true);
|
|
14
13
|
expect(matchMedia({ maxWidth: 100 }, 10)).toBe(true);
|
|
15
14
|
});
|
|
16
|
-
|
|
17
15
|
test("minWidth and maxWidth", () => {
|
|
18
16
|
expect(matchMedia({ maxWidth: 100, minWidth: 10 }, 9)).toBe(false);
|
|
19
17
|
expect(matchMedia({ maxWidth: 100, minWidth: 10 }, 101)).toBe(false);
|
package/lib/core/rules.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
import { toValue } from "./to-value";
|
|
2
3
|
import { toProperty } from "./to-property";
|
|
3
4
|
class StylePropertyMap {
|
|
@@ -60,7 +61,7 @@ class StylePropertyMap {
|
|
|
60
61
|
return this.#string;
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
class StyleRule {
|
|
64
|
+
export class StyleRule {
|
|
64
65
|
styleMap;
|
|
65
66
|
selectorText;
|
|
66
67
|
onChange;
|
|
@@ -88,7 +89,7 @@ ${this.styleMap.toString({
|
|
|
88
89
|
${spaces}}`;
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
|
-
class MediaRule {
|
|
92
|
+
export class MediaRule {
|
|
92
93
|
options;
|
|
93
94
|
rules = [];
|
|
94
95
|
#mediaType;
|
|
@@ -126,7 +127,7 @@ ${rules.join(
|
|
|
126
127
|
}`;
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
|
-
class PlaintextRule {
|
|
130
|
+
export class PlaintextRule {
|
|
130
131
|
cssText;
|
|
131
132
|
styleMap = new StylePropertyMap();
|
|
132
133
|
constructor(cssText) {
|
|
@@ -136,7 +137,7 @@ class PlaintextRule {
|
|
|
136
137
|
return this.cssText;
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
|
-
class FontFaceRule {
|
|
140
|
+
export class FontFaceRule {
|
|
140
141
|
options;
|
|
141
142
|
constructor(options) {
|
|
142
143
|
this.options = options;
|
|
@@ -159,9 +160,3 @@ class FontFaceRule {
|
|
|
159
160
|
}`;
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
|
-
export {
|
|
163
|
-
FontFaceRule,
|
|
164
|
-
MediaRule,
|
|
165
|
-
PlaintextRule,
|
|
166
|
-
StyleRule
|
|
167
|
-
};
|
package/lib/core/style-sheet.js
CHANGED
package/lib/core/to-property.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
import hyphenate from "hyphenate-style-name";
|
|
2
|
-
const toProperty = (property) => {
|
|
3
|
+
export const toProperty = (property) => {
|
|
3
4
|
if (property === "backgroundClip") {
|
|
4
5
|
return "-webkit-background-clip";
|
|
5
6
|
}
|
|
6
7
|
return hyphenate(property);
|
|
7
8
|
};
|
|
8
|
-
export {
|
|
9
|
-
toProperty
|
|
10
|
-
};
|
package/lib/core/to-value.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
import { captureError } from "@webstudio-is/error-utils";
|
|
2
3
|
import { DEFAULT_FONT_FALLBACK, SYSTEM_FONTS } from "@webstudio-is/fonts";
|
|
3
4
|
const fallbackTransform = (styleValue) => {
|
|
@@ -16,7 +17,7 @@ const fallbackTransform = (styleValue) => {
|
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
19
|
};
|
|
19
|
-
const toValue = (styleValue, transformValue) => {
|
|
20
|
+
export const toValue = (styleValue, transformValue) => {
|
|
20
21
|
if (styleValue === void 0) {
|
|
21
22
|
return "";
|
|
22
23
|
}
|
|
@@ -73,6 +74,3 @@ const toValue = (styleValue, transformValue) => {
|
|
|
73
74
|
}
|
|
74
75
|
return captureError(new Error("Unknown value type"), value);
|
|
75
76
|
};
|
|
76
|
-
export {
|
|
77
|
-
toValue
|
|
78
|
-
};
|
|
@@ -1,32 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
import { describe, test, expect } from "@jest/globals";
|
|
2
3
|
import { toValue } from "./to-value";
|
|
3
|
-
|
|
4
4
|
describe("Convert WS CSS Values to native CSS strings", () => {
|
|
5
5
|
test("keyword", () => {
|
|
6
6
|
const value = toValue({ type: "keyword", value: "red" });
|
|
7
7
|
expect(value).toBe("red");
|
|
8
8
|
});
|
|
9
|
-
|
|
10
9
|
test("unit", () => {
|
|
11
10
|
const value = toValue({ type: "unit", value: 10, unit: "px" });
|
|
12
11
|
expect(value).toBe("10px");
|
|
13
12
|
});
|
|
14
|
-
|
|
15
13
|
test("invalid", () => {
|
|
16
14
|
const value = toValue({ type: "invalid", value: "bad" });
|
|
17
15
|
expect(value).toBe("bad");
|
|
18
16
|
});
|
|
19
|
-
|
|
20
17
|
test("unset", () => {
|
|
21
18
|
const value = toValue({ type: "unset", value: "" });
|
|
22
19
|
expect(value).toBe("");
|
|
23
20
|
});
|
|
24
|
-
|
|
25
21
|
test("var", () => {
|
|
26
22
|
const value = toValue({ type: "var", value: "namespace", fallbacks: [] });
|
|
27
23
|
expect(value).toBe("var(--namespace)");
|
|
28
24
|
});
|
|
29
|
-
|
|
30
25
|
test("var with fallbacks", () => {
|
|
31
26
|
const value = toValue({
|
|
32
27
|
type: "var",
|
|
@@ -34,56 +29,52 @@ describe("Convert WS CSS Values to native CSS strings", () => {
|
|
|
34
29
|
fallbacks: [
|
|
35
30
|
{
|
|
36
31
|
type: "keyword",
|
|
37
|
-
value: "normal"
|
|
32
|
+
value: "normal"
|
|
38
33
|
},
|
|
39
34
|
{
|
|
40
35
|
type: "unit",
|
|
41
36
|
value: 10,
|
|
42
|
-
unit: "px"
|
|
43
|
-
}
|
|
44
|
-
]
|
|
37
|
+
unit: "px"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
45
40
|
});
|
|
46
41
|
expect(value).toBe("var(--namespace, normal, 10px)");
|
|
47
42
|
});
|
|
48
|
-
|
|
49
43
|
test("fontFamily", () => {
|
|
50
44
|
const value = toValue({
|
|
51
45
|
type: "fontFamily",
|
|
52
|
-
value: ["Courier New"]
|
|
46
|
+
value: ["Courier New"]
|
|
53
47
|
});
|
|
54
48
|
expect(value).toBe("Courier New, monospace");
|
|
55
49
|
});
|
|
56
|
-
|
|
57
50
|
test("Transform font family value to override default fallback", () => {
|
|
58
51
|
const value = toValue(
|
|
59
52
|
{
|
|
60
53
|
type: "fontFamily",
|
|
61
|
-
value: ["Courier New"]
|
|
54
|
+
value: ["Courier New"]
|
|
62
55
|
},
|
|
63
56
|
(styleValue) => {
|
|
64
57
|
if (styleValue.type === "fontFamily") {
|
|
65
58
|
return {
|
|
66
59
|
type: "fontFamily",
|
|
67
|
-
value: [styleValue.value[0]]
|
|
60
|
+
value: [styleValue.value[0]]
|
|
68
61
|
};
|
|
69
62
|
}
|
|
70
63
|
}
|
|
71
64
|
);
|
|
72
65
|
expect(value).toBe("Courier New");
|
|
73
66
|
});
|
|
74
|
-
|
|
75
67
|
test("array", () => {
|
|
76
|
-
const assets =
|
|
77
|
-
["1234567890", { path: "foo.png" }]
|
|
68
|
+
const assets = /* @__PURE__ */ new Map([
|
|
69
|
+
["1234567890", { path: "foo.png" }]
|
|
78
70
|
]);
|
|
79
|
-
|
|
80
71
|
const value = toValue(
|
|
81
72
|
{
|
|
82
73
|
type: "layers",
|
|
83
74
|
value: [
|
|
84
75
|
{
|
|
85
76
|
type: "keyword",
|
|
86
|
-
value: "auto"
|
|
77
|
+
value: "auto"
|
|
87
78
|
},
|
|
88
79
|
{ type: "unit", value: 10, unit: "px" },
|
|
89
80
|
{ type: "unparsed", value: "calc(10px)" },
|
|
@@ -91,34 +82,32 @@ describe("Convert WS CSS Values to native CSS strings", () => {
|
|
|
91
82
|
type: "image",
|
|
92
83
|
value: {
|
|
93
84
|
type: "asset",
|
|
94
|
-
value: "1234567890"
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
]
|
|
85
|
+
value: "1234567890"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
]
|
|
98
89
|
},
|
|
99
90
|
(styleValue) => {
|
|
100
91
|
if (styleValue.type === "image" && styleValue.value.type === "asset") {
|
|
101
92
|
const asset = assets.get(styleValue.value.value);
|
|
102
|
-
if (asset ===
|
|
93
|
+
if (asset === void 0) {
|
|
103
94
|
return {
|
|
104
95
|
type: "keyword",
|
|
105
|
-
value: "none"
|
|
96
|
+
value: "none"
|
|
106
97
|
};
|
|
107
98
|
}
|
|
108
99
|
return {
|
|
109
100
|
type: "image",
|
|
110
101
|
value: {
|
|
111
102
|
type: "url",
|
|
112
|
-
url: asset.path
|
|
113
|
-
}
|
|
103
|
+
url: asset.path
|
|
104
|
+
}
|
|
114
105
|
};
|
|
115
106
|
}
|
|
116
107
|
}
|
|
117
108
|
);
|
|
118
|
-
|
|
119
109
|
expect(value).toBe("auto, 10px, calc(10px), url(foo.png)");
|
|
120
110
|
});
|
|
121
|
-
|
|
122
111
|
test("tuple", () => {
|
|
123
112
|
const value = toValue({
|
|
124
113
|
type: "tuple",
|
|
@@ -126,8 +115,8 @@ describe("Convert WS CSS Values to native CSS strings", () => {
|
|
|
126
115
|
{ type: "unit", value: 10, unit: "px" },
|
|
127
116
|
{ type: "unit", value: 20, unit: "px" },
|
|
128
117
|
{ type: "unit", value: 30, unit: "px" },
|
|
129
|
-
{ type: "unit", value: 40, unit: "px" }
|
|
130
|
-
]
|
|
118
|
+
{ type: "unit", value: 40, unit: "px" }
|
|
119
|
+
]
|
|
131
120
|
});
|
|
132
121
|
expect(value).toBe("10px 20px 30px 40px");
|
|
133
122
|
});
|
package/lib/index.js
CHANGED
package/lib/schema.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const Unit = z.string();
|
|
4
|
+
export const UnitValue = z.object({
|
|
5
|
+
type: z.literal("unit"),
|
|
6
|
+
unit: Unit,
|
|
7
|
+
value: z.number()
|
|
8
|
+
});
|
|
9
|
+
export const KeywordValue = z.object({
|
|
10
|
+
type: z.literal("keyword"),
|
|
11
|
+
// @todo use exact type
|
|
12
|
+
value: z.string()
|
|
13
|
+
});
|
|
14
|
+
export const UnparsedValue = z.object({
|
|
15
|
+
type: z.literal("unparsed"),
|
|
16
|
+
value: z.string(),
|
|
17
|
+
// For the builder we want to be able to hide background-image
|
|
18
|
+
hidden: z.boolean().optional()
|
|
19
|
+
});
|
|
20
|
+
const FontFamilyValue = z.object({
|
|
21
|
+
type: z.literal("fontFamily"),
|
|
22
|
+
value: z.array(z.string())
|
|
23
|
+
});
|
|
24
|
+
const RgbValue = z.object({
|
|
25
|
+
type: z.literal("rgb"),
|
|
26
|
+
r: z.number(),
|
|
27
|
+
g: z.number(),
|
|
28
|
+
b: z.number(),
|
|
29
|
+
alpha: z.number()
|
|
30
|
+
});
|
|
31
|
+
export const ImageValue = z.object({
|
|
32
|
+
type: z.literal("image"),
|
|
33
|
+
value: z.union([
|
|
34
|
+
z.object({ type: z.literal("asset"), value: z.string() }),
|
|
35
|
+
// url is not stored in db and only used by css-engine transformValue
|
|
36
|
+
// to prepare image value for rendering
|
|
37
|
+
z.object({ type: z.literal("url"), url: z.string() })
|
|
38
|
+
]),
|
|
39
|
+
// For the builder we want to be able to hide images
|
|
40
|
+
hidden: z.boolean().optional()
|
|
41
|
+
});
|
|
42
|
+
export const InvalidValue = z.object({
|
|
43
|
+
type: z.literal("invalid"),
|
|
44
|
+
value: z.string()
|
|
45
|
+
});
|
|
46
|
+
const UnsetValue = z.object({
|
|
47
|
+
type: z.literal("unset"),
|
|
48
|
+
value: z.literal("")
|
|
49
|
+
});
|
|
50
|
+
export const TupleValueItem = z.union([
|
|
51
|
+
UnitValue,
|
|
52
|
+
KeywordValue,
|
|
53
|
+
UnparsedValue,
|
|
54
|
+
RgbValue
|
|
55
|
+
]);
|
|
56
|
+
export const TupleValue = z.object({
|
|
57
|
+
type: z.literal("tuple"),
|
|
58
|
+
value: z.array(TupleValueItem),
|
|
59
|
+
hidden: z.boolean().optional()
|
|
60
|
+
});
|
|
61
|
+
const LayerValueItem = z.union([
|
|
62
|
+
UnitValue,
|
|
63
|
+
KeywordValue,
|
|
64
|
+
UnparsedValue,
|
|
65
|
+
ImageValue,
|
|
66
|
+
TupleValue,
|
|
67
|
+
InvalidValue
|
|
68
|
+
]);
|
|
69
|
+
export const LayersValue = z.object({
|
|
70
|
+
type: z.literal("layers"),
|
|
71
|
+
value: z.array(LayerValueItem)
|
|
72
|
+
});
|
|
73
|
+
const ValidStaticStyleValue = z.union([
|
|
74
|
+
ImageValue,
|
|
75
|
+
LayersValue,
|
|
76
|
+
UnitValue,
|
|
77
|
+
KeywordValue,
|
|
78
|
+
FontFamilyValue,
|
|
79
|
+
RgbValue,
|
|
80
|
+
UnparsedValue,
|
|
81
|
+
TupleValue
|
|
82
|
+
]);
|
|
83
|
+
export const isValidStaticStyleValue = (styleValue) => {
|
|
84
|
+
const staticStyleValue = styleValue;
|
|
85
|
+
return staticStyleValue.type === "image" || staticStyleValue.type === "layers" || staticStyleValue.type === "unit" || staticStyleValue.type === "keyword" || staticStyleValue.type === "fontFamily" || staticStyleValue.type === "rgb" || staticStyleValue.type === "unparsed" || staticStyleValue.type === "tuple";
|
|
86
|
+
};
|
|
87
|
+
const VarValue = z.object({
|
|
88
|
+
type: z.literal("var"),
|
|
89
|
+
value: z.string(),
|
|
90
|
+
fallbacks: z.array(ValidStaticStyleValue)
|
|
91
|
+
});
|
|
92
|
+
export const StyleValue = z.union([
|
|
93
|
+
ValidStaticStyleValue,
|
|
94
|
+
InvalidValue,
|
|
95
|
+
UnsetValue,
|
|
96
|
+
VarValue
|
|
97
|
+
]);
|
|
98
|
+
const Style = z.record(z.string(), StyleValue);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type Property = "WebkitFontSmoothing" | "MozOsxFontSmoothing" | "accentColor" | "alignContent" | "alignItems" | "alignSelf" | "alignTracks" | "animationComposition" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationName" | "animationPlayState" | "animationTimingFunction" | "animationTimeline" | "appearance" | "aspectRatio" | "backdropFilter" | "backfaceVisibility" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "blockOverflow" | "blockSize" | "borderBlockColor" | "borderBlockStyle" | "borderBlockWidth" | "borderBlockEndColor" | "borderBlockEndStyle" | "borderBlockEndWidth" | "borderBlockStartColor" | "borderBlockStartStyle" | "borderBlockStartWidth" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderCollapse" | "borderEndEndRadius" | "borderEndStartRadius" | "borderImageOutset" | "borderImageRepeat" | "borderImageSlice" | "borderImageSource" | "borderImageWidth" | "borderInlineColor" | "borderInlineStyle" | "borderInlineWidth" | "borderInlineEndColor" | "borderInlineEndStyle" | "borderInlineEndWidth" | "borderInlineStartColor" | "borderInlineStartStyle" | "borderInlineStartWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderSpacing" | "borderStartEndRadius" | "borderStartStartRadius" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "bottom" | "boxDecorationBreak" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "caretColor" | "caretShape" | "clear" | "clip" | "clipPath" | "color" | "colorScheme" | "columnCount" | "columnFill" | "columnGap" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columnSpan" | "columnWidth" | "contain" | "containIntrinsicBlockSize" | "containIntrinsicHeight" | "containIntrinsicInlineSize" | "containIntrinsicWidth" | "containerName" | "containerType" | "content" | "contentVisibility" | "counterIncrement" | "counterReset" | "counterSet" | "cursor" | "direction" | "display" | "emptyCells" | "filter" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "float" | "fontFamily" | "fontFeatureSettings" | "fontKerning" | "fontLanguageOverride" | "fontOpticalSizing" | "fontPalette" | "fontVariationSettings" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontSynthesis" | "fontVariant" | "fontVariantAlternates" | "fontVariantCaps" | "fontVariantEastAsian" | "fontVariantEmoji" | "fontVariantLigatures" | "fontVariantNumeric" | "fontVariantPosition" | "fontWeight" | "forcedColorAdjust" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "hangingPunctuation" | "height" | "hyphenateCharacter" | "hyphenateLimitChars" | "hyphens" | "imageOrientation" | "imageRendering" | "imageResolution" | "initialLetter" | "initialLetterAlign" | "inlineSize" | "inputSecurity" | "insetBlockEnd" | "insetBlockStart" | "insetInlineEnd" | "insetInlineStart" | "isolation" | "justifyContent" | "justifyItems" | "justifySelf" | "justifyTracks" | "left" | "letterSpacing" | "lineBreak" | "lineClamp" | "lineHeight" | "lineHeightStep" | "listStyleImage" | "listStylePosition" | "listStyleType" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "marginTrim" | "maskBorderMode" | "maskBorderOutset" | "maskBorderRepeat" | "maskBorderSlice" | "maskBorderSource" | "maskBorderWidth" | "maskClip" | "maskComposite" | "maskImage" | "maskMode" | "maskOrigin" | "maskPosition" | "maskRepeat" | "maskSize" | "maskType" | "masonryAutoFlow" | "mathDepth" | "mathShift" | "mathStyle" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxLines" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "objectFit" | "objectPosition" | "offsetAnchor" | "offsetDistance" | "offsetPath" | "offsetPosition" | "offsetRotate" | "opacity" | "order" | "orphans" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflow" | "overflowAnchor" | "overflowBlock" | "overflowClipMargin" | "overflowInline" | "overflowWrap" | "overflowX" | "overflowY" | "overscrollBehavior" | "overscrollBehaviorBlock" | "overscrollBehaviorInline" | "overscrollBehaviorX" | "overscrollBehaviorY" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "page" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "paintOrder" | "perspective" | "perspectiveOrigin" | "pointerEvents" | "position" | "printColorAdjust" | "quotes" | "resize" | "right" | "rotate" | "rowGap" | "rubyAlign" | "rubyMerge" | "rubyPosition" | "scale" | "scrollbarColor" | "scrollbarGutter" | "scrollbarWidth" | "scrollBehavior" | "scrollMarginBlockStart" | "scrollMarginBlockEnd" | "scrollMarginBottom" | "scrollMarginInlineStart" | "scrollMarginInlineEnd" | "scrollMarginLeft" | "scrollMarginRight" | "scrollMarginTop" | "scrollPaddingBlockStart" | "scrollPaddingBlockEnd" | "scrollPaddingBottom" | "scrollPaddingInlineStart" | "scrollPaddingInlineEnd" | "scrollPaddingLeft" | "scrollPaddingRight" | "scrollPaddingTop" | "scrollSnapAlign" | "scrollSnapStop" | "scrollSnapType" | "scrollTimelineAxis" | "scrollTimelineName" | "shapeImageThreshold" | "shapeMargin" | "shapeOutside" | "tabSize" | "tableLayout" | "textAlign" | "textAlignLast" | "textCombineUpright" | "textDecorationColor" | "textDecorationLine" | "textDecorationSkip" | "textDecorationSkipInk" | "textDecorationStyle" | "textDecorationThickness" | "textEmphasisColor" | "textEmphasisPosition" | "textEmphasisStyle" | "textIndent" | "textJustify" | "textOrientation" | "textOverflow" | "textRendering" | "textShadow" | "textSizeAdjust" | "textTransform" | "textUnderlineOffset" | "textUnderlinePosition" | "top" | "touchAction" | "transform" | "transformBox" | "transformOrigin" | "transformStyle" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "translate" | "unicodeBidi" | "userSelect" | "verticalAlign" | "viewTransitionName" | "visibility" | "whiteSpace" | "widows" | "width" | "willChange" | "wordBreak" | "wordSpacing" | "wordWrap" | "writingMode" | "zIndex";
|
|
2
|
+
export type Unit = "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Style } from "
|
|
1
|
+
import type { Style } from "../schema";
|
|
2
2
|
import { MediaRule, PlaintextRule, StyleRule, type FontFaceOptions, type MediaRuleOptions } from "./rules";
|
|
3
3
|
import type { TransformValue } from "./to-value";
|
|
4
4
|
type CssRule = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Style, StyleProperty, StyleValue } from "
|
|
1
|
+
import type { Style, StyleProperty, StyleValue } from "../schema";
|
|
2
2
|
import { type TransformValue } from "./to-value";
|
|
3
3
|
declare class StylePropertyMap {
|
|
4
4
|
#private;
|
|
@@ -8,7 +8,7 @@ declare class StylePropertyMap {
|
|
|
8
8
|
set(property: StyleProperty, value?: StyleValue): void;
|
|
9
9
|
has(property: StyleProperty): boolean;
|
|
10
10
|
get size(): number;
|
|
11
|
-
keys(): IterableIterator<
|
|
11
|
+
keys(): IterableIterator<StyleProperty>;
|
|
12
12
|
delete(property: StyleProperty): void;
|
|
13
13
|
clear(): void;
|
|
14
14
|
toString({ indent }?: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { StyleProperty } from "
|
|
1
|
+
import type { StyleProperty } from "../schema";
|
|
2
2
|
export declare const toProperty: (property: StyleProperty) => string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { StyleValue } from "
|
|
1
|
+
import type { StyleValue } from "../schema";
|
|
2
2
|
export type TransformValue = (styleValue: StyleValue) => undefined | StyleValue;
|
|
3
3
|
export declare const toValue: (styleValue: undefined | StyleValue, transformValue?: TransformValue) => string;
|
package/lib/types/index.d.ts
CHANGED