cssstyle
Version:
CSSStyleDeclaration Object Model implementation
1,495 lines (1,494 loc) • 215 kB
JavaScript
"use strict";
// autogenerated - 2025-12-17
// https://www.w3.org/Style/CSS/all-properties.en.html
var external_dependency_parsers_0 = require("../parsers.js");
var backgroundImage_export_parse, backgroundImage_export_definition;
const backgroundImage_local_var_property = "background-image";
const backgroundImage_local_var_shorthand = "background";
backgroundImage_export_parse = function parse(v, opt = {}) {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const values = external_dependency_parsers_0.splitValue(v, {
delimiter: ","
});
const parsedValues = [];
for (const val of values) {
const value = external_dependency_parsers_0.parsePropertyValue(backgroundImage_local_var_property, val, {
globalObject,
inArray: true
});
if (Array.isArray(value) && value.length === 1) {
const [{
name,
type
}] = value;
switch (type) {
case "GlobalKeyword":
case "Identifier":
{
parsedValues.push(name);
break;
}
case "Url":
{
const parsedValue = external_dependency_parsers_0.parseUrl(value);
if (!parsedValue) {
return;
}
parsedValues.push(parsedValue);
break;
}
default:
{
const parsedValue = external_dependency_parsers_0.parseGradient(value);
if (!parsedValue) {
return;
}
parsedValues.push(parsedValue);
}
}
} else if (typeof value === "string") {
parsedValues.push(value);
} else {
return;
}
}
if (parsedValues.length) {
return parsedValues.join(", ");
}
};
backgroundImage_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v, this._global);
if (external_dependency_parsers_0.hasVarFunc(v)) {
this._setProperty(backgroundImage_local_var_shorthand, "");
this._setProperty(backgroundImage_local_var_property, v);
} else {
const val = backgroundImage_export_parse(v, {
globalObject: this._global
});
if (typeof val === "string") {
const shorthandPriority = this._priorities.get(backgroundImage_local_var_shorthand);
const prior = this._priorities.get(backgroundImage_local_var_property) ?? "";
const priority = shorthandPriority && prior ? "" : prior;
this._setProperty(backgroundImage_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundImage_local_var_property);
},
enumerable: true,
configurable: true
};
var backgroundPosition_export_parse, backgroundPosition_export_definition;
const backgroundPosition_local_var_property = "background-position";
const backgroundPosition_local_var_shorthand = "background";
const backgroundPosition_local_var_keyX = ["left", "right"];
const backgroundPosition_local_var_keyY = ["top", "bottom"];
const backgroundPosition_local_var_keywordsX = ["center", ...backgroundPosition_local_var_keyX];
const backgroundPosition_local_var_keywordsY = ["center", ...backgroundPosition_local_var_keyY];
const backgroundPosition_local_var_keywords = ["center", ...backgroundPosition_local_var_keyX, ...backgroundPosition_local_var_keyY];
backgroundPosition_export_parse = function parse(v, opt = {}) {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const values = external_dependency_parsers_0.splitValue(v, {
delimiter: ","
});
const parsedValues = [];
for (const val of values) {
const value = external_dependency_parsers_0.parsePropertyValue(backgroundPosition_local_var_property, val, {
globalObject,
inArray: true
});
if (Array.isArray(value) && value.length) {
let parsedValue = "";
switch (value.length) {
case 1:
{
const [part1] = value;
const val1 = part1.type === "Identifier" ? part1.name : external_dependency_parsers_0.parseLengthPercentage([part1]);
if (val1) {
if (val1 === "center") {
parsedValue = `${val1} ${val1}`;
} else if (val1 === "top" || val1 === "bottom") {
parsedValue = `center ${val1}`;
} else {
parsedValue = `${val1} center`;
}
}
break;
}
case 2:
{
const [part1, part2] = value;
const val1 = part1.type === "Identifier" ? part1.name : external_dependency_parsers_0.parseLengthPercentage([part1]);
const val2 = part2.type === "Identifier" ? part2.name : external_dependency_parsers_0.parseLengthPercentage([part2]);
if (val1 && val2) {
if (backgroundPosition_local_var_keywordsX.includes(val1) && backgroundPosition_local_var_keywordsY.includes(val2)) {
parsedValue = `${val1} ${val2}`;
} else if (backgroundPosition_local_var_keywordsY.includes(val1) && backgroundPosition_local_var_keywordsX.includes(val2)) {
parsedValue = `${val2} ${val1}`;
} else if (backgroundPosition_local_var_keywordsX.includes(val1)) {
if (val2 === "center" || !backgroundPosition_local_var_keywordsX.includes(val2)) {
parsedValue = `${val1} ${val2}`;
}
} else if (backgroundPosition_local_var_keywordsY.includes(val2)) {
if (!backgroundPosition_local_var_keywordsY.includes(val1)) {
parsedValue = `${val1} ${val2}`;
}
} else if (!backgroundPosition_local_var_keywordsY.includes(val1) && !backgroundPosition_local_var_keywordsX.includes(val2)) {
parsedValue = `${val1} ${val2}`;
}
}
break;
}
case 3:
{
const [part1, part2, part3] = value;
const val1 = part1.type === "Identifier" && part1.name;
const val2 = part2.type === "Identifier" ? part2.name : external_dependency_parsers_0.parseLengthPercentage([part2]);
const val3 = part3.type === "Identifier" ? part3.name : external_dependency_parsers_0.parseLengthPercentage([part3]);
if (val1 && val2 && val3) {
let posX = "";
let offX = "";
let posY = "";
let offY = "";
if (backgroundPosition_local_var_keywordsX.includes(val1)) {
if (backgroundPosition_local_var_keyY.includes(val2)) {
if (!backgroundPosition_local_var_keywords.includes(val3)) {
posX = val1;
posY = val2;
offY = val3;
}
} else if (backgroundPosition_local_var_keyY.includes(val3)) {
if (!backgroundPosition_local_var_keywords.includes(val2)) {
posX = val1;
offX = val2;
posY = val3;
}
}
} else if (backgroundPosition_local_var_keywordsY.includes(val1)) {
if (backgroundPosition_local_var_keyX.includes(val2)) {
if (!backgroundPosition_local_var_keywords.includes(val3)) {
posX = val2;
offX = val3;
posY = val1;
}
} else if (backgroundPosition_local_var_keyX.includes(val3)) {
if (!backgroundPosition_local_var_keywords.includes(val2)) {
posX = val3;
posY = val1;
offY = val2;
}
}
}
if (posX && posY) {
if (offX) {
parsedValue = `${posX} ${offX} ${posY}`;
} else if (offY) {
parsedValue = `${posX} ${posY} ${offY}`;
}
}
}
break;
}
case 4:
{
const [part1, part2, part3, part4] = value;
const val1 = part1.type === "Identifier" && part1.name;
const val2 = external_dependency_parsers_0.parseLengthPercentage([part2]);
const val3 = part3.type === "Identifier" && part3.name;
const val4 = external_dependency_parsers_0.parseLengthPercentage([part4]);
if (val1 && val2 && val3 && val4) {
let posX = "";
let offX = "";
let posY = "";
let offY = "";
if (backgroundPosition_local_var_keywordsX.includes(val1) && backgroundPosition_local_var_keyY.includes(val3)) {
posX = val1;
offX = val2;
posY = val3;
offY = val4;
} else if (backgroundPosition_local_var_keyX.includes(val1) && backgroundPosition_local_var_keywordsY.includes(val3)) {
posX = val1;
offX = val2;
posY = val3;
offY = val4;
} else if (backgroundPosition_local_var_keyY.includes(val1) && backgroundPosition_local_var_keywordsX.includes(val3)) {
posX = val3;
offX = val4;
posY = val1;
offY = val2;
}
if (posX && offX && posY && offY) {
parsedValue = `${posX} ${offX} ${posY} ${offY}`;
}
}
break;
}
default:
}
if (parsedValue) {
parsedValues.push(parsedValue);
} else {
return;
}
} else if (typeof value === "string") {
parsedValues.push(value);
}
}
if (parsedValues.length) {
return parsedValues.join(", ");
}
};
backgroundPosition_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v, this._global);
if (external_dependency_parsers_0.hasVarFunc(v)) {
this._setProperty(backgroundPosition_local_var_shorthand, "");
this._setProperty(backgroundPosition_local_var_property, v);
} else {
const val = backgroundPosition_export_parse(v, {
globalObject: this._global
});
if (typeof val === "string") {
const shorthandPriority = this._priorities.get(backgroundPosition_local_var_shorthand);
const prior = this._priorities.get(backgroundPosition_local_var_property) ?? "";
const priority = shorthandPriority && prior ? "" : prior;
this._setProperty(backgroundPosition_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundPosition_local_var_property);
},
enumerable: true,
configurable: true
};
var backgroundSize_export_parse, backgroundSize_export_definition;
const backgroundSize_local_var_property = "background-size";
const backgroundSize_local_var_shorthand = "background";
backgroundSize_export_parse = function parse(v, opt = {}) {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const values = external_dependency_parsers_0.splitValue(v, {
delimiter: ","
});
const parsedValues = [];
for (const val of values) {
const value = external_dependency_parsers_0.parsePropertyValue(backgroundSize_local_var_property, val, {
globalObject,
inArray: true
});
if (Array.isArray(value) && value.length) {
if (value.length === 1) {
const [{
isNumber,
name,
type,
value: itemValue
}] = value;
switch (type) {
case "Calc":
{
if (isNumber) {
return;
}
parsedValues.push(`${name}(${itemValue})`);
break;
}
case "GlobalKeyword":
case "Identifier":
{
parsedValues.push(name);
break;
}
default:
{
const parsedValue = external_dependency_parsers_0.parseLengthPercentage(value);
if (!parsedValue) {
return;
}
parsedValues.push(parsedValue);
}
}
} else {
const [val1, val2] = value;
const parts = [];
if (val1.type === "Calc" && !val1.isNumber) {
parts.push(`${val1.name}(${val1.value})`);
} else if (val1.type === "Identifier") {
parts.push(val1.name);
} else if (val1.type === "Dimension") {
parts.push(`${val1.value}${val1.unit}`);
} else if (val1.type === "Percentage") {
parts.push(`${val1.value}%`);
} else {
return;
}
switch (val2.type) {
case "Calc":
{
if (val2.isNumber) {
return;
}
parts.push(`${val2.name}(${val2.value})`);
break;
}
case "Dimension":
{
parts.push(`${val2.value}${val2.unit}`);
break;
}
case "Identifier":
{
if (val2.name !== "auto") {
parts.push(val2.name);
}
break;
}
case "Percentage":
{
parts.push(`${val2.value}%`);
break;
}
default:
{
return;
}
}
parsedValues.push(parts.join(" "));
}
} else if (typeof value === "string") {
parsedValues.push(value);
}
}
if (parsedValues.length) {
return parsedValues.join(", ");
}
};
backgroundSize_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v, this._global);
if (external_dependency_parsers_0.hasVarFunc(v)) {
this._setProperty(backgroundSize_local_var_shorthand, "");
this._setProperty(backgroundSize_local_var_property, v);
} else {
const val = backgroundSize_export_parse(v, {
globalObject: this._global
});
if (typeof val === "string") {
const shorthandPriority = this._priorities.get(backgroundSize_local_var_shorthand);
const prior = this._priorities.get(backgroundSize_local_var_property) ?? "";
const priority = shorthandPriority && prior ? "" : prior;
this._setProperty(backgroundSize_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundSize_local_var_property);
},
enumerable: true,
configurable: true
};
var backgroundRepeat_export_parse, backgroundRepeat_export_definition;
const backgroundRepeat_local_var_property = "background-repeat";
const backgroundRepeat_local_var_shorthand = "background";
backgroundRepeat_export_parse = function parse(v, opt = {}) {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const values = external_dependency_parsers_0.splitValue(v, {
delimiter: ","
});
const parsedValues = [];
for (const val of values) {
const value = external_dependency_parsers_0.parsePropertyValue(backgroundRepeat_local_var_property, val, {
globalObject,
inArray: true
});
if (Array.isArray(value) && value.length) {
let parsedValue = "";
switch (value.length) {
case 1:
{
const [part1] = value;
const val1 = part1.type === "Identifier" && part1.name;
if (val1) {
parsedValue = val1;
}
break;
}
case 2:
{
const [part1, part2] = value;
const val1 = part1.type === "Identifier" && part1.name;
const val2 = part2.type === "Identifier" && part2.name;
if (val1 && val2) {
if (val1 === "repeat" && val2 === "no-repeat") {
parsedValue = "repeat-x";
} else if (val1 === "no-repeat" && val2 === "repeat") {
parsedValue = "repeat-y";
} else if (val1 === val2) {
parsedValue = val1;
} else {
parsedValue = `${val1} ${val2}`;
}
}
break;
}
default:
}
if (parsedValue) {
parsedValues.push(parsedValue);
} else {
return;
}
} else if (typeof value === "string") {
parsedValues.push(value);
}
}
if (parsedValues.length) {
return parsedValues.join(", ");
}
};
backgroundRepeat_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v, this._global);
if (external_dependency_parsers_0.hasVarFunc(v)) {
this._setProperty(backgroundRepeat_local_var_shorthand, "");
this._setProperty(backgroundRepeat_local_var_property, v);
} else {
const val = backgroundRepeat_export_parse(v, {
globalObject: this._global
});
if (typeof val === "string") {
const shorthandPriority = this._priorities.get(backgroundRepeat_local_var_shorthand);
const prior = this._priorities.get(backgroundRepeat_local_var_property) ?? "";
const priority = shorthandPriority && prior ? "" : prior;
this._setProperty(backgroundRepeat_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundRepeat_local_var_property);
},
enumerable: true,
configurable: true
};
var backgroundOrigin_export_parse, backgroundOrigin_export_definition;
const backgroundOrigin_local_var_property = "background-origin";
const backgroundOrigin_local_var_shorthand = "background";
backgroundOrigin_export_parse = function parse(v, opt = {}) {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const values = external_dependency_parsers_0.splitValue(v, {
delimiter: ","
});
const parsedValues = [];
for (const val of values) {
const value = external_dependency_parsers_0.parsePropertyValue(backgroundOrigin_local_var_property, val, {
globalObject,
inArray: true
});
if (Array.isArray(value) && value.length === 1) {
const [{
name,
type
}] = value;
switch (type) {
case "GlobalKeyword":
case "Identifier":
{
parsedValues.push(name);
break;
}
default:
{
return;
}
}
} else if (typeof value === "string") {
parsedValues.push(value);
}
}
if (parsedValues.length) {
return parsedValues.join(", ");
}
};
backgroundOrigin_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v, this._global);
if (external_dependency_parsers_0.hasVarFunc(v)) {
this._setProperty(backgroundOrigin_local_var_shorthand, "");
this._setProperty(backgroundOrigin_local_var_property, v);
} else {
const val = backgroundOrigin_export_parse(v, {
globalObject: this._global
});
if (typeof val === "string") {
const shorthandPriority = this._priorities.get(backgroundOrigin_local_var_shorthand);
const prior = this._priorities.get(backgroundOrigin_local_var_property) ?? "";
const priority = shorthandPriority && prior ? "" : prior;
this._setProperty(backgroundOrigin_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundOrigin_local_var_property);
},
enumerable: true,
configurable: true
};
var backgroundClip_export_parse, backgroundClip_export_definition;
const backgroundClip_local_var_property = "background-clip";
const backgroundClip_local_var_shorthand = "background";
backgroundClip_export_parse = function parse(v, opt = {}) {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const values = external_dependency_parsers_0.splitValue(v, {
delimiter: ","
});
const parsedValues = [];
for (const val of values) {
const value = external_dependency_parsers_0.parsePropertyValue(backgroundClip_local_var_property, val, {
globalObject,
inArray: true
});
if (Array.isArray(value) && value.length === 1) {
const [{
name,
type
}] = value;
switch (type) {
case "GlobalKeyword":
case "Identifier":
{
parsedValues.push(name);
break;
}
default:
{
return;
}
}
} else if (typeof value === "string") {
parsedValues.push(value);
}
}
if (parsedValues.length) {
return parsedValues.join(", ");
}
};
backgroundClip_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v, this._global);
if (external_dependency_parsers_0.hasVarFunc(v)) {
this._setProperty(backgroundClip_local_var_shorthand, "");
this._setProperty(backgroundClip_local_var_property, v);
} else {
const val = backgroundClip_export_parse(v, {
globalObject: this._global
});
if (typeof val === "string") {
const shorthandPriority = this._priorities.get(backgroundClip_local_var_shorthand);
const prior = this._priorities.get(backgroundClip_local_var_property) ?? "";
const priority = shorthandPriority && prior ? "" : prior;
this._setProperty(backgroundClip_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundClip_local_var_property);
},
enumerable: true,
configurable: true
};
var backgroundAttachment_export_parse, backgroundAttachment_export_definition;
const backgroundAttachment_local_var_property = "background-attachment";
const backgroundAttachment_local_var_shorthand = "background";
backgroundAttachment_export_parse = function parse(v, opt = {}) {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const values = external_dependency_parsers_0.splitValue(v, {
delimiter: ","
});
const parsedValues = [];
for (const val of values) {
const value = external_dependency_parsers_0.parsePropertyValue(backgroundAttachment_local_var_property, val, {
globalObject,
inArray: true
});
if (Array.isArray(value) && value.length === 1) {
const [{
name,
type
}] = value;
switch (type) {
case "GlobalKeyword":
case "Identifier":
{
parsedValues.push(name);
break;
}
default:
{
return;
}
}
} else if (typeof value === "string") {
parsedValues.push(value);
}
}
if (parsedValues.length) {
return parsedValues.join(", ");
}
};
backgroundAttachment_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v, this._global);
if (external_dependency_parsers_0.hasVarFunc(v)) {
this._setProperty(backgroundAttachment_local_var_shorthand, "");
this._setProperty(backgroundAttachment_local_var_property, v);
} else {
const val = backgroundAttachment_export_parse(v, {
globalObject: this._global
});
if (typeof val === "string") {
const shorthandPriority = this._priorities.get(backgroundAttachment_local_var_shorthand);
const prior = this._priorities.get(backgroundAttachment_local_var_property) ?? "";
const priority = shorthandPriority && prior ? "" : prior;
this._setProperty(backgroundAttachment_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundAttachment_local_var_property);
},
enumerable: true,
configurable: true
};
var backgroundColor_export_parse, backgroundColor_export_definition;
const backgroundColor_local_var_property = "background-color";
const backgroundColor_local_var_shorthand = "background";
backgroundColor_export_parse = function parse(v, opt = {}) {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const value = external_dependency_parsers_0.parsePropertyValue(backgroundColor_local_var_property, v, {
globalObject,
inArray: true
});
if (Array.isArray(value) && value.length === 1) {
const [{
name,
type
}] = value;
switch (type) {
case "GlobalKeyword":
{
return name;
}
default:
{
return external_dependency_parsers_0.parseColor(value);
}
}
} else if (typeof value === "string") {
return value;
}
};
backgroundColor_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v, this._global);
if (external_dependency_parsers_0.hasVarFunc(v)) {
this._setProperty(backgroundColor_local_var_shorthand, "");
this._setProperty(backgroundColor_local_var_property, v);
} else {
const val = backgroundColor_export_parse(v, {
globalObject: this._global
});
if (typeof val === "string") {
const shorthandPriority = this._priorities.get(backgroundColor_local_var_shorthand);
const prior = this._priorities.get(backgroundColor_local_var_property) ?? "";
const priority = shorthandPriority && prior ? "" : prior;
this._setProperty(backgroundColor_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundColor_local_var_property);
},
enumerable: true,
configurable: true
};
var background_export_shorthandFor, background_export_parse, background_export_definition;
const background_local_var_property = "background";
const background_local_var_initialValues = new Map([["background-image", "none"], ["background-position", "0% 0%"], ["background-size", "auto"], ["background-repeat", "repeat"], ["background-origin", "padding-box"], ["background-clip", "border-box"], ["background-attachment", "scroll"], ["background-color", "transparent"]]);
background_export_shorthandFor = new Map([["background-image", {
parse: backgroundImage_export_parse,
definition: backgroundImage_export_definition
}], ["background-position", {
parse: backgroundPosition_export_parse,
definition: backgroundPosition_export_definition
}], ["background-size", {
parse: backgroundSize_export_parse,
definition: backgroundSize_export_definition
}], ["background-repeat", {
parse: backgroundRepeat_export_parse,
definition: backgroundRepeat_export_definition
}], ["background-origin", {
parse: backgroundOrigin_export_parse,
definition: backgroundOrigin_export_definition
}], ["background-clip", {
parse: backgroundClip_export_parse,
definition: backgroundClip_export_definition
}], ["background-attachment", {
parse: backgroundAttachment_export_parse,
definition: backgroundAttachment_export_definition
}], ["background-color", {
parse: backgroundColor_export_parse,
definition: backgroundColor_export_definition
}]]);
background_export_parse = function parse(v, opt = {}) {
const {
globalObject
} = opt;
if (v === "") {
return v;
} else if (external_dependency_parsers_0.hasCalcFunc(v)) {
v = external_dependency_parsers_0.resolveCalc(v);
}
if (!external_dependency_parsers_0.isValidPropertyValue(background_local_var_property, v)) {
return;
}
const values = external_dependency_parsers_0.splitValue(v, {
delimiter: ","
});
const bgValues = [];
const l = values.length;
for (let i = 0; i < l; i++) {
let bg = {
"background-image": background_local_var_initialValues.get("background-image"),
"background-position": background_local_var_initialValues.get("background-position"),
"background-size": background_local_var_initialValues.get("background-size"),
"background-repeat": background_local_var_initialValues.get("background-repeat"),
"background-origin": background_local_var_initialValues.get("background-origin"),
"background-clip": background_local_var_initialValues.get("background-clip"),
"background-attachment": background_local_var_initialValues.get("background-attachment"),
"background-color": background_local_var_initialValues.get("background-color")
};
if (l > 1 && i !== l - 1) {
bg = {
"background-image": background_local_var_initialValues.get("background-image"),
"background-position": background_local_var_initialValues.get("background-position"),
"background-size": background_local_var_initialValues.get("background-size"),
"background-repeat": background_local_var_initialValues.get("background-repeat"),
"background-origin": background_local_var_initialValues.get("background-origin"),
"background-clip": background_local_var_initialValues.get("background-clip"),
"background-attachment": background_local_var_initialValues.get("background-attachment")
};
}
const bgPosition = [];
const bgSize = [];
const bgRepeat = [];
const bgBox = [];
const bgParts = external_dependency_parsers_0.splitValue(values[i], {
delimiter: "/"
});
if (!bgParts.length || bgParts.length > 2) {
return;
}
const [bgPart1, bgPart2 = ""] = bgParts;
const parts1 = external_dependency_parsers_0.splitValue(bgPart1);
for (const part of parts1) {
let partValid = false;
for (const [longhand, value] of background_export_shorthandFor) {
if (external_dependency_parsers_0.isValidPropertyValue(longhand, part)) {
partValid = true;
switch (longhand) {
case "background-clip":
case "background-origin":
{
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bgBox.push(parsedValue);
}
break;
}
case "background-color":
{
if (i !== values.length - 1) {
return;
}
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bg[longhand] = parsedValue;
}
break;
}
case "background-position":
{
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bgPosition.push(parsedValue);
}
break;
}
case "background-repeat":
{
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bgRepeat.push(parsedValue);
}
break;
}
case "background-size":
{
break;
}
default:
{
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bg[longhand] = parsedValue;
}
}
}
}
}
if (!partValid) {
return;
}
}
if (bgPart2) {
const parts2 = external_dependency_parsers_0.splitValue(bgPart2);
for (const part of parts2) {
let partValid = false;
for (const [longhand, value] of background_export_shorthandFor) {
if (external_dependency_parsers_0.isValidPropertyValue(longhand, part)) {
partValid = true;
switch (longhand) {
case "background-clip":
case "background-origin":
{
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bgBox.push(parsedValue);
}
break;
}
case "background-color":
{
if (i !== l - 1) {
return;
}
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bg[longhand] = parsedValue;
}
break;
}
case "background-position":
{
break;
}
case "background-repeat":
{
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bgRepeat.push(parsedValue);
}
break;
}
case "background-size":
{
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bgSize.push(parsedValue);
}
break;
}
default:
{
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bg[longhand] = parsedValue;
}
}
}
}
}
if (!partValid) {
return;
}
}
}
if (bgPosition.length) {
const {
parse: parser
} = background_export_shorthandFor.get("background-position");
const value = parser(bgPosition.join(" "), {
globalObject
});
if (value) {
bg["background-position"] = value;
}
}
if (bgSize.length) {
const {
parse: parser
} = background_export_shorthandFor.get("background-size");
const value = parser(bgSize.join(" "), {
globalObject
});
if (value) {
bg["background-size"] = value;
}
}
if (bgRepeat.length) {
const {
parse: parser
} = background_export_shorthandFor.get("background-repeat");
const value = parser(bgRepeat.join(" "), {
globalObject
});
if (value) {
bg["background-repeat"] = value;
}
}
if (bgBox.length) {
switch (bgBox.length) {
case 1:
{
const [value] = bgBox;
bg["background-origin"] = value;
bg["background-clip"] = value;
break;
}
case 2:
{
const [value1, value2] = bgBox;
bg["background-origin"] = value1;
bg["background-clip"] = value2;
break;
}
default:
{
return;
}
}
}
bgValues.push(bg);
}
return bgValues;
};
background_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v, this._global);
if (v === "" || external_dependency_parsers_0.hasVarFunc(v)) {
for (const [key] of background_export_shorthandFor) {
this._setProperty(key, "");
}
this._setProperty(background_local_var_property, v);
} else {
const bgValues = background_export_parse(v, {
globalObject: this._global
});
if (!Array.isArray(bgValues)) {
return;
}
const bgMap = new Map([["background-image", []], ["background-position", []], ["background-size", []], ["background-repeat", []], ["background-origin", []], ["background-clip", []], ["background-attachment", []], ["background-color", []]]);
const backgrounds = [];
for (const bgValue of bgValues) {
const bg = [];
for (const [longhand, value] of Object.entries(bgValue)) {
if (value) {
const arr = bgMap.get(longhand);
arr.push(value);
bgMap.set(longhand, arr);
if (value !== background_local_var_initialValues.get(longhand)) {
if (longhand === "background-size") {
bg.push(`/ ${value}`);
} else {
bg.push(value);
}
} else if (longhand === "background-image") {
if (v === "none") {
bg.push(value);
}
} else if (longhand === "background-color") {
if (v === "transparent") {
bg.push(value);
}
}
}
}
backgrounds.push(bg.join(" "));
}
const priority = this._priorities.get(background_local_var_property) ?? "";
for (const [longhand, value] of bgMap) {
this._setProperty(longhand, value.join(", "), priority);
}
this._setProperty(background_local_var_property, backgrounds.join(", "), priority);
}
},
get() {
const v = this.getPropertyValue(background_local_var_property);
if (external_dependency_parsers_0.hasVarFunc(v)) {
return v;
}
const bgMap = new Map();
let l = 0;
for (const [longhand] of background_export_shorthandFor) {
const val = this.getPropertyValue(longhand);
if (longhand === "background-image") {
if (val === "none" && v === "none" && this.getPropertyValue("background-color") === "transparent") {
return val;
}
if (val !== background_local_var_initialValues.get(longhand)) {
const imgValues = external_dependency_parsers_0.splitValue(val, {
delimiter: ","
});
l = imgValues.length;
bgMap.set(longhand, imgValues);
}
} else if (longhand === "background-color") {
if (val !== background_local_var_initialValues.get(longhand) || v.includes(val)) {
bgMap.set(longhand, [val]);
}
} else if (val !== background_local_var_initialValues.get(longhand)) {
bgMap.set(longhand, external_dependency_parsers_0.splitValue(val, {
delimiter: ","
}));
}
}
if (l === 0) {
const [background] = bgMap.get("background-color");
if (background) {
return background;
}
return "";
}
const bgValues = [];
for (let i = 0; i < l; i++) {
bgValues[i] = [];
}
for (const [longhand, values] of bgMap) {
for (let i = 0; i < l; i++) {
switch (longhand) {
case "background-color":
{
if (i === l - 1) {
const value = values[0];
if (external_dependency_parsers_0.hasVarFunc(value)) {
return "";
}
if (value && value !== background_local_var_initialValues.get(longhand)) {
const bgValue = bgValues[i];
bgValue.push(value);
}
}
break;
}
case "background-size":
{
const value = values[i];
if (external_dependency_parsers_0.hasVarFunc(value)) {
return "";
}
if (value && value !== background_local_var_initialValues.get(longhand)) {
const bgValue = bgValues[i];
bgValue.push(`/ ${value}`);
}
break;
}
default:
{
const value = values[i];
if (external_dependency_parsers_0.hasVarFunc(value)) {
return "";
}
if (value && value !== background_local_var_initialValues.get(longhand)) {
const bgValue = bgValues[i];
bgValue.push(value);
}
}
}
}
}
const backgrounds = [];
for (const bgValue of bgValues) {
backgrounds.push(bgValue.join(" "));
}
return backgrounds.join(", ");
},
enumerable: true,
configurable: true
};
var borderTopWidth_export_parse, borderTopWidth_export_definition;
const borderTopWidth_local_var_property = "border-top-width";
const borderTopWidth_local_var_lineShorthand = "border-width";
const borderTopWidth_local_var_positionShorthand = "border-top";
const borderTopWidth_local_var_shorthand = "border";
borderTopWidth_export_parse = function parse(v, opt = {}) {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const value = external_dependency_parsers_0.parsePropertyValue(borderTopWidth_local_var_property, v, {
globalObject,
inArray: true
});
if (Array.isArray(value) && value.length === 1) {
const [{
isNumber,
name,
type,
value: itemValue
}] = value;
switch (type) {
case "Calc":
{
if (isNumber) {
return;
}
return `${name}(${itemValue})`;
}
case "GlobalKeyword":
case "Identifier":
{
return name;
}
default:
{
return external_dependency_parsers_0.parseLength(value, {
min: 0
});
}
}
} else if (typeof value === "string") {
return value;
}
};
borderTopWidth_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v, this._global);
if (external_dependency_parsers_0.hasVarFunc(v)) {
this._borderSetter(borderTopWidth_local_var_property, v, "");
} else {
const val = borderTopWidth_export_parse(v, {
globalObject: this._global
});
if (typeof val === "string") {
const shorthandPriority = this._priorities.get(borderTopWidth_local_var_shorthand);
const linePriority = this._priorities.get(borderTopWidth_local_var_lineShorthand);
const positionPriority = this._priorities.get(borderTopWidth_local_var_positionShorthand);
let priority = this._priorities.get(borderTopWidth_local_var_property) ?? "";
if ((shorthandPriority || linePriority || positionPriority) && priority) {
priority = "";
}
this._borderSetter(borderTopWidth_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(borderTopWidth_local_var_property);
},
enumerable: true,
configurable: true
};
var borderRightWidth_export_parse, borderRightWidth_export_definition;
const borderRightWidth_local_var_property = "border-right-width";
const borderRightWidth_local_var_lineShorthand = "border-width";
const borderRightWidth_local_var_positionShorthand = "border-right";
const borderRightWidth_local_var_shorthand = "border";
borderRightWidth_export_parse = function parse(v, opt = {}) {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const value = external_dependency_parsers_0.parsePropertyValue(borderRightWidth_local_var_property, v, {
globalObject,
inArray: true
});
if (Array.isArray(value) && value.length === 1) {
const [{
isNumber,
name,
type,
value: itemValue
}] = value;
switch (type) {
case "Calc":
{
if (isNumber) {
return;
}
return `${name}(${itemValue})`;
}
case "GlobalKeyword":
case "Identifier":
{
return name;
}
default:
{
return external_dependency_parsers_0.parseLength(value, {
min: 0
});
}
}
} else if (typeof value === "string") {
return value;
}
};
borderRightWidth_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v, this._global);
if (external_dependency_parsers_0.hasVarFunc(v)) {
this._borderSetter(borderRightWidth_local_var_property, v, "");
} else {
const val = borderRightWidth_export_parse(v, {
globalObject: this._global
});
if (typeof val === "string") {
const shorthandPriority = this._priorities.get(borderRightWidth_local_var_shorthand);
const linePriority = this._priorities.get(borderRightWidth_local_var_lineShorthand);
const positionPriority = this._priorities.get(borderRightWidth_local_var_positionShorthand);
let priority = this._priorities.get(borderRightWidth_local_var_property) ?? "";
if ((shorthandPriority || linePriority || positionPriority) && priority) {
priority = "";
}
this._borderSetter(borderRightWidth_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(borderRightWidth_local_var_property);
},
enumerable: true,
configurable: true
};
var borderBottomWidth_export_parse, borderBottomWidth_export_definition;
const borderBottomWidth_local_var_property = "border-bottom-width";
const borderBottomWidth_local_var_lineShorthand = "border-width";
const borderBottomWidth_local_var_positionShorthand = "border-bottom";
const borderBottomWidth_local_var_shorthand = "border";
borderBottomWidth_export_parse = function parse(v, opt = {}) {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const value = external_dependency_parsers_0.parsePropertyValue(borderBottomWidth_local_var_property, v, {
globalObject,
inArray: true
});
if (Array.isArray(value) && value.length === 1) {
const [{
isNumber,
name,
type,
value: itemValue
}] = value;
switch (type) {
case "Calc":
{
if (isNumber) {
return;
}
return `${name}(${itemValue})`;
}
case "GlobalKeyword":
case "Identifier":
{
return name;
}
default:
{
return external_dependency_parsers_0.parseLength(value, {
min: 0
});
}
}
} else if (typeof value === "string") {
return value;
}
};
borderBottomWidth_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v, this._global);
if (external_dependency_parsers_0.hasVarFunc(v)) {
this._borderSetter(borderBottomWidth_local_var_property, v, "");
} else {
const val = borderBottomWidth_export_parse(v, {
globalObject: this._global
});
if (typeof val === "string") {
const shorthandPriority = this._priorities.get(borderBottomWidth_local_var_shorthand);
const linePriority = this._priorities.get(borderBottomWidth_local_var_lineShorthand);
const positionPriority = this._priorities.get(borderBottomWidth_local_var_positionShorthand);
let priority = this._priorities.get(borderBottomWidth_local_var_property) ?? "";
if ((shorthandPriority || linePriority || positionPriority) && priority) {
priority = "";
}
this._borderSetter(borderBottomWidth_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(borderBottomWidth_local_var_property);
},
enumerable: true,
configurable: true
};
var borderLeftWidth_export_parse, borderLeftWidth_export_definition;
const borderLeftWidth_local_var_property = "border-left-width";
const borderLeftWidth_local_var_lineShorthand = "border-width";
const borderLeftWidth_local_var_positionShorthand = "border-left";
const borderLeftWidth_local_var_shorthand = "border";
borderLeftWidth_export_parse = function parse(v, opt = {}) {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const value = external_dependency_parsers_0.parsePropertyValue(borderLeftWidth_local_var_property, v, {
globalObject,
inArray: true
});
if (Array.isArray(value) && value.length === 1) {
const [{
isNumber,
name,
type,
value: itemValue
}] = value;
switch (type) {
case "Calc":
{
if (isNumber) {
return;
}
return `${name}(${itemValue})`;
}
case "GlobalKeyword":
case "Identifier":
{
return name;
}
default:
{
return external_dependency_parsers_0.parseLength(value, {
min: 0
});
}
}
} else if (typeof value === "string") {
return value;
}
};
borderLeftWidth_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v, this._global);
if (external_dependency_parsers_0.hasVarFunc(v)) {
this._borderSetter(borderLeftWidth_local_var_property, v, "");
} else {
const val = borderLeftWidth_export_parse(v, {
globalObject: this._global
});
if (typeof val === "string") {
const shorthandPriority = this._priorities.get(borderLeftWidth_local_var_shorthand);
const linePriority = this._priorities.get(borderLeftWidth_local_var_lineShorthand);
const positionPriority = this._priorities.get(borderLeftWidth_local_var_positionShorthand);
let priority = this._priorities.get(borderLeftWidth_local_var_property) ?? "";
if ((shorthandPriority || linePriority || positionPriority) && priority) {
priority = "";
}
this._borderSetter(borderLeftWidth_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(borderLeftWidth_local_var_property);
},
enumerable: true,
configurable: true
};
var borderWidth_export_shorthandFor, borderWidth_export_parse, borderWidth_export_definition;
const borderWidth_local_var_property = "border-width";
const borderWidth_local_var_shorthand = "border";
borderWidth_export_shorthandFor = new Map([["border-top-width", {
parse: borderTopWidth_export_parse,
definition: borderTopWidth_export_definition
}], ["border-right-width", {
parse: borderRightWidth_export_parse,
definition: borderRightWidth_export_definition
}], ["border-bottom-width", {
parse: borderBottomWidth_export_parse,
definition: borderBottomWidth_export_definition
}], ["border-left-width", {
parse: borderLeftWidth_export_parse,
definition: borderLeftWidth_export_definition
}]]);
borderWidth_export_parse = function parse(v, opt = {}) {
const {
globa