Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/queuepro/node_modules/postcss-merge-longhand/src/lib/ drwxrwxr-x | |
| Viewing file: Select action/file-type: 'use strict';
const hasAllProps = require('./hasAllProps.js');
const getDecls = require('./getDecls.js');
const getRules = require('./getRules.js');
/**
* @param {import('postcss').Declaration} propA
* @param {import('postcss').Declaration} propB
* @return {boolean}
*/
function isConflictingProp(propA, propB) {
if (!propB.prop || propB.important !== propA.important) {
return false;
}
const parts = propA.prop.split('-');
return parts.some(() => {
parts.pop();
return parts.join('-') === propB.prop;
});
}
/**
* @param {import('postcss').Declaration[]} match
* @param {import('postcss').Declaration[]} nodes
* @return {boolean}
*/
function hasConflicts(match, nodes) {
const firstNode = Math.min(...match.map((n) => nodes.indexOf(n)));
const lastNode = Math.max(...match.map((n) => nodes.indexOf(n)));
const between = nodes.slice(firstNode + 1, lastNode);
return match.some((a) => between.some((b) => isConflictingProp(a, b)));
}
/**
* @param {import('postcss').Rule} rule
* @param {string[]} properties
* @param {(rules: import('postcss').Declaration[], last: import('postcss').Declaration, props: import('postcss').Declaration[]) => boolean} callback
* @return {void}
*/
module.exports = function mergeRules(rule, properties, callback) {
let decls = getDecls(rule, properties);
while (decls.length) {
const last = decls[decls.length - 1];
const props = decls.filter((node) => node.important === last.important);
const rules = getRules(props, properties);
if (
hasAllProps(rules, ...properties) &&
!hasConflicts(
rules,
/** @type import('postcss').Declaration[]*/ (rule.nodes)
)
) {
if (callback(rules, last, props)) {
decls = decls.filter((node) => !rules.includes(node));
}
}
decls = decls.filter((node) => node !== last);
}
};
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0264 ]-- |