cssstyle
Version:
An implementation of the CSSStyleDeclaration class from the CSS Object Model specification
1,372 lines (1,370 loc) • 233 kB
JavaScript
"use strict";
// autogenerated - 2026-01-06
// 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, backgroundImage_export_property;
const backgroundImage_local_var_property = "background-image";
const backgroundImage_local_var_shorthand = "background";
backgroundImage_export_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 parsedValue = external_dependency_parsers_0.resolveGradientUrlValue(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);
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 priority = !this._priorities.get(backgroundImage_local_var_shorthand) && this._priorities.has(backgroundImage_local_var_property) ? this._priorities.get(backgroundImage_local_var_property) : "";
this._setProperty(backgroundImage_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundImage_local_var_property);
},
enumerable: true,
configurable: true
};
backgroundImage_export_property = backgroundImage_local_var_property;
var backgroundPosition_export_parse, backgroundPosition_export_definition, backgroundPosition_export_property;
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 = (v, opt = {}) => {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const {
AST_TYPES
} = external_dependency_parsers_0;
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) {
const [part1, part2, part3, part4] = value;
let parsedValue = "";
switch (value.length) {
case 1:
{
const val1 = part1.type === AST_TYPES.IDENTIFIER ? part1.name : external_dependency_parsers_0.resolveNumericValue([part1], {
type: "length"
});
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 val1 = part1.type === AST_TYPES.IDENTIFIER ? part1.name : external_dependency_parsers_0.resolveNumericValue([part1], {
type: "length"
});
const val2 = part2.type === AST_TYPES.IDENTIFIER ? part2.name : external_dependency_parsers_0.resolveNumericValue([part2], {
type: "length"
});
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 val1 = part1.type === AST_TYPES.IDENTIFIER && part1.name;
const val2 = part2.type === AST_TYPES.IDENTIFIER ? part2.name : external_dependency_parsers_0.resolveNumericValue([part2], {
type: "length"
});
const val3 = part3.type === AST_TYPES.IDENTIFIER ? part3.name : external_dependency_parsers_0.resolveNumericValue([part3], {
type: "length"
});
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 val1 = part1.type === AST_TYPES.IDENTIFIER && part1.name;
const val2 = external_dependency_parsers_0.resolveNumericValue([part2], {
type: "length"
});
const val3 = part3.type === AST_TYPES.IDENTIFIER && part3.name;
const val4 = external_dependency_parsers_0.resolveNumericValue([part4], {
type: "length"
});
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);
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 priority = !this._priorities.get(backgroundPosition_local_var_shorthand) && this._priorities.has(backgroundPosition_local_var_property) ? this._priorities.get(backgroundPosition_local_var_property) : "";
this._setProperty(backgroundPosition_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundPosition_local_var_property);
},
enumerable: true,
configurable: true
};
backgroundPosition_export_property = backgroundPosition_local_var_property;
var backgroundSize_export_parse, backgroundSize_export_definition, backgroundSize_export_property;
const backgroundSize_local_var_property = "background-size";
const backgroundSize_local_var_shorthand = "background";
backgroundSize_export_parse = (v, opt = {}) => {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const {
AST_TYPES
} = external_dependency_parsers_0;
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 AST_TYPES.CALC:
{
if (isNumber) {
return;
}
parsedValues.push(`${name}(${itemValue})`);
break;
}
case AST_TYPES.GLOBAL_KEYWORD:
case AST_TYPES.IDENTIFIER:
{
parsedValues.push(name);
break;
}
default:
{
const parsedValue = external_dependency_parsers_0.resolveNumericValue(value, {
type: "length"
});
if (!parsedValue) {
return;
}
parsedValues.push(parsedValue);
}
}
} else {
const [val1, val2] = value;
const parts = [];
if (val1.type === AST_TYPES.CALC && !val1.isNumber) {
parts.push(`${val1.name}(${val1.value})`);
} else if (val1.type === AST_TYPES.IDENTIFIER) {
parts.push(val1.name);
} else if (val1.type === AST_TYPES.DIMENSION) {
parts.push(`${val1.value}${val1.unit}`);
} else if (val1.type === AST_TYPES.PERCENTAGE) {
parts.push(`${val1.value}%`);
} else {
return;
}
switch (val2.type) {
case AST_TYPES.CALC:
{
if (val2.isNumber) {
return;
}
parts.push(`${val2.name}(${val2.value})`);
break;
}
case AST_TYPES.DIMENSION:
{
parts.push(`${val2.value}${val2.unit}`);
break;
}
case AST_TYPES.IDENTIFIER:
{
if (val2.name !== "auto") {
parts.push(val2.name);
}
break;
}
case AST_TYPES.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);
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 priority = !this._priorities.get(backgroundSize_local_var_shorthand) && this._priorities.has(backgroundSize_local_var_property) ? this._priorities.get(backgroundSize_local_var_property) : "";
this._setProperty(backgroundSize_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundSize_local_var_property);
},
enumerable: true,
configurable: true
};
backgroundSize_export_property = backgroundSize_local_var_property;
var backgroundRepeat_export_parse, backgroundRepeat_export_definition, backgroundRepeat_export_property;
const backgroundRepeat_local_var_property = "background-repeat";
const backgroundRepeat_local_var_shorthand = "background";
backgroundRepeat_export_parse = (v, opt = {}) => {
const {
globalObject
} = opt;
if (v === "") {
return v;
}
const {
AST_TYPES
} = external_dependency_parsers_0;
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 === AST_TYPES.IDENTIFIER && part1.name;
if (val1) {
parsedValue = val1;
}
break;
}
case 2:
{
const [part1, part2] = value;
const val1 = part1.type === AST_TYPES.IDENTIFIER && part1.name;
const val2 = part2.type === AST_TYPES.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);
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 priority = !this._priorities.get(backgroundRepeat_local_var_shorthand) && this._priorities.has(backgroundRepeat_local_var_property) ? this._priorities.get(backgroundRepeat_local_var_property) : "";
this._setProperty(backgroundRepeat_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundRepeat_local_var_property);
},
enumerable: true,
configurable: true
};
backgroundRepeat_export_property = backgroundRepeat_local_var_property;
var backgroundOrigin_export_parse, backgroundOrigin_export_definition, backgroundOrigin_export_property;
const backgroundOrigin_local_var_property = "background-origin";
const backgroundOrigin_local_var_shorthand = "background";
backgroundOrigin_export_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 parsedValue = external_dependency_parsers_0.resolveKeywordValue(value);
if (!parsedValue) {
return;
}
parsedValues.push(parsedValue);
} 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);
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 priority = !this._priorities.get(backgroundOrigin_local_var_shorthand) && this._priorities.has(backgroundOrigin_local_var_property) ? this._priorities.get(backgroundOrigin_local_var_property) : "";
this._setProperty(backgroundOrigin_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundOrigin_local_var_property);
},
enumerable: true,
configurable: true
};
backgroundOrigin_export_property = backgroundOrigin_local_var_property;
var backgroundClip_export_parse, backgroundClip_export_definition, backgroundClip_export_property;
const backgroundClip_local_var_property = "background-clip";
const backgroundClip_local_var_shorthand = "background";
backgroundClip_export_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 parsedValue = external_dependency_parsers_0.resolveKeywordValue(value);
if (!parsedValue) {
return;
}
parsedValues.push(parsedValue);
} 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);
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 priority = !this._priorities.get(backgroundClip_local_var_shorthand) && this._priorities.has(backgroundClip_local_var_property) ? this._priorities.get(backgroundClip_local_var_property) : "";
this._setProperty(backgroundClip_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundClip_local_var_property);
},
enumerable: true,
configurable: true
};
backgroundClip_export_property = backgroundClip_local_var_property;
var backgroundAttachment_export_parse, backgroundAttachment_export_definition, backgroundAttachment_export_property;
const backgroundAttachment_local_var_property = "background-attachment";
const backgroundAttachment_local_var_shorthand = "background";
backgroundAttachment_export_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 parsedValue = external_dependency_parsers_0.resolveKeywordValue(value);
if (!parsedValue) {
return;
}
parsedValues.push(parsedValue);
} 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);
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 priority = !this._priorities.get(backgroundAttachment_local_var_shorthand) && this._priorities.has(backgroundAttachment_local_var_property) ? this._priorities.get(backgroundAttachment_local_var_property) : "";
this._setProperty(backgroundAttachment_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundAttachment_local_var_property);
},
enumerable: true,
configurable: true
};
backgroundAttachment_export_property = backgroundAttachment_local_var_property;
var backgroundColor_export_parse, backgroundColor_export_definition, backgroundColor_export_property;
const backgroundColor_local_var_property = "background-color";
const backgroundColor_local_var_shorthand = "background";
backgroundColor_export_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) {
return external_dependency_parsers_0.resolveColorValue(value);
} else if (typeof value === "string") {
return value;
}
};
backgroundColor_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v);
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 priority = !this._priorities.get(backgroundColor_local_var_shorthand) && this._priorities.has(backgroundColor_local_var_property) ? this._priorities.get(backgroundColor_local_var_property) : "";
this._setProperty(backgroundColor_local_var_property, val, priority);
}
}
},
get() {
return this.getPropertyValue(backgroundColor_local_var_property);
},
enumerable: true,
configurable: true
};
backgroundColor_export_property = backgroundColor_local_var_property;
var background_export_initialValues, background_export_shorthandFor, background_export_parse, background_export_definition, background_export_property;
const background_local_var_property = "background";
background_export_initialValues = new Map([[{
parse: backgroundImage_export_parse,
definition: backgroundImage_export_definition,
property: backgroundImage_export_property
}.property, "none"], [{
parse: backgroundPosition_export_parse,
definition: backgroundPosition_export_definition,
property: backgroundPosition_export_property
}.property, "0% 0%"], [{
parse: backgroundSize_export_parse,
definition: backgroundSize_export_definition,
property: backgroundSize_export_property
}.property, "auto"], [{
parse: backgroundRepeat_export_parse,
definition: backgroundRepeat_export_definition,
property: backgroundRepeat_export_property
}.property, "repeat"], [{
parse: backgroundOrigin_export_parse,
definition: backgroundOrigin_export_definition,
property: backgroundOrigin_export_property
}.property, "padding-box"], [{
parse: backgroundClip_export_parse,
definition: backgroundClip_export_definition,
property: backgroundClip_export_property
}.property, "border-box"], [{
parse: backgroundAttachment_export_parse,
definition: backgroundAttachment_export_definition,
property: backgroundAttachment_export_property
}.property, "scroll"], [{
parse: backgroundColor_export_parse,
definition: backgroundColor_export_definition,
property: backgroundColor_export_property
}.property, "transparent"]]);
background_export_shorthandFor = new Map([[{
parse: backgroundImage_export_parse,
definition: backgroundImage_export_definition,
property: backgroundImage_export_property
}.property, {
parse: backgroundImage_export_parse,
definition: backgroundImage_export_definition,
property: backgroundImage_export_property
}], [{
parse: backgroundPosition_export_parse,
definition: backgroundPosition_export_definition,
property: backgroundPosition_export_property
}.property, {
parse: backgroundPosition_export_parse,
definition: backgroundPosition_export_definition,
property: backgroundPosition_export_property
}], [{
parse: backgroundSize_export_parse,
definition: backgroundSize_export_definition,
property: backgroundSize_export_property
}.property, {
parse: backgroundSize_export_parse,
definition: backgroundSize_export_definition,
property: backgroundSize_export_property
}], [{
parse: backgroundRepeat_export_parse,
definition: backgroundRepeat_export_definition,
property: backgroundRepeat_export_property
}.property, {
parse: backgroundRepeat_export_parse,
definition: backgroundRepeat_export_definition,
property: backgroundRepeat_export_property
}], [{
parse: backgroundOrigin_export_parse,
definition: backgroundOrigin_export_definition,
property: backgroundOrigin_export_property
}.property, {
parse: backgroundOrigin_export_parse,
definition: backgroundOrigin_export_definition,
property: backgroundOrigin_export_property
}], [{
parse: backgroundClip_export_parse,
definition: backgroundClip_export_definition,
property: backgroundClip_export_property
}.property, {
parse: backgroundClip_export_parse,
definition: backgroundClip_export_definition,
property: backgroundClip_export_property
}], [{
parse: backgroundAttachment_export_parse,
definition: backgroundAttachment_export_definition,
property: backgroundAttachment_export_property
}.property, {
parse: backgroundAttachment_export_parse,
definition: backgroundAttachment_export_definition,
property: backgroundAttachment_export_property
}], [{
parse: backgroundColor_export_parse,
definition: backgroundColor_export_definition,
property: backgroundColor_export_property
}.property, {
parse: backgroundColor_export_parse,
definition: backgroundColor_export_definition,
property: backgroundColor_export_property
}]]);
background_export_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 = {
[{
parse: backgroundImage_export_parse,
definition: backgroundImage_export_definition,
property: backgroundImage_export_property
}.property]: background_export_initialValues.get({
parse: backgroundImage_export_parse,
definition: backgroundImage_export_definition,
property: backgroundImage_export_property
}.property),
[{
parse: backgroundPosition_export_parse,
definition: backgroundPosition_export_definition,
property: backgroundPosition_export_property
}.property]: background_export_initialValues.get({
parse: backgroundPosition_export_parse,
definition: backgroundPosition_export_definition,
property: backgroundPosition_export_property
}.property),
[{
parse: backgroundSize_export_parse,
definition: backgroundSize_export_definition,
property: backgroundSize_export_property
}.property]: background_export_initialValues.get({
parse: backgroundSize_export_parse,
definition: backgroundSize_export_definition,
property: backgroundSize_export_property
}.property),
[{
parse: backgroundRepeat_export_parse,
definition: backgroundRepeat_export_definition,
property: backgroundRepeat_export_property
}.property]: background_export_initialValues.get({
parse: backgroundRepeat_export_parse,
definition: backgroundRepeat_export_definition,
property: backgroundRepeat_export_property
}.property),
[{
parse: backgroundOrigin_export_parse,
definition: backgroundOrigin_export_definition,
property: backgroundOrigin_export_property
}.property]: background_export_initialValues.get({
parse: backgroundOrigin_export_parse,
definition: backgroundOrigin_export_definition,
property: backgroundOrigin_export_property
}.property),
[{
parse: backgroundClip_export_parse,
definition: backgroundClip_export_definition,
property: backgroundClip_export_property
}.property]: background_export_initialValues.get({
parse: backgroundClip_export_parse,
definition: backgroundClip_export_definition,
property: backgroundClip_export_property
}.property),
[{
parse: backgroundAttachment_export_parse,
definition: backgroundAttachment_export_definition,
property: backgroundAttachment_export_property
}.property]: background_export_initialValues.get({
parse: backgroundAttachment_export_parse,
definition: backgroundAttachment_export_definition,
property: backgroundAttachment_export_property
}.property),
[{
parse: backgroundColor_export_parse,
definition: backgroundColor_export_definition,
property: backgroundColor_export_property
}.property]: background_export_initialValues.get({
parse: backgroundColor_export_parse,
definition: backgroundColor_export_definition,
property: backgroundColor_export_property
}.property)
};
if (l > 1 && i !== l - 1) {
bg = {
[{
parse: backgroundImage_export_parse,
definition: backgroundImage_export_definition,
property: backgroundImage_export_property
}.property]: background_export_initialValues.get({
parse: backgroundImage_export_parse,
definition: backgroundImage_export_definition,
property: backgroundImage_export_property
}.property),
[{
parse: backgroundPosition_export_parse,
definition: backgroundPosition_export_definition,
property: backgroundPosition_export_property
}.property]: background_export_initialValues.get({
parse: backgroundPosition_export_parse,
definition: backgroundPosition_export_definition,
property: backgroundPosition_export_property
}.property),
[{
parse: backgroundSize_export_parse,
definition: backgroundSize_export_definition,
property: backgroundSize_export_property
}.property]: background_export_initialValues.get({
parse: backgroundSize_export_parse,
definition: backgroundSize_export_definition,
property: backgroundSize_export_property
}.property),
[{
parse: backgroundRepeat_export_parse,
definition: backgroundRepeat_export_definition,
property: backgroundRepeat_export_property
}.property]: background_export_initialValues.get({
parse: backgroundRepeat_export_parse,
definition: backgroundRepeat_export_definition,
property: backgroundRepeat_export_property
}.property),
[{
parse: backgroundOrigin_export_parse,
definition: backgroundOrigin_export_definition,
property: backgroundOrigin_export_property
}.property]: background_export_initialValues.get({
parse: backgroundOrigin_export_parse,
definition: backgroundOrigin_export_definition,
property: backgroundOrigin_export_property
}.property),
[{
parse: backgroundClip_export_parse,
definition: backgroundClip_export_definition,
property: backgroundClip_export_property
}.property]: background_export_initialValues.get({
parse: backgroundClip_export_parse,
definition: backgroundClip_export_definition,
property: backgroundClip_export_property
}.property),
[{
parse: backgroundAttachment_export_parse,
definition: backgroundAttachment_export_definition,
property: backgroundAttachment_export_property
}.property]: background_export_initialValues.get({
parse: backgroundAttachment_export_parse,
definition: backgroundAttachment_export_definition,
property: backgroundAttachment_export_property
}.property)
};
}
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 {
parse: backgroundClip_export_parse,
definition: backgroundClip_export_definition,
property: backgroundClip_export_property
}.property:
case {
parse: backgroundOrigin_export_parse,
definition: backgroundOrigin_export_definition,
property: backgroundOrigin_export_property
}.property:
{
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bgBox.push(parsedValue);
}
break;
}
case {
parse: backgroundColor_export_parse,
definition: backgroundColor_export_definition,
property: backgroundColor_export_property
}.property:
{
if (i !== values.length - 1) {
return;
}
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bg[longhand] = parsedValue;
}
break;
}
case {
parse: backgroundPosition_export_parse,
definition: backgroundPosition_export_definition,
property: backgroundPosition_export_property
}.property:
{
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bgPosition.push(parsedValue);
}
break;
}
case {
parse: backgroundRepeat_export_parse,
definition: backgroundRepeat_export_definition,
property: backgroundRepeat_export_property
}.property:
{
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bgRepeat.push(parsedValue);
}
break;
}
case {
parse: backgroundSize_export_parse,
definition: backgroundSize_export_definition,
property: backgroundSize_export_property
}.property:
{
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 {
parse: backgroundClip_export_parse,
definition: backgroundClip_export_definition,
property: backgroundClip_export_property
}.property:
case {
parse: backgroundOrigin_export_parse,
definition: backgroundOrigin_export_definition,
property: backgroundOrigin_export_property
}.property:
{
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bgBox.push(parsedValue);
}
break;
}
case {
parse: backgroundColor_export_parse,
definition: backgroundColor_export_definition,
property: backgroundColor_export_property
}.property:
{
if (i !== l - 1) {
return;
}
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bg[longhand] = parsedValue;
}
break;
}
case {
parse: backgroundPosition_export_parse,
definition: backgroundPosition_export_definition,
property: backgroundPosition_export_property
}.property:
{
break;
}
case {
parse: backgroundRepeat_export_parse,
definition: backgroundRepeat_export_definition,
property: backgroundRepeat_export_property
}.property:
{
const parsedValue = value.parse(part, {
globalObject
});
if (parsedValue) {
bgRepeat.push(parsedValue);
}
break;
}
case {
parse: backgroundSize_export_parse,
definition: backgroundSize_export_definition,
property: backgroundSize_export_property
}.property:
{
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({
parse: backgroundPosition_export_parse,
definition: backgroundPosition_export_definition,
property: backgroundPosition_export_property
}.property);
const value = parser(bgPosition.join(" "), {
globalObject
});
if (value) {
bg[{
parse: backgroundPosition_export_parse,
definition: backgroundPosition_export_definition,
property: backgroundPosition_export_property
}.property] = value;
}
}
if (bgSize.length) {
const {
parse: parser
} = background_export_shorthandFor.get({
parse: backgroundSize_export_parse,
definition: backgroundSize_export_definition,
property: backgroundSize_export_property
}.property);
const value = parser(bgSize.join(" "), {
globalObject
});
if (value) {
bg[{
parse: backgroundSize_export_parse,
definition: backgroundSize_export_definition,
property: backgroundSize_export_property
}.property] = value;
}
}
if (bgRepeat.length) {
const {
parse: parser
} = background_export_shorthandFor.get({
parse: backgroundRepeat_export_parse,
definition: backgroundRepeat_export_definition,
property: backgroundRepeat_export_property
}.property);
const value = parser(bgRepeat.join(" "), {
globalObject
});
if (value) {
bg[{
parse: backgroundRepeat_export_parse,
definition: backgroundRepeat_export_definition,
property: backgroundRepeat_export_property
}.property] = value;
}
}
if (bgBox.length) {
switch (bgBox.length) {
case 1:
{
const [value] = bgBox;
bg[{
parse: backgroundOrigin_export_parse,
definition: backgroundOrigin_export_definition,
property: backgroundOrigin_export_property
}.property] = value;
bg[{
parse: backgroundClip_export_parse,
definition: backgroundClip_export_definition,
property: backgroundClip_export_property
}.property] = value;
break;
}
case 2:
{
const [value1, value2] = bgBox;
bg[{
parse: backgroundOrigin_export_parse,
definition: backgroundOrigin_export_definition,
property: backgroundOrigin_export_property
}.property] = value1;
bg[{
parse: backgroundClip_export_parse,
definition: backgroundClip_export_definition,
property: backgroundClip_export_property
}.property] = value2;
break;
}
default:
{
return;
}
}
}
bgValues.push(bg);
}
return bgValues;
};
background_export_definition = {
set(v) {
v = external_dependency_parsers_0.prepareValue(v);
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([[{
parse: backgroundImage_export_parse,
definition: backgroundImage_export_definition,
property: backgroundImage_export_property
}.property, []], [{
parse: backgroundPosition_export_parse,
definition: backgroundPosition_export_definition,
property: backgroundPosition_export_property
}.property, []], [{
parse: backgroundSize_export_parse,
definition: backgroundSize_export_definition,
property: backgroundSize_export_property
}.property, []], [{
parse: backgroundRepeat_export_parse,
definition: backgroundRepeat_export_definition,
property: backgroundRepeat_export_property
}.property, []], [{
parse: backgroundOrigin_export_parse,
definition: backgroundOrigin_export_definition,
property: backgroundOrigin_export_property
}.property, []], [{
parse: backgroundClip_export_parse,
definition: backgroundClip_export_definition,
property: backgroundClip_export_property
}.property, []], [{
parse: backgroundAttachment_export_parse,
definition: backgroundAttachment_export_definition,
property: backgroundAttachment_export_property
}.property, []], [{
parse: backgroundColor_export_parse,
definition: backgroundColor_export_definition,
property: backgroundColor_export_property
}.property, []]]);
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_export_initialValues.get(longhand)) {
if (longhand === {
parse: backgroundSize_export_parse,
definition: backgroundSize_export_definition,
property: backgroundSize_export_property
}.property) {
bg.push(`/ ${value}`);
} else {
bg.push(value);
}
} else if (longhand === {
parse: backgroundImage_export_parse,
definition: backgroundImage_export_definition,
property: backgroundImage_export_property
}.property) {
if (v === "none") {
bg.push(value);
}
} else if (longhand === {
parse: backgroundColor_export_parse,
definition: backgroundColor_export_definition,
property: backgroundColor_export_property
}.property) {
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 === {
parse: backgroundImage_export_parse,
definition: backgroundImage_export_definition,
property: backgroundImage_export_property
}.property) {
if (val === "none" && v === "none" && this.getPropertyValue({
parse: backgroundColor_export_parse,