sanity-plugin-all-in-one-accessibility 1.1.5 → 1.1.6
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.js +78 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,11 +16,11 @@ const AIOA_API_BASE = "https://ada.skynettechnologies.us/api/", AIOA_UPDATE_API
|
|
|
16
16
|
["bottom_center", "Bottom center", 0.5, 1],
|
|
17
17
|
["bottom_right", "Bottom right", 1, 1]
|
|
18
18
|
], AIOA_ICON_SIZES = [
|
|
19
|
-
["aioa-big-icon", "Big",
|
|
20
|
-
["aioa-medium-icon", "Medium",
|
|
21
|
-
["aioa-default-icon", "Default",
|
|
22
|
-
["aioa-small-icon", "Small",
|
|
23
|
-
["aioa-extra-small-icon", "Extra small",
|
|
19
|
+
["aioa-big-icon", "Big", 75],
|
|
20
|
+
["aioa-medium-icon", "Medium", 65],
|
|
21
|
+
["aioa-default-icon", "Default", 55],
|
|
22
|
+
["aioa-small-icon", "Small", 45],
|
|
23
|
+
["aioa-extra-small-icon", "Extra small", 35]
|
|
24
24
|
], AIOA_PRESET_COLORS = [
|
|
25
25
|
["420083", "Purple (default)"],
|
|
26
26
|
["1D4ED8", "Blue"],
|
|
@@ -249,14 +249,14 @@ function scoreSummary(data, altCount) {
|
|
|
249
249
|
alt_text: altText(altCount),
|
|
250
250
|
pages: {
|
|
251
251
|
scanned: toInt(data.total_scan_pages),
|
|
252
|
-
total: toInt(data.
|
|
252
|
+
total: toInt(data.total_pages ?? data.total_selected_pages ?? 0)
|
|
253
253
|
},
|
|
254
254
|
last_scan: toStr(data.last_scan),
|
|
255
255
|
report_url: /^https:\/\//i.test(reportUrl) ? reportUrl : ""
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
258
|
function altText(altCount) {
|
|
259
|
-
const count = isObject(altCount) ? altCount : {}, images = (key) => Math.max(0, toInt(count[key])), fixed = images("total_decorative_images") + images("total_update_alt_text")
|
|
259
|
+
const count = isObject(altCount) ? altCount : {}, images = (key) => Math.max(0, toInt(count[key])), fixed = images("total_decorative_images") + images("total_update_alt_text");
|
|
260
260
|
return ratio(fixed, fixed + images("total_missing_alt_tag"));
|
|
261
261
|
}
|
|
262
262
|
function ratio(fixed, total) {
|
|
@@ -890,6 +890,12 @@ function IconTypeSection({ state, update }) {
|
|
|
890
890
|
] })
|
|
891
891
|
] });
|
|
892
892
|
}
|
|
893
|
+
function startSize(state) {
|
|
894
|
+
if (state.iconSizeCustom.trim() !== "")
|
|
895
|
+
return state.iconSizeCustom;
|
|
896
|
+
const preset = AIOA_ICON_SIZES.find(([value]) => value === state.iconSize);
|
|
897
|
+
return preset ? String(preset[2]) : "";
|
|
898
|
+
}
|
|
893
899
|
function IconSizeSection({ state, update, refs }) {
|
|
894
900
|
return /* @__PURE__ */ jsxs("section", { className: "aioa-card", "aria-labelledby": "aioa-icon-size-title", children: [
|
|
895
901
|
/* @__PURE__ */ jsx("h2", { id: "aioa-icon-size-title", children: "Icon size for desktop" }),
|
|
@@ -901,7 +907,9 @@ function IconSizeSection({ state, update, refs }) {
|
|
|
901
907
|
type: "checkbox",
|
|
902
908
|
checked: state.customSize,
|
|
903
909
|
"aria-controls": "aioa-custom-size aioa-icon-sizes",
|
|
904
|
-
onChange: (e) => update(
|
|
910
|
+
onChange: (e) => update(
|
|
911
|
+
e.target.checked ? { customSize: !0, iconSizeCustom: startSize(state) } : { customSize: !1, sizeCheck: !1 }
|
|
912
|
+
)
|
|
905
913
|
}
|
|
906
914
|
),
|
|
907
915
|
"Set an exact size in pixels"
|
|
@@ -914,7 +922,7 @@ function IconSizeSection({ state, update, refs }) {
|
|
|
914
922
|
hidden: state.customSize,
|
|
915
923
|
children: [
|
|
916
924
|
/* @__PURE__ */ jsx("legend", { className: "visually-hidden", children: "Select icon size for desktop" }),
|
|
917
|
-
/* @__PURE__ */ jsx("div", { className: "aioa-size-row", children: AIOA_ICON_SIZES.map(([value, label,
|
|
925
|
+
/* @__PURE__ */ jsx("div", { className: "aioa-size-row", children: AIOA_ICON_SIZES.map(([value, label, px]) => {
|
|
918
926
|
const id = `aioa-size-${aioaSlug(value)}`;
|
|
919
927
|
return /* @__PURE__ */ jsxs("div", { className: "aioa-icon-option", children: [
|
|
920
928
|
/* @__PURE__ */ jsx(
|
|
@@ -930,8 +938,15 @@ function IconSizeSection({ state, update, refs }) {
|
|
|
930
938
|
}
|
|
931
939
|
),
|
|
932
940
|
/* @__PURE__ */ jsxs("label", { htmlFor: id, className: "aioa-icon-label", children: [
|
|
933
|
-
/* @__PURE__ */ jsx("span", { className: "aioa-icon", style: { "--d": `${Math.trunc(
|
|
934
|
-
/* @__PURE__ */
|
|
941
|
+
/* @__PURE__ */ jsx("span", { className: "aioa-icon", style: { "--d": `${Math.trunc(px)}px` }, children: /* @__PURE__ */ jsx("img", { src: iconUrl(state.iconType), alt: "" }) }),
|
|
942
|
+
/* @__PURE__ */ jsxs("span", { className: "aioa-icon-caption", children: [
|
|
943
|
+
label,
|
|
944
|
+
" ",
|
|
945
|
+
/* @__PURE__ */ jsxs("small", { children: [
|
|
946
|
+
px,
|
|
947
|
+
"px"
|
|
948
|
+
] })
|
|
949
|
+
] })
|
|
935
950
|
] })
|
|
936
951
|
] }, value);
|
|
937
952
|
}) })
|
|
@@ -1038,7 +1053,29 @@ function ReportIcon() {
|
|
|
1038
1053
|
/* @__PURE__ */ jsx("path", { d: "M12 10v4M12 17v.5" })
|
|
1039
1054
|
] });
|
|
1040
1055
|
}
|
|
1041
|
-
const UpgradeUrlContext = createContext(AIOA_UPGRADE_URL), PlanExpiredContext = createContext(!1)
|
|
1056
|
+
const UpgradeUrlContext = createContext(AIOA_UPGRADE_URL), PlanExpiredContext = createContext(!1), DashboardContext = createContext({ busy: null, open: () => {
|
|
1057
|
+
} });
|
|
1058
|
+
function DashboardButton({
|
|
1059
|
+
id,
|
|
1060
|
+
className,
|
|
1061
|
+
children
|
|
1062
|
+
}) {
|
|
1063
|
+
const { busy, open } = useContext(DashboardContext), isBusy = busy === id;
|
|
1064
|
+
return /* @__PURE__ */ jsx(
|
|
1065
|
+
"button",
|
|
1066
|
+
{
|
|
1067
|
+
type: "button",
|
|
1068
|
+
className,
|
|
1069
|
+
disabled: isBusy,
|
|
1070
|
+
"aria-busy": isBusy || void 0,
|
|
1071
|
+
onClick: () => open(id),
|
|
1072
|
+
children: isBusy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1073
|
+
/* @__PURE__ */ jsx("span", { className: "aioa-spinner", "aria-hidden": "true" }),
|
|
1074
|
+
/* @__PURE__ */ jsx("span", { children: "Opening\u2026" })
|
|
1075
|
+
] }) : children
|
|
1076
|
+
}
|
|
1077
|
+
);
|
|
1078
|
+
}
|
|
1042
1079
|
function Header({
|
|
1043
1080
|
theme,
|
|
1044
1081
|
onToggleTheme
|
|
@@ -1084,9 +1121,9 @@ function UpgradeBanner() {
|
|
|
1084
1121
|
] }),
|
|
1085
1122
|
/* @__PURE__ */ jsx("h2", { id: "aioa-upgrade-title", children: expired ? "Your paid plan has expired" : "With 24 Features" }),
|
|
1086
1123
|
expired ? /* @__PURE__ */ jsxs("p", { children: [
|
|
1087
|
-
"
|
|
1124
|
+
"Renew your plan to unlock ",
|
|
1088
1125
|
/* @__PURE__ */ jsx("strong", { children: "100+ Premium Accessibility Features" }),
|
|
1089
|
-
". Paid Features and Accessibility Score are locked until then."
|
|
1126
|
+
" again. Paid Features and Accessibility Score are locked until then."
|
|
1090
1127
|
] }) : /* @__PURE__ */ jsxs("p", { children: [
|
|
1091
1128
|
"Upgrade to unlock ",
|
|
1092
1129
|
/* @__PURE__ */ jsx("strong", { children: "90+ Premium Accessibility Features" }),
|
|
@@ -1098,7 +1135,11 @@ function UpgradeBanner() {
|
|
|
1098
1135
|
] })
|
|
1099
1136
|
] }),
|
|
1100
1137
|
/* @__PURE__ */ jsxs("div", { className: "aioa-upgrade-cta", children: [
|
|
1101
|
-
/* @__PURE__ */ jsxs(
|
|
1138
|
+
expired ? /* @__PURE__ */ jsxs(DashboardButton, { id: "renew-banner", className: "aioa-btn-white", children: [
|
|
1139
|
+
"Renew Plan",
|
|
1140
|
+
/* @__PURE__ */ jsx(ArrowIcon, {}),
|
|
1141
|
+
/* @__PURE__ */ jsx("span", { className: "visually-hidden", children: "(opens your dashboard in a new tab)" })
|
|
1142
|
+
] }) : /* @__PURE__ */ jsxs(
|
|
1102
1143
|
"a",
|
|
1103
1144
|
{
|
|
1104
1145
|
href: upgradeHref,
|
|
@@ -1112,7 +1153,7 @@ function UpgradeBanner() {
|
|
|
1112
1153
|
]
|
|
1113
1154
|
}
|
|
1114
1155
|
),
|
|
1115
|
-
|
|
1156
|
+
/* @__PURE__ */ jsx("small", { children: expired ? "Renew from your dashboard" : /* @__PURE__ */ jsx(Fragment, { children: "10-day free trial \xB7 Cancel anytime" }) })
|
|
1116
1157
|
] })
|
|
1117
1158
|
] }),
|
|
1118
1159
|
/* @__PURE__ */ jsxs("p", { className: "aioa-upgrade-note", children: [
|
|
@@ -1121,33 +1162,17 @@ function UpgradeBanner() {
|
|
|
1121
1162
|
] })
|
|
1122
1163
|
] });
|
|
1123
1164
|
}
|
|
1124
|
-
function PaidBanner({
|
|
1125
|
-
busy,
|
|
1126
|
-
onDashboard
|
|
1127
|
-
}) {
|
|
1165
|
+
function PaidBanner() {
|
|
1128
1166
|
return /* @__PURE__ */ jsxs("section", { className: "aioa-notice", "aria-labelledby": "aioa-paid-title", children: [
|
|
1129
1167
|
/* @__PURE__ */ jsxs("div", { className: "aioa-notice-body", children: [
|
|
1130
1168
|
/* @__PURE__ */ jsx("p", { className: "aioa-tag is-success", children: "Paid plan active" }),
|
|
1131
1169
|
/* @__PURE__ */ jsx("h2", { id: "aioa-paid-title", children: "All pro features are unlocked" }),
|
|
1132
1170
|
/* @__PURE__ */ jsx("p", { children: "Manage features, accessibility reports and widget analytics from your dashboard." })
|
|
1133
1171
|
] }),
|
|
1134
|
-
/* @__PURE__ */ jsx("div", { className: "aioa-notice-action", children: /* @__PURE__ */
|
|
1135
|
-
"
|
|
1136
|
-
{
|
|
1137
|
-
|
|
1138
|
-
className: "aioa-btn aioa-btn-primary",
|
|
1139
|
-
disabled: busy,
|
|
1140
|
-
"aria-busy": busy || void 0,
|
|
1141
|
-
onClick: (e) => onDashboard(e.currentTarget),
|
|
1142
|
-
children: busy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1143
|
-
/* @__PURE__ */ jsx("span", { className: "aioa-spinner", "aria-hidden": "true" }),
|
|
1144
|
-
/* @__PURE__ */ jsx("span", { children: "Opening\u2026" })
|
|
1145
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1146
|
-
"Dashboard",
|
|
1147
|
-
/* @__PURE__ */ jsx("span", { className: "visually-hidden", children: "(opens in a new tab)" })
|
|
1148
|
-
] })
|
|
1149
|
-
}
|
|
1150
|
-
) })
|
|
1172
|
+
/* @__PURE__ */ jsx("div", { className: "aioa-notice-action", children: /* @__PURE__ */ jsxs(DashboardButton, { id: "dashboard", className: "aioa-btn aioa-btn-primary", children: [
|
|
1173
|
+
"Dashboard",
|
|
1174
|
+
/* @__PURE__ */ jsx("span", { className: "visually-hidden", children: "(opens in a new tab)" })
|
|
1175
|
+
] }) })
|
|
1151
1176
|
] });
|
|
1152
1177
|
}
|
|
1153
1178
|
function SiteStrip({ domain }) {
|
|
@@ -1226,8 +1251,11 @@ function Lockable({
|
|
|
1226
1251
|
/* @__PURE__ */ jsx("div", { ref: contentRef, className: `aioa-lock-content ${contentClassName}`.trim(), children }),
|
|
1227
1252
|
locked && /* @__PURE__ */ jsx("div", { className: `aioa-lock${center ? " is-center" : ""}`, children: /* @__PURE__ */ jsxs("div", { className: "aioa-lock-card", role: "group", "aria-labelledby": `${lockId}-text`, children: [
|
|
1228
1253
|
/* @__PURE__ */ jsx("span", { className: "aioa-lock-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx(LockIcon, {}) }),
|
|
1229
|
-
/* @__PURE__ */ jsx("p", { className: "aioa-lock-text", id: `${lockId}-text`, children: expired ? "Your paid plan has expired.
|
|
1230
|
-
/* @__PURE__ */ jsxs(
|
|
1254
|
+
/* @__PURE__ */ jsx("p", { className: "aioa-lock-text", id: `${lockId}-text`, children: expired ? "Your paid plan has expired. Renew it to view all 100+ features again." : "Try a 10-day free trial to view all 90+ features." }),
|
|
1255
|
+
expired ? /* @__PURE__ */ jsxs(DashboardButton, { id: `renew-${lockId}`, className: "aioa-btn aioa-btn-primary", children: [
|
|
1256
|
+
"Renew Plan",
|
|
1257
|
+
/* @__PURE__ */ jsx("span", { className: "visually-hidden", children: "(opens your dashboard in a new tab)" })
|
|
1258
|
+
] }) : /* @__PURE__ */ jsxs(
|
|
1231
1259
|
"a",
|
|
1232
1260
|
{
|
|
1233
1261
|
href: upgradeHref,
|
|
@@ -1944,6 +1972,8 @@ const AIOA_CSS = `
|
|
|
1944
1972
|
border-radius: var(--radius-sm); background: #fff; color: #420083; font-weight: 700; text-decoration: none; white-space: nowrap;
|
|
1945
1973
|
}
|
|
1946
1974
|
.aioa-btn-white:hover { background: #f3eefa; }
|
|
1975
|
+
button.aioa-btn-white { border: 0; cursor: pointer; }
|
|
1976
|
+
button.aioa-btn-white[disabled] { opacity: .8; cursor: progress; }
|
|
1947
1977
|
.aioa-btn-white svg { width: 17px; height: 17px; }
|
|
1948
1978
|
|
|
1949
1979
|
.aioa-upgrade-note { margin-top: 16px; padding-top: 13px; border-top: 1px solid rgba(255, 255, 255, .16); font-size: 13.5px; color: #d3c1f3; }
|
|
@@ -2091,6 +2121,8 @@ const AIOA_CSS = `
|
|
|
2091
2121
|
/* Icon size: each circle at its own diameter (--d, set in the icon-size partial), bottoms aligned */
|
|
2092
2122
|
.aioa-size-row { --scale: 1; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 22px; }
|
|
2093
2123
|
.aioa-size-row .aioa-icon { width: calc(var(--d) * var(--scale)); }
|
|
2124
|
+
.aioa-size-row .aioa-icon-caption { text-align: center; line-height: 1.35; }
|
|
2125
|
+
.aioa-icon-caption small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
|
|
2094
2126
|
|
|
2095
2127
|
/* ---------- Save bar ---------- */
|
|
2096
2128
|
|
|
@@ -2352,7 +2384,7 @@ function SettingsPage({ tool }) {
|
|
|
2352
2384
|
const upgradeHref = useMemo(
|
|
2353
2385
|
() => upgradeUrl(activeDomain, adminName, adminEmail),
|
|
2354
2386
|
[activeDomain, adminName, adminEmail]
|
|
2355
|
-
), { theme, toggleTheme } = useTheme(), { toasts, toast, dismiss } = useToasts(), [view, setView] = useState({ name: "load" }), [isPaid, setIsPaid] = useState(!1), [planExpired, setPlanExpired] = useState(!1), [tab, setTab] = useState("appearance"), [appearance, setAppearance] = useState(emptyAppearance), [paid, setPaid] = useState(() => paidFrom({})), [dirty, setDirty] = useState(!1), [saving, setSaving] = useState(!1), [score, setScore] = useState({ status: "idle" }), [dashboardBusy, setDashboardBusy] = useState(
|
|
2387
|
+
), { theme, toggleTheme } = useTheme(), { toasts, toast, dismiss } = useToasts(), [view, setView] = useState({ name: "load" }), [isPaid, setIsPaid] = useState(!1), [planExpired, setPlanExpired] = useState(!1), [tab, setTab] = useState("appearance"), [appearance, setAppearance] = useState(emptyAppearance), [paid, setPaid] = useState(() => paidFrom({})), [dirty, setDirty] = useState(!1), [saving, setSaving] = useState(!1), [score, setScore] = useState({ status: "idle" }), [dashboardBusy, setDashboardBusy] = useState(null), latest = useRef({ appearance, paid, isPaid });
|
|
2356
2388
|
latest.current = { appearance, paid, isPaid };
|
|
2357
2389
|
const updateAppearance = useCallback((patch) => {
|
|
2358
2390
|
setAppearance((state) => ({ ...state, ...patch })), setDirty(!0);
|
|
@@ -2390,7 +2422,7 @@ function SettingsPage({ tool }) {
|
|
|
2390
2422
|
}, showDashboardError = (err) => {
|
|
2391
2423
|
const reason = err instanceof TypeError ? "Please check your connection." : err instanceof Error && err.message || "";
|
|
2392
2424
|
toast("error", "Could not open the dashboard", `${reason ? `${reason} ` : ""}Please try again.`);
|
|
2393
|
-
}, openDashboard = () => {
|
|
2425
|
+
}, openDashboard = (id) => {
|
|
2394
2426
|
if (dashboardBusy)
|
|
2395
2427
|
return;
|
|
2396
2428
|
const win = window.open("", "_blank");
|
|
@@ -2399,7 +2431,7 @@ function SettingsPage({ tool }) {
|
|
|
2399
2431
|
win.document.title = "Opening dashboard\u2026", win.document.body.style.cssText = "font-family:system-ui,sans-serif;display:grid;place-items:center;min-height:90vh;color:#420083", win.document.body.textContent = "Opening your All in One Accessibility dashboard\u2026";
|
|
2400
2432
|
} catch {
|
|
2401
2433
|
}
|
|
2402
|
-
setDashboardBusy(
|
|
2434
|
+
setDashboardBusy(id), getDashboardLink(activeDomain).then((result) => {
|
|
2403
2435
|
const link = "link" in result ? result.link : "";
|
|
2404
2436
|
if (!link || !/^https:\/\//i.test(link))
|
|
2405
2437
|
throw new Error(
|
|
@@ -2408,7 +2440,7 @@ function SettingsPage({ tool }) {
|
|
|
2408
2440
|
openIn(win, link);
|
|
2409
2441
|
}).catch((err) => {
|
|
2410
2442
|
win && !win.closed && win.close(), showDashboardError(err);
|
|
2411
|
-
}).finally(() => setDashboardBusy(
|
|
2443
|
+
}).finally(() => setDashboardBusy(null));
|
|
2412
2444
|
}, register2 = useRef({
|
|
2413
2445
|
promise: null,
|
|
2414
2446
|
settled: !1
|
|
@@ -2529,8 +2561,8 @@ function SettingsPage({ tool }) {
|
|
|
2529
2561
|
/* @__PURE__ */ jsx("p", { children: view.message }),
|
|
2530
2562
|
view.retry && /* @__PURE__ */ jsx("button", { type: "button", className: "aioa-btn aioa-btn-primary", onClick: loadSettings, children: "Try again" })
|
|
2531
2563
|
] }),
|
|
2532
|
-
view.name === "settings" && /* @__PURE__ */ jsx(UpgradeUrlContext.Provider, { value: upgradeHref, children: /* @__PURE__ */
|
|
2533
|
-
isPaid ? /* @__PURE__ */ jsx(PaidBanner, {
|
|
2564
|
+
view.name === "settings" && /* @__PURE__ */ jsx(UpgradeUrlContext.Provider, { value: upgradeHref, children: /* @__PURE__ */ jsx(PlanExpiredContext.Provider, { value: planExpired, children: /* @__PURE__ */ jsxs(DashboardContext.Provider, { value: { busy: dashboardBusy, open: openDashboard }, children: [
|
|
2565
|
+
isPaid ? /* @__PURE__ */ jsx(PaidBanner, {}) : /* @__PURE__ */ jsx(UpgradeBanner, {}),
|
|
2534
2566
|
/* @__PURE__ */ jsx(SiteStrip, { domain: activeDomain }),
|
|
2535
2567
|
/* @__PURE__ */ jsx(
|
|
2536
2568
|
Tabs,
|
|
@@ -2620,7 +2652,7 @@ function SettingsPage({ tool }) {
|
|
|
2620
2652
|
/* @__PURE__ */ jsx("p", { className: "aioa-after-note", children: "It may take a few seconds for changes to appear on your website. If you don't see them, clear your browser cache or check in a private window." })
|
|
2621
2653
|
] })
|
|
2622
2654
|
] })
|
|
2623
|
-
] }) })
|
|
2655
|
+
] }) }) })
|
|
2624
2656
|
] })
|
|
2625
2657
|
] }),
|
|
2626
2658
|
/* @__PURE__ */ jsx(ToastRegion, { toasts, onDismiss: dismiss })
|