@elementor/editor-audits 4.3.0-1036
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/index.d.mts +122 -0
- package/dist/index.d.ts +122 -0
- package/dist/index.js +2822 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2801 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +65 -0
- package/src/api/page-context-client.ts +19 -0
- package/src/audits/accessibility-policy.ts +32 -0
- package/src/audits/cookie-policy.ts +32 -0
- package/src/audits/deep-nesting.ts +45 -0
- package/src/audits/default-design-system.ts +32 -0
- package/src/audits/deprecated-widgets.ts +57 -0
- package/src/audits/heading-structure.ts +294 -0
- package/src/audits/hidden-elements.ts +41 -0
- package/src/audits/images-alt-text.ts +47 -0
- package/src/audits/images-too-large.ts +61 -0
- package/src/audits/nested-boxed-containers.ts +44 -0
- package/src/audits/page-excerpt.ts +30 -0
- package/src/audits/page-featured-image.ts +29 -0
- package/src/audits/page-title.ts +48 -0
- package/src/audits/prefer-global-colors.ts +52 -0
- package/src/audits/prefer-global-fonts.ts +50 -0
- package/src/audits/privacy-policy.ts +35 -0
- package/src/audits/robots-noindex.ts +35 -0
- package/src/audits/sections-and-columns.ts +39 -0
- package/src/audits/site-identity.ts +62 -0
- package/src/audits/too-many-widgets.ts +43 -0
- package/src/components/audit-feedback.tsx +178 -0
- package/src/components/audit-panel.tsx +55 -0
- package/src/components/category-icons.ts +17 -0
- package/src/components/count-summary-circle.tsx +66 -0
- package/src/components/fix-violation-with-angie.tsx +50 -0
- package/src/components/issues-category-row.tsx +62 -0
- package/src/components/pages/all-audits-page.tsx +65 -0
- package/src/components/pages/category-page.tsx +50 -0
- package/src/components/pages/error-page.tsx +21 -0
- package/src/components/pages/issues-page.tsx +48 -0
- package/src/components/pages/loading-page.tsx +12 -0
- package/src/components/pages/overview-page.tsx +140 -0
- package/src/components/pages/welcome-page.tsx +48 -0
- package/src/components/promotion-card.tsx +43 -0
- package/src/components/promotions.tsx +69 -0
- package/src/components/report-shell.tsx +110 -0
- package/src/components/score-bar.tsx +56 -0
- package/src/components/score-circle.tsx +60 -0
- package/src/components/severity-icons.tsx +26 -0
- package/src/components/status-section.tsx +47 -0
- package/src/components/subpage-header.tsx +29 -0
- package/src/components/violation-icons.tsx +33 -0
- package/src/components/violation-row.tsx +169 -0
- package/src/constants.ts +35 -0
- package/src/editor-app-bar.tsx +13 -0
- package/src/editor-panel.tsx +19 -0
- package/src/hooks/focus-violation.ts +53 -0
- package/src/hooks/use-audit-report.ts +43 -0
- package/src/hooks/use-audit-toggle-props.ts +17 -0
- package/src/index.ts +14 -0
- package/src/init.ts +14 -0
- package/src/register-audits.ts +56 -0
- package/src/register-promotions.ts +75 -0
- package/src/registry.ts +19 -0
- package/src/runner.ts +44 -0
- package/src/store/index.ts +2 -0
- package/src/store/selectors.ts +15 -0
- package/src/store/slice.ts +42 -0
- package/src/types.ts +112 -0
- package/src/utils/audit-status-summary.ts +112 -0
- package/src/utils/build-angie-prompt.ts +9 -0
- package/src/utils/collect-hardcoded-colors.ts +74 -0
- package/src/utils/collect-hardcoded-fonts.ts +70 -0
- package/src/utils/compute-report.ts +51 -0
- package/src/utils/find-audit-run.ts +5 -0
- package/src/utils/image-alt.ts +19 -0
- package/src/utils/image-like-sources.ts +70 -0
- package/src/utils/keyboard-click.ts +10 -0
- package/src/utils/match-global-by-value.ts +5 -0
- package/src/utils/page-attachments.ts +14 -0
- package/src/utils/read-kit-snapshot.ts +149 -0
- package/src/utils/report-storage.ts +16 -0
- package/src/utils/score-thresholds.ts +23 -0
- package/src/utils/severity-counts.ts +59 -0
- package/src/utils/sort-failed-audits.ts +19 -0
- package/src/utils/v1-snapshot.ts +27 -0
- package/src/utils/walk.ts +17 -0
- package/src/utils/window-config.ts +20 -0
package/CHANGELOG.md
ADDED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
declare function init(): void;
|
|
2
|
+
|
|
3
|
+
type Audit = {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
fixHint: string;
|
|
8
|
+
categories: AuditCategory[];
|
|
9
|
+
severity: AuditSeverity;
|
|
10
|
+
weight: number;
|
|
11
|
+
evaluate: (ctx: AuditContext) => AuditResult | Promise<AuditResult>;
|
|
12
|
+
};
|
|
13
|
+
type AuditCategory = 'best-practices' | 'seo' | 'accessibility' | 'performance' | 'compliance';
|
|
14
|
+
type AuditSeverity = 'error' | 'warning' | 'info';
|
|
15
|
+
type AuditMeta = Omit<Audit, 'evaluate'>;
|
|
16
|
+
type AuditRun = {
|
|
17
|
+
audit: AuditMeta;
|
|
18
|
+
result: AuditResult;
|
|
19
|
+
};
|
|
20
|
+
type AuditFailMetadata = {
|
|
21
|
+
missingAltImageCount?: number;
|
|
22
|
+
oversizedImageCount?: number;
|
|
23
|
+
};
|
|
24
|
+
type AuditResult = {
|
|
25
|
+
status: 'pass';
|
|
26
|
+
} | {
|
|
27
|
+
status: 'fail';
|
|
28
|
+
violations: AuditViolation[];
|
|
29
|
+
metadata?: AuditFailMetadata;
|
|
30
|
+
} | {
|
|
31
|
+
status: 'skipped';
|
|
32
|
+
reason: string;
|
|
33
|
+
};
|
|
34
|
+
type AuditViolation = {
|
|
35
|
+
auditId: string;
|
|
36
|
+
elementId?: string;
|
|
37
|
+
targetHint?: 'page-settings' | 'site-settings' | 'site-identity-settings' | 'element-settings';
|
|
38
|
+
externalUrl?: string;
|
|
39
|
+
label: string;
|
|
40
|
+
detail?: string;
|
|
41
|
+
angieFix?: boolean;
|
|
42
|
+
};
|
|
43
|
+
type PageContextResponse = {
|
|
44
|
+
post_title: string | null;
|
|
45
|
+
post_excerpt: string | null;
|
|
46
|
+
featured_image_id: number | null;
|
|
47
|
+
image_sizes: Record<number, {
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
filesize_bytes: number;
|
|
51
|
+
mime: string;
|
|
52
|
+
src: string;
|
|
53
|
+
alt: string;
|
|
54
|
+
}>;
|
|
55
|
+
kit_id: number;
|
|
56
|
+
kit_is_default_unchanged: boolean;
|
|
57
|
+
is_noindex: boolean;
|
|
58
|
+
reading_settings_url: string;
|
|
59
|
+
privacy_policy_url: string | null;
|
|
60
|
+
privacy_settings_url: string;
|
|
61
|
+
ally_plugin_active: boolean;
|
|
62
|
+
ally_plugin_url: string;
|
|
63
|
+
cookiez_plugin_active: boolean;
|
|
64
|
+
cookiez_plugin_url: string;
|
|
65
|
+
image_optimization_plugin_active: boolean;
|
|
66
|
+
image_optimization_plugin_url: string;
|
|
67
|
+
site_identity: {
|
|
68
|
+
site_name_set: boolean;
|
|
69
|
+
site_description_set: boolean;
|
|
70
|
+
site_logo_set: boolean;
|
|
71
|
+
site_favicon_set: boolean;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
type ElementSnapshotNode = {
|
|
75
|
+
id: string;
|
|
76
|
+
elType: string;
|
|
77
|
+
widgetType?: string;
|
|
78
|
+
settings: Record<string, unknown>;
|
|
79
|
+
elements: ElementSnapshotNode[];
|
|
80
|
+
};
|
|
81
|
+
type ElementsModelSnapshot = {
|
|
82
|
+
documentId: number;
|
|
83
|
+
tree: ElementSnapshotNode[];
|
|
84
|
+
};
|
|
85
|
+
type KitSnapshot = {
|
|
86
|
+
id: number;
|
|
87
|
+
globals: {
|
|
88
|
+
colors: Array<{
|
|
89
|
+
id: string;
|
|
90
|
+
value: string;
|
|
91
|
+
title: string;
|
|
92
|
+
}>;
|
|
93
|
+
fonts: Array<{
|
|
94
|
+
id: string;
|
|
95
|
+
value: string;
|
|
96
|
+
title: string;
|
|
97
|
+
}>;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
type AuditContext = {
|
|
101
|
+
documentId: number;
|
|
102
|
+
elements: ElementsModelSnapshot;
|
|
103
|
+
pageContext: PageContextResponse;
|
|
104
|
+
kit: KitSnapshot;
|
|
105
|
+
};
|
|
106
|
+
type PageAuditReport = {
|
|
107
|
+
documentId: number;
|
|
108
|
+
runAt: number;
|
|
109
|
+
overall: number;
|
|
110
|
+
categories: Record<AuditCategory, {
|
|
111
|
+
score: number;
|
|
112
|
+
failed: number;
|
|
113
|
+
total: number;
|
|
114
|
+
}>;
|
|
115
|
+
auditResults: AuditRun[];
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
declare function registerAudit(audit: Audit): void;
|
|
119
|
+
|
|
120
|
+
declare function runPageAudit(documentId: number): Promise<PageAuditReport>;
|
|
121
|
+
|
|
122
|
+
export { type Audit, type AuditCategory, type AuditContext, type AuditMeta, type AuditResult, type AuditRun, type AuditSeverity, type AuditViolation, type PageAuditReport, init, registerAudit, runPageAudit };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
declare function init(): void;
|
|
2
|
+
|
|
3
|
+
type Audit = {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
fixHint: string;
|
|
8
|
+
categories: AuditCategory[];
|
|
9
|
+
severity: AuditSeverity;
|
|
10
|
+
weight: number;
|
|
11
|
+
evaluate: (ctx: AuditContext) => AuditResult | Promise<AuditResult>;
|
|
12
|
+
};
|
|
13
|
+
type AuditCategory = 'best-practices' | 'seo' | 'accessibility' | 'performance' | 'compliance';
|
|
14
|
+
type AuditSeverity = 'error' | 'warning' | 'info';
|
|
15
|
+
type AuditMeta = Omit<Audit, 'evaluate'>;
|
|
16
|
+
type AuditRun = {
|
|
17
|
+
audit: AuditMeta;
|
|
18
|
+
result: AuditResult;
|
|
19
|
+
};
|
|
20
|
+
type AuditFailMetadata = {
|
|
21
|
+
missingAltImageCount?: number;
|
|
22
|
+
oversizedImageCount?: number;
|
|
23
|
+
};
|
|
24
|
+
type AuditResult = {
|
|
25
|
+
status: 'pass';
|
|
26
|
+
} | {
|
|
27
|
+
status: 'fail';
|
|
28
|
+
violations: AuditViolation[];
|
|
29
|
+
metadata?: AuditFailMetadata;
|
|
30
|
+
} | {
|
|
31
|
+
status: 'skipped';
|
|
32
|
+
reason: string;
|
|
33
|
+
};
|
|
34
|
+
type AuditViolation = {
|
|
35
|
+
auditId: string;
|
|
36
|
+
elementId?: string;
|
|
37
|
+
targetHint?: 'page-settings' | 'site-settings' | 'site-identity-settings' | 'element-settings';
|
|
38
|
+
externalUrl?: string;
|
|
39
|
+
label: string;
|
|
40
|
+
detail?: string;
|
|
41
|
+
angieFix?: boolean;
|
|
42
|
+
};
|
|
43
|
+
type PageContextResponse = {
|
|
44
|
+
post_title: string | null;
|
|
45
|
+
post_excerpt: string | null;
|
|
46
|
+
featured_image_id: number | null;
|
|
47
|
+
image_sizes: Record<number, {
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
filesize_bytes: number;
|
|
51
|
+
mime: string;
|
|
52
|
+
src: string;
|
|
53
|
+
alt: string;
|
|
54
|
+
}>;
|
|
55
|
+
kit_id: number;
|
|
56
|
+
kit_is_default_unchanged: boolean;
|
|
57
|
+
is_noindex: boolean;
|
|
58
|
+
reading_settings_url: string;
|
|
59
|
+
privacy_policy_url: string | null;
|
|
60
|
+
privacy_settings_url: string;
|
|
61
|
+
ally_plugin_active: boolean;
|
|
62
|
+
ally_plugin_url: string;
|
|
63
|
+
cookiez_plugin_active: boolean;
|
|
64
|
+
cookiez_plugin_url: string;
|
|
65
|
+
image_optimization_plugin_active: boolean;
|
|
66
|
+
image_optimization_plugin_url: string;
|
|
67
|
+
site_identity: {
|
|
68
|
+
site_name_set: boolean;
|
|
69
|
+
site_description_set: boolean;
|
|
70
|
+
site_logo_set: boolean;
|
|
71
|
+
site_favicon_set: boolean;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
type ElementSnapshotNode = {
|
|
75
|
+
id: string;
|
|
76
|
+
elType: string;
|
|
77
|
+
widgetType?: string;
|
|
78
|
+
settings: Record<string, unknown>;
|
|
79
|
+
elements: ElementSnapshotNode[];
|
|
80
|
+
};
|
|
81
|
+
type ElementsModelSnapshot = {
|
|
82
|
+
documentId: number;
|
|
83
|
+
tree: ElementSnapshotNode[];
|
|
84
|
+
};
|
|
85
|
+
type KitSnapshot = {
|
|
86
|
+
id: number;
|
|
87
|
+
globals: {
|
|
88
|
+
colors: Array<{
|
|
89
|
+
id: string;
|
|
90
|
+
value: string;
|
|
91
|
+
title: string;
|
|
92
|
+
}>;
|
|
93
|
+
fonts: Array<{
|
|
94
|
+
id: string;
|
|
95
|
+
value: string;
|
|
96
|
+
title: string;
|
|
97
|
+
}>;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
type AuditContext = {
|
|
101
|
+
documentId: number;
|
|
102
|
+
elements: ElementsModelSnapshot;
|
|
103
|
+
pageContext: PageContextResponse;
|
|
104
|
+
kit: KitSnapshot;
|
|
105
|
+
};
|
|
106
|
+
type PageAuditReport = {
|
|
107
|
+
documentId: number;
|
|
108
|
+
runAt: number;
|
|
109
|
+
overall: number;
|
|
110
|
+
categories: Record<AuditCategory, {
|
|
111
|
+
score: number;
|
|
112
|
+
failed: number;
|
|
113
|
+
total: number;
|
|
114
|
+
}>;
|
|
115
|
+
auditResults: AuditRun[];
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
declare function registerAudit(audit: Audit): void;
|
|
119
|
+
|
|
120
|
+
declare function runPageAudit(documentId: number): Promise<PageAuditReport>;
|
|
121
|
+
|
|
122
|
+
export { type Audit, type AuditCategory, type AuditContext, type AuditMeta, type AuditResult, type AuditRun, type AuditSeverity, type AuditViolation, type PageAuditReport, init, registerAudit, runPageAudit };
|