@elementor/editor-audits 4.4.0-1129 → 4.4.0-1130

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/dist/index.mjs CHANGED
@@ -208,16 +208,16 @@ async function requestPageContext(documentId, imageSizeRequests, allowNonceRetry
208
208
 
209
209
  // src/registry.ts
210
210
  var registry = /* @__PURE__ */ new Map();
211
- function registerAudit(audit26) {
212
- registry.set(audit26.id, audit26);
211
+ function registerAudit(audit25) {
212
+ registry.set(audit25.id, audit25);
213
213
  }
214
214
  function getRegisteredAudits() {
215
215
  return Array.from(registry.values());
216
216
  }
217
217
 
218
218
  // src/utils/is-scored-audit.ts
219
- function isScoredAudit(audit26) {
220
- return audit26.weight > 0;
219
+ function isScoredAudit(audit25) {
220
+ return audit25.weight > 0;
221
221
  }
222
222
 
223
223
  // src/utils/sort-failed-audits.ts
@@ -278,16 +278,16 @@ function computeReport(documentId, results) {
278
278
  const accumulators = Object.fromEntries(
279
279
  ALL_CATEGORIES.map((c) => [c, { totalWeight: 0, passedWeight: 0, total: 0, failed: 0 }])
280
280
  );
281
- for (const { audit: audit26, result } of results) {
281
+ for (const { audit: audit25, result } of results) {
282
282
  if (result.status === "skipped") {
283
283
  continue;
284
284
  }
285
- for (const category of audit26.categories) {
285
+ for (const category of audit25.categories) {
286
286
  const acc = accumulators[category];
287
287
  acc.total++;
288
- acc.totalWeight += audit26.weight;
288
+ acc.totalWeight += audit25.weight;
289
289
  if (result.status === "pass") {
290
- acc.passedWeight += audit26.weight;
290
+ acc.passedWeight += audit25.weight;
291
291
  } else {
292
292
  acc.failed++;
293
293
  }
@@ -613,10 +613,10 @@ async function runPageAudit(documentId) {
613
613
  const ctx = { documentId, elements, pageContext, kit, renderedHtml };
614
614
  const registered = getRegisteredAudits();
615
615
  const auditResults = await Promise.all(
616
- registered.map(async (audit26) => {
617
- const { evaluate: _evaluate, ...meta } = audit26;
616
+ registered.map(async (audit25) => {
617
+ const { evaluate: _evaluate, ...meta } = audit25;
618
618
  try {
619
- const result = await audit26.evaluate(ctx);
619
+ const result = await audit25.evaluate(ctx);
620
620
  return { audit: meta, result };
621
621
  } catch (error) {
622
622
  const reason = error instanceof Error ? error.message : "unknown-error";
@@ -1109,9 +1109,9 @@ function ViolationIcon({ violation, widgetIcon }) {
1109
1109
  function SkipReasonTooltip({ reason }) {
1110
1110
  return /* @__PURE__ */ React12.createElement(Tooltip3, { title: reason, placement: "top" }, /* @__PURE__ */ React12.createElement(Box7, { "aria-label": reason, component: "span", sx: { display: "inline-flex", alignItems: "center" } }, /* @__PURE__ */ React12.createElement(HelpIcon, { fontSize: "small", color: "action" })));
1111
1111
  }
1112
- function StatusIndicator({ audit: audit26, violations }) {
1112
+ function StatusIndicator({ audit: audit25, violations }) {
1113
1113
  if (violations) {
1114
- return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(SeverityIcon, { severity: audit26.severity }), isScoredAudit(audit26) && /* @__PURE__ */ React12.createElement(Typography6, { variant: "caption", color: "text.secondary", fontWeight: "bold" }, violations.length));
1114
+ return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(SeverityIcon, { severity: audit25.severity }), isScoredAudit(audit25) && /* @__PURE__ */ React12.createElement(Typography6, { variant: "caption", color: "text.secondary", fontWeight: "bold" }, violations.length));
1115
1115
  }
1116
1116
  return /* @__PURE__ */ React12.createElement(CheckIcon, { fontSize: "small", color: "success" });
1117
1117
  }
@@ -1153,7 +1153,7 @@ function getSharedAngiePrompt(violations) {
1153
1153
  );
1154
1154
  return allShareTheSameFix ? first.angiePrompt : void 0;
1155
1155
  }
1156
- function ViolationRow({ audit: audit26, expanded, onToggleExpand, skipReason, violations }) {
1156
+ function ViolationRow({ audit: audit25, expanded, onToggleExpand, skipReason, violations }) {
1157
1157
  const primaryViolation = violations?.[0];
1158
1158
  const isGuidanceFocusable = !!primaryViolation;
1159
1159
  const panelZIndex = useFloatingPanelZIndex2(AUDIT_PANEL_ID);
@@ -1176,8 +1176,8 @@ function ViolationRow({ audit: audit26, expanded, onToggleExpand, skipReason, vi
1176
1176
  },
1177
1177
  onClick: onToggleExpand
1178
1178
  },
1179
- /* @__PURE__ */ React12.createElement(Typography6, { variant: "subtitle2", color: "text.secondary", sx: { flex: 1 } }, audit26.title),
1180
- !skipReason && /* @__PURE__ */ React12.createElement(StatusIndicator, { audit: audit26, violations })
1179
+ /* @__PURE__ */ React12.createElement(Typography6, { variant: "subtitle2", color: "text.secondary", sx: { flex: 1 } }, audit25.title),
1180
+ !skipReason && /* @__PURE__ */ React12.createElement(StatusIndicator, { audit: audit25, violations })
1181
1181
  ), skipReason && /* @__PURE__ */ React12.createElement(SkipReasonTooltip, { reason: skipReason }), /* @__PURE__ */ React12.createElement(
1182
1182
  IconButton5,
1183
1183
  {
@@ -1195,7 +1195,7 @@ function ViolationRow({ audit: audit26, expanded, onToggleExpand, skipReason, vi
1195
1195
  }
1196
1196
  }
1197
1197
  )
1198
- )), /* @__PURE__ */ React12.createElement(Collapse2, { in: expanded }, /* @__PURE__ */ React12.createElement(Box7, { paddingBlock: 1 }, /* @__PURE__ */ React12.createElement(Tooltip3, { title: audit26.fixHint, placement: "top" }, /* @__PURE__ */ React12.createElement(
1198
+ )), /* @__PURE__ */ React12.createElement(Collapse2, { in: expanded }, /* @__PURE__ */ React12.createElement(Box7, { paddingBlock: 1 }, /* @__PURE__ */ React12.createElement(Tooltip3, { title: audit25.fixHint, placement: "top" }, /* @__PURE__ */ React12.createElement(
1199
1199
  Alert,
1200
1200
  {
1201
1201
  severity: "secondary",
@@ -1206,7 +1206,7 @@ function ViolationRow({ audit: audit26, expanded, onToggleExpand, skipReason, vi
1206
1206
  onClick: isGuidanceFocusable ? handleGuidanceClick : void 0,
1207
1207
  onKeyDown: isGuidanceFocusable ? onKeyboardClick(handleGuidanceClick) : void 0
1208
1208
  },
1209
- /* @__PURE__ */ React12.createElement(Typography6, { variant: "caption", component: "p", color: "text.secondary" }, audit26.description),
1209
+ /* @__PURE__ */ React12.createElement(Typography6, { variant: "caption", component: "p", color: "text.secondary" }, audit25.description),
1210
1210
  primaryViolation && /* @__PURE__ */ React12.createElement(
1211
1211
  GuidanceAction,
1212
1212
  {
@@ -1324,17 +1324,17 @@ import { __ as __12 } from "@wordpress/i18n";
1324
1324
  var ALL_SEVERITIES = ["error", "warning", "info"];
1325
1325
  function countSeverities(report, category) {
1326
1326
  const counts = { error: 0, warning: 0, info: 0 };
1327
- for (const { audit: audit26, result } of report.auditResults) {
1327
+ for (const { audit: audit25, result } of report.auditResults) {
1328
1328
  if (result.status !== "fail") {
1329
1329
  continue;
1330
1330
  }
1331
- if (category && !audit26.categories.includes(category)) {
1331
+ if (category && !audit25.categories.includes(category)) {
1332
1332
  continue;
1333
1333
  }
1334
- if (!isScoredAudit(audit26)) {
1334
+ if (!isScoredAudit(audit25)) {
1335
1335
  continue;
1336
1336
  }
1337
- counts[audit26.severity] += result.violations.length;
1337
+ counts[audit25.severity] += result.violations.length;
1338
1338
  }
1339
1339
  return counts;
1340
1340
  }
@@ -1540,7 +1540,7 @@ function SeverityCard({ severity, count }) {
1540
1540
  flex: 1,
1541
1541
  flexDirection: "column",
1542
1542
  gap: 1,
1543
- bgcolor: "grey.50",
1543
+ bgcolor: "action.hover",
1544
1544
  borderRadius: 1.5,
1545
1545
  px: 1.5,
1546
1546
  py: 1
@@ -2966,50 +2966,6 @@ var audit24 = {
2966
2966
  }
2967
2967
  };
2968
2968
 
2969
- // src/audits/too-many-widgets.ts
2970
- import { getWidgetsCache as getWidgetsCache3 } from "@elementor/editor-elements";
2971
- import { __ as __43 } from "@wordpress/i18n";
2972
- var WIDGET_COUNT_THRESHOLD = 100;
2973
- function isCountableWidget(node, widgetsCache) {
2974
- if (node.elType === "widget") {
2975
- return true;
2976
- }
2977
- return !!widgetsCache?.[node.elType]?.meta?.is_compound;
2978
- }
2979
- var audit25 = {
2980
- id: "audits/too-many-widgets",
2981
- title: __43("Too many widgets", "elementor"),
2982
- description: __43("Excessive DOM size caused by too many widgets degrades rendering performance.", "elementor"),
2983
- fixHint: __43("Reduce the number of widgets on the page by removing or combining elements.", "elementor"),
2984
- categories: ["best-practices", "performance"],
2985
- severity: "warning",
2986
- weight: 5,
2987
- evaluate: (ctx) => {
2988
- if (ctx.elements.tree.length === 0) {
2989
- return { status: "skipped", reason: __43("No elements", "elementor") };
2990
- }
2991
- const widgetsCache = getWidgetsCache3();
2992
- let widgetCount = 0;
2993
- walkElements(ctx.elements.tree, (node) => {
2994
- if (isCountableWidget(node, widgetsCache)) {
2995
- widgetCount++;
2996
- }
2997
- });
2998
- if (widgetCount <= WIDGET_COUNT_THRESHOLD) {
2999
- return { status: "pass" };
3000
- }
3001
- return {
3002
- status: "fail",
3003
- violations: [
3004
- {
3005
- auditId: audit25.id,
3006
- label: __43("Page has too many widgets.", "elementor")
3007
- }
3008
- ]
3009
- };
3010
- }
3011
- };
3012
-
3013
2969
  // src/register-audits.ts
3014
2970
  var AUDITS = [
3015
2971
  audit17,
@@ -3017,7 +2973,6 @@ var AUDITS = [
3017
2973
  audit16,
3018
2974
  audit10,
3019
2975
  audit7,
3020
- audit25,
3021
2976
  audit23,
3022
2977
  audit5,
3023
2978
  audit14,
@@ -3039,8 +2994,8 @@ var AUDITS = [
3039
2994
  audit8
3040
2995
  ];
3041
2996
  function registerAllAudits() {
3042
- for (const audit26 of AUDITS) {
3043
- registerAudit(audit26);
2997
+ for (const audit25 of AUDITS) {
2998
+ registerAudit(audit25);
3044
2999
  }
3045
3000
  }
3046
3001