Complete Email Sortierer implementation with Appwrite and Stripe integration
This commit is contained in:
20
server/node_modules/cssstyle/LICENSE
generated
vendored
Normal file
20
server/node_modules/cssstyle/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) Chad Walker
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
11
server/node_modules/cssstyle/README.md
generated
vendored
Normal file
11
server/node_modules/cssstyle/README.md
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# CSSStyleDeclaration
|
||||
|
||||
A Node.js implementation of the CSS Object Model [`CSSStyleDeclaration` class](https://drafts.csswg.org/cssom/#the-cssstyledeclaration-interface).
|
||||
|
||||
## Background
|
||||
|
||||
This package is an extension of the `CSSStyleDeclaration` class in Nikita Vasilyev's [CSSOM](https://github.com/NV/CSSOM), with added support for modern specifications. The primary use case is for testing browser code in a Node environment.
|
||||
|
||||
It was originally created by Chad Walker, it is now maintained by the jsdom community.
|
||||
|
||||
Bug reports and pull requests are welcome.
|
||||
649
server/node_modules/cssstyle/lib/CSSStyleDeclaration.js
generated
vendored
Normal file
649
server/node_modules/cssstyle/lib/CSSStyleDeclaration.js
generated
vendored
Normal file
@@ -0,0 +1,649 @@
|
||||
/**
|
||||
* This is a fork from the CSS Style Declaration part of
|
||||
* https://github.com/NV/CSSOM
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const allProperties = require("./generated/allProperties");
|
||||
const implementedProperties = require("./generated/implementedProperties");
|
||||
const generatedProperties = require("./generated/properties");
|
||||
const {
|
||||
borderProperties,
|
||||
getPositionValue,
|
||||
normalizeProperties,
|
||||
prepareBorderProperties,
|
||||
prepareProperties,
|
||||
shorthandProperties
|
||||
} = require("./normalize");
|
||||
const {
|
||||
hasVarFunc,
|
||||
isGlobalKeyword,
|
||||
parseCSS,
|
||||
parsePropertyValue,
|
||||
prepareValue
|
||||
} = require("./parsers");
|
||||
const allExtraProperties = require("./utils/allExtraProperties");
|
||||
const { dashedToCamelCase } = require("./utils/camelize");
|
||||
const { getPropertyDescriptor } = require("./utils/propertyDescriptors");
|
||||
const { asciiLowercase } = require("./utils/strings");
|
||||
|
||||
/**
|
||||
* @see https://drafts.csswg.org/cssom/#the-cssstyledeclaration-interface
|
||||
*/
|
||||
class CSSStyleDeclaration {
|
||||
/**
|
||||
* @param {Function} onChangeCallback
|
||||
* @param {object} [opt]
|
||||
* @param {object} [opt.context] - Window, Element or CSSRule.
|
||||
*/
|
||||
constructor(onChangeCallback, opt = {}) {
|
||||
// Make constructor and internals non-enumerable.
|
||||
Object.defineProperties(this, {
|
||||
constructor: {
|
||||
enumerable: false,
|
||||
writable: true
|
||||
},
|
||||
|
||||
// Window
|
||||
_global: {
|
||||
value: globalThis,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
},
|
||||
|
||||
// Element
|
||||
_ownerNode: {
|
||||
value: null,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
},
|
||||
|
||||
// CSSRule
|
||||
_parentNode: {
|
||||
value: null,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
},
|
||||
|
||||
_onChange: {
|
||||
value: null,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
},
|
||||
|
||||
_values: {
|
||||
value: new Map(),
|
||||
enumerable: false,
|
||||
writable: true
|
||||
},
|
||||
|
||||
_priorities: {
|
||||
value: new Map(),
|
||||
enumerable: false,
|
||||
writable: true
|
||||
},
|
||||
|
||||
_length: {
|
||||
value: 0,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
},
|
||||
|
||||
_computed: {
|
||||
value: false,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
},
|
||||
|
||||
_readonly: {
|
||||
value: false,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
},
|
||||
|
||||
_setInProgress: {
|
||||
value: false,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
}
|
||||
});
|
||||
|
||||
const { context } = opt;
|
||||
if (context) {
|
||||
if (typeof context.getComputedStyle === "function") {
|
||||
this._global = context;
|
||||
this._computed = true;
|
||||
this._readonly = true;
|
||||
} else if (context.nodeType === 1 && Object.hasOwn(context, "style")) {
|
||||
this._global = context.ownerDocument.defaultView;
|
||||
this._ownerNode = context;
|
||||
} else if (Object.hasOwn(context, "parentRule")) {
|
||||
this._parentRule = context;
|
||||
// Find Window from the owner node of the StyleSheet.
|
||||
const window = context?.parentStyleSheet?.ownerNode?.ownerDocument?.defaultView;
|
||||
if (window) {
|
||||
this._global = window;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeof onChangeCallback === "function") {
|
||||
this._onChange = onChangeCallback;
|
||||
}
|
||||
}
|
||||
|
||||
get cssText() {
|
||||
if (this._computed) {
|
||||
return "";
|
||||
}
|
||||
const properties = new Map();
|
||||
for (let i = 0; i < this._length; i++) {
|
||||
const property = this[i];
|
||||
const value = this.getPropertyValue(property);
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
if (shorthandProperties.has(property)) {
|
||||
const { shorthandFor } = shorthandProperties.get(property);
|
||||
for (const [longhand] of shorthandFor) {
|
||||
if (priority || !this._priorities.get(longhand)) {
|
||||
properties.delete(longhand);
|
||||
}
|
||||
}
|
||||
}
|
||||
properties.set(property, { property, value, priority });
|
||||
}
|
||||
const normalizedProperties = normalizeProperties(properties);
|
||||
const parts = [];
|
||||
for (const { property, value, priority } of normalizedProperties.values()) {
|
||||
if (priority) {
|
||||
parts.push(`${property}: ${value} !${priority};`);
|
||||
} else {
|
||||
parts.push(`${property}: ${value};`);
|
||||
}
|
||||
}
|
||||
return parts.join(" ");
|
||||
}
|
||||
|
||||
set cssText(val) {
|
||||
if (this._readonly) {
|
||||
const msg = "cssText can not be modified.";
|
||||
const name = "NoModificationAllowedError";
|
||||
throw new this._global.DOMException(msg, name);
|
||||
}
|
||||
Array.prototype.splice.call(this, 0, this._length);
|
||||
this._values.clear();
|
||||
this._priorities.clear();
|
||||
if (this._parentRule || (this._ownerNode && this._setInProgress)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this._setInProgress = true;
|
||||
const valueObj = parseCSS(
|
||||
val,
|
||||
{
|
||||
context: "declarationList",
|
||||
parseValue: false
|
||||
},
|
||||
true
|
||||
);
|
||||
if (valueObj?.children) {
|
||||
const properties = new Map();
|
||||
let shouldSkipNext = false;
|
||||
for (const item of valueObj.children) {
|
||||
if (item.type === "Atrule") {
|
||||
continue;
|
||||
}
|
||||
if (item.type === "Rule") {
|
||||
shouldSkipNext = true;
|
||||
continue;
|
||||
}
|
||||
if (shouldSkipNext === true) {
|
||||
shouldSkipNext = false;
|
||||
continue;
|
||||
}
|
||||
const {
|
||||
important,
|
||||
property,
|
||||
value: { value }
|
||||
} = item;
|
||||
if (typeof property === "string" && typeof value === "string") {
|
||||
const priority = important ? "important" : "";
|
||||
const isCustomProperty = property.startsWith("--");
|
||||
if (isCustomProperty || hasVarFunc(value)) {
|
||||
if (properties.has(property)) {
|
||||
const { priority: itemPriority } = properties.get(property);
|
||||
if (!itemPriority) {
|
||||
properties.set(property, { property, value, priority });
|
||||
}
|
||||
} else {
|
||||
properties.set(property, { property, value, priority });
|
||||
}
|
||||
} else {
|
||||
const parsedValue = parsePropertyValue(property, value, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (parsedValue) {
|
||||
if (properties.has(property)) {
|
||||
const { priority: itemPriority } = properties.get(property);
|
||||
if (!itemPriority) {
|
||||
properties.set(property, { property, value, priority });
|
||||
}
|
||||
} else {
|
||||
properties.set(property, { property, value, priority });
|
||||
}
|
||||
} else {
|
||||
this.removeProperty(property);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const parsedProperties = prepareProperties(properties, {
|
||||
globalObject: this._global
|
||||
});
|
||||
for (const [property, item] of parsedProperties) {
|
||||
const { priority, value } = item;
|
||||
this._priorities.set(property, priority);
|
||||
this.setProperty(property, value, priority);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
return;
|
||||
} finally {
|
||||
this._setInProgress = false;
|
||||
}
|
||||
if (typeof this._onChange === "function") {
|
||||
this._onChange(this.cssText);
|
||||
}
|
||||
}
|
||||
|
||||
get length() {
|
||||
return this._length;
|
||||
}
|
||||
|
||||
// This deletes indices if the new length is less then the current length.
|
||||
// If the new length is more, it does nothing, the new indices will be
|
||||
// undefined until set.
|
||||
set length(len) {
|
||||
for (let i = len; i < this._length; i++) {
|
||||
delete this[i];
|
||||
}
|
||||
this._length = len;
|
||||
}
|
||||
|
||||
// Readonly
|
||||
get parentRule() {
|
||||
return this._parentRule;
|
||||
}
|
||||
|
||||
get cssFloat() {
|
||||
return this.getPropertyValue("float");
|
||||
}
|
||||
|
||||
set cssFloat(value) {
|
||||
this._setProperty("float", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} property
|
||||
*/
|
||||
getPropertyPriority(property) {
|
||||
return this._priorities.get(property) || "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} property
|
||||
*/
|
||||
getPropertyValue(property) {
|
||||
if (this._values.has(property)) {
|
||||
return this._values.get(property).toString();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {...number} args
|
||||
*/
|
||||
item(...args) {
|
||||
if (!args.length) {
|
||||
const msg = "1 argument required, but only 0 present.";
|
||||
throw new this._global.TypeError(msg);
|
||||
}
|
||||
const [value] = args;
|
||||
const index = parseInt(value);
|
||||
if (Number.isNaN(index) || index < 0 || index >= this._length) {
|
||||
return "";
|
||||
}
|
||||
return this[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} property
|
||||
*/
|
||||
removeProperty(property) {
|
||||
if (this._readonly) {
|
||||
const msg = `Property ${property} can not be modified.`;
|
||||
const name = "NoModificationAllowedError";
|
||||
throw new this._global.DOMException(msg, name);
|
||||
}
|
||||
if (!this._values.has(property)) {
|
||||
return "";
|
||||
}
|
||||
const prevValue = this._values.get(property);
|
||||
this._values.delete(property);
|
||||
this._priorities.delete(property);
|
||||
const index = Array.prototype.indexOf.call(this, property);
|
||||
if (index >= 0) {
|
||||
Array.prototype.splice.call(this, index, 1);
|
||||
if (typeof this._onChange === "function") {
|
||||
this._onChange(this.cssText);
|
||||
}
|
||||
}
|
||||
return prevValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} prop
|
||||
* @param {string} val
|
||||
* @param {string} prior
|
||||
*/
|
||||
setProperty(prop, val, prior) {
|
||||
if (this._readonly) {
|
||||
const msg = `Property ${prop} can not be modified.`;
|
||||
const name = "NoModificationAllowedError";
|
||||
throw new this._global.DOMException(msg, name);
|
||||
}
|
||||
const value = prepareValue(val);
|
||||
if (value === "") {
|
||||
this[prop] = "";
|
||||
this.removeProperty(prop);
|
||||
return;
|
||||
}
|
||||
const priority = prior === "important" ? "important" : "";
|
||||
const isCustomProperty = prop.startsWith("--");
|
||||
if (isCustomProperty) {
|
||||
this._setProperty(prop, value, priority);
|
||||
return;
|
||||
}
|
||||
const property = asciiLowercase(prop);
|
||||
if (!allProperties.has(property) && !allExtraProperties.has(property)) {
|
||||
return;
|
||||
}
|
||||
if (priority) {
|
||||
this._priorities.set(property, priority);
|
||||
} else {
|
||||
this._priorities.delete(property);
|
||||
}
|
||||
this[property] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Internal methods
|
||||
Object.defineProperties(CSSStyleDeclaration.prototype, {
|
||||
_setProperty: {
|
||||
/**
|
||||
* @param {string} property
|
||||
* @param {string} val
|
||||
* @param {string} priority
|
||||
*/
|
||||
value(property, val, priority) {
|
||||
if (typeof val !== "string") {
|
||||
return;
|
||||
}
|
||||
if (val === "") {
|
||||
this.removeProperty(property);
|
||||
return;
|
||||
}
|
||||
let originalText = "";
|
||||
if (typeof this._onChange === "function" && !this._setInProgress) {
|
||||
originalText = this.cssText;
|
||||
}
|
||||
if (this._values.has(property)) {
|
||||
const index = Array.prototype.indexOf.call(this, property);
|
||||
// The property already exists but is not indexed into `this` so add it.
|
||||
if (index < 0) {
|
||||
this[this._length] = property;
|
||||
this._length++;
|
||||
}
|
||||
} else {
|
||||
// New property.
|
||||
this[this._length] = property;
|
||||
this._length++;
|
||||
}
|
||||
if (priority === "important") {
|
||||
this._priorities.set(property, priority);
|
||||
} else {
|
||||
this._priorities.delete(property);
|
||||
}
|
||||
this._values.set(property, val);
|
||||
if (
|
||||
typeof this._onChange === "function" &&
|
||||
!this._setInProgress &&
|
||||
this.cssText !== originalText
|
||||
) {
|
||||
this._onChange(this.cssText);
|
||||
}
|
||||
},
|
||||
enumerable: false
|
||||
},
|
||||
|
||||
_borderSetter: {
|
||||
/**
|
||||
* @param {string} prop
|
||||
* @param {object|Array|string} val
|
||||
* @param {string} prior
|
||||
*/
|
||||
value(prop, val, prior) {
|
||||
const properties = new Map();
|
||||
if (prop === "border") {
|
||||
let priority = "";
|
||||
if (typeof prior === "string") {
|
||||
priority = prior;
|
||||
} else {
|
||||
priority = this._priorities.get(prop) ?? "";
|
||||
}
|
||||
properties.set(prop, { propery: prop, value: val, priority });
|
||||
} else {
|
||||
for (let i = 0; i < this._length; i++) {
|
||||
const property = this[i];
|
||||
if (borderProperties.has(property)) {
|
||||
const value = this.getPropertyValue(property);
|
||||
const longhandPriority = this._priorities.get(property) ?? "";
|
||||
let priority = longhandPriority;
|
||||
if (prop === property && typeof prior === "string") {
|
||||
priority = prior;
|
||||
}
|
||||
properties.set(property, { property, value, priority });
|
||||
}
|
||||
}
|
||||
}
|
||||
const parsedProperties = prepareBorderProperties(prop, val, prior, properties, {
|
||||
globalObject: this._global
|
||||
});
|
||||
for (const [property, item] of parsedProperties) {
|
||||
const { priority, value } = item;
|
||||
this._setProperty(property, value, priority);
|
||||
}
|
||||
},
|
||||
enumerable: false
|
||||
},
|
||||
|
||||
_flexBoxSetter: {
|
||||
/**
|
||||
* @param {string} prop
|
||||
* @param {string} val
|
||||
* @param {string} prior
|
||||
* @param {string} shorthandProperty
|
||||
*/
|
||||
value(prop, val, prior, shorthandProperty) {
|
||||
if (!shorthandProperty || !shorthandProperties.has(shorthandProperty)) {
|
||||
return;
|
||||
}
|
||||
const shorthandPriority = this._priorities.get(shorthandProperty);
|
||||
this.removeProperty(shorthandProperty);
|
||||
let priority = "";
|
||||
if (typeof prior === "string") {
|
||||
priority = prior;
|
||||
} else {
|
||||
priority = this._priorities.get(prop) ?? "";
|
||||
}
|
||||
this.removeProperty(prop);
|
||||
if (shorthandPriority && priority) {
|
||||
this._setProperty(prop, val);
|
||||
} else {
|
||||
this._setProperty(prop, val, priority);
|
||||
}
|
||||
if (val && !hasVarFunc(val)) {
|
||||
const longhandValues = [];
|
||||
const shorthandItem = shorthandProperties.get(shorthandProperty);
|
||||
let hasGlobalKeyword = false;
|
||||
for (const [longhandProperty] of shorthandItem.shorthandFor) {
|
||||
if (longhandProperty === prop) {
|
||||
if (isGlobalKeyword(val)) {
|
||||
hasGlobalKeyword = true;
|
||||
}
|
||||
longhandValues.push(val);
|
||||
} else {
|
||||
const longhandValue = this.getPropertyValue(longhandProperty);
|
||||
const longhandPriority = this._priorities.get(longhandProperty) ?? "";
|
||||
if (!longhandValue || longhandPriority !== priority) {
|
||||
break;
|
||||
}
|
||||
if (isGlobalKeyword(longhandValue)) {
|
||||
hasGlobalKeyword = true;
|
||||
}
|
||||
longhandValues.push(longhandValue);
|
||||
}
|
||||
}
|
||||
if (longhandValues.length === shorthandItem.shorthandFor.size) {
|
||||
if (hasGlobalKeyword) {
|
||||
const [firstValue, ...restValues] = longhandValues;
|
||||
if (restValues.every((value) => value === firstValue)) {
|
||||
this._setProperty(shorthandProperty, firstValue, priority);
|
||||
}
|
||||
} else {
|
||||
const parsedValue = shorthandItem.parse(longhandValues.join(" "));
|
||||
const shorthandValue = Object.values(parsedValue).join(" ");
|
||||
this._setProperty(shorthandProperty, shorthandValue, priority);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
enumerable: false
|
||||
},
|
||||
|
||||
_positionShorthandSetter: {
|
||||
/**
|
||||
* @param {string} prop
|
||||
* @param {Array|string} val
|
||||
* @param {string} prior
|
||||
*/
|
||||
value(prop, val, prior) {
|
||||
if (!shorthandProperties.has(prop)) {
|
||||
return;
|
||||
}
|
||||
const shorthandValues = [];
|
||||
if (Array.isArray(val)) {
|
||||
shorthandValues.push(...val);
|
||||
} else if (typeof val === "string") {
|
||||
shorthandValues.push(val);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
let priority = "";
|
||||
if (typeof prior === "string") {
|
||||
priority = prior;
|
||||
} else {
|
||||
priority = this._priorities.get(prop) ?? "";
|
||||
}
|
||||
const { position, shorthandFor } = shorthandProperties.get(prop);
|
||||
let hasPriority = false;
|
||||
for (const [longhandProperty, longhandItem] of shorthandFor) {
|
||||
const { position: longhandPosition } = longhandItem;
|
||||
const longhandValue = getPositionValue(shorthandValues, longhandPosition);
|
||||
if (priority) {
|
||||
this._setProperty(longhandProperty, longhandValue, priority);
|
||||
} else {
|
||||
const longhandPriority = this._priorities.get(longhandProperty) ?? "";
|
||||
if (longhandPriority) {
|
||||
hasPriority = true;
|
||||
} else {
|
||||
this._setProperty(longhandProperty, longhandValue, priority);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasPriority) {
|
||||
this.removeProperty(prop);
|
||||
} else {
|
||||
const shorthandValue = getPositionValue(shorthandValues, position);
|
||||
this._setProperty(prop, shorthandValue, priority);
|
||||
}
|
||||
},
|
||||
enumerable: false
|
||||
},
|
||||
|
||||
_positionLonghandSetter: {
|
||||
/**
|
||||
* @param {string} prop
|
||||
* @param {string} val
|
||||
* @param {string} prior
|
||||
* @param {string} shorthandProperty
|
||||
*/
|
||||
value(prop, val, prior, shorthandProperty) {
|
||||
if (!shorthandProperty || !shorthandProperties.has(shorthandProperty)) {
|
||||
return;
|
||||
}
|
||||
const shorthandPriority = this._priorities.get(shorthandProperty);
|
||||
this.removeProperty(shorthandProperty);
|
||||
let priority = "";
|
||||
if (typeof prior === "string") {
|
||||
priority = prior;
|
||||
} else {
|
||||
priority = this._priorities.get(prop) ?? "";
|
||||
}
|
||||
this.removeProperty(prop);
|
||||
if (shorthandPriority && priority) {
|
||||
this._setProperty(prop, val);
|
||||
} else {
|
||||
this._setProperty(prop, val, priority);
|
||||
}
|
||||
if (val && !hasVarFunc(val)) {
|
||||
const longhandValues = [];
|
||||
const { shorthandFor, position: shorthandPosition } =
|
||||
shorthandProperties.get(shorthandProperty);
|
||||
for (const [longhandProperty] of shorthandFor) {
|
||||
const longhandValue = this.getPropertyValue(longhandProperty);
|
||||
const longhandPriority = this._priorities.get(longhandProperty) ?? "";
|
||||
if (!longhandValue || longhandPriority !== priority) {
|
||||
return;
|
||||
}
|
||||
longhandValues.push(longhandValue);
|
||||
}
|
||||
if (longhandValues.length === shorthandFor.size) {
|
||||
const replacedValue = getPositionValue(longhandValues, shorthandPosition);
|
||||
this._setProperty(shorthandProperty, replacedValue);
|
||||
}
|
||||
}
|
||||
},
|
||||
enumerable: false
|
||||
}
|
||||
});
|
||||
|
||||
// Properties
|
||||
Object.defineProperties(CSSStyleDeclaration.prototype, generatedProperties);
|
||||
|
||||
// Additional properties
|
||||
[...allProperties, ...allExtraProperties].forEach((property) => {
|
||||
if (!implementedProperties.has(property)) {
|
||||
const declaration = getPropertyDescriptor(property);
|
||||
Object.defineProperty(CSSStyleDeclaration.prototype, property, declaration);
|
||||
const camel = dashedToCamelCase(property);
|
||||
Object.defineProperty(CSSStyleDeclaration.prototype, camel, declaration);
|
||||
if (/^webkit[A-Z]/.test(camel)) {
|
||||
const pascal = camel.replace(/^webkit/, "Webkit");
|
||||
Object.defineProperty(CSSStyleDeclaration.prototype, pascal, declaration);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
CSSStyleDeclaration,
|
||||
propertyList: Object.fromEntries(implementedProperties)
|
||||
};
|
||||
653
server/node_modules/cssstyle/lib/generated/allProperties.js
generated
vendored
Normal file
653
server/node_modules/cssstyle/lib/generated/allProperties.js
generated
vendored
Normal file
@@ -0,0 +1,653 @@
|
||||
"use strict";
|
||||
// autogenerated - 2025-08-02
|
||||
// https://www.w3.org/Style/CSS/all-properties.en.html
|
||||
|
||||
module.exports = new Set([
|
||||
"-webkit-line-clamp",
|
||||
"accent-color",
|
||||
"align-content",
|
||||
"align-items",
|
||||
"align-self",
|
||||
"alignment-baseline",
|
||||
"all",
|
||||
"anchor-name",
|
||||
"anchor-scope",
|
||||
"animation",
|
||||
"animation-composition",
|
||||
"animation-delay",
|
||||
"animation-direction",
|
||||
"animation-duration",
|
||||
"animation-fill-mode",
|
||||
"animation-iteration-count",
|
||||
"animation-name",
|
||||
"animation-play-state",
|
||||
"animation-range",
|
||||
"animation-range-end",
|
||||
"animation-range-start",
|
||||
"animation-timeline",
|
||||
"animation-timing-function",
|
||||
"appearance",
|
||||
"aspect-ratio",
|
||||
"azimuth",
|
||||
"backface-visibility",
|
||||
"background",
|
||||
"background-attachment",
|
||||
"background-blend-mode",
|
||||
"background-clip",
|
||||
"background-color",
|
||||
"background-image",
|
||||
"background-origin",
|
||||
"background-position",
|
||||
"background-repeat",
|
||||
"background-size",
|
||||
"baseline-shift",
|
||||
"baseline-source",
|
||||
"block-ellipsis",
|
||||
"block-size",
|
||||
"block-step",
|
||||
"block-step-align",
|
||||
"block-step-insert",
|
||||
"block-step-round",
|
||||
"block-step-size",
|
||||
"bookmark-label",
|
||||
"bookmark-level",
|
||||
"bookmark-state",
|
||||
"border",
|
||||
"border-block",
|
||||
"border-block-color",
|
||||
"border-block-end",
|
||||
"border-block-end-color",
|
||||
"border-block-end-radius",
|
||||
"border-block-end-style",
|
||||
"border-block-end-width",
|
||||
"border-block-start",
|
||||
"border-block-start-color",
|
||||
"border-block-start-radius",
|
||||
"border-block-start-style",
|
||||
"border-block-start-width",
|
||||
"border-block-style",
|
||||
"border-block-width",
|
||||
"border-bottom",
|
||||
"border-bottom-color",
|
||||
"border-bottom-left-radius",
|
||||
"border-bottom-radius",
|
||||
"border-bottom-right-radius",
|
||||
"border-bottom-style",
|
||||
"border-bottom-width",
|
||||
"border-boundary",
|
||||
"border-clip",
|
||||
"border-clip-bottom",
|
||||
"border-clip-left",
|
||||
"border-clip-right",
|
||||
"border-clip-top",
|
||||
"border-collapse",
|
||||
"border-color",
|
||||
"border-end-end-radius",
|
||||
"border-end-start-radius",
|
||||
"border-image",
|
||||
"border-image-outset",
|
||||
"border-image-repeat",
|
||||
"border-image-slice",
|
||||
"border-image-source",
|
||||
"border-image-width",
|
||||
"border-inline",
|
||||
"border-inline-color",
|
||||
"border-inline-end",
|
||||
"border-inline-end-color",
|
||||
"border-inline-end-radius",
|
||||
"border-inline-end-style",
|
||||
"border-inline-end-width",
|
||||
"border-inline-start",
|
||||
"border-inline-start-color",
|
||||
"border-inline-start-radius",
|
||||
"border-inline-start-style",
|
||||
"border-inline-start-width",
|
||||
"border-inline-style",
|
||||
"border-inline-width",
|
||||
"border-left",
|
||||
"border-left-color",
|
||||
"border-left-radius",
|
||||
"border-left-style",
|
||||
"border-left-width",
|
||||
"border-limit",
|
||||
"border-radius",
|
||||
"border-right",
|
||||
"border-right-color",
|
||||
"border-right-radius",
|
||||
"border-right-style",
|
||||
"border-right-width",
|
||||
"border-shape",
|
||||
"border-spacing",
|
||||
"border-start-end-radius",
|
||||
"border-start-start-radius",
|
||||
"border-style",
|
||||
"border-top",
|
||||
"border-top-color",
|
||||
"border-top-left-radius",
|
||||
"border-top-radius",
|
||||
"border-top-right-radius",
|
||||
"border-top-style",
|
||||
"border-top-width",
|
||||
"border-width",
|
||||
"bottom",
|
||||
"box-decoration-break",
|
||||
"box-shadow",
|
||||
"box-shadow-blur",
|
||||
"box-shadow-color",
|
||||
"box-shadow-offset",
|
||||
"box-shadow-position",
|
||||
"box-shadow-spread",
|
||||
"box-sizing",
|
||||
"box-snap",
|
||||
"break-after",
|
||||
"break-before",
|
||||
"break-inside",
|
||||
"caption-side",
|
||||
"caret",
|
||||
"caret-color",
|
||||
"caret-shape",
|
||||
"clear",
|
||||
"clip",
|
||||
"clip-path",
|
||||
"clip-rule",
|
||||
"color",
|
||||
"color-adjust",
|
||||
"color-interpolation-filters",
|
||||
"color-scheme",
|
||||
"column-count",
|
||||
"column-fill",
|
||||
"column-gap",
|
||||
"column-rule",
|
||||
"column-rule-break",
|
||||
"column-rule-color",
|
||||
"column-rule-outset",
|
||||
"column-rule-style",
|
||||
"column-rule-width",
|
||||
"column-span",
|
||||
"column-width",
|
||||
"columns",
|
||||
"contain",
|
||||
"contain-intrinsic-block-size",
|
||||
"contain-intrinsic-height",
|
||||
"contain-intrinsic-inline-size",
|
||||
"contain-intrinsic-size",
|
||||
"contain-intrinsic-width",
|
||||
"container",
|
||||
"container-name",
|
||||
"container-type",
|
||||
"content",
|
||||
"content-visibility",
|
||||
"continue",
|
||||
"corner-block-end-shape",
|
||||
"corner-block-start-shape",
|
||||
"corner-bottom-left-shape",
|
||||
"corner-bottom-right-shape",
|
||||
"corner-bottom-shape",
|
||||
"corner-end-end-shape",
|
||||
"corner-end-start-shape",
|
||||
"corner-inline-end-shape",
|
||||
"corner-inline-start-shape",
|
||||
"corner-left-shape",
|
||||
"corner-right-shape",
|
||||
"corner-shape",
|
||||
"corner-start-end-shape",
|
||||
"corner-start-start-shape",
|
||||
"corner-top-left-shape",
|
||||
"corner-top-right-shape",
|
||||
"corner-top-shape",
|
||||
"counter-increment",
|
||||
"counter-reset",
|
||||
"counter-set",
|
||||
"cue",
|
||||
"cue-after",
|
||||
"cue-before",
|
||||
"cursor",
|
||||
"direction",
|
||||
"display",
|
||||
"dominant-baseline",
|
||||
"dynamic-range-limit",
|
||||
"elevation",
|
||||
"empty-cells",
|
||||
"fill",
|
||||
"fill-break",
|
||||
"fill-color",
|
||||
"fill-image",
|
||||
"fill-opacity",
|
||||
"fill-origin",
|
||||
"fill-position",
|
||||
"fill-repeat",
|
||||
"fill-rule",
|
||||
"fill-size",
|
||||
"filter",
|
||||
"flex",
|
||||
"flex-basis",
|
||||
"flex-direction",
|
||||
"flex-flow",
|
||||
"flex-grow",
|
||||
"flex-shrink",
|
||||
"flex-wrap",
|
||||
"float",
|
||||
"float-defer",
|
||||
"float-offset",
|
||||
"float-reference",
|
||||
"flood-color",
|
||||
"flood-opacity",
|
||||
"flow-from",
|
||||
"flow-into",
|
||||
"font",
|
||||
"font-family",
|
||||
"font-feature-settings",
|
||||
"font-kerning",
|
||||
"font-language-override",
|
||||
"font-optical-sizing",
|
||||
"font-palette",
|
||||
"font-size",
|
||||
"font-size-adjust",
|
||||
"font-stretch",
|
||||
"font-style",
|
||||
"font-synthesis",
|
||||
"font-synthesis-position",
|
||||
"font-synthesis-small-caps",
|
||||
"font-synthesis-style",
|
||||
"font-synthesis-weight",
|
||||
"font-variant",
|
||||
"font-variant-alternates",
|
||||
"font-variant-caps",
|
||||
"font-variant-east-asian",
|
||||
"font-variant-emoji",
|
||||
"font-variant-ligatures",
|
||||
"font-variant-numeric",
|
||||
"font-variant-position",
|
||||
"font-variation-settings",
|
||||
"font-weight",
|
||||
"font-width",
|
||||
"footnote-display",
|
||||
"footnote-policy",
|
||||
"forced-color-adjust",
|
||||
"gap",
|
||||
"glyph-orientation-vertical",
|
||||
"grid",
|
||||
"grid-area",
|
||||
"grid-auto-columns",
|
||||
"grid-auto-flow",
|
||||
"grid-auto-rows",
|
||||
"grid-column",
|
||||
"grid-column-end",
|
||||
"grid-column-start",
|
||||
"grid-row",
|
||||
"grid-row-end",
|
||||
"grid-row-start",
|
||||
"grid-template",
|
||||
"grid-template-areas",
|
||||
"grid-template-columns",
|
||||
"grid-template-rows",
|
||||
"hanging-punctuation",
|
||||
"height",
|
||||
"hyphenate-character",
|
||||
"hyphenate-limit-chars",
|
||||
"hyphenate-limit-last",
|
||||
"hyphenate-limit-lines",
|
||||
"hyphenate-limit-zone",
|
||||
"hyphens",
|
||||
"image-orientation",
|
||||
"image-rendering",
|
||||
"image-resolution",
|
||||
"initial-letter",
|
||||
"initial-letter-align",
|
||||
"initial-letter-wrap",
|
||||
"inline-size",
|
||||
"inline-sizing",
|
||||
"inset",
|
||||
"inset-block",
|
||||
"inset-block-end",
|
||||
"inset-block-start",
|
||||
"inset-inline",
|
||||
"inset-inline-end",
|
||||
"inset-inline-start",
|
||||
"interpolate-size",
|
||||
"isolation",
|
||||
"item-cross",
|
||||
"item-direction",
|
||||
"item-flow",
|
||||
"item-pack",
|
||||
"item-slack",
|
||||
"item-track",
|
||||
"item-wrap",
|
||||
"justify-content",
|
||||
"justify-items",
|
||||
"justify-self",
|
||||
"left",
|
||||
"letter-spacing",
|
||||
"lighting-color",
|
||||
"line-break",
|
||||
"line-clamp",
|
||||
"line-fit-edge",
|
||||
"line-grid",
|
||||
"line-height",
|
||||
"line-height-step",
|
||||
"line-padding",
|
||||
"line-snap",
|
||||
"list-style",
|
||||
"list-style-image",
|
||||
"list-style-position",
|
||||
"list-style-type",
|
||||
"margin",
|
||||
"margin-block",
|
||||
"margin-block-end",
|
||||
"margin-block-start",
|
||||
"margin-bottom",
|
||||
"margin-break",
|
||||
"margin-inline",
|
||||
"margin-inline-end",
|
||||
"margin-inline-start",
|
||||
"margin-left",
|
||||
"margin-right",
|
||||
"margin-top",
|
||||
"margin-trim",
|
||||
"marker",
|
||||
"marker-end",
|
||||
"marker-knockout-left",
|
||||
"marker-knockout-right",
|
||||
"marker-mid",
|
||||
"marker-pattern",
|
||||
"marker-segment",
|
||||
"marker-side",
|
||||
"marker-start",
|
||||
"mask",
|
||||
"mask-border",
|
||||
"mask-border-mode",
|
||||
"mask-border-outset",
|
||||
"mask-border-repeat",
|
||||
"mask-border-slice",
|
||||
"mask-border-source",
|
||||
"mask-border-width",
|
||||
"mask-clip",
|
||||
"mask-composite",
|
||||
"mask-image",
|
||||
"mask-mode",
|
||||
"mask-origin",
|
||||
"mask-position",
|
||||
"mask-repeat",
|
||||
"mask-size",
|
||||
"mask-type",
|
||||
"max-block-size",
|
||||
"max-height",
|
||||
"max-inline-size",
|
||||
"max-lines",
|
||||
"max-width",
|
||||
"min-block-size",
|
||||
"min-height",
|
||||
"min-inline-size",
|
||||
"min-intrinsic-sizing",
|
||||
"min-width",
|
||||
"mix-blend-mode",
|
||||
"nav-down",
|
||||
"nav-left",
|
||||
"nav-right",
|
||||
"nav-up",
|
||||
"object-fit",
|
||||
"object-position",
|
||||
"offset",
|
||||
"offset-anchor",
|
||||
"offset-distance",
|
||||
"offset-path",
|
||||
"offset-position",
|
||||
"offset-rotate",
|
||||
"opacity",
|
||||
"order",
|
||||
"orphans",
|
||||
"outline",
|
||||
"outline-color",
|
||||
"outline-offset",
|
||||
"outline-style",
|
||||
"outline-width",
|
||||
"overflow",
|
||||
"overflow-anchor",
|
||||
"overflow-block",
|
||||
"overflow-clip-margin",
|
||||
"overflow-clip-margin-block",
|
||||
"overflow-clip-margin-block-end",
|
||||
"overflow-clip-margin-block-start",
|
||||
"overflow-clip-margin-bottom",
|
||||
"overflow-clip-margin-inline",
|
||||
"overflow-clip-margin-inline-end",
|
||||
"overflow-clip-margin-inline-start",
|
||||
"overflow-clip-margin-left",
|
||||
"overflow-clip-margin-right",
|
||||
"overflow-clip-margin-top",
|
||||
"overflow-inline",
|
||||
"overflow-wrap",
|
||||
"overflow-x",
|
||||
"overflow-y",
|
||||
"overlay",
|
||||
"overscroll-behavior",
|
||||
"overscroll-behavior-block",
|
||||
"overscroll-behavior-inline",
|
||||
"overscroll-behavior-x",
|
||||
"overscroll-behavior-y",
|
||||
"padding",
|
||||
"padding-block",
|
||||
"padding-block-end",
|
||||
"padding-block-start",
|
||||
"padding-bottom",
|
||||
"padding-inline",
|
||||
"padding-inline-end",
|
||||
"padding-inline-start",
|
||||
"padding-left",
|
||||
"padding-right",
|
||||
"padding-top",
|
||||
"page",
|
||||
"page-break-after",
|
||||
"page-break-before",
|
||||
"page-break-inside",
|
||||
"pause",
|
||||
"pause-after",
|
||||
"pause-before",
|
||||
"perspective",
|
||||
"perspective-origin",
|
||||
"pitch",
|
||||
"pitch-range",
|
||||
"place-content",
|
||||
"place-items",
|
||||
"place-self",
|
||||
"play-during",
|
||||
"position",
|
||||
"position-anchor",
|
||||
"position-area",
|
||||
"position-try",
|
||||
"position-try-fallbacks",
|
||||
"position-try-order",
|
||||
"position-visibility",
|
||||
"print-color-adjust",
|
||||
"quotes",
|
||||
"reading-flow",
|
||||
"region-fragment",
|
||||
"resize",
|
||||
"rest",
|
||||
"rest-after",
|
||||
"rest-before",
|
||||
"richness",
|
||||
"right",
|
||||
"rotate",
|
||||
"row-gap",
|
||||
"row-rule",
|
||||
"row-rule-break",
|
||||
"row-rule-color",
|
||||
"row-rule-outset",
|
||||
"row-rule-style",
|
||||
"row-rule-width",
|
||||
"ruby-align",
|
||||
"ruby-merge",
|
||||
"ruby-overhang",
|
||||
"ruby-position",
|
||||
"rule",
|
||||
"rule-break",
|
||||
"rule-color",
|
||||
"rule-outset",
|
||||
"rule-paint-order",
|
||||
"rule-style",
|
||||
"rule-width",
|
||||
"running",
|
||||
"scale",
|
||||
"scroll-behavior",
|
||||
"scroll-margin",
|
||||
"scroll-margin-block",
|
||||
"scroll-margin-block-end",
|
||||
"scroll-margin-block-start",
|
||||
"scroll-margin-bottom",
|
||||
"scroll-margin-inline",
|
||||
"scroll-margin-inline-end",
|
||||
"scroll-margin-inline-start",
|
||||
"scroll-margin-left",
|
||||
"scroll-margin-right",
|
||||
"scroll-margin-top",
|
||||
"scroll-marker-group",
|
||||
"scroll-padding",
|
||||
"scroll-padding-block",
|
||||
"scroll-padding-block-end",
|
||||
"scroll-padding-block-start",
|
||||
"scroll-padding-bottom",
|
||||
"scroll-padding-inline",
|
||||
"scroll-padding-inline-end",
|
||||
"scroll-padding-inline-start",
|
||||
"scroll-padding-left",
|
||||
"scroll-padding-right",
|
||||
"scroll-padding-top",
|
||||
"scroll-snap-align",
|
||||
"scroll-snap-stop",
|
||||
"scroll-snap-type",
|
||||
"scroll-start-target",
|
||||
"scroll-timeline",
|
||||
"scroll-timeline-axis",
|
||||
"scroll-timeline-name",
|
||||
"scrollbar-color",
|
||||
"scrollbar-gutter",
|
||||
"scrollbar-width",
|
||||
"shape-image-threshold",
|
||||
"shape-inside",
|
||||
"shape-margin",
|
||||
"shape-outside",
|
||||
"slider-orientation",
|
||||
"spatial-navigation-action",
|
||||
"spatial-navigation-contain",
|
||||
"spatial-navigation-function",
|
||||
"speak",
|
||||
"speak-as",
|
||||
"speak-header",
|
||||
"speak-numeral",
|
||||
"speak-punctuation",
|
||||
"speech-rate",
|
||||
"stress",
|
||||
"string-set",
|
||||
"stroke",
|
||||
"stroke-align",
|
||||
"stroke-alignment",
|
||||
"stroke-break",
|
||||
"stroke-color",
|
||||
"stroke-dash-corner",
|
||||
"stroke-dash-justify",
|
||||
"stroke-dashadjust",
|
||||
"stroke-dasharray",
|
||||
"stroke-dashcorner",
|
||||
"stroke-dashoffset",
|
||||
"stroke-image",
|
||||
"stroke-linecap",
|
||||
"stroke-linejoin",
|
||||
"stroke-miterlimit",
|
||||
"stroke-opacity",
|
||||
"stroke-origin",
|
||||
"stroke-position",
|
||||
"stroke-repeat",
|
||||
"stroke-size",
|
||||
"stroke-width",
|
||||
"tab-size",
|
||||
"table-layout",
|
||||
"text-align",
|
||||
"text-align-all",
|
||||
"text-align-last",
|
||||
"text-autospace",
|
||||
"text-box",
|
||||
"text-box-edge",
|
||||
"text-box-trim",
|
||||
"text-combine-upright",
|
||||
"text-decoration",
|
||||
"text-decoration-color",
|
||||
"text-decoration-line",
|
||||
"text-decoration-skip",
|
||||
"text-decoration-skip-box",
|
||||
"text-decoration-skip-ink",
|
||||
"text-decoration-skip-inset",
|
||||
"text-decoration-skip-self",
|
||||
"text-decoration-skip-spaces",
|
||||
"text-decoration-style",
|
||||
"text-decoration-thickness",
|
||||
"text-emphasis",
|
||||
"text-emphasis-color",
|
||||
"text-emphasis-position",
|
||||
"text-emphasis-skip",
|
||||
"text-emphasis-style",
|
||||
"text-group-align",
|
||||
"text-indent",
|
||||
"text-justify",
|
||||
"text-orientation",
|
||||
"text-overflow",
|
||||
"text-shadow",
|
||||
"text-spacing",
|
||||
"text-spacing-trim",
|
||||
"text-transform",
|
||||
"text-underline-offset",
|
||||
"text-underline-position",
|
||||
"text-wrap",
|
||||
"text-wrap-mode",
|
||||
"text-wrap-style",
|
||||
"timeline-scope",
|
||||
"top",
|
||||
"transform",
|
||||
"transform-box",
|
||||
"transform-origin",
|
||||
"transform-style",
|
||||
"transition",
|
||||
"transition-behavior",
|
||||
"transition-delay",
|
||||
"transition-duration",
|
||||
"transition-property",
|
||||
"transition-timing-function",
|
||||
"translate",
|
||||
"unicode-bidi",
|
||||
"user-select",
|
||||
"vertical-align",
|
||||
"view-timeline",
|
||||
"view-timeline-axis",
|
||||
"view-timeline-inset",
|
||||
"view-timeline-name",
|
||||
"view-transition-class",
|
||||
"view-transition-group",
|
||||
"view-transition-name",
|
||||
"visibility",
|
||||
"voice-balance",
|
||||
"voice-duration",
|
||||
"voice-family",
|
||||
"voice-pitch",
|
||||
"voice-range",
|
||||
"voice-rate",
|
||||
"voice-stress",
|
||||
"voice-volume",
|
||||
"volume",
|
||||
"white-space",
|
||||
"white-space-collapse",
|
||||
"white-space-trim",
|
||||
"widows",
|
||||
"width",
|
||||
"will-change",
|
||||
"word-break",
|
||||
"word-space-transform",
|
||||
"word-spacing",
|
||||
"word-wrap",
|
||||
"wrap-after",
|
||||
"wrap-before",
|
||||
"wrap-flow",
|
||||
"wrap-inside",
|
||||
"wrap-through",
|
||||
"writing-mode",
|
||||
"z-index"
|
||||
]);
|
||||
1466
server/node_modules/cssstyle/lib/generated/implementedProperties.js
generated
vendored
Normal file
1466
server/node_modules/cssstyle/lib/generated/implementedProperties.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6637
server/node_modules/cssstyle/lib/generated/properties.js
generated
vendored
Normal file
6637
server/node_modules/cssstyle/lib/generated/properties.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
13033
server/node_modules/cssstyle/lib/generated/propertyDefinitions.js
generated
vendored
Normal file
13033
server/node_modules/cssstyle/lib/generated/propertyDefinitions.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1574
server/node_modules/cssstyle/lib/normalize.js
generated
vendored
Normal file
1574
server/node_modules/cssstyle/lib/normalize.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
871
server/node_modules/cssstyle/lib/parsers.js
generated
vendored
Normal file
871
server/node_modules/cssstyle/lib/parsers.js
generated
vendored
Normal file
@@ -0,0 +1,871 @@
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
resolve: resolveColor,
|
||||
utils: { cssCalc, resolveGradient, splitValue }
|
||||
} = require("@asamuzakjp/css-color");
|
||||
const { next: syntaxes } = require("@csstools/css-syntax-patches-for-csstree");
|
||||
const csstree = require("css-tree");
|
||||
const { LRUCache } = require("lru-cache");
|
||||
const { asciiLowercase } = require("./utils/strings");
|
||||
|
||||
// CSS global keywords
|
||||
// @see https://drafts.csswg.org/css-cascade-5/#defaulting-keywords
|
||||
const GLOBAL_KEYS = new Set(["initial", "inherit", "unset", "revert", "revert-layer"]);
|
||||
|
||||
// System colors
|
||||
// @see https://drafts.csswg.org/css-color/#css-system-colors
|
||||
// @see https://drafts.csswg.org/css-color/#deprecated-system-colors
|
||||
const SYS_COLORS = new Set([
|
||||
"accentcolor",
|
||||
"accentcolortext",
|
||||
"activeborder",
|
||||
"activecaption",
|
||||
"activetext",
|
||||
"appworkspace",
|
||||
"background",
|
||||
"buttonborder",
|
||||
"buttonface",
|
||||
"buttonhighlight",
|
||||
"buttonshadow",
|
||||
"buttontext",
|
||||
"canvas",
|
||||
"canvastext",
|
||||
"captiontext",
|
||||
"field",
|
||||
"fieldtext",
|
||||
"graytext",
|
||||
"highlight",
|
||||
"highlighttext",
|
||||
"inactiveborder",
|
||||
"inactivecaption",
|
||||
"inactivecaptiontext",
|
||||
"infobackground",
|
||||
"infotext",
|
||||
"linktext",
|
||||
"mark",
|
||||
"marktext",
|
||||
"menu",
|
||||
"menutext",
|
||||
"scrollbar",
|
||||
"selecteditem",
|
||||
"selecteditemtext",
|
||||
"threeddarkshadow",
|
||||
"threedface",
|
||||
"threedhighlight",
|
||||
"threedlightshadow",
|
||||
"threedshadow",
|
||||
"visitedtext",
|
||||
"window",
|
||||
"windowframe",
|
||||
"windowtext"
|
||||
]);
|
||||
|
||||
// AST node types
|
||||
const AST_TYPES = Object.freeze({
|
||||
CALC: "Calc",
|
||||
DIMENSION: "Dimension",
|
||||
FUNCTION: "Function",
|
||||
GLOBAL_KEYWORD: "GlobalKeyword",
|
||||
HASH: "Hash",
|
||||
IDENTIFIER: "Identifier",
|
||||
NUMBER: "Number",
|
||||
PERCENTAGE: "Percentage",
|
||||
STRING: "String",
|
||||
URL: "Url"
|
||||
});
|
||||
|
||||
// Regular expressions
|
||||
const CALC_FUNC_NAMES =
|
||||
"(?:a?(?:cos|sin|tan)|abs|atan2|calc|clamp|exp|hypot|log|max|min|mod|pow|rem|round|sign|sqrt)";
|
||||
const calcRegEx = new RegExp(`^${CALC_FUNC_NAMES}\\(`);
|
||||
const calcContainedRegEx = new RegExp(`(?<=[*/\\s(])${CALC_FUNC_NAMES}\\(`);
|
||||
const calcNameRegEx = new RegExp(`^${CALC_FUNC_NAMES}$`);
|
||||
const varRegEx = /^var\(/;
|
||||
const varContainedRegEx = /(?<=[*/\s(])var\(/;
|
||||
|
||||
// Patched css-tree
|
||||
const cssTree = csstree.fork(syntaxes);
|
||||
|
||||
// Instance of the LRU Cache. Stores up to 4096 items.
|
||||
const lruCache = new LRUCache({
|
||||
max: 4096
|
||||
});
|
||||
|
||||
/**
|
||||
* Prepares a stringified value.
|
||||
*
|
||||
* @param {string|number|null|undefined} value - The value to prepare.
|
||||
* @returns {string} The prepared value.
|
||||
*/
|
||||
const prepareValue = (value) => {
|
||||
// `null` is converted to an empty string.
|
||||
// @see https://webidl.spec.whatwg.org/#LegacyNullToEmptyString
|
||||
if (value === null) {
|
||||
return "";
|
||||
}
|
||||
return `${value}`.trim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the value is a global keyword.
|
||||
*
|
||||
* @param {string} val - The value to check.
|
||||
* @returns {boolean} True if the value is a global keyword, false otherwise.
|
||||
*/
|
||||
const isGlobalKeyword = (val) => {
|
||||
return GLOBAL_KEYS.has(asciiLowercase(val));
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the value starts with or contains a CSS var() function.
|
||||
*
|
||||
* @param {string} val - The value to check.
|
||||
* @returns {boolean} True if the value contains a var() function, false otherwise.
|
||||
*/
|
||||
const hasVarFunc = (val) => {
|
||||
return varRegEx.test(val) || varContainedRegEx.test(val);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the value starts with or contains CSS calc() or math functions.
|
||||
*
|
||||
* @param {string} val - The value to check.
|
||||
* @returns {boolean} True if the value contains calc() or math functions, false otherwise.
|
||||
*/
|
||||
const hasCalcFunc = (val) => {
|
||||
return calcRegEx.test(val) || calcContainedRegEx.test(val);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a CSS string into an AST.
|
||||
*
|
||||
* @param {string} val - The CSS string to parse.
|
||||
* @param {object} opt - The options for parsing.
|
||||
* @param {boolean} [toObject=false] - Whether to return a plain object.
|
||||
* @returns {object} The AST or a plain object.
|
||||
*/
|
||||
const parseCSS = (val, opt, toObject = false) => {
|
||||
val = prepareValue(val);
|
||||
const ast = cssTree.parse(val, opt);
|
||||
if (toObject) {
|
||||
return cssTree.toPlainObject(ast);
|
||||
}
|
||||
return ast;
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the value is a valid property value.
|
||||
* Returns false for custom properties or values containing var().
|
||||
*
|
||||
* @param {string} prop - The property name.
|
||||
* @param {string} val - The property value.
|
||||
* @returns {boolean} True if the value is valid, false otherwise.
|
||||
*/
|
||||
const isValidPropertyValue = (prop, val) => {
|
||||
val = prepareValue(val);
|
||||
if (val === "") {
|
||||
return true;
|
||||
}
|
||||
// cssTree.lexer does not support deprecated system colors
|
||||
// @see https://github.com/w3c/webref/issues/1519#issuecomment-3120290261
|
||||
// @see https://github.com/w3c/webref/issues/1647
|
||||
if (SYS_COLORS.has(asciiLowercase(val))) {
|
||||
if (/^(?:-webkit-)?(?:[a-z][a-z\d]*-)*color$/i.test(prop)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const cacheKey = `isValidPropertyValue_${prop}_${val}`;
|
||||
const cachedValue = lruCache.get(cacheKey);
|
||||
if (typeof cachedValue === "boolean") {
|
||||
return cachedValue;
|
||||
}
|
||||
let result;
|
||||
try {
|
||||
const ast = parseCSS(val, {
|
||||
context: "value"
|
||||
});
|
||||
const { error, matched } = cssTree.lexer.matchProperty(prop, ast);
|
||||
result = error === null && matched !== null;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
lruCache.set(cacheKey, result);
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolves CSS math functions.
|
||||
*
|
||||
* @param {string} val - The value to resolve.
|
||||
* @param {object} [opt={ format: "specifiedValue" }] - The options for resolving.
|
||||
* @returns {string|undefined} The resolved value.
|
||||
*/
|
||||
const resolveCalc = (val, opt = { format: "specifiedValue" }) => {
|
||||
val = prepareValue(val);
|
||||
if (val === "" || hasVarFunc(val) || !hasCalcFunc(val)) {
|
||||
return val;
|
||||
}
|
||||
const cacheKey = `resolveCalc_${val}`;
|
||||
const cachedValue = lruCache.get(cacheKey);
|
||||
if (typeof cachedValue === "string") {
|
||||
return cachedValue;
|
||||
}
|
||||
const obj = parseCSS(val, { context: "value" }, true);
|
||||
if (!obj?.children) {
|
||||
return;
|
||||
}
|
||||
const { children: items } = obj;
|
||||
const values = [];
|
||||
for (const item of items) {
|
||||
const { type: itemType, name: itemName, value: itemValue } = item;
|
||||
if (itemType === AST_TYPES.FUNCTION) {
|
||||
const value = cssTree
|
||||
.generate(item)
|
||||
.replace(/\)(?!\)|\s|,)/g, ") ")
|
||||
.trim();
|
||||
if (calcNameRegEx.test(itemName)) {
|
||||
const newValue = cssCalc(value, opt);
|
||||
values.push(newValue);
|
||||
} else {
|
||||
values.push(value);
|
||||
}
|
||||
} else if (itemType === AST_TYPES.STRING) {
|
||||
values.push(`"${itemValue}"`);
|
||||
} else {
|
||||
values.push(itemName ?? itemValue);
|
||||
}
|
||||
}
|
||||
const resolvedValue = values.join(" ");
|
||||
lruCache.set(cacheKey, resolvedValue);
|
||||
return resolvedValue;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a property value.
|
||||
* Returns a string or an array of parsed objects.
|
||||
*
|
||||
* @param {string} prop - The property name.
|
||||
* @param {string} val - The property value.
|
||||
* @param {object} [opt={}] - The options for parsing.
|
||||
* @returns {string|Array<object>|undefined} The parsed value.
|
||||
*/
|
||||
const parsePropertyValue = (prop, val, opt = {}) => {
|
||||
const { caseSensitive, inArray } = opt;
|
||||
val = prepareValue(val);
|
||||
if (val === "" || hasVarFunc(val)) {
|
||||
return val;
|
||||
} else if (hasCalcFunc(val)) {
|
||||
const calculatedValue = resolveCalc(val, {
|
||||
format: "specifiedValue"
|
||||
});
|
||||
if (typeof calculatedValue !== "string") {
|
||||
return;
|
||||
}
|
||||
val = calculatedValue;
|
||||
}
|
||||
const cacheKey = `parsePropertyValue_${prop}_${val}_${caseSensitive}`;
|
||||
const cachedValue = lruCache.get(cacheKey);
|
||||
if (cachedValue === false) {
|
||||
return;
|
||||
} else if (inArray) {
|
||||
if (Array.isArray(cachedValue)) {
|
||||
return cachedValue;
|
||||
}
|
||||
} else if (typeof cachedValue === "string") {
|
||||
return cachedValue;
|
||||
}
|
||||
let parsedValue;
|
||||
const lowerCasedValue = asciiLowercase(val);
|
||||
if (GLOBAL_KEYS.has(lowerCasedValue)) {
|
||||
if (inArray) {
|
||||
parsedValue = [
|
||||
{
|
||||
type: AST_TYPES.GLOBAL_KEYWORD,
|
||||
name: lowerCasedValue
|
||||
}
|
||||
];
|
||||
} else {
|
||||
parsedValue = lowerCasedValue;
|
||||
}
|
||||
} else if (SYS_COLORS.has(lowerCasedValue)) {
|
||||
if (/^(?:(?:-webkit-)?(?:[a-z][a-z\d]*-)*color|border)$/i.test(prop)) {
|
||||
if (inArray) {
|
||||
parsedValue = [
|
||||
{
|
||||
type: AST_TYPES.IDENTIFIER,
|
||||
name: lowerCasedValue
|
||||
}
|
||||
];
|
||||
} else {
|
||||
parsedValue = lowerCasedValue;
|
||||
}
|
||||
} else {
|
||||
parsedValue = false;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
const ast = parseCSS(val, {
|
||||
context: "value"
|
||||
});
|
||||
const { error, matched } = cssTree.lexer.matchProperty(prop, ast);
|
||||
if (error || !matched) {
|
||||
parsedValue = false;
|
||||
} else if (inArray) {
|
||||
const obj = cssTree.toPlainObject(ast);
|
||||
const items = obj.children;
|
||||
const values = [];
|
||||
for (const item of items) {
|
||||
const { children, name, type, value, unit } = item;
|
||||
switch (type) {
|
||||
case AST_TYPES.DIMENSION: {
|
||||
values.push({
|
||||
type,
|
||||
value,
|
||||
unit: asciiLowercase(unit)
|
||||
});
|
||||
break;
|
||||
}
|
||||
case AST_TYPES.FUNCTION: {
|
||||
const css = cssTree
|
||||
.generate(item)
|
||||
.replace(/\)(?!\)|\s|,)/g, ") ")
|
||||
.trim();
|
||||
const raw = items.length === 1 ? val : css;
|
||||
// Remove "${name}(" from the start and ")" from the end
|
||||
const itemValue = raw.slice(name.length + 1, -1).trim();
|
||||
if (name === "calc") {
|
||||
if (children.length === 1) {
|
||||
const [child] = children;
|
||||
if (child.type === AST_TYPES.NUMBER) {
|
||||
values.push({
|
||||
type: AST_TYPES.CALC,
|
||||
isNumber: true,
|
||||
value: `${parseFloat(child.value)}`,
|
||||
name,
|
||||
raw
|
||||
});
|
||||
} else {
|
||||
values.push({
|
||||
type: AST_TYPES.CALC,
|
||||
isNumber: false,
|
||||
value: `${asciiLowercase(itemValue)}`,
|
||||
name,
|
||||
raw
|
||||
});
|
||||
}
|
||||
} else {
|
||||
values.push({
|
||||
type: AST_TYPES.CALC,
|
||||
isNumber: false,
|
||||
value: asciiLowercase(itemValue),
|
||||
name,
|
||||
raw
|
||||
});
|
||||
}
|
||||
} else {
|
||||
values.push({
|
||||
type,
|
||||
name,
|
||||
value: asciiLowercase(itemValue),
|
||||
raw
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AST_TYPES.IDENTIFIER: {
|
||||
if (caseSensitive) {
|
||||
values.push(item);
|
||||
} else {
|
||||
values.push({
|
||||
type,
|
||||
name: asciiLowercase(name)
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
values.push(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
parsedValue = values;
|
||||
} else {
|
||||
parsedValue = val;
|
||||
}
|
||||
} catch {
|
||||
parsedValue = false;
|
||||
}
|
||||
}
|
||||
lruCache.set(cacheKey, parsedValue);
|
||||
if (parsedValue === false) {
|
||||
return;
|
||||
}
|
||||
return parsedValue;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a numeric value (number, dimension, percentage).
|
||||
* Helper function for parseNumber, parseLength, etc.
|
||||
*
|
||||
* @param {Array<object>} val - The AST value.
|
||||
* @param {object} [opt={}] - The options for parsing.
|
||||
* @param {Function} validateType - Function to validate the node type.
|
||||
* @returns {object|undefined} The parsed result containing num and unit, or undefined.
|
||||
*/
|
||||
const parseNumericValue = (val, opt, validateType) => {
|
||||
const [item] = val;
|
||||
const { type, value, unit } = item ?? {};
|
||||
if (!validateType(type, value, unit)) {
|
||||
return;
|
||||
}
|
||||
const { clamp } = opt || {};
|
||||
const max = opt?.max ?? Number.INFINITY;
|
||||
const min = opt?.min ?? Number.NEGATIVE_INFINITY;
|
||||
let num = parseFloat(value);
|
||||
if (clamp) {
|
||||
if (num > max) {
|
||||
num = max;
|
||||
} else if (num < min) {
|
||||
num = min;
|
||||
}
|
||||
} else if (num > max || num < min) {
|
||||
return;
|
||||
}
|
||||
return {
|
||||
num,
|
||||
unit: unit ? asciiLowercase(unit) : null,
|
||||
type
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a <number> value.
|
||||
*
|
||||
* @param {Array<object>} val - The AST value.
|
||||
* @param {object} [opt={}] - The options for parsing.
|
||||
* @returns {string|undefined} The parsed number.
|
||||
*/
|
||||
const parseNumber = (val, opt = {}) => {
|
||||
const res = parseNumericValue(val, opt, (type) => type === AST_TYPES.NUMBER);
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
return `${res.num}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a <length> value.
|
||||
*
|
||||
* @param {Array<object>} val - The AST value.
|
||||
* @param {object} [opt={}] - The options for parsing.
|
||||
* @returns {string|undefined} The parsed length.
|
||||
*/
|
||||
const parseLength = (val, opt = {}) => {
|
||||
const res = parseNumericValue(
|
||||
val,
|
||||
opt,
|
||||
(type, value) => type === AST_TYPES.DIMENSION || (type === AST_TYPES.NUMBER && value === "0")
|
||||
);
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
const { num, unit } = res;
|
||||
if (num === 0 && !unit) {
|
||||
return `${num}px`;
|
||||
} else if (unit) {
|
||||
return `${num}${unit}`;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a <percentage> value.
|
||||
*
|
||||
* @param {Array<object>} val - The AST value.
|
||||
* @param {object} [opt={}] - The options for parsing.
|
||||
* @returns {string|undefined} The parsed percentage.
|
||||
*/
|
||||
const parsePercentage = (val, opt = {}) => {
|
||||
const res = parseNumericValue(
|
||||
val,
|
||||
opt,
|
||||
(type, value) => type === AST_TYPES.PERCENTAGE || (type === AST_TYPES.NUMBER && value === "0")
|
||||
);
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
const { num } = res;
|
||||
return `${num}%`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses an <angle> value.
|
||||
*
|
||||
* @param {Array<object>} val - The AST value.
|
||||
* @param {object} [opt={}] - The options for parsing.
|
||||
* @returns {string|undefined} The parsed angle.
|
||||
*/
|
||||
const parseAngle = (val, opt = {}) => {
|
||||
const res = parseNumericValue(
|
||||
val,
|
||||
opt,
|
||||
(type, value) => type === AST_TYPES.DIMENSION || (type === AST_TYPES.NUMBER && value === "0")
|
||||
);
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
const { num, unit } = res;
|
||||
if (unit) {
|
||||
if (!/^(?:deg|g?rad|turn)$/i.test(unit)) {
|
||||
return;
|
||||
}
|
||||
return `${num}${unit}`;
|
||||
} else if (num === 0) {
|
||||
return `${num}deg`;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a <url> value.
|
||||
*
|
||||
* @param {Array<object>} val - The AST value.
|
||||
* @returns {string|undefined} The parsed url.
|
||||
*/
|
||||
const parseUrl = (val) => {
|
||||
const [item] = val;
|
||||
const { type, value } = item ?? {};
|
||||
if (type !== AST_TYPES.URL) {
|
||||
return;
|
||||
}
|
||||
const str = value.replace(/\\\\/g, "\\").replaceAll('"', '\\"');
|
||||
return `url("${str}")`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a <string> value.
|
||||
*
|
||||
* @param {Array<object>} val - The AST value.
|
||||
* @returns {string|undefined} The parsed string.
|
||||
*/
|
||||
const parseString = (val) => {
|
||||
const [item] = val;
|
||||
const { type, value } = item ?? {};
|
||||
if (type !== AST_TYPES.STRING) {
|
||||
return;
|
||||
}
|
||||
const str = value.replace(/\\\\/g, "\\").replaceAll('"', '\\"');
|
||||
return `"${str}"`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a <color> value.
|
||||
*
|
||||
* @param {Array<object>} val - The AST value.
|
||||
* @returns {string|undefined} The parsed color.
|
||||
*/
|
||||
const parseColor = (val) => {
|
||||
const [item] = val;
|
||||
const { name, type, value } = item ?? {};
|
||||
switch (type) {
|
||||
case AST_TYPES.FUNCTION: {
|
||||
const res = resolveColor(`${name}(${value})`, {
|
||||
format: "specifiedValue"
|
||||
});
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AST_TYPES.HASH: {
|
||||
const res = resolveColor(`#${value}`, {
|
||||
format: "specifiedValue"
|
||||
});
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AST_TYPES.IDENTIFIER: {
|
||||
if (SYS_COLORS.has(name)) {
|
||||
return name;
|
||||
}
|
||||
const res = resolveColor(name, {
|
||||
format: "specifiedValue"
|
||||
});
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a <gradient> value.
|
||||
*
|
||||
* @param {Array<object>} val - The AST value.
|
||||
* @returns {string|undefined} The parsed gradient.
|
||||
*/
|
||||
const parseGradient = (val) => {
|
||||
const [item] = val;
|
||||
const { name, type, value } = item ?? {};
|
||||
if (type !== AST_TYPES.FUNCTION) {
|
||||
return;
|
||||
}
|
||||
const res = resolveGradient(`${name}(${value})`, {
|
||||
format: "specifiedValue"
|
||||
});
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolves a keyword value.
|
||||
*
|
||||
* @param {Array<object>} value - The AST node array containing the keyword value.
|
||||
* @param {object} [opt={}] - The options for parsing.
|
||||
* @returns {string|undefined} The resolved keyword or undefined.
|
||||
*/
|
||||
const resolveKeywordValue = (value, opt = {}) => {
|
||||
const [{ name, type }] = value;
|
||||
const { length } = opt;
|
||||
switch (type) {
|
||||
case AST_TYPES.GLOBAL_KEYWORD: {
|
||||
if (length > 1) {
|
||||
return;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
case AST_TYPES.IDENTIFIER: {
|
||||
return name;
|
||||
}
|
||||
default:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolves a function value.
|
||||
*
|
||||
* @param {Array<object>} value - The AST node array containing the function value.
|
||||
* @param {object} [opt={}] - The options for parsing.
|
||||
* @returns {string|undefined} The resolved function or undefined.
|
||||
*/
|
||||
const resolveFunctionValue = (value, opt = {}) => {
|
||||
const [{ name, type, value: itemValue }] = value;
|
||||
const { length } = opt;
|
||||
switch (type) {
|
||||
case AST_TYPES.FUNCTION: {
|
||||
return `${name}(${itemValue})`;
|
||||
}
|
||||
case AST_TYPES.GLOBAL_KEYWORD: {
|
||||
if (length > 1) {
|
||||
return;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
case AST_TYPES.IDENTIFIER: {
|
||||
return name;
|
||||
}
|
||||
default:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolves a length or percentage or number value.
|
||||
*
|
||||
* @param {Array<object>} value - The AST node array containing the value.
|
||||
* @param {object} [opt={}] - The options for parsing.
|
||||
* @returns {string|undefined} The resolved length/percentage/number or undefined.
|
||||
*/
|
||||
const resolveNumericValue = (value, opt = {}) => {
|
||||
const [{ name, type: itemType, value: itemValue }] = value;
|
||||
const { length, type } = opt;
|
||||
switch (itemType) {
|
||||
case AST_TYPES.CALC: {
|
||||
return `${name}(${itemValue})`;
|
||||
}
|
||||
case AST_TYPES.DIMENSION: {
|
||||
if (type === "angle") {
|
||||
return parseAngle(value, opt);
|
||||
}
|
||||
return parseLength(value, opt);
|
||||
}
|
||||
case AST_TYPES.GLOBAL_KEYWORD: {
|
||||
if (length > 1) {
|
||||
return;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
case AST_TYPES.IDENTIFIER: {
|
||||
return name;
|
||||
}
|
||||
case AST_TYPES.NUMBER: {
|
||||
switch (type) {
|
||||
case "angle": {
|
||||
return parseAngle(value, opt);
|
||||
}
|
||||
case "length": {
|
||||
return parseLength(value, opt);
|
||||
}
|
||||
case "percentage": {
|
||||
return parsePercentage(value, opt);
|
||||
}
|
||||
default: {
|
||||
return parseNumber(value, opt);
|
||||
}
|
||||
}
|
||||
}
|
||||
case AST_TYPES.PERCENTAGE: {
|
||||
return parsePercentage(value, opt);
|
||||
}
|
||||
default:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolves a color value.
|
||||
*
|
||||
* @param {Array<object>} value - The AST node array containing the color value.
|
||||
* @param {object} [opt={}] - The options for parsing.
|
||||
* @returns {string|undefined} The resolved color or undefined.
|
||||
*/
|
||||
const resolveColorValue = (value, opt = {}) => {
|
||||
const [{ name, type }] = value;
|
||||
const { length } = opt;
|
||||
switch (type) {
|
||||
case AST_TYPES.GLOBAL_KEYWORD: {
|
||||
if (length > 1) {
|
||||
return;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
default: {
|
||||
return parseColor(value, opt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolves a gradient or URL value.
|
||||
*
|
||||
* @param {Array<object>} value - The AST node array containing the color value.
|
||||
* @param {object} [opt={}] - The options for parsing.
|
||||
* @returns {string|undefined} The resolved gradient/url or undefined.
|
||||
*/
|
||||
const resolveGradientUrlValue = (value, opt = {}) => {
|
||||
const [{ name, type }] = value;
|
||||
const { length } = opt;
|
||||
switch (type) {
|
||||
case AST_TYPES.GLOBAL_KEYWORD: {
|
||||
if (length > 1) {
|
||||
return;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
case AST_TYPES.IDENTIFIER: {
|
||||
return name;
|
||||
}
|
||||
case AST_TYPES.URL: {
|
||||
return parseUrl(value, opt);
|
||||
}
|
||||
default: {
|
||||
return parseGradient(value, opt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolves a border shorthand value.
|
||||
*
|
||||
* @param {Array<object>} value - The AST node array containing the shorthand value.
|
||||
* @param {object} subProps - The sub properties object.
|
||||
* @param {Map} parsedValues - The Map of parsed values.
|
||||
* @returns {Array|string|undefined} - The resolved [prop, value] pair, keyword or undefined.
|
||||
*/
|
||||
const resolveBorderShorthandValue = (value, subProps, parsedValues) => {
|
||||
const [{ isNumber, name, type, value: itemValue }] = value;
|
||||
const { color: colorProp, style: styleProp, width: widthProp } = subProps;
|
||||
switch (type) {
|
||||
case AST_TYPES.CALC: {
|
||||
if (isNumber || parsedValues.has(widthProp)) {
|
||||
return;
|
||||
}
|
||||
return [widthProp, `${name}(${itemValue}`];
|
||||
}
|
||||
case AST_TYPES.DIMENSION:
|
||||
case AST_TYPES.NUMBER: {
|
||||
if (parsedValues.has(widthProp)) {
|
||||
return;
|
||||
}
|
||||
const parsedValue = parseLength(value, { min: 0 });
|
||||
if (!parsedValue) {
|
||||
return;
|
||||
}
|
||||
return [widthProp, parsedValue];
|
||||
}
|
||||
case AST_TYPES.FUNCTION:
|
||||
case AST_TYPES.HASH: {
|
||||
if (parsedValues.has(colorProp)) {
|
||||
return;
|
||||
}
|
||||
const parsedValue = parseColor(value);
|
||||
if (!parsedValue) {
|
||||
return;
|
||||
}
|
||||
return [colorProp, parsedValue];
|
||||
}
|
||||
case AST_TYPES.GLOBAL_KEYWORD: {
|
||||
return name;
|
||||
}
|
||||
case AST_TYPES.IDENTIFIER: {
|
||||
if (isValidPropertyValue(widthProp, name)) {
|
||||
if (parsedValues.has(widthProp)) {
|
||||
return;
|
||||
}
|
||||
return [widthProp, name];
|
||||
} else if (isValidPropertyValue(styleProp, name)) {
|
||||
if (parsedValues.has(styleProp)) {
|
||||
return;
|
||||
}
|
||||
return [styleProp, name];
|
||||
} else if (isValidPropertyValue(colorProp, name)) {
|
||||
if (parsedValues.has(colorProp)) {
|
||||
return;
|
||||
}
|
||||
return [colorProp, name];
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
AST_TYPES,
|
||||
hasCalcFunc,
|
||||
hasVarFunc,
|
||||
isGlobalKeyword,
|
||||
isValidPropertyValue,
|
||||
parseAngle,
|
||||
parseCSS,
|
||||
parseColor,
|
||||
parseGradient,
|
||||
parseLength,
|
||||
parseNumber,
|
||||
parsePercentage,
|
||||
parsePropertyValue,
|
||||
parseString,
|
||||
parseUrl,
|
||||
prepareValue,
|
||||
resolveBorderShorthandValue,
|
||||
resolveCalc,
|
||||
resolveColorValue,
|
||||
resolveFunctionValue,
|
||||
resolveGradientUrlValue,
|
||||
resolveKeywordValue,
|
||||
resolveNumericValue,
|
||||
splitValue
|
||||
};
|
||||
406
server/node_modules/cssstyle/lib/properties/background.js
generated
vendored
Normal file
406
server/node_modules/cssstyle/lib/properties/background.js
generated
vendored
Normal file
@@ -0,0 +1,406 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
const backgroundImage = require("./backgroundImage");
|
||||
const backgroundPosition = require("./backgroundPosition");
|
||||
const backgroundSize = require("./backgroundSize");
|
||||
const backgroundRepeat = require("./backgroundRepeat");
|
||||
const backgroundOrigin = require("./backgroundOrigin");
|
||||
const backgroundClip = require("./backgroundClip");
|
||||
const backgroundAttachment = require("./backgroundAttachment");
|
||||
const backgroundColor = require("./backgroundColor");
|
||||
|
||||
const property = "background";
|
||||
|
||||
module.exports.initialValues = new Map([
|
||||
[backgroundImage.property, "none"],
|
||||
[backgroundPosition.property, "0% 0%"],
|
||||
[backgroundSize.property, "auto"],
|
||||
[backgroundRepeat.property, "repeat"],
|
||||
[backgroundOrigin.property, "padding-box"],
|
||||
[backgroundClip.property, "border-box"],
|
||||
[backgroundAttachment.property, "scroll"],
|
||||
[backgroundColor.property, "transparent"]
|
||||
]);
|
||||
|
||||
module.exports.shorthandFor = new Map([
|
||||
[backgroundImage.property, backgroundImage],
|
||||
[backgroundPosition.property, backgroundPosition],
|
||||
[backgroundSize.property, backgroundSize],
|
||||
[backgroundRepeat.property, backgroundRepeat],
|
||||
[backgroundOrigin.property, backgroundOrigin],
|
||||
[backgroundClip.property, backgroundClip],
|
||||
[backgroundAttachment.property, backgroundAttachment],
|
||||
[backgroundColor.property, backgroundColor]
|
||||
]);
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
} else if (parsers.hasCalcFunc(v)) {
|
||||
v = parsers.resolveCalc(v);
|
||||
}
|
||||
if (!parsers.isValidPropertyValue(property, v)) {
|
||||
return;
|
||||
}
|
||||
const values = parsers.splitValue(v, {
|
||||
delimiter: ","
|
||||
});
|
||||
const bgValues = [];
|
||||
const l = values.length;
|
||||
for (let i = 0; i < l; i++) {
|
||||
let bg = {
|
||||
[backgroundImage.property]: module.exports.initialValues.get(backgroundImage.property),
|
||||
[backgroundPosition.property]: module.exports.initialValues.get(backgroundPosition.property),
|
||||
[backgroundSize.property]: module.exports.initialValues.get(backgroundSize.property),
|
||||
[backgroundRepeat.property]: module.exports.initialValues.get(backgroundRepeat.property),
|
||||
[backgroundOrigin.property]: module.exports.initialValues.get(backgroundOrigin.property),
|
||||
[backgroundClip.property]: module.exports.initialValues.get(backgroundClip.property),
|
||||
[backgroundAttachment.property]: module.exports.initialValues.get(
|
||||
backgroundAttachment.property
|
||||
),
|
||||
[backgroundColor.property]: module.exports.initialValues.get(backgroundColor.property)
|
||||
};
|
||||
if (l > 1 && i !== l - 1) {
|
||||
bg = {
|
||||
[backgroundImage.property]: module.exports.initialValues.get(backgroundImage.property),
|
||||
[backgroundPosition.property]: module.exports.initialValues.get(
|
||||
backgroundPosition.property
|
||||
),
|
||||
[backgroundSize.property]: module.exports.initialValues.get(backgroundSize.property),
|
||||
[backgroundRepeat.property]: module.exports.initialValues.get(backgroundRepeat.property),
|
||||
[backgroundOrigin.property]: module.exports.initialValues.get(backgroundOrigin.property),
|
||||
[backgroundClip.property]: module.exports.initialValues.get(backgroundClip.property),
|
||||
[backgroundAttachment.property]: module.exports.initialValues.get(
|
||||
backgroundAttachment.property
|
||||
)
|
||||
};
|
||||
}
|
||||
const bgPosition = [];
|
||||
const bgSize = [];
|
||||
const bgRepeat = [];
|
||||
const bgBox = [];
|
||||
const bgParts = parsers.splitValue(values[i], {
|
||||
delimiter: "/"
|
||||
});
|
||||
if (!bgParts.length || bgParts.length > 2) {
|
||||
return;
|
||||
}
|
||||
const [bgPart1, bgPart2 = ""] = bgParts;
|
||||
const parts1 = parsers.splitValue(bgPart1);
|
||||
for (const part of parts1) {
|
||||
let partValid = false;
|
||||
for (const [longhand, value] of module.exports.shorthandFor) {
|
||||
if (parsers.isValidPropertyValue(longhand, part)) {
|
||||
partValid = true;
|
||||
switch (longhand) {
|
||||
case backgroundClip.property:
|
||||
case backgroundOrigin.property: {
|
||||
const parsedValue = value.parse(part, { globalObject });
|
||||
if (parsedValue) {
|
||||
bgBox.push(parsedValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case backgroundColor.property: {
|
||||
if (i !== values.length - 1) {
|
||||
return;
|
||||
}
|
||||
const parsedValue = value.parse(part, { globalObject });
|
||||
if (parsedValue) {
|
||||
bg[longhand] = parsedValue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case backgroundPosition.property: {
|
||||
const parsedValue = value.parse(part, { globalObject });
|
||||
if (parsedValue) {
|
||||
bgPosition.push(parsedValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case backgroundRepeat.property: {
|
||||
const parsedValue = value.parse(part, { globalObject });
|
||||
if (parsedValue) {
|
||||
bgRepeat.push(parsedValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case backgroundSize.property: {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
const parsedValue = value.parse(part, { globalObject });
|
||||
if (parsedValue) {
|
||||
bg[longhand] = parsedValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!partValid) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (bgPart2) {
|
||||
const parts2 = parsers.splitValue(bgPart2);
|
||||
for (const part of parts2) {
|
||||
let partValid = false;
|
||||
for (const [longhand, value] of module.exports.shorthandFor) {
|
||||
if (parsers.isValidPropertyValue(longhand, part)) {
|
||||
partValid = true;
|
||||
switch (longhand) {
|
||||
case backgroundClip.property:
|
||||
case backgroundOrigin.property: {
|
||||
const parsedValue = value.parse(part, { globalObject });
|
||||
if (parsedValue) {
|
||||
bgBox.push(parsedValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case backgroundColor.property: {
|
||||
if (i !== l - 1) {
|
||||
return;
|
||||
}
|
||||
const parsedValue = value.parse(part, { globalObject });
|
||||
if (parsedValue) {
|
||||
bg[longhand] = parsedValue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case backgroundPosition.property: {
|
||||
break;
|
||||
}
|
||||
case backgroundRepeat.property: {
|
||||
const parsedValue = value.parse(part, { globalObject });
|
||||
if (parsedValue) {
|
||||
bgRepeat.push(parsedValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case backgroundSize.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 } = module.exports.shorthandFor.get(backgroundPosition.property);
|
||||
const value = parser(bgPosition.join(" "), { globalObject });
|
||||
if (value) {
|
||||
bg[backgroundPosition.property] = value;
|
||||
}
|
||||
}
|
||||
if (bgSize.length) {
|
||||
const { parse: parser } = module.exports.shorthandFor.get(backgroundSize.property);
|
||||
const value = parser(bgSize.join(" "), { globalObject });
|
||||
if (value) {
|
||||
bg[backgroundSize.property] = value;
|
||||
}
|
||||
}
|
||||
if (bgRepeat.length) {
|
||||
const { parse: parser } = module.exports.shorthandFor.get(backgroundRepeat.property);
|
||||
const value = parser(bgRepeat.join(" "), { globalObject });
|
||||
if (value) {
|
||||
bg[backgroundRepeat.property] = value;
|
||||
}
|
||||
}
|
||||
if (bgBox.length) {
|
||||
switch (bgBox.length) {
|
||||
case 1: {
|
||||
const [value] = bgBox;
|
||||
bg[backgroundOrigin.property] = value;
|
||||
bg[backgroundClip.property] = value;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
const [value1, value2] = bgBox;
|
||||
bg[backgroundOrigin.property] = value1;
|
||||
bg[backgroundClip.property] = value2;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
bgValues.push(bg);
|
||||
}
|
||||
return bgValues;
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (v === "" || parsers.hasVarFunc(v)) {
|
||||
for (const [key] of module.exports.shorthandFor) {
|
||||
this._setProperty(key, "");
|
||||
}
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const bgValues = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (!Array.isArray(bgValues)) {
|
||||
return;
|
||||
}
|
||||
const bgMap = new Map([
|
||||
[backgroundImage.property, []],
|
||||
[backgroundPosition.property, []],
|
||||
[backgroundSize.property, []],
|
||||
[backgroundRepeat.property, []],
|
||||
[backgroundOrigin.property, []],
|
||||
[backgroundClip.property, []],
|
||||
[backgroundAttachment.property, []],
|
||||
[backgroundColor.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 !== module.exports.initialValues.get(longhand)) {
|
||||
if (longhand === backgroundSize.property) {
|
||||
bg.push(`/ ${value}`);
|
||||
} else {
|
||||
bg.push(value);
|
||||
}
|
||||
} else if (longhand === backgroundImage.property) {
|
||||
if (v === "none") {
|
||||
bg.push(value);
|
||||
}
|
||||
} else if (longhand === backgroundColor.property) {
|
||||
if (v === "transparent") {
|
||||
bg.push(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
backgrounds.push(bg.join(" "));
|
||||
}
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
for (const [longhand, value] of bgMap) {
|
||||
this._setProperty(longhand, value.join(", "), priority);
|
||||
}
|
||||
this._setProperty(property, backgrounds.join(", "), priority);
|
||||
}
|
||||
},
|
||||
get() {
|
||||
const v = this.getPropertyValue(property);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
return v;
|
||||
}
|
||||
const bgMap = new Map();
|
||||
let l = 0;
|
||||
for (const [longhand] of module.exports.shorthandFor) {
|
||||
const val = this.getPropertyValue(longhand);
|
||||
if (longhand === backgroundImage.property) {
|
||||
if (
|
||||
val === "none" &&
|
||||
v === "none" &&
|
||||
this.getPropertyValue(backgroundColor.property) === "transparent"
|
||||
) {
|
||||
return val;
|
||||
}
|
||||
if (val !== module.exports.initialValues.get(longhand)) {
|
||||
const imgValues = parsers.splitValue(val, {
|
||||
delimiter: ","
|
||||
});
|
||||
l = imgValues.length;
|
||||
bgMap.set(longhand, imgValues);
|
||||
}
|
||||
} else if (longhand === backgroundColor.property) {
|
||||
if (val !== module.exports.initialValues.get(longhand) || v.includes(val)) {
|
||||
bgMap.set(longhand, [val]);
|
||||
}
|
||||
} else if (val !== module.exports.initialValues.get(longhand)) {
|
||||
bgMap.set(
|
||||
longhand,
|
||||
parsers.splitValue(val, {
|
||||
delimiter: ","
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
if (l === 0) {
|
||||
const bgColArr = bgMap.get(backgroundColor.property);
|
||||
const background = bgColArr ? bgColArr[0] : null;
|
||||
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 backgroundColor.property: {
|
||||
if (i === l - 1) {
|
||||
const value = values[0];
|
||||
if (parsers.hasVarFunc(value)) {
|
||||
return "";
|
||||
}
|
||||
if (value && value !== module.exports.initialValues.get(longhand)) {
|
||||
const bgValue = bgValues[i];
|
||||
bgValue.push(value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case backgroundSize.property: {
|
||||
const value = values[i];
|
||||
if (parsers.hasVarFunc(value)) {
|
||||
return "";
|
||||
}
|
||||
if (value && value !== module.exports.initialValues.get(longhand)) {
|
||||
const bgValue = bgValues[i];
|
||||
bgValue.push(`/ ${value}`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
const value = values[i];
|
||||
if (parsers.hasVarFunc(value)) {
|
||||
return "";
|
||||
}
|
||||
if (value && value !== module.exports.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
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
61
server/node_modules/cssstyle/lib/properties/backgroundAttachment.js
generated
vendored
Normal file
61
server/node_modules/cssstyle/lib/properties/backgroundAttachment.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "background-attachment";
|
||||
const shorthand = "background";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.splitValue(v, { delimiter: "," });
|
||||
const parsedValues = [];
|
||||
for (const val of values) {
|
||||
const value = parsers.parsePropertyValue(property, val, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
const parsedValue = parsers.resolveKeywordValue(value);
|
||||
if (!parsedValue) {
|
||||
return;
|
||||
}
|
||||
parsedValues.push(parsedValue);
|
||||
} else if (typeof value === "string") {
|
||||
parsedValues.push(value);
|
||||
}
|
||||
}
|
||||
if (parsedValues.length) {
|
||||
return parsedValues.join(", ");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
61
server/node_modules/cssstyle/lib/properties/backgroundClip.js
generated
vendored
Normal file
61
server/node_modules/cssstyle/lib/properties/backgroundClip.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "background-clip";
|
||||
const shorthand = "background";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.splitValue(v, { delimiter: "," });
|
||||
const parsedValues = [];
|
||||
for (const val of values) {
|
||||
const value = parsers.parsePropertyValue(property, val, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
const parsedValue = parsers.resolveKeywordValue(value);
|
||||
if (!parsedValue) {
|
||||
return;
|
||||
}
|
||||
parsedValues.push(parsedValue);
|
||||
} else if (typeof value === "string") {
|
||||
parsedValues.push(value);
|
||||
}
|
||||
}
|
||||
if (parsedValues.length) {
|
||||
return parsedValues.join(", ");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
50
server/node_modules/cssstyle/lib/properties/backgroundColor.js
generated
vendored
Normal file
50
server/node_modules/cssstyle/lib/properties/backgroundColor.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "background-color";
|
||||
const shorthand = "background";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
63
server/node_modules/cssstyle/lib/properties/backgroundImage.js
generated
vendored
Normal file
63
server/node_modules/cssstyle/lib/properties/backgroundImage.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "background-image";
|
||||
const shorthand = "background";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.splitValue(v, { delimiter: "," });
|
||||
const parsedValues = [];
|
||||
for (const val of values) {
|
||||
const value = parsers.parsePropertyValue(property, val, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
const parsedValue = parsers.resolveGradientUrlValue(value);
|
||||
if (!parsedValue) {
|
||||
return;
|
||||
}
|
||||
parsedValues.push(parsedValue);
|
||||
} else if (typeof value === "string") {
|
||||
parsedValues.push(value);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (parsedValues.length) {
|
||||
return parsedValues.join(", ");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
61
server/node_modules/cssstyle/lib/properties/backgroundOrigin.js
generated
vendored
Normal file
61
server/node_modules/cssstyle/lib/properties/backgroundOrigin.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "background-origin";
|
||||
const shorthand = "background";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.splitValue(v, { delimiter: "," });
|
||||
const parsedValues = [];
|
||||
for (const val of values) {
|
||||
const value = parsers.parsePropertyValue(property, val, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
const parsedValue = parsers.resolveKeywordValue(value);
|
||||
if (!parsedValue) {
|
||||
return;
|
||||
}
|
||||
parsedValues.push(parsedValue);
|
||||
} else if (typeof value === "string") {
|
||||
parsedValues.push(value);
|
||||
}
|
||||
}
|
||||
if (parsedValues.length) {
|
||||
return parsedValues.join(", ");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
204
server/node_modules/cssstyle/lib/properties/backgroundPosition.js
generated
vendored
Normal file
204
server/node_modules/cssstyle/lib/properties/backgroundPosition.js
generated
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "background-position";
|
||||
const shorthand = "background";
|
||||
const keyX = ["left", "right"];
|
||||
const keyY = ["top", "bottom"];
|
||||
const keywordsX = ["center", ...keyX];
|
||||
const keywordsY = ["center", ...keyY];
|
||||
const keywords = ["center", ...keyX, ...keyY];
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const { AST_TYPES } = parsers;
|
||||
const values = parsers.splitValue(v, {
|
||||
delimiter: ","
|
||||
});
|
||||
const parsedValues = [];
|
||||
for (const val of values) {
|
||||
const value = parsers.parsePropertyValue(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
|
||||
: parsers.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
|
||||
: parsers.resolveNumericValue([part1], { type: "length" });
|
||||
const val2 =
|
||||
part2.type === AST_TYPES.IDENTIFIER
|
||||
? part2.name
|
||||
: parsers.resolveNumericValue([part2], { type: "length" });
|
||||
if (val1 && val2) {
|
||||
if (keywordsX.includes(val1) && keywordsY.includes(val2)) {
|
||||
parsedValue = `${val1} ${val2}`;
|
||||
} else if (keywordsY.includes(val1) && keywordsX.includes(val2)) {
|
||||
parsedValue = `${val2} ${val1}`;
|
||||
} else if (keywordsX.includes(val1)) {
|
||||
if (val2 === "center" || !keywordsX.includes(val2)) {
|
||||
parsedValue = `${val1} ${val2}`;
|
||||
}
|
||||
} else if (keywordsY.includes(val2)) {
|
||||
if (!keywordsY.includes(val1)) {
|
||||
parsedValue = `${val1} ${val2}`;
|
||||
}
|
||||
} else if (!keywordsY.includes(val1) && !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
|
||||
: parsers.resolveNumericValue([part2], { type: "length" });
|
||||
const val3 =
|
||||
part3.type === AST_TYPES.IDENTIFIER
|
||||
? part3.name
|
||||
: parsers.resolveNumericValue([part3], { type: "length" });
|
||||
if (val1 && val2 && val3) {
|
||||
let posX = "";
|
||||
let offX = "";
|
||||
let posY = "";
|
||||
let offY = "";
|
||||
if (keywordsX.includes(val1)) {
|
||||
if (keyY.includes(val2)) {
|
||||
if (!keywords.includes(val3)) {
|
||||
posX = val1;
|
||||
posY = val2;
|
||||
offY = val3;
|
||||
}
|
||||
} else if (keyY.includes(val3)) {
|
||||
if (!keywords.includes(val2)) {
|
||||
posX = val1;
|
||||
offX = val2;
|
||||
posY = val3;
|
||||
}
|
||||
}
|
||||
} else if (keywordsY.includes(val1)) {
|
||||
if (keyX.includes(val2)) {
|
||||
if (!keywords.includes(val3)) {
|
||||
posX = val2;
|
||||
offX = val3;
|
||||
posY = val1;
|
||||
}
|
||||
} else if (keyX.includes(val3)) {
|
||||
if (!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 = parsers.resolveNumericValue([part2], { type: "length" });
|
||||
const val3 = part3.type === AST_TYPES.IDENTIFIER && part3.name;
|
||||
const val4 = parsers.resolveNumericValue([part4], { type: "length" });
|
||||
if (val1 && val2 && val3 && val4) {
|
||||
let posX = "";
|
||||
let offX = "";
|
||||
let posY = "";
|
||||
let offY = "";
|
||||
if (keywordsX.includes(val1) && keyY.includes(val3)) {
|
||||
posX = val1;
|
||||
offX = val2;
|
||||
posY = val3;
|
||||
offY = val4;
|
||||
} else if (keyX.includes(val1) && keywordsY.includes(val3)) {
|
||||
posX = val1;
|
||||
offX = val2;
|
||||
posY = val3;
|
||||
offY = val4;
|
||||
} else if (keyY.includes(val1) && 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(", ");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
93
server/node_modules/cssstyle/lib/properties/backgroundRepeat.js
generated
vendored
Normal file
93
server/node_modules/cssstyle/lib/properties/backgroundRepeat.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "background-repeat";
|
||||
const shorthand = "background";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const { AST_TYPES } = parsers;
|
||||
const values = parsers.splitValue(v, {
|
||||
delimiter: ","
|
||||
});
|
||||
const parsedValues = [];
|
||||
for (const val of values) {
|
||||
const value = parsers.parsePropertyValue(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(", ");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
126
server/node_modules/cssstyle/lib/properties/backgroundSize.js
generated
vendored
Normal file
126
server/node_modules/cssstyle/lib/properties/backgroundSize.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "background-size";
|
||||
const shorthand = "background";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const { AST_TYPES } = parsers;
|
||||
const values = parsers.splitValue(v, {
|
||||
delimiter: ","
|
||||
});
|
||||
const parsedValues = [];
|
||||
for (const val of values) {
|
||||
const value = parsers.parsePropertyValue(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 = parsers.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(", ");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
107
server/node_modules/cssstyle/lib/properties/border.js
generated
vendored
Normal file
107
server/node_modules/cssstyle/lib/properties/border.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
const borderWidth = require("./borderWidth");
|
||||
const borderStyle = require("./borderStyle");
|
||||
const borderColor = require("./borderColor");
|
||||
const borderTop = require("./borderTop");
|
||||
const borderRight = require("./borderRight");
|
||||
const borderBottom = require("./borderBottom");
|
||||
const borderLeft = require("./borderLeft");
|
||||
|
||||
const property = "border";
|
||||
|
||||
const subProps = {
|
||||
width: borderWidth.property,
|
||||
style: borderStyle.property,
|
||||
color: borderColor.property
|
||||
};
|
||||
|
||||
module.exports.initialValues = new Map([
|
||||
[borderWidth.property, "medium"],
|
||||
[borderStyle.property, "none"],
|
||||
[borderColor.property, "currentcolor"]
|
||||
]);
|
||||
|
||||
module.exports.shorthandFor = new Map([
|
||||
[borderWidth.property, borderWidth],
|
||||
[borderStyle.property, borderStyle],
|
||||
[borderColor.property, borderColor]
|
||||
]);
|
||||
|
||||
module.exports.positionShorthandFor = new Map([
|
||||
[borderTop.property, borderTop],
|
||||
[borderRight.property, borderRight],
|
||||
[borderBottom.property, borderBottom],
|
||||
[borderLeft.property, borderLeft]
|
||||
]);
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "" || parsers.hasVarFunc(v)) {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.splitValue(v);
|
||||
const parsedValues = new Map();
|
||||
for (const val of values) {
|
||||
const value = parsers.parsePropertyValue(property, val, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
const parsedValue = parsers.resolveBorderShorthandValue(value, subProps, parsedValues);
|
||||
if (typeof parsedValue === "string") {
|
||||
return parsedValue;
|
||||
} else if (Array.isArray(parsedValue)) {
|
||||
const [key, resolvedVal] = parsedValue;
|
||||
parsedValues.set(key, resolvedVal);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (parsedValues.size) {
|
||||
const keys = module.exports.shorthandFor.keys();
|
||||
const obj = {
|
||||
[borderWidth.property]: "medium"
|
||||
};
|
||||
for (const key of keys) {
|
||||
if (parsedValues.has(key)) {
|
||||
const parsedValue = parsedValues.get(key);
|
||||
if (parsedValue !== module.exports.initialValues.get(key)) {
|
||||
obj[key] = parsedValues.get(key);
|
||||
if (obj[borderWidth.property] && obj[borderWidth.property] === "medium") {
|
||||
delete obj[borderWidth.property];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (val || typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
100
server/node_modules/cssstyle/lib/properties/borderBottom.js
generated
vendored
Normal file
100
server/node_modules/cssstyle/lib/properties/borderBottom.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
const borderBottomWidth = require("./borderBottomWidth");
|
||||
const borderBottomStyle = require("./borderBottomStyle");
|
||||
const borderBottomColor = require("./borderBottomColor");
|
||||
|
||||
const property = "border-bottom";
|
||||
const shorthand = "border";
|
||||
|
||||
const subProps = {
|
||||
width: borderBottomWidth.property,
|
||||
style: borderBottomStyle.property,
|
||||
color: borderBottomColor.property
|
||||
};
|
||||
|
||||
module.exports.initialValues = new Map([
|
||||
[borderBottomWidth.property, "medium"],
|
||||
[borderBottomStyle.property, "none"],
|
||||
[borderBottomColor.property, "currentcolor"]
|
||||
]);
|
||||
|
||||
module.exports.shorthandFor = new Map([
|
||||
[borderBottomWidth.property, borderBottomWidth],
|
||||
[borderBottomStyle.property, borderBottomStyle],
|
||||
[borderBottomColor.property, borderBottomColor]
|
||||
]);
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.splitValue(v);
|
||||
const parsedValues = new Map();
|
||||
for (const val of values) {
|
||||
const value = parsers.parsePropertyValue(property, val, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
const parsedValue = parsers.resolveBorderShorthandValue(value, subProps, parsedValues);
|
||||
if (typeof parsedValue === "string") {
|
||||
return parsedValue;
|
||||
} else if (Array.isArray(parsedValue)) {
|
||||
const [key, resolvedVal] = parsedValue;
|
||||
parsedValues.set(key, resolvedVal);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (parsedValues.size) {
|
||||
const keys = module.exports.shorthandFor.keys();
|
||||
const obj = {
|
||||
[borderBottomWidth.property]: "medium"
|
||||
};
|
||||
for (const key of keys) {
|
||||
if (parsedValues.has(key)) {
|
||||
const parsedValue = parsedValues.get(key);
|
||||
if (parsedValue !== module.exports.initialValues.get(key)) {
|
||||
obj[key] = parsedValues.get(key);
|
||||
if (obj[borderBottomWidth.property] && obj[borderBottomWidth.property] === "medium") {
|
||||
delete obj[borderBottomWidth.property];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (val || typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
54
server/node_modules/cssstyle/lib/properties/borderBottomColor.js
generated
vendored
Normal file
54
server/node_modules/cssstyle/lib/properties/borderBottomColor.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "border-bottom-color";
|
||||
const lineShorthand = "border-color";
|
||||
const positionShorthand = "border-bottom";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const shorthandPriority = this._priorities.get(shorthand);
|
||||
const linePriority = this._priorities.get(lineShorthand);
|
||||
const positionPriority = this._priorities.get(positionShorthand);
|
||||
const priority =
|
||||
!(shorthandPriority || linePriority || positionPriority) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
54
server/node_modules/cssstyle/lib/properties/borderBottomStyle.js
generated
vendored
Normal file
54
server/node_modules/cssstyle/lib/properties/borderBottomStyle.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "border-bottom-style";
|
||||
const lineShorthand = "border-style";
|
||||
const positionShorthand = "border-bottom";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveKeywordValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const shorthandPriority = this._priorities.get(shorthand);
|
||||
const linePriority = this._priorities.get(lineShorthand);
|
||||
const positionPriority = this._priorities.get(positionShorthand);
|
||||
const priority =
|
||||
!(shorthandPriority || linePriority || positionPriority) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
57
server/node_modules/cssstyle/lib/properties/borderBottomWidth.js
generated
vendored
Normal file
57
server/node_modules/cssstyle/lib/properties/borderBottomWidth.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "border-bottom-width";
|
||||
const lineShorthand = "border-width";
|
||||
const positionShorthand = "border-bottom";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
min: 0,
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const shorthandPriority = this._priorities.get(shorthand);
|
||||
const linePriority = this._priorities.get(lineShorthand);
|
||||
const positionPriority = this._priorities.get(positionShorthand);
|
||||
const priority =
|
||||
!(shorthandPriority || linePriority || positionPriority) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/borderCollapse.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/borderCollapse.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "border-collapse";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveKeywordValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
110
server/node_modules/cssstyle/lib/properties/borderColor.js
generated
vendored
Normal file
110
server/node_modules/cssstyle/lib/properties/borderColor.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
const borderTopColor = require("./borderTopColor");
|
||||
const borderRightColor = require("./borderRightColor");
|
||||
const borderBottomColor = require("./borderBottomColor");
|
||||
const borderLeftColor = require("./borderLeftColor");
|
||||
|
||||
const property = "border-color";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.shorthandFor = new Map([
|
||||
[borderTopColor.property, borderTopColor],
|
||||
[borderRightColor.property, borderRightColor],
|
||||
[borderBottomColor.property, borderBottomColor],
|
||||
[borderLeftColor.property, borderLeftColor]
|
||||
]);
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
const parsedValues = [];
|
||||
if (Array.isArray(values) && values.length) {
|
||||
if (values.length > 4) {
|
||||
return;
|
||||
}
|
||||
for (const value of values) {
|
||||
const parsedValue = parsers.resolveColorValue([value], {
|
||||
length: values.length
|
||||
});
|
||||
if (!parsedValue) {
|
||||
return;
|
||||
}
|
||||
parsedValues.push(parsedValue);
|
||||
}
|
||||
} else if (typeof values === "string") {
|
||||
parsedValues.push(values);
|
||||
}
|
||||
if (parsedValues.length) {
|
||||
switch (parsedValues.length) {
|
||||
case 1: {
|
||||
return parsedValues;
|
||||
}
|
||||
case 2: {
|
||||
const [val1, val2] = parsedValues;
|
||||
if (val1 === val2) {
|
||||
return [val1];
|
||||
}
|
||||
return parsedValues;
|
||||
}
|
||||
case 3: {
|
||||
const [val1, val2, val3] = parsedValues;
|
||||
if (val1 === val3) {
|
||||
if (val1 === val2) {
|
||||
return [val1];
|
||||
}
|
||||
return [val1, val2];
|
||||
}
|
||||
return parsedValues;
|
||||
}
|
||||
case 4: {
|
||||
const [val1, val2, val3, val4] = parsedValues;
|
||||
if (val2 === val4) {
|
||||
if (val1 === val3) {
|
||||
if (val1 === val2) {
|
||||
return [val1];
|
||||
}
|
||||
return [val1, val2];
|
||||
}
|
||||
return [val1, val2, val3];
|
||||
}
|
||||
return parsedValues;
|
||||
}
|
||||
default:
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (Array.isArray(val) || typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
100
server/node_modules/cssstyle/lib/properties/borderLeft.js
generated
vendored
Normal file
100
server/node_modules/cssstyle/lib/properties/borderLeft.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
const borderLeftWidth = require("./borderLeftWidth");
|
||||
const borderLeftStyle = require("./borderLeftStyle");
|
||||
const borderLeftColor = require("./borderLeftColor");
|
||||
|
||||
const property = "border-left";
|
||||
const shorthand = "border";
|
||||
|
||||
const subProps = {
|
||||
width: borderLeftWidth.property,
|
||||
style: borderLeftStyle.property,
|
||||
color: borderLeftColor.property
|
||||
};
|
||||
|
||||
module.exports.initialValues = new Map([
|
||||
[borderLeftWidth.property, "medium"],
|
||||
[borderLeftStyle.property, "none"],
|
||||
[borderLeftColor.property, "currentcolor"]
|
||||
]);
|
||||
|
||||
module.exports.shorthandFor = new Map([
|
||||
[borderLeftWidth.property, borderLeftWidth],
|
||||
[borderLeftStyle.property, borderLeftStyle],
|
||||
[borderLeftColor.property, borderLeftColor]
|
||||
]);
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.splitValue(v);
|
||||
const parsedValues = new Map();
|
||||
for (const val of values) {
|
||||
const value = parsers.parsePropertyValue(property, val, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
const parsedValue = parsers.resolveBorderShorthandValue(value, subProps, parsedValues);
|
||||
if (typeof parsedValue === "string") {
|
||||
return parsedValue;
|
||||
} else if (Array.isArray(parsedValue)) {
|
||||
const [key, resolvedVal] = parsedValue;
|
||||
parsedValues.set(key, resolvedVal);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (parsedValues.size) {
|
||||
const keys = module.exports.shorthandFor.keys();
|
||||
const obj = {
|
||||
[borderLeftWidth.property]: "medium"
|
||||
};
|
||||
for (const key of keys) {
|
||||
if (parsedValues.has(key)) {
|
||||
const parsedValue = parsedValues.get(key);
|
||||
if (parsedValue !== module.exports.initialValues.get(key)) {
|
||||
obj[key] = parsedValues.get(key);
|
||||
if (obj[borderLeftWidth.property] && obj[borderLeftWidth.property] === "medium") {
|
||||
delete obj[borderLeftWidth.property];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (val || typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
54
server/node_modules/cssstyle/lib/properties/borderLeftColor.js
generated
vendored
Normal file
54
server/node_modules/cssstyle/lib/properties/borderLeftColor.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "border-left-color";
|
||||
const lineShorthand = "border-color";
|
||||
const positionShorthand = "border-left";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const shorthandPriority = this._priorities.get(shorthand);
|
||||
const linePriority = this._priorities.get(lineShorthand);
|
||||
const positionPriority = this._priorities.get(positionShorthand);
|
||||
const priority =
|
||||
!(shorthandPriority || linePriority || positionPriority) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
54
server/node_modules/cssstyle/lib/properties/borderLeftStyle.js
generated
vendored
Normal file
54
server/node_modules/cssstyle/lib/properties/borderLeftStyle.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "border-left-style";
|
||||
const lineShorthand = "border-style";
|
||||
const positionShorthand = "border-left";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveKeywordValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const shorthandPriority = this._priorities.get(shorthand);
|
||||
const linePriority = this._priorities.get(lineShorthand);
|
||||
const positionPriority = this._priorities.get(positionShorthand);
|
||||
const priority =
|
||||
!(shorthandPriority || linePriority || positionPriority) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
57
server/node_modules/cssstyle/lib/properties/borderLeftWidth.js
generated
vendored
Normal file
57
server/node_modules/cssstyle/lib/properties/borderLeftWidth.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "border-left-width";
|
||||
const lineShorthand = "border-width";
|
||||
const positionShorthand = "border-left";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
min: 0,
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const shorthandPriority = this._priorities.get(shorthand);
|
||||
const linePriority = this._priorities.get(lineShorthand);
|
||||
const positionPriority = this._priorities.get(positionShorthand);
|
||||
const priority =
|
||||
!(shorthandPriority || linePriority || positionPriority) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
100
server/node_modules/cssstyle/lib/properties/borderRight.js
generated
vendored
Normal file
100
server/node_modules/cssstyle/lib/properties/borderRight.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
const borderRightWidth = require("./borderRightWidth");
|
||||
const borderRightStyle = require("./borderRightStyle");
|
||||
const borderRightColor = require("./borderRightColor");
|
||||
|
||||
const property = "border-right";
|
||||
const shorthand = "border";
|
||||
|
||||
const subProps = {
|
||||
width: borderRightWidth.property,
|
||||
style: borderRightStyle.property,
|
||||
color: borderRightColor.property
|
||||
};
|
||||
|
||||
module.exports.initialValues = new Map([
|
||||
[borderRightWidth.property, "medium"],
|
||||
[borderRightStyle.property, "none"],
|
||||
[borderRightColor.property, "currentcolor"]
|
||||
]);
|
||||
|
||||
module.exports.shorthandFor = new Map([
|
||||
[borderRightWidth.property, borderRightWidth],
|
||||
[borderRightStyle.property, borderRightStyle],
|
||||
[borderRightColor.property, borderRightColor]
|
||||
]);
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.splitValue(v);
|
||||
const parsedValues = new Map();
|
||||
for (const val of values) {
|
||||
const value = parsers.parsePropertyValue(property, val, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
const parsedValue = parsers.resolveBorderShorthandValue(value, subProps, parsedValues);
|
||||
if (typeof parsedValue === "string") {
|
||||
return parsedValue;
|
||||
} else if (Array.isArray(parsedValue)) {
|
||||
const [key, resolvedVal] = parsedValue;
|
||||
parsedValues.set(key, resolvedVal);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (parsedValues.size) {
|
||||
const keys = module.exports.shorthandFor.keys();
|
||||
const obj = {
|
||||
[borderRightWidth.property]: "medium"
|
||||
};
|
||||
for (const key of keys) {
|
||||
if (parsedValues.has(key)) {
|
||||
const parsedValue = parsedValues.get(key);
|
||||
if (parsedValue !== module.exports.initialValues.get(key)) {
|
||||
obj[key] = parsedValues.get(key);
|
||||
if (obj[borderRightWidth.property] && obj[borderRightWidth.property] === "medium") {
|
||||
delete obj[borderRightWidth.property];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (val || typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
54
server/node_modules/cssstyle/lib/properties/borderRightColor.js
generated
vendored
Normal file
54
server/node_modules/cssstyle/lib/properties/borderRightColor.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "border-right-color";
|
||||
const lineShorthand = "border-color";
|
||||
const positionShorthand = "border-right";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const shorthandPriority = this._priorities.get(shorthand);
|
||||
const linePriority = this._priorities.get(lineShorthand);
|
||||
const positionPriority = this._priorities.get(positionShorthand);
|
||||
const priority =
|
||||
!(shorthandPriority || linePriority || positionPriority) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
54
server/node_modules/cssstyle/lib/properties/borderRightStyle.js
generated
vendored
Normal file
54
server/node_modules/cssstyle/lib/properties/borderRightStyle.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "border-right-style";
|
||||
const lineShorthand = "border-style";
|
||||
const positionShorthand = "border-right";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveKeywordValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const shorthandPriority = this._priorities.get(shorthand);
|
||||
const linePriority = this._priorities.get(lineShorthand);
|
||||
const positionPriority = this._priorities.get(positionShorthand);
|
||||
const priority =
|
||||
!(shorthandPriority || linePriority || positionPriority) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
57
server/node_modules/cssstyle/lib/properties/borderRightWidth.js
generated
vendored
Normal file
57
server/node_modules/cssstyle/lib/properties/borderRightWidth.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "border-right-width";
|
||||
const lineShorthand = "border-width";
|
||||
const positionShorthand = "border-right";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
min: 0,
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const shorthandPriority = this._priorities.get(shorthand);
|
||||
const linePriority = this._priorities.get(lineShorthand);
|
||||
const positionPriority = this._priorities.get(positionShorthand);
|
||||
const priority =
|
||||
!(shorthandPriority || linePriority || positionPriority) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
65
server/node_modules/cssstyle/lib/properties/borderSpacing.js
generated
vendored
Normal file
65
server/node_modules/cssstyle/lib/properties/borderSpacing.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "border-spacing";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length) {
|
||||
switch (value.length) {
|
||||
case 1: {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
type: "length"
|
||||
});
|
||||
}
|
||||
case 2: {
|
||||
const [part1, part2] = value;
|
||||
const val1 = parsers.resolveNumericValue([part1], {
|
||||
type: "length"
|
||||
});
|
||||
const val2 = parsers.resolveNumericValue([part2], {
|
||||
type: "length"
|
||||
});
|
||||
if (val1 && val2) {
|
||||
return `${val1} ${val2}`;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
}
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
110
server/node_modules/cssstyle/lib/properties/borderStyle.js
generated
vendored
Normal file
110
server/node_modules/cssstyle/lib/properties/borderStyle.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
const borderTopStyle = require("./borderTopStyle");
|
||||
const borderRightStyle = require("./borderRightStyle");
|
||||
const borderBottomStyle = require("./borderBottomStyle");
|
||||
const borderLeftStyle = require("./borderLeftStyle");
|
||||
|
||||
const property = "border-style";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.shorthandFor = new Map([
|
||||
[borderTopStyle.property, borderTopStyle],
|
||||
[borderRightStyle.property, borderRightStyle],
|
||||
[borderBottomStyle.property, borderBottomStyle],
|
||||
[borderLeftStyle.property, borderLeftStyle]
|
||||
]);
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
const parsedValues = [];
|
||||
if (Array.isArray(values) && values.length) {
|
||||
if (values.length > 4) {
|
||||
return;
|
||||
}
|
||||
for (const value of values) {
|
||||
const parsedValue = parsers.resolveKeywordValue([value], {
|
||||
length: values.length
|
||||
});
|
||||
if (!parsedValue) {
|
||||
return;
|
||||
}
|
||||
parsedValues.push(parsedValue);
|
||||
}
|
||||
} else if (typeof values === "string") {
|
||||
parsedValues.push(values);
|
||||
}
|
||||
if (parsedValues.length) {
|
||||
switch (parsedValues.length) {
|
||||
case 1: {
|
||||
return parsedValues;
|
||||
}
|
||||
case 2: {
|
||||
const [val1, val2] = parsedValues;
|
||||
if (val1 === val2) {
|
||||
return [val1];
|
||||
}
|
||||
return parsedValues;
|
||||
}
|
||||
case 3: {
|
||||
const [val1, val2, val3] = parsedValues;
|
||||
if (val1 === val3) {
|
||||
if (val1 === val2) {
|
||||
return [val1];
|
||||
}
|
||||
return [val1, val2];
|
||||
}
|
||||
return parsedValues;
|
||||
}
|
||||
case 4: {
|
||||
const [val1, val2, val3, val4] = parsedValues;
|
||||
if (val2 === val4) {
|
||||
if (val1 === val3) {
|
||||
if (val1 === val2) {
|
||||
return [val1];
|
||||
}
|
||||
return [val1, val2];
|
||||
}
|
||||
return [val1, val2, val3];
|
||||
}
|
||||
return parsedValues;
|
||||
}
|
||||
default:
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (Array.isArray(val) || typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
100
server/node_modules/cssstyle/lib/properties/borderTop.js
generated
vendored
Normal file
100
server/node_modules/cssstyle/lib/properties/borderTop.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
const borderTopWidth = require("./borderTopWidth");
|
||||
const borderTopStyle = require("./borderTopStyle");
|
||||
const borderTopColor = require("./borderTopColor");
|
||||
|
||||
const property = "border-top";
|
||||
const shorthand = "border";
|
||||
|
||||
const subProps = {
|
||||
width: borderTopWidth.property,
|
||||
style: borderTopStyle.property,
|
||||
color: borderTopColor.property
|
||||
};
|
||||
|
||||
module.exports.initialValues = new Map([
|
||||
[borderTopWidth.property, "medium"],
|
||||
[borderTopStyle.property, "none"],
|
||||
[borderTopColor.property, "currentcolor"]
|
||||
]);
|
||||
|
||||
module.exports.shorthandFor = new Map([
|
||||
[borderTopWidth.property, borderTopWidth],
|
||||
[borderTopStyle.property, borderTopStyle],
|
||||
[borderTopColor.property, borderTopColor]
|
||||
]);
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.splitValue(v);
|
||||
const parsedValues = new Map();
|
||||
for (const val of values) {
|
||||
const value = parsers.parsePropertyValue(property, val, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
const parsedValue = parsers.resolveBorderShorthandValue(value, subProps, parsedValues);
|
||||
if (typeof parsedValue === "string") {
|
||||
return parsedValue;
|
||||
} else if (Array.isArray(parsedValue)) {
|
||||
const [key, resolvedVal] = parsedValue;
|
||||
parsedValues.set(key, resolvedVal);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (parsedValues.size) {
|
||||
const keys = module.exports.shorthandFor.keys();
|
||||
const obj = {
|
||||
[borderTopWidth.property]: "medium"
|
||||
};
|
||||
for (const key of keys) {
|
||||
if (parsedValues.has(key)) {
|
||||
const parsedValue = parsedValues.get(key);
|
||||
if (parsedValue !== module.exports.initialValues.get(key)) {
|
||||
obj[key] = parsedValues.get(key);
|
||||
if (obj[borderTopWidth.property] && obj[borderTopWidth.property] === "medium") {
|
||||
delete obj[borderTopWidth.property];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (val || typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
54
server/node_modules/cssstyle/lib/properties/borderTopColor.js
generated
vendored
Normal file
54
server/node_modules/cssstyle/lib/properties/borderTopColor.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "border-top-color";
|
||||
const lineShorthand = "border-color";
|
||||
const positionShorthand = "border-top";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const shorthandPriority = this._priorities.get(shorthand);
|
||||
const linePriority = this._priorities.get(lineShorthand);
|
||||
const positionPriority = this._priorities.get(positionShorthand);
|
||||
const priority =
|
||||
!(shorthandPriority || linePriority || positionPriority) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
54
server/node_modules/cssstyle/lib/properties/borderTopStyle.js
generated
vendored
Normal file
54
server/node_modules/cssstyle/lib/properties/borderTopStyle.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "border-top-style";
|
||||
const lineShorthand = "border-style";
|
||||
const positionShorthand = "border-top";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveKeywordValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const shorthandPriority = this._priorities.get(shorthand);
|
||||
const linePriority = this._priorities.get(lineShorthand);
|
||||
const positionPriority = this._priorities.get(positionShorthand);
|
||||
const priority =
|
||||
!(shorthandPriority || linePriority || positionPriority) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
57
server/node_modules/cssstyle/lib/properties/borderTopWidth.js
generated
vendored
Normal file
57
server/node_modules/cssstyle/lib/properties/borderTopWidth.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "border-top-width";
|
||||
const lineShorthand = "border-width";
|
||||
const positionShorthand = "border-top";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
min: 0,
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const shorthandPriority = this._priorities.get(shorthand);
|
||||
const linePriority = this._priorities.get(lineShorthand);
|
||||
const positionPriority = this._priorities.get(positionShorthand);
|
||||
const priority =
|
||||
!(shorthandPriority || linePriority || positionPriority) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
111
server/node_modules/cssstyle/lib/properties/borderWidth.js
generated
vendored
Normal file
111
server/node_modules/cssstyle/lib/properties/borderWidth.js
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
const borderTopWidth = require("./borderTopWidth");
|
||||
const borderRightWidth = require("./borderRightWidth");
|
||||
const borderBottomWidth = require("./borderBottomWidth");
|
||||
const borderLeftWidth = require("./borderLeftWidth");
|
||||
|
||||
const property = "border-width";
|
||||
const shorthand = "border";
|
||||
|
||||
module.exports.shorthandFor = new Map([
|
||||
[borderTopWidth.property, borderTopWidth],
|
||||
[borderRightWidth.property, borderRightWidth],
|
||||
[borderBottomWidth.property, borderBottomWidth],
|
||||
[borderLeftWidth.property, borderLeftWidth]
|
||||
]);
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
const parsedValues = [];
|
||||
if (Array.isArray(values) && values.length) {
|
||||
if (values.length > 4) {
|
||||
return;
|
||||
}
|
||||
for (const value of values) {
|
||||
const parsedValue = parsers.resolveNumericValue([value], {
|
||||
length: values.length,
|
||||
type: "length"
|
||||
});
|
||||
if (!parsedValue) {
|
||||
return;
|
||||
}
|
||||
parsedValues.push(parsedValue);
|
||||
}
|
||||
} else if (typeof values === "string") {
|
||||
parsedValues.push(values);
|
||||
}
|
||||
if (parsedValues.length) {
|
||||
switch (parsedValues.length) {
|
||||
case 1: {
|
||||
return parsedValues;
|
||||
}
|
||||
case 2: {
|
||||
const [val1, val2] = parsedValues;
|
||||
if (val1 === val2) {
|
||||
return [val1];
|
||||
}
|
||||
return parsedValues;
|
||||
}
|
||||
case 3: {
|
||||
const [val1, val2, val3] = parsedValues;
|
||||
if (val1 === val3) {
|
||||
if (val1 === val2) {
|
||||
return [val1];
|
||||
}
|
||||
return [val1, val2];
|
||||
}
|
||||
return parsedValues;
|
||||
}
|
||||
case 4: {
|
||||
const [val1, val2, val3, val4] = parsedValues;
|
||||
if (val2 === val4) {
|
||||
if (val1 === val3) {
|
||||
if (val1 === val2) {
|
||||
return [val1];
|
||||
}
|
||||
return [val1, val2];
|
||||
}
|
||||
return [val1, val2, val3];
|
||||
}
|
||||
return parsedValues;
|
||||
}
|
||||
default:
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._borderSetter(property, v, "");
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (Array.isArray(val) || typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._borderSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
47
server/node_modules/cssstyle/lib/properties/bottom.js
generated
vendored
Normal file
47
server/node_modules/cssstyle/lib/properties/bottom.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "bottom";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/clear.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/clear.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "clear";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveKeywordValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
73
server/node_modules/cssstyle/lib/properties/clip.js
generated
vendored
Normal file
73
server/node_modules/cssstyle/lib/properties/clip.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
// deprecated
|
||||
// @see https://drafts.csswg.org/css-masking-1/#clip-property
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "clip";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const { AST_TYPES } = parsers;
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
const [{ name, type, value: itemValue }] = value;
|
||||
switch (type) {
|
||||
case AST_TYPES.FUNCTION: {
|
||||
const values = parsers.splitValue(itemValue, {
|
||||
delimiter: ","
|
||||
});
|
||||
const parsedValues = [];
|
||||
for (const item of values) {
|
||||
const parsedValue = parsers.parseCSS(item, { context: "value" }, true);
|
||||
const val = parsers.resolveNumericValue(parsedValue.children, {
|
||||
type: "length"
|
||||
});
|
||||
if (val) {
|
||||
parsedValues.push(val);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
return `${name}(${parsedValues.join(", ")})`;
|
||||
}
|
||||
case AST_TYPES.GLOBAL_KEYWORD:
|
||||
case AST_TYPES.IDENTIFIER: {
|
||||
return name;
|
||||
}
|
||||
default:
|
||||
}
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/color.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/color.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "color";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
210
server/node_modules/cssstyle/lib/properties/display.js
generated
vendored
Normal file
210
server/node_modules/cssstyle/lib/properties/display.js
generated
vendored
Normal file
@@ -0,0 +1,210 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "display";
|
||||
|
||||
/* keywords */
|
||||
const displayOutside = ["block", "inline", "run-in"];
|
||||
const displayFlow = ["flow", "flow-root"];
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const { AST_TYPES } = parsers;
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length) {
|
||||
switch (value.length) {
|
||||
case 1: {
|
||||
const [{ name, type }] = value;
|
||||
switch (type) {
|
||||
case AST_TYPES.GLOBAL_KEYWORD: {
|
||||
return name;
|
||||
}
|
||||
case AST_TYPES.IDENTIFIER: {
|
||||
if (name === "flow") {
|
||||
return "block";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
default:
|
||||
}
|
||||
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) {
|
||||
let outerValue = "";
|
||||
let innerValue = "";
|
||||
if (val1 === "list-item") {
|
||||
outerValue = val2;
|
||||
innerValue = val1;
|
||||
} else if (val2 === "list-item") {
|
||||
outerValue = val1;
|
||||
innerValue = val2;
|
||||
} else if (displayOutside.includes(val1)) {
|
||||
outerValue = val1;
|
||||
innerValue = val2;
|
||||
} else if (displayOutside.includes(val2)) {
|
||||
outerValue = val2;
|
||||
innerValue = val1;
|
||||
}
|
||||
if (innerValue === "list-item") {
|
||||
switch (outerValue) {
|
||||
case "block":
|
||||
case "flow": {
|
||||
return innerValue;
|
||||
}
|
||||
case "flow-root":
|
||||
case "inline":
|
||||
case "run-in": {
|
||||
return `${outerValue} ${innerValue}`;
|
||||
}
|
||||
default:
|
||||
}
|
||||
} else if (outerValue === "block") {
|
||||
switch (innerValue) {
|
||||
case "flow": {
|
||||
return outerValue;
|
||||
}
|
||||
case "flow-root":
|
||||
case "flex":
|
||||
case "grid":
|
||||
case "table": {
|
||||
return innerValue;
|
||||
}
|
||||
case "ruby": {
|
||||
return `${outerValue} ${innerValue}`;
|
||||
}
|
||||
default:
|
||||
}
|
||||
} else if (outerValue === "inline") {
|
||||
switch (innerValue) {
|
||||
case "flow": {
|
||||
return outerValue;
|
||||
}
|
||||
case "flow-root": {
|
||||
return `${outerValue}-block`;
|
||||
}
|
||||
case "flex":
|
||||
case "grid":
|
||||
case "table": {
|
||||
return `${outerValue}-${innerValue}`;
|
||||
}
|
||||
case "ruby": {
|
||||
return innerValue;
|
||||
}
|
||||
default:
|
||||
}
|
||||
} else if (outerValue === "run-in") {
|
||||
switch (innerValue) {
|
||||
case "flow": {
|
||||
return outerValue;
|
||||
}
|
||||
case "flow-root":
|
||||
case "flex":
|
||||
case "grid":
|
||||
case "table":
|
||||
case "ruby": {
|
||||
return `${outerValue} ${innerValue}`;
|
||||
}
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
const [part1, part2, part3] = value;
|
||||
const val1 = part1.type === AST_TYPES.IDENTIFIER && part1.name;
|
||||
const val2 = part2.type === AST_TYPES.IDENTIFIER && part2.name;
|
||||
const val3 = part3.type === AST_TYPES.IDENTIFIER && part3.name;
|
||||
if (val1 && val2 && part3) {
|
||||
let outerValue = "";
|
||||
let flowValue = "";
|
||||
let listItemValue = "";
|
||||
if (val1 === "list-item") {
|
||||
listItemValue = val1;
|
||||
if (displayFlow.includes(val2)) {
|
||||
flowValue = val2;
|
||||
outerValue = val3;
|
||||
} else if (displayFlow.includes(val3)) {
|
||||
flowValue = val3;
|
||||
outerValue = val2;
|
||||
}
|
||||
} else if (val2 === "list-item") {
|
||||
listItemValue = val2;
|
||||
if (displayFlow.includes(val1)) {
|
||||
flowValue = val1;
|
||||
outerValue = val3;
|
||||
} else if (displayFlow.includes(val3)) {
|
||||
flowValue = val3;
|
||||
outerValue = val1;
|
||||
}
|
||||
} else if (val3 === "list-item") {
|
||||
listItemValue = val3;
|
||||
if (displayFlow.includes(val1)) {
|
||||
flowValue = val1;
|
||||
outerValue = val2;
|
||||
} else if (displayFlow.includes(val2)) {
|
||||
flowValue = val2;
|
||||
outerValue = val1;
|
||||
}
|
||||
}
|
||||
if (outerValue && flowValue && listItemValue) {
|
||||
switch (outerValue) {
|
||||
case "block": {
|
||||
if (flowValue === "flow") {
|
||||
return listItemValue;
|
||||
}
|
||||
return `${flowValue} ${listItemValue}`;
|
||||
}
|
||||
case "inline":
|
||||
case "run-in": {
|
||||
if (flowValue === "flow") {
|
||||
return `${outerValue} ${listItemValue}`;
|
||||
}
|
||||
return `${outerValue} ${flowValue} ${listItemValue}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
}
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
178
server/node_modules/cssstyle/lib/properties/flex.js
generated
vendored
Normal file
178
server/node_modules/cssstyle/lib/properties/flex.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
const flexGrow = require("./flexGrow");
|
||||
const flexShrink = require("./flexShrink");
|
||||
const flexBasis = require("./flexBasis");
|
||||
|
||||
const property = "flex";
|
||||
|
||||
module.exports.initialValues = new Map([
|
||||
[flexGrow.property, "0"],
|
||||
[flexShrink.property, "1"],
|
||||
[flexBasis.property, "auto"]
|
||||
]);
|
||||
|
||||
module.exports.shorthandFor = new Map([
|
||||
[flexGrow.property, flexGrow],
|
||||
[flexShrink.property, flexShrink],
|
||||
[flexBasis.property, flexBasis]
|
||||
]);
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const { AST_TYPES } = parsers;
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length) {
|
||||
const flex = {
|
||||
[flexGrow.property]: "1",
|
||||
[flexShrink.property]: "1",
|
||||
[flexBasis.property]: "0%"
|
||||
};
|
||||
if (value.length === 1) {
|
||||
const [{ isNumber, name, type, unit, value: itemValue }] = value;
|
||||
switch (type) {
|
||||
case AST_TYPES.CALC: {
|
||||
if (isNumber) {
|
||||
flex[flexGrow.property] = `${name}(${itemValue})`;
|
||||
return flex;
|
||||
}
|
||||
flex[flexBasis.property] = `${name}(${itemValue})`;
|
||||
return flex;
|
||||
}
|
||||
case AST_TYPES.DIMENSION: {
|
||||
flex[flexBasis.property] = `${itemValue}${unit}`;
|
||||
return flex;
|
||||
}
|
||||
case AST_TYPES.GLOBAL_KEYWORD: {
|
||||
return name;
|
||||
}
|
||||
case AST_TYPES.IDENTIFIER: {
|
||||
if (name === "none") {
|
||||
return {
|
||||
[flexGrow.property]: "0",
|
||||
[flexShrink.property]: "0",
|
||||
[flexBasis.property]: "auto"
|
||||
};
|
||||
}
|
||||
flex[flexBasis.property] = name;
|
||||
return flex;
|
||||
}
|
||||
case AST_TYPES.NUMBER: {
|
||||
flex[flexGrow.property] = itemValue;
|
||||
return flex;
|
||||
}
|
||||
case AST_TYPES.PERCENTAGE: {
|
||||
flex[flexBasis.property] = `${itemValue}%`;
|
||||
return flex;
|
||||
}
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
const [val1, val2, val3] = value;
|
||||
if (val1.type === AST_TYPES.CALC && val1.isNumber) {
|
||||
flex[flexGrow.property] = `${val1.name}(${val1.value})`;
|
||||
} else if (val1.type === AST_TYPES.NUMBER) {
|
||||
flex[flexGrow.property] = val1.value;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (val3) {
|
||||
if (val2.type === AST_TYPES.CALC && val2.isNumber) {
|
||||
flex[flexShrink.property] = `${val2.name}(${val2.value})`;
|
||||
} else if (val2.type === AST_TYPES.NUMBER) {
|
||||
flex[flexShrink.property] = val2.value;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (val3.type === AST_TYPES.GLOBAL_KEYWORD || val3.type === AST_TYPES.IDENTIFIER) {
|
||||
flex[flexBasis.property] = val3.name;
|
||||
} else if (val3.type === AST_TYPES.CALC && !val3.isNumber) {
|
||||
flex[flexBasis.property] = `${val3.name}(${val3.value})`;
|
||||
} else if (val3.type === AST_TYPES.DIMENSION) {
|
||||
flex[flexBasis.property] = `${val3.value}${val3.unit}`;
|
||||
} else if (val3.type === AST_TYPES.PERCENTAGE) {
|
||||
flex[flexBasis.property] = `${val3.value}%`;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
switch (val2.type) {
|
||||
case AST_TYPES.CALC: {
|
||||
if (val2.isNumber) {
|
||||
flex[flexShrink.property] = `${val2.name}(${val2.value})`;
|
||||
} else {
|
||||
flex[flexBasis.property] = `${val2.name}(${val2.value})`;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AST_TYPES.DIMENSION: {
|
||||
flex[flexBasis.property] = `${val2.value}${val2.unit}`;
|
||||
break;
|
||||
}
|
||||
case AST_TYPES.NUMBER: {
|
||||
flex[flexShrink.property] = val2.value;
|
||||
break;
|
||||
}
|
||||
case AST_TYPES.PERCENTAGE: {
|
||||
flex[flexBasis.property] = `${val2.value}%`;
|
||||
break;
|
||||
}
|
||||
case AST_TYPES.IDENTIFIER: {
|
||||
flex[flexBasis.property] = val2.name;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flex;
|
||||
}
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
for (const [longhand] of module.exports.shorthandFor) {
|
||||
this._setProperty(longhand, "");
|
||||
}
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
if (typeof val === "string") {
|
||||
for (const [longhand] of module.exports.shorthandFor) {
|
||||
this._setProperty(longhand, val, priority);
|
||||
}
|
||||
this._setProperty(property, val, priority);
|
||||
} else if (val) {
|
||||
const values = [];
|
||||
for (const [longhand, value] of Object.entries(val)) {
|
||||
values.push(value);
|
||||
this._setProperty(longhand, value, priority);
|
||||
}
|
||||
this._setProperty(property, values.join(" "), priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
52
server/node_modules/cssstyle/lib/properties/flexBasis.js
generated
vendored
Normal file
52
server/node_modules/cssstyle/lib/properties/flexBasis.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "flex-basis";
|
||||
const shorthand = "flex";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._flexBoxSetter(property, val, priority, shorthand);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
52
server/node_modules/cssstyle/lib/properties/flexGrow.js
generated
vendored
Normal file
52
server/node_modules/cssstyle/lib/properties/flexGrow.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "flex-grow";
|
||||
const shorthand = "flex";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue("flex-grow", v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
min: 0
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._flexBoxSetter(property, val, priority, shorthand);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
52
server/node_modules/cssstyle/lib/properties/flexShrink.js
generated
vendored
Normal file
52
server/node_modules/cssstyle/lib/properties/flexShrink.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "flex-shrink";
|
||||
const shorthand = "flex";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
min: 0
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._flexBoxSetter(property, val, priority, shorthand);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/float.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/float.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "float";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveKeywordValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/floodColor.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/floodColor.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "flood-color";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
302
server/node_modules/cssstyle/lib/properties/font.js
generated
vendored
Normal file
302
server/node_modules/cssstyle/lib/properties/font.js
generated
vendored
Normal file
@@ -0,0 +1,302 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
const fontStyle = require("./fontStyle");
|
||||
const fontVariant = require("./fontVariant");
|
||||
const fontWeight = require("./fontWeight");
|
||||
const fontSize = require("./fontSize");
|
||||
const lineHeight = require("./lineHeight");
|
||||
const fontFamily = require("./fontFamily");
|
||||
|
||||
const property = "font";
|
||||
|
||||
module.exports.shorthandFor = new Map([
|
||||
[fontStyle.property, fontStyle],
|
||||
[fontVariant.property, fontVariant],
|
||||
[fontWeight.property, fontWeight],
|
||||
[fontSize.property, fontSize],
|
||||
[lineHeight.property, lineHeight],
|
||||
[fontFamily.property, fontFamily]
|
||||
]);
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
} else if (parsers.hasCalcFunc(v)) {
|
||||
v = parsers.resolveCalc(v);
|
||||
}
|
||||
if (!parsers.isValidPropertyValue(property, v)) {
|
||||
return;
|
||||
}
|
||||
const { AST_TYPES } = parsers;
|
||||
const [fontBlock, ...families] = parsers.splitValue(v, {
|
||||
delimiter: ","
|
||||
});
|
||||
const [fontBlockA, fontBlockB] = parsers.splitValue(fontBlock, {
|
||||
delimiter: "/"
|
||||
});
|
||||
const font = {
|
||||
[fontStyle.property]: "normal",
|
||||
[fontVariant.property]: "normal",
|
||||
[fontWeight.property]: "normal"
|
||||
};
|
||||
const fontFamilies = new Set();
|
||||
if (fontBlockB) {
|
||||
const [lineB, ...familiesB] = fontBlockB.trim().split(" ");
|
||||
if (!lineB || !familiesB.length) {
|
||||
return;
|
||||
}
|
||||
const lineHeightB = lineHeight.parse(lineB, {
|
||||
global
|
||||
});
|
||||
if (typeof lineHeightB !== "string") {
|
||||
return;
|
||||
}
|
||||
const familyB = fontFamily.parse(familiesB.join(" "), {
|
||||
globalObject,
|
||||
caseSensitive: true
|
||||
});
|
||||
if (typeof familyB === "string") {
|
||||
fontFamilies.add(familyB);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
const parts = parsers.splitValue(fontBlockA.trim());
|
||||
const properties = [
|
||||
fontStyle.property,
|
||||
fontVariant.property,
|
||||
fontWeight.property,
|
||||
fontSize.property
|
||||
];
|
||||
for (const part of parts) {
|
||||
if (part === "normal") {
|
||||
continue;
|
||||
} else {
|
||||
for (const longhand of properties) {
|
||||
switch (longhand) {
|
||||
case fontSize.property: {
|
||||
const parsedValue = fontSize.parse(part, {
|
||||
globalObject
|
||||
});
|
||||
if (typeof parsedValue === "string") {
|
||||
font[longhand] = parsedValue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case fontStyle.property:
|
||||
case fontWeight.property: {
|
||||
if (font[longhand] === "normal") {
|
||||
const longhandItem = module.exports.shorthandFor.get(longhand);
|
||||
const parsedValue = longhandItem.parse(part, {
|
||||
globalObject
|
||||
});
|
||||
if (typeof parsedValue === "string") {
|
||||
font[longhand] = parsedValue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case fontVariant.property: {
|
||||
if (font[longhand] === "normal") {
|
||||
const parsedValue = fontVariant.parse(part, {
|
||||
globalObject
|
||||
});
|
||||
if (typeof parsedValue === "string") {
|
||||
if (parsedValue === "small-cap") {
|
||||
font[longhand] = parsedValue;
|
||||
} else if (parsedValue !== "normal") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Object.hasOwn(font, fontSize.property)) {
|
||||
font[lineHeight.property] = lineHeightB;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
const revParts = parsers.splitValue(fontBlockA.trim()).toReversed();
|
||||
if (revParts.length === 1) {
|
||||
const [part] = revParts;
|
||||
const value = parsers.parsePropertyValue(property, part, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
const [{ name, type }] = value;
|
||||
if (type === AST_TYPES.GLOBAL_KEYWORD) {
|
||||
return {
|
||||
[fontStyle.property]: name,
|
||||
[fontVariant.property]: name,
|
||||
[fontWeight.property]: name,
|
||||
[fontSize.property]: name,
|
||||
[lineHeight.property]: name,
|
||||
[fontFamily.property]: name
|
||||
};
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
const properties = [
|
||||
fontStyle.property,
|
||||
fontVariant.property,
|
||||
fontWeight.property,
|
||||
lineHeight.property
|
||||
];
|
||||
for (const longhand of properties) {
|
||||
font[longhand] = "normal";
|
||||
}
|
||||
const revFontFamily = [];
|
||||
let fontSizeA;
|
||||
for (const part of revParts) {
|
||||
if (fontSizeA) {
|
||||
if (/^normal$/i.test(part)) {
|
||||
continue;
|
||||
} else {
|
||||
for (const longhand of properties) {
|
||||
switch (longhand) {
|
||||
case fontStyle.property:
|
||||
case fontWeight.property:
|
||||
case lineHeight.property: {
|
||||
if (font[longhand] === "normal") {
|
||||
const longhandItem = module.exports.shorthandFor.get(longhand);
|
||||
const parsedValue = longhandItem.parse(part, {
|
||||
globalObject
|
||||
});
|
||||
if (typeof parsedValue === "string") {
|
||||
font[longhand] = parsedValue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case fontVariant.property: {
|
||||
if (font[longhand] === "normal") {
|
||||
const parsedValue = fontVariant.parse(part, {
|
||||
globalObject
|
||||
});
|
||||
if (typeof parsedValue === "string") {
|
||||
if (parsedValue === "small-cap") {
|
||||
font[longhand] = parsedValue;
|
||||
} else if (parsedValue !== "normal") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const parsedFontSize = fontSize.parse(part, {
|
||||
globalObject
|
||||
});
|
||||
if (typeof parsedFontSize === "string") {
|
||||
fontSizeA = parsedFontSize;
|
||||
} else {
|
||||
const parsedFontFamily = fontFamily.parse(part, {
|
||||
globalObject,
|
||||
caseSensitive: true
|
||||
});
|
||||
if (typeof parsedFontFamily === "string") {
|
||||
revFontFamily.push(parsedFontFamily);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const family = fontFamily.parse(revFontFamily.toReversed().join(" "), {
|
||||
globalObject,
|
||||
caseSensitive: true
|
||||
});
|
||||
if (fontSizeA && family) {
|
||||
font[fontSize.property] = fontSizeA;
|
||||
fontFamilies.add(fontFamily.parse(family));
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (const family of families) {
|
||||
const parsedFontFamily = fontFamily.parse(family, {
|
||||
globalObject,
|
||||
caseSensitive: true
|
||||
});
|
||||
if (parsedFontFamily) {
|
||||
fontFamilies.add(parsedFontFamily);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
font[fontFamily.property] = [...fontFamilies].join(", ");
|
||||
return font;
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (v === "" || parsers.hasVarFunc(v)) {
|
||||
for (const [key] of module.exports.shorthandFor) {
|
||||
this._setProperty(key, "");
|
||||
}
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const obj = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
const str = new Set();
|
||||
for (const [key] of module.exports.shorthandFor) {
|
||||
const val = obj[key];
|
||||
if (typeof val === "string") {
|
||||
this._setProperty(key, val, priority);
|
||||
if (val && val !== "normal" && !str.has(val)) {
|
||||
if (key === lineHeight.property) {
|
||||
str.add(`/ ${val}`);
|
||||
} else {
|
||||
str.add(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this._setProperty(property, [...str].join(" "), priority);
|
||||
}
|
||||
},
|
||||
get() {
|
||||
const val = this.getPropertyValue(property);
|
||||
if (parsers.hasVarFunc(val)) {
|
||||
return val;
|
||||
}
|
||||
const str = new Set();
|
||||
for (const [key] of module.exports.shorthandFor) {
|
||||
const v = this.getPropertyValue(key);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
return "";
|
||||
}
|
||||
if (v && v !== "normal" && !str.has(v)) {
|
||||
if (key === lineHeight.property) {
|
||||
str.add(`/ ${v}`);
|
||||
} else {
|
||||
str.add(`${v}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
return [...str].join(" ");
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
98
server/node_modules/cssstyle/lib/properties/fontFamily.js
generated
vendored
Normal file
98
server/node_modules/cssstyle/lib/properties/fontFamily.js
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "font-family";
|
||||
const shorthand = "font";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const { AST_TYPES } = parsers;
|
||||
const values = parsers.splitValue(v, {
|
||||
delimiter: ","
|
||||
});
|
||||
const parsedValues = [];
|
||||
for (const val of values) {
|
||||
const value = parsers.parsePropertyValue(property, val, {
|
||||
globalObject,
|
||||
caseSensitive: true,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length) {
|
||||
if (value.length === 1) {
|
||||
const [{ name, type, value: itemValue }] = value;
|
||||
switch (type) {
|
||||
case AST_TYPES.FUNCTION: {
|
||||
parsedValues.push(`${name}(${itemValue})`);
|
||||
break;
|
||||
}
|
||||
case AST_TYPES.GLOBAL_KEYWORD:
|
||||
case AST_TYPES.IDENTIFIER: {
|
||||
if (name === "undefined") {
|
||||
return;
|
||||
}
|
||||
parsedValues.push(name);
|
||||
break;
|
||||
}
|
||||
case "String": {
|
||||
const parsedValue = itemValue.replaceAll("\\", "").replaceAll('"', '\\"');
|
||||
parsedValues.push(`"${parsedValue}"`);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const parts = [];
|
||||
for (const item of value) {
|
||||
const { name, type } = item;
|
||||
if (type !== AST_TYPES.IDENTIFIER) {
|
||||
return;
|
||||
}
|
||||
parts.push(name);
|
||||
}
|
||||
const parsedValue = parts.join(" ").replaceAll("\\", "").replaceAll('"', '\\"');
|
||||
parsedValues.push(`"${parsedValue}"`);
|
||||
}
|
||||
} else if (typeof value === "string") {
|
||||
parsedValues.push(value);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (parsedValues.length) {
|
||||
return parsedValues.join(", ");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
53
server/node_modules/cssstyle/lib/properties/fontSize.js
generated
vendored
Normal file
53
server/node_modules/cssstyle/lib/properties/fontSize.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "font-size";
|
||||
const shorthand = "font";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
min: 0,
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
69
server/node_modules/cssstyle/lib/properties/fontStyle.js
generated
vendored
Normal file
69
server/node_modules/cssstyle/lib/properties/fontStyle.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "font-style";
|
||||
const shorthand = "font";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const { AST_TYPES } = parsers;
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length) {
|
||||
if (value.length === 1) {
|
||||
const [{ name, type }] = value;
|
||||
switch (type) {
|
||||
case AST_TYPES.GLOBAL_KEYWORD:
|
||||
case AST_TYPES.IDENTIFIER: {
|
||||
return name;
|
||||
}
|
||||
default:
|
||||
}
|
||||
} else if (value.length === 2) {
|
||||
const [part1, part2] = value;
|
||||
const val1 = part1.type === AST_TYPES.IDENTIFIER && part1.name;
|
||||
const val2 = parsers.resolveNumericValue([part2], {
|
||||
type: "angle"
|
||||
});
|
||||
if (val1 && val1 === "oblique" && val2) {
|
||||
return `${val1} ${val2}`;
|
||||
}
|
||||
}
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
66
server/node_modules/cssstyle/lib/properties/fontVariant.js
generated
vendored
Normal file
66
server/node_modules/cssstyle/lib/properties/fontVariant.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "font-variant";
|
||||
const shorthand = "font";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.splitValue(v);
|
||||
const parsedValues = [];
|
||||
for (const val of values) {
|
||||
const value = parsers.parsePropertyValue(property, val, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
const parsedValue = parsers.resolveFunctionValue(value);
|
||||
if (!parsedValue) {
|
||||
return;
|
||||
}
|
||||
parsedValues.push(parsedValue);
|
||||
} else if (typeof value === "string") {
|
||||
parsedValues.push(value);
|
||||
}
|
||||
}
|
||||
if (parsedValues.length) {
|
||||
if (parsedValues.length > 1) {
|
||||
if (parsedValues.includes("normal") || parsedValues.includes("none")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
return parsedValues.join(" ");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
57
server/node_modules/cssstyle/lib/properties/fontWeight.js
generated
vendored
Normal file
57
server/node_modules/cssstyle/lib/properties/fontWeight.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "font-weight";
|
||||
const shorthand = "font";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
const parsedValue = parsers.resolveNumericValue(value, {
|
||||
min: 1,
|
||||
max: 1000
|
||||
});
|
||||
if (!parsedValue) {
|
||||
return;
|
||||
}
|
||||
return parsedValue;
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
48
server/node_modules/cssstyle/lib/properties/height.js
generated
vendored
Normal file
48
server/node_modules/cssstyle/lib/properties/height.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "height";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
min: 0,
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
47
server/node_modules/cssstyle/lib/properties/left.js
generated
vendored
Normal file
47
server/node_modules/cssstyle/lib/properties/left.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "left";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/lightingColor.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/lightingColor.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "lighting-color";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
52
server/node_modules/cssstyle/lib/properties/lineHeight.js
generated
vendored
Normal file
52
server/node_modules/cssstyle/lib/properties/lineHeight.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "line-height";
|
||||
const shorthand = "font";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
min: 0
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
77
server/node_modules/cssstyle/lib/properties/margin.js
generated
vendored
Normal file
77
server/node_modules/cssstyle/lib/properties/margin.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
const marginTop = require("./marginTop");
|
||||
const marginRight = require("./marginRight");
|
||||
const marginBottom = require("./marginBottom");
|
||||
const marginLeft = require("./marginLeft");
|
||||
|
||||
const property = "margin";
|
||||
|
||||
module.exports.position = "edges";
|
||||
|
||||
module.exports.shorthandFor = new Map([
|
||||
[marginTop.property, marginTop],
|
||||
[marginRight.property, marginRight],
|
||||
[marginBottom.property, marginBottom],
|
||||
[marginLeft.property, marginLeft]
|
||||
]);
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
const parsedValues = [];
|
||||
if (Array.isArray(values) && values.length) {
|
||||
if (values.length > 4) {
|
||||
return;
|
||||
}
|
||||
for (const value of values) {
|
||||
const parsedValue = parsers.resolveNumericValue([value], {
|
||||
length: values.length,
|
||||
type: "length"
|
||||
});
|
||||
if (!parsedValue) {
|
||||
return;
|
||||
}
|
||||
parsedValues.push(parsedValue);
|
||||
}
|
||||
} else if (typeof values === "string") {
|
||||
parsedValues.push(values);
|
||||
}
|
||||
if (parsedValues.length) {
|
||||
return parsedValues;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
for (const [longhand] of module.exports.shorthandFor) {
|
||||
this._setProperty(longhand, "");
|
||||
}
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (Array.isArray(val) || typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._positionShorthandSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
54
server/node_modules/cssstyle/lib/properties/marginBottom.js
generated
vendored
Normal file
54
server/node_modules/cssstyle/lib/properties/marginBottom.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "margin-bottom";
|
||||
const shorthand = "margin";
|
||||
|
||||
module.exports.position = "bottom";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._positionLonghandSetter(property, val, priority, shorthand);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
54
server/node_modules/cssstyle/lib/properties/marginLeft.js
generated
vendored
Normal file
54
server/node_modules/cssstyle/lib/properties/marginLeft.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "margin-left";
|
||||
const shorthand = "margin";
|
||||
|
||||
module.exports.position = "left";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._positionLonghandSetter(property, val, priority, shorthand);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
54
server/node_modules/cssstyle/lib/properties/marginRight.js
generated
vendored
Normal file
54
server/node_modules/cssstyle/lib/properties/marginRight.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "margin-right";
|
||||
const shorthand = "margin";
|
||||
|
||||
module.exports.position = "right";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._positionLonghandSetter(property, val, priority, shorthand);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
54
server/node_modules/cssstyle/lib/properties/marginTop.js
generated
vendored
Normal file
54
server/node_modules/cssstyle/lib/properties/marginTop.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "margin-top";
|
||||
const shorthand = "margin";
|
||||
|
||||
module.exports.position = "top";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._positionLonghandSetter(property, val, priority, shorthand);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
47
server/node_modules/cssstyle/lib/properties/opacity.js
generated
vendored
Normal file
47
server/node_modules/cssstyle/lib/properties/opacity.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "opacity";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
clamp: true
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/outlineColor.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/outlineColor.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "outline-color";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
78
server/node_modules/cssstyle/lib/properties/padding.js
generated
vendored
Normal file
78
server/node_modules/cssstyle/lib/properties/padding.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
const paddingTop = require("./paddingTop");
|
||||
const paddingRight = require("./paddingRight");
|
||||
const paddingBottom = require("./paddingBottom");
|
||||
const paddingLeft = require("./paddingLeft");
|
||||
|
||||
const property = "padding";
|
||||
|
||||
module.exports.position = "edges";
|
||||
|
||||
module.exports.shorthandFor = new Map([
|
||||
[paddingTop.property, paddingTop],
|
||||
[paddingRight.property, paddingRight],
|
||||
[paddingBottom.property, paddingBottom],
|
||||
[paddingLeft.property, paddingLeft]
|
||||
]);
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const values = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
const parsedValues = [];
|
||||
if (Array.isArray(values) && values.length) {
|
||||
if (values.length > 4) {
|
||||
return;
|
||||
}
|
||||
for (const value of values) {
|
||||
const parsedValue = parsers.resolveNumericValue([value], {
|
||||
length: values.length,
|
||||
min: 0,
|
||||
type: "length"
|
||||
});
|
||||
if (!parsedValue) {
|
||||
return;
|
||||
}
|
||||
parsedValues.push(parsedValue);
|
||||
}
|
||||
} else if (typeof values === "string") {
|
||||
parsedValues.push(values);
|
||||
}
|
||||
if (parsedValues.length) {
|
||||
return parsedValues;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
for (const [longhand] of module.exports.shorthandFor) {
|
||||
this._setProperty(longhand, "");
|
||||
}
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (Array.isArray(val) || typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._positionShorthandSetter(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
55
server/node_modules/cssstyle/lib/properties/paddingBottom.js
generated
vendored
Normal file
55
server/node_modules/cssstyle/lib/properties/paddingBottom.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "padding-bottom";
|
||||
const shorthand = "padding";
|
||||
|
||||
module.exports.position = "bottom";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
min: 0,
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._positionLonghandSetter(property, val, priority, shorthand);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
55
server/node_modules/cssstyle/lib/properties/paddingLeft.js
generated
vendored
Normal file
55
server/node_modules/cssstyle/lib/properties/paddingLeft.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "padding-left";
|
||||
const shorthand = "padding";
|
||||
|
||||
module.exports.position = "left";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
min: 0,
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._positionLonghandSetter(property, val, priority, shorthand);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
55
server/node_modules/cssstyle/lib/properties/paddingRight.js
generated
vendored
Normal file
55
server/node_modules/cssstyle/lib/properties/paddingRight.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "padding-right";
|
||||
const shorthand = "padding";
|
||||
|
||||
module.exports.position = "right";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
min: 0,
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._positionLonghandSetter(property, val, priority, shorthand);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
55
server/node_modules/cssstyle/lib/properties/paddingTop.js
generated
vendored
Normal file
55
server/node_modules/cssstyle/lib/properties/paddingTop.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "padding-top";
|
||||
const shorthand = "padding";
|
||||
|
||||
module.exports.position = "top";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
min: 0,
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(shorthand, "");
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority =
|
||||
!this._priorities.get(shorthand) && this._priorities.has(property)
|
||||
? this._priorities.get(property)
|
||||
: "";
|
||||
this._positionLonghandSetter(property, val, priority, shorthand);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
47
server/node_modules/cssstyle/lib/properties/right.js
generated
vendored
Normal file
47
server/node_modules/cssstyle/lib/properties/right.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "right";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/stopColor.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/stopColor.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "stop-color";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
47
server/node_modules/cssstyle/lib/properties/top.js
generated
vendored
Normal file
47
server/node_modules/cssstyle/lib/properties/top.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "top";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/webkitBorderAfterColor.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/webkitBorderAfterColor.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "-webkit-border-after-color";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/webkitBorderBeforeColor.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/webkitBorderBeforeColor.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "-webkit-border-before-color";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/webkitBorderEndColor.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/webkitBorderEndColor.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "-webkit-border-end-color";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/webkitBorderStartColor.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/webkitBorderStartColor.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "-webkit-border-start-color";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/webkitColumnRuleColor.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/webkitColumnRuleColor.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "-webkit-column-rule-color";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/webkitTapHighlightColor.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/webkitTapHighlightColor.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "-webkit-tap-highlight-color";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/webkitTextEmphasisColor.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/webkitTextEmphasisColor.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "-webkit-text-emphasis-color";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/webkitTextFillColor.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/webkitTextFillColor.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "-webkit-text-fill-color";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
45
server/node_modules/cssstyle/lib/properties/webkitTextStrokeColor.js
generated
vendored
Normal file
45
server/node_modules/cssstyle/lib/properties/webkitTextStrokeColor.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "-webkit-text-stroke-color";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveColorValue(value);
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
48
server/node_modules/cssstyle/lib/properties/width.js
generated
vendored
Normal file
48
server/node_modules/cssstyle/lib/properties/width.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const property = "width";
|
||||
|
||||
module.exports.parse = (v, opt = {}) => {
|
||||
const { globalObject } = opt;
|
||||
if (v === "") {
|
||||
return v;
|
||||
}
|
||||
const value = parsers.parsePropertyValue(property, v, {
|
||||
globalObject,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(value) && value.length === 1) {
|
||||
return parsers.resolveNumericValue(value, {
|
||||
min: 0,
|
||||
type: "length"
|
||||
});
|
||||
} else if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.definition = {
|
||||
set(v) {
|
||||
v = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(v)) {
|
||||
this._setProperty(property, v);
|
||||
} else {
|
||||
const val = module.exports.parse(v, {
|
||||
globalObject: this._global
|
||||
});
|
||||
if (typeof val === "string") {
|
||||
const priority = this._priorities.get(property) ?? "";
|
||||
this._setProperty(property, val, priority);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
|
||||
module.exports.property = property;
|
||||
155
server/node_modules/cssstyle/lib/utils/allExtraProperties.js
generated
vendored
Normal file
155
server/node_modules/cssstyle/lib/utils/allExtraProperties.js
generated
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* This file contains all implemented properties that are not a part of any
|
||||
* current specifications or drafts, but are handled by browsers nevertheless.
|
||||
*/
|
||||
|
||||
const webkitProperties = [
|
||||
"background-composite",
|
||||
"border-after",
|
||||
"border-after-color",
|
||||
"border-after-style",
|
||||
"border-after-width",
|
||||
"border-before",
|
||||
"border-before-color",
|
||||
"border-before-style",
|
||||
"border-before-width",
|
||||
"border-end",
|
||||
"border-end-color",
|
||||
"border-end-style",
|
||||
"border-end-width",
|
||||
"border-fit",
|
||||
"border-horizontal-spacing",
|
||||
"border-start",
|
||||
"border-start-color",
|
||||
"border-start-style",
|
||||
"border-start-width",
|
||||
"border-vertical-spacing",
|
||||
"color-correction",
|
||||
"column-axis",
|
||||
"column-break-after",
|
||||
"column-break-before",
|
||||
"column-break-inside",
|
||||
"column-rule-color",
|
||||
"flex-align",
|
||||
"flex-item-align",
|
||||
"flex-line-pack",
|
||||
"flex-order",
|
||||
"flex-pack",
|
||||
"flex-wrap",
|
||||
"font-size-delta",
|
||||
"font-smoothing",
|
||||
"highlight",
|
||||
"hyphenate-limit-after",
|
||||
"hyphenate-limit-before",
|
||||
"locale",
|
||||
"logical-height",
|
||||
"logical-width",
|
||||
"margin-after",
|
||||
"margin-after-collapse",
|
||||
"margin-before",
|
||||
"margin-before-collapse",
|
||||
"margin-bottom-collapse",
|
||||
"margin-collapse",
|
||||
"margin-end",
|
||||
"margin-start",
|
||||
"margin-top-collapse",
|
||||
"marquee",
|
||||
"marquee-direction",
|
||||
"marquee-increment",
|
||||
"marquee-repetition",
|
||||
"marquee-speed",
|
||||
"marquee-style",
|
||||
"mask-attachment",
|
||||
"mask-box-image-outset",
|
||||
"mask-box-image-repeat",
|
||||
"mask-box-image-slice",
|
||||
"mask-box-image-source",
|
||||
"mask-box-image-width",
|
||||
"mask-position-x",
|
||||
"mask-position-y",
|
||||
"mask-repeat-x",
|
||||
"mask-repeat-y",
|
||||
"match-nearest-mail-blockquote-color",
|
||||
"max-logical-height",
|
||||
"max-logical-width",
|
||||
"min-logical-height",
|
||||
"min-logical-width",
|
||||
"nbsp-mode",
|
||||
"overflow-scrolling",
|
||||
"padding-after",
|
||||
"padding-before",
|
||||
"padding-end",
|
||||
"padding-start",
|
||||
"perspective-origin-x",
|
||||
"perspective-origin-y",
|
||||
"region-break-after",
|
||||
"region-break-before",
|
||||
"region-break-inside",
|
||||
"region-overflow",
|
||||
"rtl-ordering",
|
||||
"svg-shadow",
|
||||
"tap-highlight-color",
|
||||
"text-decorations-in-effect",
|
||||
"text-emphasis-color",
|
||||
"text-fill-color",
|
||||
"text-security",
|
||||
"text-size-adjust",
|
||||
"text-stroke",
|
||||
"text-stroke-color",
|
||||
"text-stroke-width",
|
||||
"transform",
|
||||
"transform-origin-x",
|
||||
"transform-origin-y",
|
||||
"transform-origin-z",
|
||||
"user-drag",
|
||||
"user-modify",
|
||||
"wrap",
|
||||
"wrap-margin",
|
||||
"wrap-padding",
|
||||
"wrap-shape-inside",
|
||||
"wrap-shape-outside",
|
||||
"zoom"
|
||||
].map((prop) => `-webkit-${prop}`);
|
||||
|
||||
module.exports = new Set([
|
||||
"background-position-x",
|
||||
"background-position-y",
|
||||
"background-repeat-x",
|
||||
"background-repeat-y",
|
||||
"color-interpolation",
|
||||
"color-profile",
|
||||
"color-rendering",
|
||||
"enable-background",
|
||||
"glyph-orientation-horizontal",
|
||||
"kerning",
|
||||
"marker-offset",
|
||||
"marks",
|
||||
"pointer-events",
|
||||
"shape-rendering",
|
||||
"size",
|
||||
"src",
|
||||
"stop-color",
|
||||
"stop-opacity",
|
||||
"text-anchor",
|
||||
"text-line-through",
|
||||
"text-line-through-color",
|
||||
"text-line-through-mode",
|
||||
"text-line-through-style",
|
||||
"text-line-through-width",
|
||||
"text-overline",
|
||||
"text-overline-color",
|
||||
"text-overline-mode",
|
||||
"text-overline-style",
|
||||
"text-overline-width",
|
||||
"text-rendering",
|
||||
"text-underline",
|
||||
"text-underline-color",
|
||||
"text-underline-mode",
|
||||
"text-underline-style",
|
||||
"text-underline-width",
|
||||
"unicode-range",
|
||||
"vector-effect",
|
||||
...webkitProperties
|
||||
]);
|
||||
37
server/node_modules/cssstyle/lib/utils/camelize.js
generated
vendored
Normal file
37
server/node_modules/cssstyle/lib/utils/camelize.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
|
||||
const { asciiLowercase } = require("./strings");
|
||||
|
||||
// Utility to translate from `border-width` to `borderWidth`.
|
||||
// NOTE: For values prefixed with webkit, e.g. `-webkit-foo`, we need to provide
|
||||
// both `webkitFoo` and `WebkitFoo`. Here we only return `webkitFoo`.
|
||||
exports.dashedToCamelCase = function (dashed) {
|
||||
if (dashed.startsWith("--")) {
|
||||
return dashed;
|
||||
}
|
||||
let camel = "";
|
||||
let nextCap = false;
|
||||
// skip leading hyphen in vendor prefixed value, e.g. -webkit-foo
|
||||
let i = /^-webkit-/.test(dashed) ? 1 : 0;
|
||||
for (; i < dashed.length; i++) {
|
||||
if (dashed[i] !== "-") {
|
||||
camel += nextCap ? dashed[i].toUpperCase() : dashed[i];
|
||||
nextCap = false;
|
||||
} else {
|
||||
nextCap = true;
|
||||
}
|
||||
}
|
||||
return camel;
|
||||
};
|
||||
|
||||
// Utility to translate from `borderWidth` to `border-width`.
|
||||
exports.camelCaseToDashed = function (camelCase) {
|
||||
if (camelCase.startsWith("--")) {
|
||||
return camelCase;
|
||||
}
|
||||
const dashed = asciiLowercase(camelCase.replace(/(?<=[a-z])[A-Z]/g, "-$&"));
|
||||
if (/^webkit-/.test(dashed)) {
|
||||
return `-${dashed}`;
|
||||
}
|
||||
return dashed;
|
||||
};
|
||||
55
server/node_modules/cssstyle/lib/utils/propertyDescriptors.js
generated
vendored
Normal file
55
server/node_modules/cssstyle/lib/utils/propertyDescriptors.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
|
||||
const parsers = require("../parsers");
|
||||
|
||||
const { AST_TYPES } = parsers;
|
||||
|
||||
const getPropertyDescriptor = (property) => ({
|
||||
set(v) {
|
||||
const value = parsers.prepareValue(v);
|
||||
if (parsers.hasVarFunc(value)) {
|
||||
this._setProperty(property, value);
|
||||
} else {
|
||||
const parsedValue = parsers.parsePropertyValue(property, v, {
|
||||
globalObject: this._global,
|
||||
inArray: true
|
||||
});
|
||||
if (Array.isArray(parsedValue)) {
|
||||
if (parsedValue.length === 1) {
|
||||
const [{ name, type, value: itemValue }] = parsedValue;
|
||||
switch (type) {
|
||||
case AST_TYPES.CALC: {
|
||||
this._setProperty(property, `${name}(${itemValue})`);
|
||||
break;
|
||||
}
|
||||
case AST_TYPES.GLOBAL_KEYWORD:
|
||||
case AST_TYPES.IDENTIFIER: {
|
||||
// Set the normalized name for keywords or identifiers.
|
||||
this._setProperty(property, name);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
// Set the prepared value for Dimension, Function, etc.
|
||||
this._setProperty(property, value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Set the prepared value for lists containing multiple values.
|
||||
this._setProperty(property, value);
|
||||
}
|
||||
} else if (typeof parsedValue === "string") {
|
||||
// Empty string.
|
||||
this._setProperty(property, parsedValue);
|
||||
}
|
||||
}
|
||||
},
|
||||
get() {
|
||||
return this.getPropertyValue(property);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
getPropertyDescriptor
|
||||
};
|
||||
173
server/node_modules/cssstyle/lib/utils/strings.js
generated
vendored
Normal file
173
server/node_modules/cssstyle/lib/utils/strings.js
generated
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
// Forked from https://github.com/jsdom/jsdom/blob/main/lib/jsdom/living/helpers/strings.js
|
||||
|
||||
"use strict";
|
||||
|
||||
// https://infra.spec.whatwg.org/#ascii-whitespace
|
||||
const asciiWhitespaceRe = /^[\t\n\f\r ]$/;
|
||||
exports.asciiWhitespaceRe = asciiWhitespaceRe;
|
||||
|
||||
// https://infra.spec.whatwg.org/#ascii-lowercase
|
||||
exports.asciiLowercase = (s) => {
|
||||
if (!/[^\x00-\x7f]/.test(s)) {
|
||||
return s.toLowerCase();
|
||||
}
|
||||
const len = s.length;
|
||||
const out = new Array(len);
|
||||
for (let i = 0; i < len; i++) {
|
||||
const code = s.charCodeAt(i);
|
||||
// If the character is between 'A' (65) and 'Z' (90), convert using bitwise OR with 32
|
||||
out[i] = code >= 65 && code <= 90 ? String.fromCharCode(code | 32) : s[i];
|
||||
}
|
||||
return out.join("");
|
||||
};
|
||||
|
||||
// https://infra.spec.whatwg.org/#ascii-uppercase
|
||||
exports.asciiUppercase = (s) => {
|
||||
if (!/[^\x00-\x7f]/.test(s)) {
|
||||
return s.toUpperCase();
|
||||
}
|
||||
const len = s.length;
|
||||
const out = new Array(len);
|
||||
for (let i = 0; i < len; i++) {
|
||||
const code = s.charCodeAt(i);
|
||||
// If the character is between 'a' (97) and 'z' (122), convert using bitwise AND with ~32
|
||||
out[i] = code >= 97 && code <= 122 ? String.fromCharCode(code & ~32) : s[i];
|
||||
}
|
||||
return out.join("");
|
||||
};
|
||||
|
||||
// https://infra.spec.whatwg.org/#strip-newlines
|
||||
exports.stripNewlines = (s) => {
|
||||
return s.replace(/[\n\r]+/g, "");
|
||||
};
|
||||
|
||||
// https://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace
|
||||
exports.stripLeadingAndTrailingASCIIWhitespace = (s) => {
|
||||
return s.replace(/^[ \t\n\f\r]+/, "").replace(/[ \t\n\f\r]+$/, "");
|
||||
};
|
||||
|
||||
// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
|
||||
exports.stripAndCollapseASCIIWhitespace = (s) => {
|
||||
return s
|
||||
.replace(/[ \t\n\f\r]+/g, " ")
|
||||
.replace(/^[ \t\n\f\r]+/, "")
|
||||
.replace(/[ \t\n\f\r]+$/, "");
|
||||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/infrastructure.html#valid-simple-colour
|
||||
exports.isValidSimpleColor = (s) => {
|
||||
return /^#[a-fA-F\d]{6}$/.test(s);
|
||||
};
|
||||
|
||||
// https://infra.spec.whatwg.org/#ascii-case-insensitive
|
||||
exports.asciiCaseInsensitiveMatch = (a, b) => {
|
||||
if (a.length !== b.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < a.length; ++i) {
|
||||
if ((a.charCodeAt(i) | 32) !== (b.charCodeAt(i) | 32)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-integers
|
||||
// Error is represented as null.
|
||||
const parseInteger = (exports.parseInteger = (input) => {
|
||||
// The implementation here is slightly different from the spec's. We want to use parseInt(), but parseInt() trims
|
||||
// Unicode whitespace in addition to just ASCII ones, so we make sure that the trimmed prefix contains only ASCII
|
||||
// whitespace ourselves.
|
||||
const numWhitespace = input.length - input.trimStart().length;
|
||||
if (/[^\t\n\f\r ]/.test(input.slice(0, numWhitespace))) {
|
||||
return null;
|
||||
}
|
||||
// We don't allow hexadecimal numbers here.
|
||||
// eslint-disable-next-line radix
|
||||
const value = parseInt(input, 10);
|
||||
if (Number.isNaN(value)) {
|
||||
return null;
|
||||
}
|
||||
// parseInt() returns -0 for "-0". Normalize that here.
|
||||
return value === 0 ? 0 : value;
|
||||
});
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-non-negative-integers
|
||||
// Error is represented as null.
|
||||
exports.parseNonNegativeInteger = (input) => {
|
||||
const value = parseInteger(input);
|
||||
if (value === null) {
|
||||
return null;
|
||||
}
|
||||
if (value < 0) {
|
||||
return null;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-floating-point-number
|
||||
const floatingPointNumRe = /^-?(?:\d+|\d*\.\d+)(?:[eE][-+]?\d+)?$/;
|
||||
exports.isValidFloatingPointNumber = (str) => floatingPointNumRe.test(str);
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-floating-point-number-values
|
||||
// Error is represented as null.
|
||||
exports.parseFloatingPointNumber = (str) => {
|
||||
// The implementation here is slightly different from the spec's. We need to use parseFloat() in order to retain
|
||||
// accuracy, but parseFloat() trims Unicode whitespace in addition to just ASCII ones, so we make sure that the
|
||||
// trimmed prefix contains only ASCII whitespace ourselves.
|
||||
const numWhitespace = str.length - str.trimStart().length;
|
||||
if (/[^\t\n\f\r ]/.test(str.slice(0, numWhitespace))) {
|
||||
return null;
|
||||
}
|
||||
const parsed = parseFloat(str);
|
||||
return isFinite(parsed) ? parsed : null;
|
||||
};
|
||||
|
||||
// https://infra.spec.whatwg.org/#split-on-ascii-whitespace
|
||||
exports.splitOnASCIIWhitespace = (str) => {
|
||||
let position = 0;
|
||||
const tokens = [];
|
||||
while (position < str.length && asciiWhitespaceRe.test(str[position])) {
|
||||
position++;
|
||||
}
|
||||
if (position === str.length) {
|
||||
return tokens;
|
||||
}
|
||||
while (position < str.length) {
|
||||
const start = position;
|
||||
while (position < str.length && !asciiWhitespaceRe.test(str[position])) {
|
||||
position++;
|
||||
}
|
||||
tokens.push(str.slice(start, position));
|
||||
while (position < str.length && asciiWhitespaceRe.test(str[position])) {
|
||||
position++;
|
||||
}
|
||||
}
|
||||
return tokens;
|
||||
};
|
||||
|
||||
// https://infra.spec.whatwg.org/#split-on-commas
|
||||
exports.splitOnCommas = (str) => {
|
||||
let position = 0;
|
||||
const tokens = [];
|
||||
while (position < str.length) {
|
||||
let start = position;
|
||||
while (position < str.length && str[position] !== ",") {
|
||||
position++;
|
||||
}
|
||||
let end = position;
|
||||
while (start < str.length && asciiWhitespaceRe.test(str[start])) {
|
||||
start++;
|
||||
}
|
||||
while (end > start && asciiWhitespaceRe.test(str[end - 1])) {
|
||||
end--;
|
||||
}
|
||||
tokens.push(str.slice(start, end));
|
||||
if (position < str.length) {
|
||||
position++;
|
||||
}
|
||||
}
|
||||
return tokens;
|
||||
};
|
||||
53
server/node_modules/cssstyle/package.json
generated
vendored
Normal file
53
server/node_modules/cssstyle/package.json
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "cssstyle",
|
||||
"description": "An implementation of the CSSStyleDeclaration class from the CSS Object Model specification",
|
||||
"keywords": [
|
||||
"CSS",
|
||||
"CSSStyleDeclaration",
|
||||
"StyleSheet"
|
||||
],
|
||||
"version": "5.3.7",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jsdom/cssstyle.git"
|
||||
},
|
||||
"files": [
|
||||
"lib/"
|
||||
],
|
||||
"main": "./lib/CSSStyleDeclaration.js",
|
||||
"dependencies": {
|
||||
"@asamuzakjp/css-color": "^4.1.1",
|
||||
"@csstools/css-syntax-patches-for-csstree": "^1.0.21",
|
||||
"css-tree": "^3.1.0",
|
||||
"lru-cache": "^11.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/generator": "^7.28.5",
|
||||
"@babel/parser": "^7.28.5",
|
||||
"@babel/traverse": "^7.28.5",
|
||||
"@babel/types": "^7.28.5",
|
||||
"@domenic/eslint-config": "^4.0.1",
|
||||
"@webref/css": "^8.1.1",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-prettier": "^5.5.4",
|
||||
"globals": "^16.5.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^3.7.4",
|
||||
"resolve": "^1.22.11"
|
||||
},
|
||||
"scripts": {
|
||||
"download": "node ./scripts/downloadLatestProperties.mjs",
|
||||
"lint": "eslint --max-warnings 0",
|
||||
"lint:fix": "eslint --fix --max-warnings 0",
|
||||
"prepare": "run-p prepare:*",
|
||||
"prepare:implemented_properties": "node ./scripts/generateImplementedProperties.mjs",
|
||||
"prepare:properties": "node ./scripts/generateProperties.js",
|
||||
"prepare:propertyDefinitions": "node ./scripts/generatePropertyDefinitions.mjs",
|
||||
"test": "node --test"
|
||||
},
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user