@pigmilcom/a11y 1.0.6 → 1.0.7
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.
Potentially problematic release.
This version of @pigmilcom/a11y might be problematic. Click here for more details.
- package/README.md +1 -23
- package/dist/a11y.cdn.js +4 -4
- package/dist/index.css +347 -634
- package/dist/index.js +35 -35
- package/dist/index.min.css +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.mjs +35 -35
- package/package.json +3 -6
- package/src/cdn.jsx +3 -4
package/dist/index.mjs
CHANGED
|
@@ -61,7 +61,7 @@ var TOGGLES = [
|
|
|
61
61
|
key: "highContrast",
|
|
62
62
|
label: "High Contrast",
|
|
63
63
|
desc: "Increase colour contrast for readability",
|
|
64
|
-
icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "
|
|
64
|
+
icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "pgm-icon", fill: "none", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true", children: [
|
|
65
65
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
66
66
|
/* @__PURE__ */ jsx("path", { d: "M12 2v20" }),
|
|
67
67
|
/* @__PURE__ */ jsx("path", { d: "M12 2a10 10 0 0 1 0 20", fill: "currentColor", stroke: "none" })
|
|
@@ -71,7 +71,7 @@ var TOGGLES = [
|
|
|
71
71
|
key: "invertColors",
|
|
72
72
|
label: "Invert Colors",
|
|
73
73
|
desc: "Invert all page colours",
|
|
74
|
-
icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "
|
|
74
|
+
icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "pgm-icon", fill: "none", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true", children: [
|
|
75
75
|
/* @__PURE__ */ jsx("path", { d: "M12 3v18M3 12h18" }),
|
|
76
76
|
/* @__PURE__ */ jsx("path", { d: "M12 3a9 9 0 0 1 0 18", fill: "currentColor", stroke: "none" })
|
|
77
77
|
] })
|
|
@@ -80,7 +80,7 @@ var TOGGLES = [
|
|
|
80
80
|
key: "grayscale",
|
|
81
81
|
label: "Grayscale",
|
|
82
82
|
desc: "Remove all colour from the page",
|
|
83
|
-
icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "
|
|
83
|
+
icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "pgm-icon", fill: "none", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true", children: [
|
|
84
84
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
|
|
85
85
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "4", fill: "currentColor", stroke: "none" })
|
|
86
86
|
] })
|
|
@@ -89,13 +89,13 @@ var TOGGLES = [
|
|
|
89
89
|
key: "reduceMotion",
|
|
90
90
|
label: "Reduce Motion",
|
|
91
91
|
desc: "Stop animations and transitions",
|
|
92
|
-
icon: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "
|
|
92
|
+
icon: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "pgm-icon", fill: "none", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M5 12h14M12 5l-7 7 7 7" }) })
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
key: "highlightLinks",
|
|
96
96
|
label: "Highlight Links",
|
|
97
97
|
desc: "Make all links visible at a glance",
|
|
98
|
-
icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "
|
|
98
|
+
icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "pgm-icon", fill: "none", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true", children: [
|
|
99
99
|
/* @__PURE__ */ jsx("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }),
|
|
100
100
|
/* @__PURE__ */ jsx("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })
|
|
101
101
|
] })
|
|
@@ -104,13 +104,13 @@ var TOGGLES = [
|
|
|
104
104
|
key: "textSpacing",
|
|
105
105
|
label: "Text Spacing",
|
|
106
106
|
desc: "Increase letter, word & line spacing",
|
|
107
|
-
icon: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "
|
|
107
|
+
icon: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "pgm-icon", fill: "none", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M4 6h16M4 10h16M4 14h16M4 18h16" }) })
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
key: "adhd",
|
|
111
111
|
label: "ADHD Friendly",
|
|
112
112
|
desc: "Remove distractions, add focus ring",
|
|
113
|
-
icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "
|
|
113
|
+
icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "pgm-icon", fill: "none", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true", children: [
|
|
114
114
|
/* @__PURE__ */ jsx("path", { d: "M12 2L2 7l10 5 10-5-10-5z" }),
|
|
115
115
|
/* @__PURE__ */ jsx("path", { d: "M2 17l10 5 10-5" }),
|
|
116
116
|
/* @__PURE__ */ jsx("path", { d: "M2 12l10 5 10-5" })
|
|
@@ -120,7 +120,7 @@ var TOGGLES = [
|
|
|
120
120
|
key: "dyslexia",
|
|
121
121
|
label: "Dyslexia Font",
|
|
122
122
|
desc: "Switch to a high-readability typeface",
|
|
123
|
-
icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "
|
|
123
|
+
icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "pgm-icon", fill: "none", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true", children: [
|
|
124
124
|
/* @__PURE__ */ jsx("path", { d: "M4 7V4h16v3" }),
|
|
125
125
|
/* @__PURE__ */ jsx("path", { d: "M9 20h6" }),
|
|
126
126
|
/* @__PURE__ */ jsx("path", { d: "M12 4v16" })
|
|
@@ -172,13 +172,13 @@ function A11yWidget({ className }) {
|
|
|
172
172
|
"aria-expanded": open,
|
|
173
173
|
"aria-haspopup": "dialog",
|
|
174
174
|
onClick: () => setOpen((v) => !v),
|
|
175
|
-
className: `
|
|
175
|
+
className: `pgm-btn${className ? ` ${className}` : ""}`,
|
|
176
176
|
children: [
|
|
177
|
-
/* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "
|
|
177
|
+
/* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "pgm-icon-lg", fill: "none", stroke: "currentColor", strokeWidth: 1.8, "aria-hidden": "true", children: [
|
|
178
178
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "5", r: "1.5", fill: "currentColor", stroke: "none" }),
|
|
179
179
|
/* @__PURE__ */ jsx("path", { d: "M5 8.5h14M8 8.5l1 10 3-4 3 4 1-10", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
180
180
|
] }),
|
|
181
|
-
isModified && /* @__PURE__ */ jsx("span", { className: "
|
|
181
|
+
isModified && /* @__PURE__ */ jsx("span", { className: "pgm-dot", "aria-hidden": "true" })
|
|
182
182
|
]
|
|
183
183
|
}
|
|
184
184
|
),
|
|
@@ -187,7 +187,7 @@ function A11yWidget({ className }) {
|
|
|
187
187
|
/* @__PURE__ */ jsx(
|
|
188
188
|
"div",
|
|
189
189
|
{
|
|
190
|
-
className: "
|
|
190
|
+
className: "pgm-backdrop",
|
|
191
191
|
onClick: () => setOpen(false),
|
|
192
192
|
"aria-hidden": "true"
|
|
193
193
|
}
|
|
@@ -198,12 +198,12 @@ function A11yWidget({ className }) {
|
|
|
198
198
|
role: "dialog",
|
|
199
199
|
"aria-modal": "true",
|
|
200
200
|
"aria-label": "Accessibility settings",
|
|
201
|
-
className: "
|
|
201
|
+
className: "pgm-dialog",
|
|
202
202
|
children: [
|
|
203
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
203
|
+
/* @__PURE__ */ jsxs("div", { className: "pgm-header", children: [
|
|
204
204
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
205
|
-
/* @__PURE__ */ jsx("p", { className: "
|
|
206
|
-
/* @__PURE__ */ jsx("p", { className: "
|
|
205
|
+
/* @__PURE__ */ jsx("p", { className: "pgm-header-title", children: "Accessibility" }),
|
|
206
|
+
/* @__PURE__ */ jsx("p", { className: "pgm-header-subtitle", children: "WCAG 2.1 \xB7 Personalise your experience" })
|
|
207
207
|
] }),
|
|
208
208
|
/* @__PURE__ */ jsx(
|
|
209
209
|
"button",
|
|
@@ -211,29 +211,29 @@ function A11yWidget({ className }) {
|
|
|
211
211
|
type: "button",
|
|
212
212
|
"aria-label": "Close accessibility panel",
|
|
213
213
|
onClick: () => setOpen(false),
|
|
214
|
-
className: "
|
|
215
|
-
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "
|
|
214
|
+
className: "pgm-close-btn",
|
|
215
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "pgm-icon-sm", fill: "none", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12", strokeLinecap: "round" }) })
|
|
216
216
|
}
|
|
217
217
|
)
|
|
218
218
|
] }),
|
|
219
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
220
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
221
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
222
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
219
|
+
/* @__PURE__ */ jsxs("div", { className: "pgm-size-section", children: [
|
|
220
|
+
/* @__PURE__ */ jsxs("div", { className: "pgm-size-header", children: [
|
|
221
|
+
/* @__PURE__ */ jsx("span", { className: "pgm-size-label", children: "Text Size" }),
|
|
222
|
+
/* @__PURE__ */ jsx("span", { className: "pgm-size-value", children: TEXT_LABELS[prefs.textSize] })
|
|
223
223
|
] }),
|
|
224
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
224
|
+
/* @__PURE__ */ jsx("div", { className: "pgm-size-btns", children: TEXT_LABELS.map((lbl, i) => /* @__PURE__ */ jsx(
|
|
225
225
|
"button",
|
|
226
226
|
{
|
|
227
227
|
type: "button",
|
|
228
228
|
"aria-pressed": prefs.textSize === i,
|
|
229
229
|
onClick: () => update({ textSize: i }),
|
|
230
|
-
className: `
|
|
230
|
+
className: `pgm-size-btn ${prefs.textSize === i ? "pgm-size-btn--active" : "pgm-size-btn--inactive"}`,
|
|
231
231
|
children: lbl
|
|
232
232
|
},
|
|
233
233
|
lbl
|
|
234
234
|
)) })
|
|
235
235
|
] }),
|
|
236
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
236
|
+
/* @__PURE__ */ jsx("div", { className: "pgm-toggle-list", children: TOGGLES.map(({ key, label, desc, icon }) => {
|
|
237
237
|
const on = prefs[key];
|
|
238
238
|
return /* @__PURE__ */ jsxs(
|
|
239
239
|
"button",
|
|
@@ -242,22 +242,22 @@ function A11yWidget({ className }) {
|
|
|
242
242
|
role: "switch",
|
|
243
243
|
"aria-checked": on,
|
|
244
244
|
onClick: () => update({ [key]: !on }),
|
|
245
|
-
className: `
|
|
245
|
+
className: `pgm-toggle-btn${on ? " pgm-toggle-btn--on" : ""}`,
|
|
246
246
|
children: [
|
|
247
|
-
/* @__PURE__ */ jsx("span", { className: `
|
|
248
|
-
/* @__PURE__ */ jsxs("span", { className: "
|
|
249
|
-
/* @__PURE__ */ jsx("span", { className: `
|
|
250
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
247
|
+
/* @__PURE__ */ jsx("span", { className: `pgm-toggle-icon${on ? " pgm-toggle-icon--on" : ""}`, children: icon }),
|
|
248
|
+
/* @__PURE__ */ jsxs("span", { className: "pgm-toggle-text", children: [
|
|
249
|
+
/* @__PURE__ */ jsx("span", { className: `pgm-toggle-label${on ? " pgm-toggle-label--on" : ""}`, children: label }),
|
|
250
|
+
/* @__PURE__ */ jsx("span", { className: "pgm-toggle-desc", children: desc })
|
|
251
251
|
] }),
|
|
252
252
|
/* @__PURE__ */ jsx(
|
|
253
253
|
"span",
|
|
254
254
|
{
|
|
255
255
|
"aria-hidden": "true",
|
|
256
|
-
className: `
|
|
256
|
+
className: `pgm-pill${on ? " pgm-pill--on" : " pgm-pill--off"}`,
|
|
257
257
|
children: /* @__PURE__ */ jsx(
|
|
258
258
|
"span",
|
|
259
259
|
{
|
|
260
|
-
className: `
|
|
260
|
+
className: `pgm-pill-knob${on ? " pgm-pill-knob--on" : " pgm-pill-knob--off"}`
|
|
261
261
|
}
|
|
262
262
|
)
|
|
263
263
|
}
|
|
@@ -267,15 +267,15 @@ function A11yWidget({ className }) {
|
|
|
267
267
|
key
|
|
268
268
|
);
|
|
269
269
|
}) }),
|
|
270
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
271
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
270
|
+
/* @__PURE__ */ jsxs("div", { className: "pgm-footer", children: [
|
|
271
|
+
/* @__PURE__ */ jsx("span", { className: "pgm-footer-note", children: "Changes apply instantly & persist" }),
|
|
272
272
|
/* @__PURE__ */ jsx(
|
|
273
273
|
"button",
|
|
274
274
|
{
|
|
275
275
|
type: "button",
|
|
276
276
|
onClick: reset,
|
|
277
277
|
disabled: !isModified,
|
|
278
|
-
className: "
|
|
278
|
+
className: "pgm-reset-btn",
|
|
279
279
|
children: "Reset all"
|
|
280
280
|
}
|
|
281
281
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pigmilcom/a11y",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "WCAG 2.1 accessibility widget for React — text size, contrast, dyslexia font, motion reduction, and more.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build:js": "tsup",
|
|
42
42
|
"build:js:min": "tsup --config tsup.min.config.mjs",
|
|
43
|
-
"build:css": "
|
|
44
|
-
"build:css:min": "
|
|
43
|
+
"build:css": "node scripts/build-css.js",
|
|
44
|
+
"build:css:min": "node scripts/build-css.js",
|
|
45
45
|
"build:cdn": "npm run build:css && tsup --config tsup.cdn.config.mjs && node -e \"require('fs').unlinkSync('./dist/a11y.cdn.css')\"",
|
|
46
46
|
"build": "npm run build:js && npm run build:js:min && npm run build:css && npm run build:css:min && npm run build:cdn",
|
|
47
47
|
"dev": "tsup --watch",
|
|
@@ -52,11 +52,8 @@
|
|
|
52
52
|
"react-dom": ">=17.0.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"autoprefixer": "^10.4.20",
|
|
56
|
-
"postcss": "^8.4.47",
|
|
57
55
|
"react": "^18.3.1",
|
|
58
56
|
"react-dom": "^18.3.1",
|
|
59
|
-
"tailwindcss": "^3.4.14",
|
|
60
57
|
"tsup": "^8.3.0",
|
|
61
58
|
"typescript": "^5.7.3"
|
|
62
59
|
},
|
package/src/cdn.jsx
CHANGED
|
@@ -17,15 +17,14 @@
|
|
|
17
17
|
import { createRoot } from 'react-dom/client';
|
|
18
18
|
import A11yWidget from './widget.jsx';
|
|
19
19
|
|
|
20
|
-
// Inline the pre-built CSS (
|
|
20
|
+
// Inline the pre-built CSS (widget UI + a11y modifier rules).
|
|
21
21
|
// esbuild treats .css files as raw text via the loader option in tsup.cdn.config.mjs.
|
|
22
22
|
import css from '../dist/index.css';
|
|
23
23
|
|
|
24
24
|
// ── Capture currentScript synchronously (only valid during initial execution) ─
|
|
25
25
|
const _script = document.currentScript;
|
|
26
26
|
|
|
27
|
-
// ── Position map — inline CSS applied to the container
|
|
28
|
-
// conflicts where .relative overrides .fixed when both are on the same element)
|
|
27
|
+
// ── Position map — inline CSS applied to the container ────────────────────────
|
|
29
28
|
const POSITIONS = {
|
|
30
29
|
'bottom-right': 'bottom:1.25rem;right:1.25rem',
|
|
31
30
|
'bottom-left': 'bottom:1.25rem;left:1.25rem',
|
|
@@ -56,7 +55,7 @@ function mount() {
|
|
|
56
55
|
container.setAttribute('style', `position:fixed;z-index:9998;${posCSS}`);
|
|
57
56
|
document.body.appendChild(container);
|
|
58
57
|
_root = createRoot(container);
|
|
59
|
-
_root.render(<A11yWidget
|
|
58
|
+
_root.render(<A11yWidget />);
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
function unmount() {
|