@webstudio-is/css-data 0.91.0 → 0.266.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/index.js +17534 -15
- package/lib/types/__generated__/animatable-properties.d.ts +1 -0
- package/lib/types/__generated__/html.d.ts +2 -0
- package/lib/types/__generated__/keyword-values.d.ts +4 -358
- package/lib/types/__generated__/properties.d.ts +10 -3674
- package/lib/types/__generated__/property-value-descriptions.d.ts +7 -5446
- package/lib/types/__generated__/pseudo-classes.d.ts +1 -0
- package/lib/types/__generated__/pseudo-elements.d.ts +1 -0
- package/lib/types/__generated__/pseudo-selector-descriptions.d.ts +2 -0
- package/lib/types/__generated__/shorthand-properties.d.ts +1 -0
- package/lib/types/css-tree.d.ts +772 -0
- package/lib/types/index.d.ts +18 -3680
- package/lib/types/media-condition-simulator.d.ts +7 -0
- package/lib/types/parse-css-value.d.ts +8 -3
- package/lib/types/parse-css.d.ts +75 -6
- package/lib/types/property-parsers/conic-gradient.d.ts +3 -0
- package/lib/types/property-parsers/gradient-utils.d.ts +20 -0
- package/lib/types/property-parsers/grid-template-areas.d.ts +21 -0
- package/lib/types/property-parsers/grid-template-tracks.d.ts +128 -0
- package/lib/types/property-parsers/index.d.ts +6 -2
- package/lib/types/property-parsers/linear-gradient.d.ts +4 -0
- package/lib/types/property-parsers/radial-gradient.d.ts +3 -0
- package/lib/types/property-parsers/types.d.ts +28 -0
- package/lib/types/selector-validation.d.ts +13 -0
- package/lib/types/shorthands.d.ts +2 -0
- package/package.json +29 -33
- package/lib/__generated__/keyword-values.js +0 -5255
- package/lib/__generated__/properties.js +0 -3697
- package/lib/__generated__/property-value-descriptions.js +0 -2740
- package/lib/__generated__/units.js +0 -65
- package/lib/cjs/__generated__/keyword-values.js +0 -5275
- package/lib/cjs/__generated__/properties.js +0 -3717
- package/lib/cjs/__generated__/property-value-descriptions.js +0 -2760
- package/lib/cjs/__generated__/units.js +0 -85
- package/lib/cjs/custom-data.js +0 -64
- package/lib/cjs/html-check.js +0 -25
- package/lib/cjs/html.js +0 -581
- package/lib/cjs/index.js +0 -48
- package/lib/cjs/package.json +0 -1
- package/lib/cjs/parse-css-value.js +0 -152
- package/lib/cjs/parse-css.js +0 -136
- package/lib/cjs/popularity-index.js +0 -4633
- package/lib/cjs/property-parsers/background.js +0 -119
- package/lib/cjs/property-parsers/box-shadow.js +0 -129
- package/lib/cjs/property-parsers/index.js +0 -19
- package/lib/cjs/property-parsers/parsers.js +0 -26
- package/lib/cjs/property-parsers/to-longhand.js +0 -24
- package/lib/cjs/schema.js +0 -135
- package/lib/custom-data.js +0 -44
- package/lib/html-check.js +0 -2
- package/lib/html.js +0 -561
- package/lib/parse-css-value.js +0 -122
- package/lib/parse-css.js +0 -106
- package/lib/popularity-index.js +0 -4613
- package/lib/property-parsers/background.js +0 -89
- package/lib/property-parsers/box-shadow.js +0 -99
- package/lib/property-parsers/index.js +0 -2
- package/lib/property-parsers/parsers.js +0 -6
- package/lib/property-parsers/to-longhand.js +0 -4
- package/lib/schema.js +0 -115
- package/lib/types/custom-data.d.ts +0 -15
- package/lib/types/html-check.d.ts +0 -1
- package/lib/types/html.d.ts +0 -62
- package/lib/types/parse-css-value.test.d.ts +0 -1
- package/lib/types/parse-css.test.d.ts +0 -1
- package/lib/types/popularity-index.d.ts +0 -6
- package/lib/types/property-parsers/background.d.ts +0 -11
- package/lib/types/property-parsers/background.test.d.ts +0 -1
- package/lib/types/property-parsers/box-shadow.d.ts +0 -3
- package/lib/types/property-parsers/box-shadow.test.d.ts +0 -1
- package/lib/types/property-parsers/parsers.d.ts +0 -2
- package/lib/types/property-parsers/to-longhand.d.ts +0 -1
- package/lib/types/schema.d.ts +0 -3243
- package/src/__generated__/keyword-values.ts +0 -5253
- package/src/__generated__/properties.ts +0 -3696
- package/src/__generated__/property-value-descriptions.ts +0 -4008
- package/src/__generated__/units.ts +0 -63
- package/src/custom-data.ts +0 -57
- package/src/html-check.ts +0 -8
- package/src/html.ts +0 -617
- package/src/index.ts +0 -25
- package/src/parse-css-value.test.ts +0 -136
- package/src/parse-css-value.ts +0 -157
- package/src/parse-css.test.ts +0 -101
- package/src/parse-css.ts +0 -137
- package/src/popularity-index.ts +0 -4611
- package/src/property-parsers/README.md +0 -11
- package/src/property-parsers/background.test.ts +0 -184
- package/src/property-parsers/background.ts +0 -147
- package/src/property-parsers/box-shadow.test.ts +0 -294
- package/src/property-parsers/box-shadow.ts +0 -130
- package/src/property-parsers/index.ts +0 -2
- package/src/property-parsers/parsers.ts +0 -5
- package/src/property-parsers/to-longhand.ts +0 -4
- package/src/schema.ts +0 -193
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var background_exports = {};
|
|
30
|
-
__export(background_exports, {
|
|
31
|
-
backgroundToLonghand: () => backgroundToLonghand,
|
|
32
|
-
gradientNames: () => gradientNames,
|
|
33
|
-
parseBackground: () => parseBackground,
|
|
34
|
-
parseBackgroundImage: () => parseBackgroundImage
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(background_exports);
|
|
37
|
-
var csstree = __toESM(require("css-tree"), 1);
|
|
38
|
-
var import_parse_css_value = require("../parse-css-value");
|
|
39
|
-
const gradientNames = [
|
|
40
|
-
"conic-gradient",
|
|
41
|
-
"linear-gradient",
|
|
42
|
-
"radial-gradient",
|
|
43
|
-
"repeating-conic-gradient",
|
|
44
|
-
"repeating-linear-gradient",
|
|
45
|
-
"repeating-radial-gradient"
|
|
46
|
-
];
|
|
47
|
-
const parseBackground = (background) => {
|
|
48
|
-
const { backgroundImage, backgroundColor: backgroundColorRaw } = backgroundToLonghand(background);
|
|
49
|
-
const backgroundColor = backgroundColorRaw ? (0, import_parse_css_value.parseCssValue)("backgroundColor", backgroundColorRaw) : void 0;
|
|
50
|
-
return {
|
|
51
|
-
backgroundImage: parseBackgroundImage(backgroundImage),
|
|
52
|
-
backgroundColor: backgroundColor && backgroundColor.type === "rgb" ? backgroundColor : void 0
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
const cssTreeTryParseValue = (input) => {
|
|
56
|
-
try {
|
|
57
|
-
const ast = csstree.parse(input, { context: "value" });
|
|
58
|
-
return ast;
|
|
59
|
-
} catch {
|
|
60
|
-
return void 0;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const backgroundToLonghand = (background) => {
|
|
64
|
-
const layers = [];
|
|
65
|
-
let tokenStream = background.trim();
|
|
66
|
-
tokenStream = tokenStream.endsWith(";") ? tokenStream.slice(0, -1) : tokenStream;
|
|
67
|
-
const cleanupKeywords = ["background:", "background-image:"];
|
|
68
|
-
for (const cleanupKeyword of cleanupKeywords) {
|
|
69
|
-
tokenStream = tokenStream.startsWith(cleanupKeyword) ? tokenStream.slice(cleanupKeyword.length).trim() : tokenStream;
|
|
70
|
-
}
|
|
71
|
-
const cssAst = cssTreeTryParseValue(tokenStream);
|
|
72
|
-
if (cssAst === void 0) {
|
|
73
|
-
return {
|
|
74
|
-
backgroundImage: [],
|
|
75
|
-
backgroundColor: void 0
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
let backgroundColorRaw;
|
|
79
|
-
let nestingLevel = 0;
|
|
80
|
-
csstree.walk(cssAst, {
|
|
81
|
-
enter: (node, item, list) => {
|
|
82
|
-
if (node.type === "Function") {
|
|
83
|
-
if (gradientNames.includes(node.name)) {
|
|
84
|
-
layers.push(csstree.generate(node));
|
|
85
|
-
}
|
|
86
|
-
if (item.next === null && nestingLevel === 0) {
|
|
87
|
-
backgroundColorRaw = csstree.generate(node);
|
|
88
|
-
}
|
|
89
|
-
nestingLevel++;
|
|
90
|
-
}
|
|
91
|
-
if (node.type === "Hash" && item.next === null && nestingLevel === 0) {
|
|
92
|
-
backgroundColorRaw = csstree.generate(node);
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
leave: (node, item, list) => {
|
|
96
|
-
if (node.type === "Function") {
|
|
97
|
-
nestingLevel--;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
return {
|
|
102
|
-
backgroundImage: layers,
|
|
103
|
-
backgroundColor: backgroundColorRaw
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
const parseBackgroundImage = (layers) => {
|
|
107
|
-
const backgroundImages = [];
|
|
108
|
-
for (const layer of layers) {
|
|
109
|
-
if (gradientNames.some((gradientName) => layer.startsWith(gradientName)) === false) {
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
const layerStyle = (0, import_parse_css_value.parseCssValue)("backgroundImage", layer);
|
|
113
|
-
if (layerStyle.type !== "unparsed") {
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
backgroundImages.push(layerStyle);
|
|
117
|
-
}
|
|
118
|
-
return backgroundImages.length > 0 ? { type: "layers", value: backgroundImages } : { type: "invalid", value: layers.join(",") };
|
|
119
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var box_shadow_exports = {};
|
|
30
|
-
__export(box_shadow_exports, {
|
|
31
|
-
parseBoxShadow: () => parseBoxShadow
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(box_shadow_exports);
|
|
34
|
-
var csstree = __toESM(require("css-tree"), 1);
|
|
35
|
-
var import_schema = require("../schema");
|
|
36
|
-
var import_colord = require("colord");
|
|
37
|
-
const cssTreeTryParseValue = (input) => {
|
|
38
|
-
try {
|
|
39
|
-
const ast = csstree.parse(input, { context: "value" });
|
|
40
|
-
return ast;
|
|
41
|
-
} catch {
|
|
42
|
-
return void 0;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const parseBoxShadow = (boxShadow) => {
|
|
46
|
-
let tokenStream = boxShadow.trim();
|
|
47
|
-
tokenStream = tokenStream.endsWith(";") ? tokenStream.slice(0, -1) : tokenStream;
|
|
48
|
-
const cleanupKeywords = ["box-shadow:"];
|
|
49
|
-
for (const cleanupKeyword of cleanupKeywords) {
|
|
50
|
-
tokenStream = tokenStream.startsWith(cleanupKeyword) ? tokenStream.slice(cleanupKeyword.length).trim() : tokenStream;
|
|
51
|
-
}
|
|
52
|
-
const cssAst = cssTreeTryParseValue(tokenStream);
|
|
53
|
-
if (cssAst === void 0) {
|
|
54
|
-
return {
|
|
55
|
-
type: "invalid",
|
|
56
|
-
value: boxShadow
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
const parsed = csstree.lexer.matchProperty("box-shadow", cssAst);
|
|
60
|
-
if (parsed.error) {
|
|
61
|
-
return {
|
|
62
|
-
type: "invalid",
|
|
63
|
-
value: boxShadow
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
const layers = [];
|
|
67
|
-
csstree.walk(cssAst, (node) => {
|
|
68
|
-
if (node.type === "Value") {
|
|
69
|
-
const children = node.children;
|
|
70
|
-
let layer = [];
|
|
71
|
-
for (const child of children) {
|
|
72
|
-
if (children.last === child) {
|
|
73
|
-
layer.push(child);
|
|
74
|
-
}
|
|
75
|
-
if (child.type === "Operator" || children.last === child) {
|
|
76
|
-
const shadow = [];
|
|
77
|
-
for (let index = 0; index < layer.length; index++) {
|
|
78
|
-
const item = layer[index];
|
|
79
|
-
if (item.type === "Identifier") {
|
|
80
|
-
shadow.push({
|
|
81
|
-
type: "keyword",
|
|
82
|
-
value: item.name
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
if (item.type === "Function" || item.type === "Hash") {
|
|
86
|
-
const colorValue = (0, import_colord.colord)(csstree.generate(item));
|
|
87
|
-
if (!colorValue.isValid()) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const rgb = colorValue.toRgb();
|
|
91
|
-
shadow.push({
|
|
92
|
-
type: "rgb",
|
|
93
|
-
alpha: rgb.a,
|
|
94
|
-
r: rgb.r,
|
|
95
|
-
g: rgb.g,
|
|
96
|
-
b: rgb.b
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
if (item.type === "Dimension") {
|
|
100
|
-
shadow.push({
|
|
101
|
-
type: "unit",
|
|
102
|
-
value: Number(item.value),
|
|
103
|
-
unit: item.unit
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
if (item.type === "Number") {
|
|
107
|
-
shadow.push({
|
|
108
|
-
type: "unit",
|
|
109
|
-
value: Number(item.value),
|
|
110
|
-
unit: "number"
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
layers.push({
|
|
115
|
-
type: "tuple",
|
|
116
|
-
value: shadow
|
|
117
|
-
});
|
|
118
|
-
layer = [];
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
layer.push(child);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
return layers.length > 0 ? {
|
|
126
|
-
type: "layers",
|
|
127
|
-
value: layers
|
|
128
|
-
} : { type: "invalid", value: boxShadow };
|
|
129
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var property_parsers_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(property_parsers_exports);
|
|
18
|
-
__reExport(property_parsers_exports, require("./background"), module.exports);
|
|
19
|
-
__reExport(property_parsers_exports, require("./box-shadow"), module.exports);
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var parsers_exports = {};
|
|
20
|
-
__export(parsers_exports, {
|
|
21
|
-
backgroundImage: () => import_background.parseBackgroundImage,
|
|
22
|
-
boxShadow: () => import_box_shadow.parseBoxShadow
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(parsers_exports);
|
|
25
|
-
var import_background = require("./background");
|
|
26
|
-
var import_box_shadow = require("./box-shadow");
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var to_longhand_exports = {};
|
|
20
|
-
__export(to_longhand_exports, {
|
|
21
|
-
background: () => import_background.backgroundToLonghand
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(to_longhand_exports);
|
|
24
|
-
var import_background = require("./background");
|
package/lib/cjs/schema.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var schema_exports = {};
|
|
20
|
-
__export(schema_exports, {
|
|
21
|
-
ImageValue: () => ImageValue,
|
|
22
|
-
InvalidValue: () => InvalidValue,
|
|
23
|
-
KeywordValue: () => KeywordValue,
|
|
24
|
-
LayersValue: () => LayersValue,
|
|
25
|
-
StyleValue: () => StyleValue,
|
|
26
|
-
TupleValue: () => TupleValue,
|
|
27
|
-
TupleValueItem: () => TupleValueItem,
|
|
28
|
-
UnitValue: () => UnitValue,
|
|
29
|
-
UnparsedValue: () => UnparsedValue,
|
|
30
|
-
isValidStaticStyleValue: () => isValidStaticStyleValue
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(schema_exports);
|
|
33
|
-
var import_units = require("./__generated__/units");
|
|
34
|
-
var import_zod = require("zod");
|
|
35
|
-
const Unit = import_zod.z.union([
|
|
36
|
-
// expected tuple with at least single element
|
|
37
|
-
// so cast to tuple with single union element to get correct inference
|
|
38
|
-
import_zod.z.enum(Object.values(import_units.units).flat()),
|
|
39
|
-
import_zod.z.literal("number")
|
|
40
|
-
]);
|
|
41
|
-
const UnitValue = import_zod.z.object({
|
|
42
|
-
type: import_zod.z.literal("unit"),
|
|
43
|
-
unit: Unit,
|
|
44
|
-
value: import_zod.z.number()
|
|
45
|
-
});
|
|
46
|
-
const KeywordValue = import_zod.z.object({
|
|
47
|
-
type: import_zod.z.literal("keyword"),
|
|
48
|
-
// @todo use exact type
|
|
49
|
-
value: import_zod.z.string()
|
|
50
|
-
});
|
|
51
|
-
const UnparsedValue = import_zod.z.object({
|
|
52
|
-
type: import_zod.z.literal("unparsed"),
|
|
53
|
-
value: import_zod.z.string(),
|
|
54
|
-
// For the builder we want to be able to hide background-image
|
|
55
|
-
hidden: import_zod.z.boolean().optional()
|
|
56
|
-
});
|
|
57
|
-
const FontFamilyValue = import_zod.z.object({
|
|
58
|
-
type: import_zod.z.literal("fontFamily"),
|
|
59
|
-
value: import_zod.z.array(import_zod.z.string())
|
|
60
|
-
});
|
|
61
|
-
const RgbValue = import_zod.z.object({
|
|
62
|
-
type: import_zod.z.literal("rgb"),
|
|
63
|
-
r: import_zod.z.number(),
|
|
64
|
-
g: import_zod.z.number(),
|
|
65
|
-
b: import_zod.z.number(),
|
|
66
|
-
alpha: import_zod.z.number()
|
|
67
|
-
});
|
|
68
|
-
const ImageValue = import_zod.z.object({
|
|
69
|
-
type: import_zod.z.literal("image"),
|
|
70
|
-
value: import_zod.z.union([
|
|
71
|
-
import_zod.z.object({ type: import_zod.z.literal("asset"), value: import_zod.z.string() }),
|
|
72
|
-
// url is not stored in db and only used by css-engine transformValue
|
|
73
|
-
// to prepare image value for rendering
|
|
74
|
-
import_zod.z.object({ type: import_zod.z.literal("url"), url: import_zod.z.string() })
|
|
75
|
-
]),
|
|
76
|
-
// For the builder we want to be able to hide images
|
|
77
|
-
hidden: import_zod.z.boolean().optional()
|
|
78
|
-
});
|
|
79
|
-
const InvalidValue = import_zod.z.object({
|
|
80
|
-
type: import_zod.z.literal("invalid"),
|
|
81
|
-
value: import_zod.z.string()
|
|
82
|
-
});
|
|
83
|
-
const UnsetValue = import_zod.z.object({
|
|
84
|
-
type: import_zod.z.literal("unset"),
|
|
85
|
-
value: import_zod.z.literal("")
|
|
86
|
-
});
|
|
87
|
-
const TupleValueItem = import_zod.z.union([
|
|
88
|
-
UnitValue,
|
|
89
|
-
KeywordValue,
|
|
90
|
-
UnparsedValue,
|
|
91
|
-
RgbValue
|
|
92
|
-
]);
|
|
93
|
-
const TupleValue = import_zod.z.object({
|
|
94
|
-
type: import_zod.z.literal("tuple"),
|
|
95
|
-
value: import_zod.z.array(TupleValueItem),
|
|
96
|
-
hidden: import_zod.z.boolean().optional()
|
|
97
|
-
});
|
|
98
|
-
const LayerValueItem = import_zod.z.union([
|
|
99
|
-
UnitValue,
|
|
100
|
-
KeywordValue,
|
|
101
|
-
UnparsedValue,
|
|
102
|
-
ImageValue,
|
|
103
|
-
TupleValue,
|
|
104
|
-
InvalidValue
|
|
105
|
-
]);
|
|
106
|
-
const LayersValue = import_zod.z.object({
|
|
107
|
-
type: import_zod.z.literal("layers"),
|
|
108
|
-
value: import_zod.z.array(LayerValueItem)
|
|
109
|
-
});
|
|
110
|
-
const ValidStaticStyleValue = import_zod.z.union([
|
|
111
|
-
ImageValue,
|
|
112
|
-
LayersValue,
|
|
113
|
-
UnitValue,
|
|
114
|
-
KeywordValue,
|
|
115
|
-
FontFamilyValue,
|
|
116
|
-
RgbValue,
|
|
117
|
-
UnparsedValue,
|
|
118
|
-
TupleValue
|
|
119
|
-
]);
|
|
120
|
-
const isValidStaticStyleValue = (styleValue) => {
|
|
121
|
-
const staticStyleValue = styleValue;
|
|
122
|
-
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";
|
|
123
|
-
};
|
|
124
|
-
const VarValue = import_zod.z.object({
|
|
125
|
-
type: import_zod.z.literal("var"),
|
|
126
|
-
value: import_zod.z.string(),
|
|
127
|
-
fallbacks: import_zod.z.array(ValidStaticStyleValue)
|
|
128
|
-
});
|
|
129
|
-
const StyleValue = import_zod.z.union([
|
|
130
|
-
ValidStaticStyleValue,
|
|
131
|
-
InvalidValue,
|
|
132
|
-
UnsetValue,
|
|
133
|
-
VarValue
|
|
134
|
-
]);
|
|
135
|
-
const Style = import_zod.z.record(import_zod.z.string(), StyleValue);
|
package/lib/custom-data.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { popularityIndex } from "./popularity-index";
|
|
2
|
-
const propertiesData = {};
|
|
3
|
-
const keywordValues = {};
|
|
4
|
-
const getPopularityIndex = (property) => popularityIndex.find((data) => data.property === property)?.dayPercentage ?? 0;
|
|
5
|
-
propertiesData.WebkitFontSmoothing = {
|
|
6
|
-
unitGroups: [],
|
|
7
|
-
inherited: true,
|
|
8
|
-
initial: {
|
|
9
|
-
type: "keyword",
|
|
10
|
-
value: "auto"
|
|
11
|
-
},
|
|
12
|
-
popularity: getPopularityIndex("webkit-font-smoothing"),
|
|
13
|
-
appliesTo: "allElements"
|
|
14
|
-
};
|
|
15
|
-
keywordValues.WebkitFontSmoothing = [
|
|
16
|
-
"auto",
|
|
17
|
-
"none",
|
|
18
|
-
"antialiased",
|
|
19
|
-
"subpixel-antialiased"
|
|
20
|
-
];
|
|
21
|
-
propertiesData.MozOsxFontSmoothing = {
|
|
22
|
-
unitGroups: [],
|
|
23
|
-
inherited: true,
|
|
24
|
-
initial: {
|
|
25
|
-
type: "keyword",
|
|
26
|
-
value: "auto"
|
|
27
|
-
},
|
|
28
|
-
popularity: getPopularityIndex("moz-osx-font-smoothing"),
|
|
29
|
-
appliesTo: "allElements"
|
|
30
|
-
};
|
|
31
|
-
keywordValues.MozOsxFontSmoothing = ["auto", "grayscale"];
|
|
32
|
-
keywordValues.listStyleType = [
|
|
33
|
-
"disc",
|
|
34
|
-
"circle",
|
|
35
|
-
"square",
|
|
36
|
-
"decimal",
|
|
37
|
-
"georgian",
|
|
38
|
-
"trad-chinese-informal",
|
|
39
|
-
"kannada"
|
|
40
|
-
];
|
|
41
|
-
export {
|
|
42
|
-
keywordValues,
|
|
43
|
-
propertiesData
|
|
44
|
-
};
|
package/lib/html-check.js
DELETED