@salesforce-ux/eslint-plugin-slds
Version:
ESLint plugin provides custom linting rules specifically built for Salesforce Lightning Design System 2 (SLDS 2 beta)
69 lines (67 loc) • 2.27 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/utils/css-functions.ts
var css_functions_exports = {};
__export(css_functions_exports, {
containsCssFunction: () => containsCssFunction,
isCssColorFunction: () => isCssColorFunction,
isCssFunction: () => isCssFunction,
isCssMathFunction: () => isCssMathFunction
});
module.exports = __toCommonJS(css_functions_exports);
var CSS_FUNCTIONS = [
"attr",
"calc",
"color-mix",
"conic-gradient",
"counter",
"cubic-bezier",
"linear-gradient",
"max",
"min",
"radial-gradient",
"repeating-conic-gradient",
"repeating-linear-gradient",
"repeating-radial-gradient",
"var"
];
var CSS_MATH_FUNCTIONS = ["calc", "min", "max"];
var RGB_COLOR_FUNCTIONS = ["rgb", "rgba", "hsl", "hsla"];
var cssFunctionsRegex = new RegExp(`(?:${CSS_FUNCTIONS.join("|")})`);
var cssFunctionsExactRegex = new RegExp(`^(?:${CSS_FUNCTIONS.join("|")})$`);
var cssMathFunctionsRegex = new RegExp(`^(?:${CSS_MATH_FUNCTIONS.join("|")})$`);
function containsCssFunction(value) {
return cssFunctionsRegex.test(value);
}
function isCssFunction(value) {
return cssFunctionsExactRegex.test(value);
}
function isCssMathFunction(value) {
return cssMathFunctionsRegex.test(value);
}
function isCssColorFunction(value) {
return RGB_COLOR_FUNCTIONS.includes(value);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
containsCssFunction,
isCssColorFunction,
isCssFunction,
isCssMathFunction
});
//# sourceMappingURL=css-functions.js.map