full site update
This commit is contained in:
6
node_modules/astro/dist/runtime/client/dev-toolbar/apps/audit/annotations.d.ts
generated
vendored
Normal file
6
node_modules/astro/dist/runtime/client/dev-toolbar/apps/audit/annotations.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export interface Annotation {
|
||||
file: string;
|
||||
location: string;
|
||||
}
|
||||
export declare function getAnnotationsForElement(element: Element): Annotation | undefined;
|
||||
export declare function processAnnotations(): void;
|
27
node_modules/astro/dist/runtime/client/dev-toolbar/apps/audit/annotations.js
generated
vendored
Normal file
27
node_modules/astro/dist/runtime/client/dev-toolbar/apps/audit/annotations.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
const ELEMENT_ANNOTATIONS = /* @__PURE__ */ new WeakMap();
|
||||
function getAnnotationsForElement(element) {
|
||||
return ELEMENT_ANNOTATIONS.get(element);
|
||||
}
|
||||
const ANNOTATION_MAP = {
|
||||
"data-astro-source-file": "file",
|
||||
"data-astro-source-loc": "location"
|
||||
};
|
||||
function extractAnnotations(element) {
|
||||
const annotations = {};
|
||||
for (const [attr, key] of Object.entries(ANNOTATION_MAP)) {
|
||||
annotations[key] = element.getAttribute(attr);
|
||||
}
|
||||
for (const attr of Object.keys(ANNOTATION_MAP)) {
|
||||
element.removeAttribute(attr);
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
function processAnnotations() {
|
||||
for (const element of document.querySelectorAll(`[data-astro-source-file]`)) {
|
||||
ELEMENT_ANNOTATIONS.set(element, extractAnnotations(element));
|
||||
}
|
||||
}
|
||||
export {
|
||||
getAnnotationsForElement,
|
||||
processAnnotations
|
||||
};
|
2
node_modules/astro/dist/runtime/client/dev-toolbar/apps/audit/index.d.ts
generated
vendored
2
node_modules/astro/dist/runtime/client/dev-toolbar/apps/audit/index.d.ts
generated
vendored
@@ -9,7 +9,7 @@ export type Audit = {
|
||||
declare const _default: {
|
||||
id: string;
|
||||
name: string;
|
||||
icon: "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 1 20 16\"><path fill=\"#fff\" d=\"M.6 2A1.1 1.1 0 0 1 1.7.9h16.6a1.1 1.1 0 1 1 0 2.2H1.6A1.1 1.1 0 0 1 .8 2Zm1.1 7.1h6a1.1 1.1 0 0 0 0-2.2h-6a1.1 1.1 0 0 0 0 2.2ZM9.3 13H1.8a1.1 1.1 0 1 0 0 2.2h7.5a1.1 1.1 0 1 0 0-2.2Zm11.3 1.9a1.1 1.1 0 0 1-1.5 0l-1.7-1.7a4.1 4.1 0 1 1 1.6-1.6l1.6 1.7a1.1 1.1 0 0 1 0 1.6Zm-5.3-3.4a1.9 1.9 0 1 0 0-3.8 1.9 1.9 0 0 0 0 3.8Z\"/></svg>";
|
||||
icon: "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 1 20 16\" aria-hidden=\"true\"><path fill=\"#fff\" d=\"M.6 2A1.1 1.1 0 0 1 1.7.9h16.6a1.1 1.1 0 1 1 0 2.2H1.6A1.1 1.1 0 0 1 .8 2Zm1.1 7.1h6a1.1 1.1 0 0 0 0-2.2h-6a1.1 1.1 0 0 0 0 2.2ZM9.3 13H1.8a1.1 1.1 0 1 0 0 2.2h7.5a1.1 1.1 0 1 0 0-2.2Zm11.3 1.9a1.1 1.1 0 0 1-1.5 0l-1.7-1.7a4.1 4.1 0 1 1 1.6-1.6l1.6 1.7a1.1 1.1 0 0 1 0 1.6Zm-5.3-3.4a1.9 1.9 0 1 0 0-3.8 1.9 1.9 0 0 0 0 3.8Z\"/></svg>";
|
||||
init(canvas: ShadowRoot, eventTarget: import("../../helpers.js").ToolbarAppEventTarget): Promise<void>;
|
||||
};
|
||||
export default _default;
|
||||
|
16
node_modules/astro/dist/runtime/client/dev-toolbar/apps/audit/index.js
generated
vendored
16
node_modules/astro/dist/runtime/client/dev-toolbar/apps/audit/index.js
generated
vendored
@@ -1,11 +1,12 @@
|
||||
import { settings } from "../../settings.js";
|
||||
import { positionHighlight } from "../utils/highlight.js";
|
||||
import { closeOnOutsideClick } from "../utils/window.js";
|
||||
import { processAnnotations } from "./annotations.js";
|
||||
import { rulesCategories } from "./rules/index.js";
|
||||
import { DevToolbarAuditListItem } from "./ui/audit-list-item.js";
|
||||
import { DevToolbarAuditListWindow } from "./ui/audit-list-window.js";
|
||||
import { createAuditUI } from "./ui/audit-ui.js";
|
||||
const icon = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 1 20 16"><path fill="#fff" d="M.6 2A1.1 1.1 0 0 1 1.7.9h16.6a1.1 1.1 0 1 1 0 2.2H1.6A1.1 1.1 0 0 1 .8 2Zm1.1 7.1h6a1.1 1.1 0 0 0 0-2.2h-6a1.1 1.1 0 0 0 0 2.2ZM9.3 13H1.8a1.1 1.1 0 1 0 0 2.2h7.5a1.1 1.1 0 1 0 0-2.2Zm11.3 1.9a1.1 1.1 0 0 1-1.5 0l-1.7-1.7a4.1 4.1 0 1 1 1.6-1.6l1.6 1.7a1.1 1.1 0 0 1 0 1.6Zm-5.3-3.4a1.9 1.9 0 1 0 0-3.8 1.9 1.9 0 0 0 0 3.8Z"/></svg>';
|
||||
const icon = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 1 20 16" aria-hidden="true"><path fill="#fff" d="M.6 2A1.1 1.1 0 0 1 1.7.9h16.6a1.1 1.1 0 1 1 0 2.2H1.6A1.1 1.1 0 0 1 .8 2Zm1.1 7.1h6a1.1 1.1 0 0 0 0-2.2h-6a1.1 1.1 0 0 0 0 2.2ZM9.3 13H1.8a1.1 1.1 0 1 0 0 2.2h7.5a1.1 1.1 0 1 0 0-2.2Zm11.3 1.9a1.1 1.1 0 0 1-1.5 0l-1.7-1.7a4.1 4.1 0 1 1 1.6-1.6l1.6 1.7a1.1 1.1 0 0 1 0 1.6Zm-5.3-3.4a1.9 1.9 0 1 0 0-3.8 1.9 1.9 0 0 0 0 3.8Z"/></svg>';
|
||||
try {
|
||||
customElements.define("astro-dev-toolbar-audit-window", DevToolbarAuditListWindow);
|
||||
customElements.define("astro-dev-toolbar-audit-list-item", DevToolbarAuditListItem);
|
||||
@@ -22,8 +23,9 @@ var audit_default = {
|
||||
"astro-dev-toolbar-audit-window"
|
||||
);
|
||||
let hasCreatedUI = false;
|
||||
auditWindow.popover = "";
|
||||
canvas.appendChild(auditWindow);
|
||||
await lint();
|
||||
await run();
|
||||
let mutationDebounce;
|
||||
const observer = new MutationObserver(() => {
|
||||
if (mutationDebounce) {
|
||||
@@ -34,7 +36,7 @@ var audit_default = {
|
||||
if ("requestIdleCallback" in window) {
|
||||
window.requestIdleCallback(
|
||||
async () => {
|
||||
lint().then(() => {
|
||||
run().then(() => {
|
||||
if (showState) createAuditsUI();
|
||||
});
|
||||
},
|
||||
@@ -42,7 +44,7 @@ var audit_default = {
|
||||
);
|
||||
} else {
|
||||
setTimeout(async () => {
|
||||
lint().then(() => {
|
||||
run().then(() => {
|
||||
if (showState) createAuditsUI();
|
||||
});
|
||||
}, 150);
|
||||
@@ -54,7 +56,7 @@ var audit_default = {
|
||||
observer.disconnect();
|
||||
});
|
||||
document.addEventListener("astro:after-swap", async () => {
|
||||
lint();
|
||||
run();
|
||||
});
|
||||
document.addEventListener("astro:page-load", async () => {
|
||||
refreshLintPositions();
|
||||
@@ -93,6 +95,10 @@ var audit_default = {
|
||||
canvas.appendChild(fragment);
|
||||
hasCreatedUI = true;
|
||||
}
|
||||
async function run() {
|
||||
processAnnotations();
|
||||
await lint();
|
||||
}
|
||||
async function lint() {
|
||||
if (audits.length > 0) {
|
||||
audits.forEach((audit) => {
|
||||
|
5
node_modules/astro/dist/runtime/client/dev-toolbar/apps/audit/rules/a11y.js
generated
vendored
5
node_modules/astro/dist/runtime/client/dev-toolbar/apps/audit/rules/a11y.js
generated
vendored
@@ -176,12 +176,12 @@ const input_type_to_implicit_role = /* @__PURE__ */ new Map([
|
||||
["url", "textbox"]
|
||||
]);
|
||||
const ariaAttributes = new Set(
|
||||
"activedescendant atomic autocomplete busy checked colcount colindex colspan controls current describedby description details disabled dropeffect errormessage expanded flowto grabbed haspopup hidden invalid keyshortcuts label labelledby level live modal multiline multiselectable orientation owns placeholder posinset pressed readonly relevant required roledescription rowcount rowindex rowspan selected setsize sort valuemax valuemin valuenow valuetext".split(
|
||||
"activedescendant atomic autocomplete busy checked colcount colindex colspan controls current describedby details disabled dropeffect errormessage expanded flowto grabbed haspopup hidden invalid keyshortcuts label labelledby level live modal multiline multiselectable orientation owns placeholder posinset pressed readonly relevant required roledescription rowcount rowindex rowspan selected setsize sort valuemax valuemin valuenow valuetext".split(
|
||||
" "
|
||||
)
|
||||
);
|
||||
const ariaRoles = new Set(
|
||||
"alert alertdialog application article banner button cell checkbox columnheader combobox complementary contentinfo definition dialog directory document feed figure form grid gridcell group heading img link list listbox listitem log main marquee math menu menubar menuitem menuitemcheckbox menuitemradio navigation none note option presentation progressbar radio radiogroup region row rowgroup rowheader scrollbar search searchbox separator slider spinbutton status switch tab tablist tabpanel textbox timer toolbar tooltip tree treegrid treeitem".split(
|
||||
"alert alertdialog application article banner blockquote button caption cell checkbox code columnheader combobox command complementary composite contentinfo definition deletion dialog directory document emphasis feed figure form generic grid gridcell group heading img input insertion landmark link list listbox listitem log main marquee math meter menu menubar menuitem menuitemcheckbox menuitemradio navigation none note option paragraph presentation progressbar radio radiogroup range region roletype row rowgroup rowheader scrollbar search searchbox section sectionhead select separator slider spinbutton status strong structure subscript superscript switch tab table tablist tabpanel term textbox time timer toolbar tooltip tree treegrid treeitem widget window".split(
|
||||
" "
|
||||
)
|
||||
);
|
||||
@@ -423,6 +423,7 @@ const a11y = [
|
||||
match(element) {
|
||||
const isScrollable = element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
|
||||
if (isScrollable) return false;
|
||||
if (element.localName === "pre") return false;
|
||||
if (!isInteractive(element)) return false;
|
||||
if (!interactiveElements.includes(element.localName) && !roleless_elements.includes(element.localName))
|
||||
return true;
|
||||
|
14
node_modules/astro/dist/runtime/client/dev-toolbar/apps/audit/rules/perf.js
generated
vendored
14
node_modules/astro/dist/runtime/client/dev-toolbar/apps/audit/rules/perf.js
generated
vendored
@@ -23,7 +23,12 @@ const perf = [
|
||||
selector: 'img:not([loading]), img[loading="eager"], iframe:not([loading]), iframe[loading="eager"]',
|
||||
match(element) {
|
||||
const htmlElement = element;
|
||||
const elementYPosition = htmlElement.getBoundingClientRect().y + window.scrollY;
|
||||
let currentElement = element;
|
||||
let elementYPosition = 0;
|
||||
while (currentElement) {
|
||||
elementYPosition += currentElement.offsetTop;
|
||||
currentElement = currentElement.offsetParent;
|
||||
}
|
||||
if (elementYPosition < window.innerHeight) return false;
|
||||
if (htmlElement.src.startsWith("data:")) return false;
|
||||
return true;
|
||||
@@ -36,7 +41,12 @@ const perf = [
|
||||
selector: 'img[loading="lazy"], iframe[loading="lazy"]',
|
||||
match(element) {
|
||||
const htmlElement = element;
|
||||
const elementYPosition = htmlElement.getBoundingClientRect().y + window.scrollY;
|
||||
let currentElement = element;
|
||||
let elementYPosition = 0;
|
||||
while (currentElement) {
|
||||
elementYPosition += currentElement.offsetTop;
|
||||
currentElement = currentElement.offsetParent;
|
||||
}
|
||||
if (elementYPosition > window.innerHeight) return false;
|
||||
if (htmlElement.src.startsWith("data:")) return false;
|
||||
return true;
|
||||
|
@@ -66,7 +66,7 @@ class DevToolbarAuditListWindow extends HTMLElement {
|
||||
"Noto Color Emoji";
|
||||
color: rgba(191, 193, 201, 1);
|
||||
position: fixed;
|
||||
z-index: 999999999;
|
||||
z-index: 2000000009;
|
||||
bottom: 72px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
|
4
node_modules/astro/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-ui.js
generated
vendored
4
node_modules/astro/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-ui.js
generated
vendored
@@ -4,6 +4,7 @@ import {
|
||||
createHighlight,
|
||||
getElementsPositionInDocument
|
||||
} from "../../utils/highlight.js";
|
||||
import { getAnnotationsForElement } from "../annotations.js";
|
||||
import { resolveAuditRule } from "../rules/index.js";
|
||||
function truncate(val, maxLength) {
|
||||
return val.length > maxLength ? val.slice(0, maxLength - 1) + "…" : val;
|
||||
@@ -50,8 +51,7 @@ function buildAuditTooltip(rule, element) {
|
||||
content: escapeHTML(message)
|
||||
}
|
||||
];
|
||||
const elementFile = element.getAttribute("data-astro-source-file");
|
||||
const elementPosition = element.getAttribute("data-astro-source-loc");
|
||||
const { file: elementFile, location: elementPosition } = getAnnotationsForElement(element) ?? {};
|
||||
if (elementFile) {
|
||||
const elementFileWithPosition = elementFile + (elementPosition ? ":" + elementPosition : "");
|
||||
tooltip.sections.push({
|
||||
|
Reference in New Issue
Block a user