mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 06:38:07 +02:00
[Editor] Update the loading icon when wait for ML to take into account prefered-reduced-motion setting
* The icon has been updated in https://bugzilla.mozilla.org/show_bug.cgi?id=1908920; * Add a linter to check that a svg element doesn't have fill="context-fill" attribute.
This commit is contained in:
parent
f6216df889
commit
36c5d192c7
5 changed files with 902 additions and 67 deletions
21
.svglintrc.js
Normal file
21
.svglintrc.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
export default {
|
||||
rules: {
|
||||
valid: true,
|
||||
|
||||
custom: [
|
||||
(reporter, $, ast, { filename }) => {
|
||||
reporter.name = "no-svg-fill-context-fill";
|
||||
|
||||
const svg = $.find("svg");
|
||||
const fill = svg.attr("fill");
|
||||
if (fill === "context-fill") {
|
||||
reporter.error(
|
||||
"Fill attribute on svg element must not be set to 'context-fill'",
|
||||
svg[0],
|
||||
ast
|
||||
);
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
28
gulpfile.mjs
28
gulpfile.mjs
|
@ -1897,7 +1897,7 @@ gulp.task(
|
|||
|
||||
gulp.task("lint", function (done) {
|
||||
console.log();
|
||||
console.log("### Linting JS/CSS/JSON files");
|
||||
console.log("### Linting JS/CSS/JSON/SVG files");
|
||||
|
||||
// Ensure that we lint the Firefox specific *.jsm files too.
|
||||
const esLintOptions = [
|
||||
|
@ -1930,6 +1930,12 @@ gulp.task("lint", function (done) {
|
|||
prettierOptions.push("--log-level", "warn", "--check");
|
||||
}
|
||||
|
||||
const svgLintOptions = [
|
||||
"node_modules/svglint/bin/cli.js",
|
||||
"web/**/*.svg",
|
||||
"--ci",
|
||||
];
|
||||
|
||||
const esLintProcess = startNode(esLintOptions, { stdio: "inherit" });
|
||||
esLintProcess.on("close", function (esLintCode) {
|
||||
if (esLintCode !== 0) {
|
||||
|
@ -1950,8 +1956,24 @@ gulp.task("lint", function (done) {
|
|||
done(new Error("Prettier failed."));
|
||||
return;
|
||||
}
|
||||
console.log("files checked, no errors found");
|
||||
done();
|
||||
|
||||
const svgLintProcess = startNode(svgLintOptions, {
|
||||
stdio: "pipe",
|
||||
});
|
||||
svgLintProcess.stdout.setEncoding("utf8");
|
||||
svgLintProcess.stdout.on("data", m => {
|
||||
m = m.toString().replace(/-+ Summary -+.*/ms, "");
|
||||
console.log(m);
|
||||
});
|
||||
svgLintProcess.on("close", function (svgLintCode) {
|
||||
if (svgLintCode !== 0) {
|
||||
done(new Error("svglint failed."));
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("files checked, no errors found");
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
889
package-lock.json
generated
889
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -50,6 +50,7 @@
|
|||
"puppeteer": "^23.1.1",
|
||||
"stylelint": "^16.8.2",
|
||||
"stylelint-prettier": "^5.0.2",
|
||||
"svglint": "^3.0.0",
|
||||
"terser-webpack-plugin": "^5.3.10",
|
||||
"tsc-alias": "^1.8.10",
|
||||
"ttest": "^4.0.0",
|
||||
|
|
|
@ -1,16 +1,30 @@
|
|||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<svg id="loading-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" width="12" height="12">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
|
||||
<style>
|
||||
@keyframes loadingSVGRotate {
|
||||
from { rotate: 0; } to { rotate: 360deg }
|
||||
@media not (prefers-reduced-motion) {
|
||||
@keyframes loadingRotate {
|
||||
from { rotate: 0; } to { rotate: 360deg }
|
||||
}
|
||||
#circle-arrows {
|
||||
animation: loadingRotate 1.8s linear infinite;
|
||||
transform-origin: 50% 50%;
|
||||
}
|
||||
#hourglass {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
#loading-svg {
|
||||
animation: loadingSVGRotate 1.2s linear infinite;
|
||||
transform-origin: 50% 50%;
|
||||
|
||||
@media (prefers-reduced-motion) {
|
||||
#circle-arrows {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<path d="M8.9 3.8c-.2-.2-.1-.5.1-.7.2-.1.6-.1.7.2.5.7.8 1.6.8 2.5 0 2.5-2 4.5-4.5 4.5l0 1.5c0 .2-.2.3-.3.1l-2-1.9 0-.4 1.9-1.9c.2-.2.4-.1.4.1l0 1.5c1.9 0 3.5-1.6 3.5-3.5 0-.7-.2-1.4-.6-2z"/>
|
||||
<path d="M3.1 8.2c.2.2.1.5-.1.7-.2.1-.6.1-.7-.2-.5-.7-.8-1.6-.8-2.5 0-2.5 2-4.5 4.5-4.5L6 .2c0-.2.2-.3.3-.1l2 1.9 0 .4-2 2c-.1.1-.3 0-.3-.2l0-1.5c-1.9 0-3.5 1.6-3.5 3.5 0 .7.2 1.4.6 2z"/>
|
||||
<path id="circle-arrows" d="M9 5.528c0 .42.508.63.804.333l2.528-2.528a.47.47 0 0 0 0-.666L9.805.14A.471.471 0 0 0 9 .472v1.866A5.756 5.756 0 0 0 2.25 8c0 .942.232 1.83.635 2.615l1.143-1.143A4.208 4.208 0 0 1 3.75 8 4.254 4.254 0 0 1 8 3.75c.345 0 .68.042 1 .122v1.656zM7 10.472v1.656c.32.08.655.122 1 .122A4.254 4.254 0 0 0 12.25 8c0-.52-.107-1.013-.279-1.474l1.143-1.143c.404.786.636 1.674.636 2.617A5.756 5.756 0 0 1 7 13.662v1.866a.47.47 0 0 1-.804.333l-2.528-2.528a.47.47 0 0 1 0-.666l2.528-2.528a.47.47 0 0 1 .804.333z"/>
|
||||
<g id="hourglass">
|
||||
<path d="M13,1 C13.5522847,1 14,1.44771525 14,2 C14,2.55228475 13.5522847,3 13,3 L12.9854217,2.99990801 C12.9950817,3.16495885 13,3.33173274 13,3.5 C13,5.24679885 10.9877318,6.01090495 10.9877318,8.0017538 C10.9877318,9.99260264 13,10.7536922 13,12.5 C13,12.6686079 12.9950617,12.8357163 12.985363,13.0010943 L13,13 C13.5522847,13 14,13.4477153 14,14 C14,14.5522847 13.5522847,15 13,15 L3,15 C2.44771525,15 2,14.5522847 2,14 C2,13.4477153 2.44771525,13 3,13 L3.01463704,13.0010943 C3.00493827,12.8357163 3,12.6686079 3,12.5 C3,10.7536922 4.9877318,9.99260264 5,8.0017538 C5.0122682,6.01090495 3,5.24679885 3,3.5 C3,3.33173274 3.00491834,3.16495885 3.01457832,2.99990801 L3,3 C2.44771525,3 2,2.55228475 2,2 C2,1.44771525 2.44771525,1 3,1 L13,1 Z M10.987,3 L5.012,3 L5.00308914,3.24815712 C5.00103707,3.33163368 5,3.4155948 5,3.5 C5,5.36125069 6.99153646,6.01774089 6.99153646,8.0017538 C6.99153646,9.98576671 5,10.6393737 5,12.5 L5.00307746,12.7513676 L5.01222201,12.9998392 L5.60191711,12.9988344 L6.0425138,12.2959826 C7.02362731,10.7653275 7.67612271,10 8,10 C8.37014547,10 9.16950644,10.9996115 10.3980829,12.9988344 L10.987778,12.9998392 C10.9958674,12.8352104 11,12.66849 11,12.5 C11,10.6393737 8.98689779,10.0147381 8.98689779,8.0017538 C8.98689779,5.98876953 11,5.36125069 11,3.5 L10.9969109,3.24815712 L10.987,3 Z"/>
|
||||
<path d="M6,4 L10,4 C8.95166016,6 8.28499349,7 8,7 C7.71500651,7 7.04833984,6 6,4 Z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 926 B After Width: | Height: | Size: 2.6 KiB |
Loading…
Add table
Add a link
Reference in a new issue