first commit

This commit is contained in:
jefferyzhao
2025-07-31 17:44:12 +08:00
commit b9bdc8598b
42390 changed files with 4467935 additions and 0 deletions

View File

@ -0,0 +1,39 @@
@counter-style my-alpha {
system: fixed;
symbols: A B C;
suffix: " ";
}
@COUNTER-STYLE my-alpha {
system: fixed;
symbols: A B C;
suffix: " ";
}
@counter-style my-alpha {
system: fixed;
symbols: ;
suffix: " ";
}
@media (max-width: 400px) {
@counter-style my-alpha {
system: fixed;
symbols: A B C;
suffix: " ";
}
@supports (display: flex) {
@counter-style my-alpha {
system: fixed;
symbols: a b c;
suffix: " ";
}
}
@counter-style my-alpha {
system: fixed;
symbols: ;
suffix: " ";
}
}

View File

@ -0,0 +1,22 @@
@counter-style my-alpha {
system: fixed;
symbols: ;
suffix: " ";
}
@media (max-width: 400px) {
@supports (display: flex) {
@counter-style my-alpha {
system: fixed;
symbols: a b c;
suffix: " ";
}
}
@counter-style my-alpha {
system: fixed;
symbols: ;
suffix: " ";
}
}

View File

@ -0,0 +1,100 @@
@-webkit-keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 0.8;
}
}
@-WEBKIT-KEYFRAMES fade-in {
0% {
opacity: 0;
}
100% {
opacity: 0.8;
}
}
@keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 0.8;
}
}
@KEYFRAMES fade-in {
0% {
opacity: 0;
}
100% {
opacity: 0.8;
}
}
@media (max-width: 500px) {
@-webkit-keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@-webkit-keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 0.8;
}
}
@keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 0.8;
}
}
@supports (display: flex) {
@-webkit-keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
}
}
@-webkit-keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}

View File

@ -0,0 +1,52 @@
@media (max-width: 500px) {
@-webkit-keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 0.8;
}
}
@keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 0.8;
}
}
@supports (display: flex) {
@-webkit-keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
}
}
@-webkit-keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}

View File

@ -0,0 +1,63 @@
import fs from 'fs';
import postcss from 'postcss';
import test from 'ava';
import {diffLines} from 'diff';
import chalk from 'chalk';
import plugin from '../';
function getDiff (left, right) {
let msg = ['\n'];
diffLines(left, right).forEach(item => {
if (item.added || item.removed) {
let text = item.value
.replace('\n', '\u00b6\n')
.replace('\ufeff', '[[BOM]]');
msg.push(chalk[item.added ? 'green' : 'red'](text));
} else {
let value = item.value.replace('\ufeff', '[[BOM]]');
let lines = value.split('\n');
// max line count for each item
let keepLines = 6;
// lines to be omitted
let omitLines = lines.length - keepLines;
if (lines.length > keepLines) {
lines.splice(
Math.floor(keepLines / 2),
omitLines,
chalk.gray('(...' + omitLines + ' lines omitted...)')
);
}
msg.concat(lines);
}
});
msg.push('\n');
return msg.map(line => ' ' + line).join('');
}
function read (file) {
return fs.readFileSync(__dirname + `/fixtures/${file}.css`, {encoding: 'utf-8'});
}
function exec (t, input) {
let output = read(`${input}.post`);
return postcss([ plugin() ]).process(read(input))
.then( result => {
if (result.css !== output) {
t.fail(getDiff(result.css, output));
}
t.deepEqual(result.warnings().length, 0);
});
}
test(
'Overridden @keyframes should be discarded correctly.',
exec,
'keyframes'
);
test(
'Overridden @counter-style should be discarded correctly.',
exec,
'counter-style'
);

46
node_modules/postcss-discard-overridden/src/index.js generated vendored Normal file
View File

@ -0,0 +1,46 @@
import postcss from 'postcss';
const OVERRIDABLE_RULES = ['keyframes', 'counter-style'];
const SCOPE_RULES = ['media', 'supports'];
function isOverridable (name) {
return ~OVERRIDABLE_RULES.indexOf(postcss.vendor.unprefixed(name.toLowerCase()));
}
function isScope (name) {
return ~SCOPE_RULES.indexOf(postcss.vendor.unprefixed(name.toLowerCase()));
}
function getScope (node) {
let current = node.parent;
const chain = [node.name.toLowerCase(), node.params];
do {
if (current.type === 'atrule' && isScope(current.name)) {
chain.unshift(current.name + ' ' + current.params);
}
current = current.parent;
} while (current);
return chain.join('|');
}
export default postcss.plugin('postcss-discard-overridden', () => {
return css => {
const cache = {};
const rules = [];
css.walkAtRules(node => {
if (isOverridable(node.name)) {
const scope = getScope(node);
cache[scope] = node;
rules.push({
node,
scope,
});
}
});
rules.forEach(rule => {
if (cache[rule.scope] !== rule.node) {
rule.node.remove();
}
});
};
});