@bauer-group/accessibility-widget 1.0.3
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/LICENSE +21 -0
- package/README.md +259 -0
- package/dist/accessibility-widget-core.min.js +6 -0
- package/dist/accessibility-widget-core.min.js.map +7 -0
- package/dist/accessibility-widget-loader.min.js +14 -0
- package/dist/accessibility-widget-loader.min.js.map +7 -0
- package/dist/accessibility-widget.min.css +7 -0
- package/dist/accessibility-widget.min.css.map +7 -0
- package/dist/config.d.ts +33 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/core.d.ts +31 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/features/apply.d.ts +3 -0
- package/dist/features/apply.d.ts.map +1 -0
- package/dist/features/profile.d.ts +3 -0
- package/dist/features/profile.d.ts.map +1 -0
- package/dist/features/reading-guide.d.ts +2 -0
- package/dist/features/reading-guide.d.ts.map +1 -0
- package/dist/features/reading-mask.d.ts +2 -0
- package/dist/features/reading-mask.d.ts.map +1 -0
- package/dist/features/structure-nav.d.ts +2 -0
- package/dist/features/structure-nav.d.ts.map +1 -0
- package/dist/features/tts.d.ts +7 -0
- package/dist/features/tts.d.ts.map +1 -0
- package/dist/focus-trap.d.ts +6 -0
- package/dist/focus-trap.d.ts.map +1 -0
- package/dist/i18n/ar.d.ts +3 -0
- package/dist/i18n/ar.d.ts.map +1 -0
- package/dist/i18n/bn.d.ts +3 -0
- package/dist/i18n/bn.d.ts.map +1 -0
- package/dist/i18n/cs.d.ts +3 -0
- package/dist/i18n/cs.d.ts.map +1 -0
- package/dist/i18n/de.d.ts +3 -0
- package/dist/i18n/de.d.ts.map +1 -0
- package/dist/i18n/el.d.ts +3 -0
- package/dist/i18n/el.d.ts.map +1 -0
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/es.d.ts +3 -0
- package/dist/i18n/es.d.ts.map +1 -0
- package/dist/i18n/fa.d.ts +3 -0
- package/dist/i18n/fa.d.ts.map +1 -0
- package/dist/i18n/fr.d.ts +3 -0
- package/dist/i18n/fr.d.ts.map +1 -0
- package/dist/i18n/he.d.ts +3 -0
- package/dist/i18n/he.d.ts.map +1 -0
- package/dist/i18n/hi.d.ts +3 -0
- package/dist/i18n/hi.d.ts.map +1 -0
- package/dist/i18n/hu.d.ts +3 -0
- package/dist/i18n/hu.d.ts.map +1 -0
- package/dist/i18n/id.d.ts +3 -0
- package/dist/i18n/id.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +6 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/it.d.ts +3 -0
- package/dist/i18n/it.d.ts.map +1 -0
- package/dist/i18n/ja.d.ts +3 -0
- package/dist/i18n/ja.d.ts.map +1 -0
- package/dist/i18n/ko.d.ts +3 -0
- package/dist/i18n/ko.d.ts.map +1 -0
- package/dist/i18n/nl.d.ts +3 -0
- package/dist/i18n/nl.d.ts.map +1 -0
- package/dist/i18n/pl.d.ts +3 -0
- package/dist/i18n/pl.d.ts.map +1 -0
- package/dist/i18n/pt.d.ts +3 -0
- package/dist/i18n/pt.d.ts.map +1 -0
- package/dist/i18n/ro.d.ts +3 -0
- package/dist/i18n/ro.d.ts.map +1 -0
- package/dist/i18n/ru.d.ts +3 -0
- package/dist/i18n/ru.d.ts.map +1 -0
- package/dist/i18n/sv.d.ts +3 -0
- package/dist/i18n/sv.d.ts.map +1 -0
- package/dist/i18n/th.d.ts +3 -0
- package/dist/i18n/th.d.ts.map +1 -0
- package/dist/i18n/tr.d.ts +3 -0
- package/dist/i18n/tr.d.ts.map +1 -0
- package/dist/i18n/types.d.ts +44 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/uk.d.ts +3 -0
- package/dist/i18n/uk.d.ts.map +1 -0
- package/dist/i18n/ur.d.ts +3 -0
- package/dist/i18n/ur.d.ts.map +1 -0
- package/dist/i18n/vi.d.ts +3 -0
- package/dist/i18n/vi.d.ts.map +1 -0
- package/dist/i18n/zh.d.ts +3 -0
- package/dist/i18n/zh.d.ts.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/integrity.json +9 -0
- package/dist/integrity.txt +12 -0
- package/dist/loader.d.ts +2 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/panel/drag.d.ts +34 -0
- package/dist/panel/drag.d.ts.map +1 -0
- package/dist/panel/panel.d.ts +23 -0
- package/dist/panel/panel.d.ts.map +1 -0
- package/dist/state.d.ts +18 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/styles/critical.d.ts +16 -0
- package/dist/styles/critical.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/locale.d.ts +11 -0
- package/dist/types/locale.d.ts.map +1 -0
- package/dist/types/widget.d.ts +207 -0
- package/dist/types/widget.d.ts.map +1 -0
- package/dist/util/debug.d.ts +8 -0
- package/dist/util/debug.d.ts.map +1 -0
- package/dist/util/dom.d.ts +19 -0
- package/dist/util/dom.d.ts.map +1 -0
- package/dist/util/events.d.ts +38 -0
- package/dist/util/events.d.ts.map +1 -0
- package/dist/util/feature-icons.d.ts +33 -0
- package/dist/util/feature-icons.d.ts.map +1 -0
- package/dist/util/language-names.d.ts +12 -0
- package/dist/util/language-names.d.ts.map +1 -0
- package/dist/util/svg.d.ts +38 -0
- package/dist/util/svg.d.ts.map +1 -0
- package/package.json +67 -0
- package/src/config.ts +213 -0
- package/src/core.ts +173 -0
- package/src/features/apply.ts +37 -0
- package/src/features/profile.ts +18 -0
- package/src/features/reading-guide.ts +25 -0
- package/src/features/reading-mask.ts +25 -0
- package/src/features/structure-nav.ts +43 -0
- package/src/features/tts.ts +73 -0
- package/src/focus-trap.ts +35 -0
- package/src/globals.d.ts +63 -0
- package/src/i18n/ar.ts +48 -0
- package/src/i18n/bn.ts +48 -0
- package/src/i18n/cs.ts +48 -0
- package/src/i18n/de.ts +65 -0
- package/src/i18n/el.ts +48 -0
- package/src/i18n/en.ts +65 -0
- package/src/i18n/es.ts +48 -0
- package/src/i18n/fa.ts +48 -0
- package/src/i18n/fr.ts +48 -0
- package/src/i18n/he.ts +48 -0
- package/src/i18n/hi.ts +48 -0
- package/src/i18n/hu.ts +48 -0
- package/src/i18n/id.ts +48 -0
- package/src/i18n/index.ts +70 -0
- package/src/i18n/it.ts +48 -0
- package/src/i18n/ja.ts +48 -0
- package/src/i18n/ko.ts +48 -0
- package/src/i18n/nl.ts +48 -0
- package/src/i18n/pl.ts +48 -0
- package/src/i18n/pt.ts +48 -0
- package/src/i18n/ro.ts +48 -0
- package/src/i18n/ru.ts +48 -0
- package/src/i18n/sv.ts +48 -0
- package/src/i18n/th.ts +48 -0
- package/src/i18n/tr.ts +48 -0
- package/src/i18n/types.ts +36 -0
- package/src/i18n/uk.ts +48 -0
- package/src/i18n/ur.ts +48 -0
- package/src/i18n/vi.ts +48 -0
- package/src/i18n/zh.ts +48 -0
- package/src/index.ts +9 -0
- package/src/loader.ts +533 -0
- package/src/panel/drag.ts +210 -0
- package/src/panel/panel.ts +617 -0
- package/src/state.ts +91 -0
- package/src/styles/critical.ts +56 -0
- package/src/styles/widget.css +739 -0
- package/src/types/index.ts +2 -0
- package/src/types/locale.ts +55 -0
- package/src/types/widget.ts +300 -0
- package/src/util/debug.ts +12 -0
- package/src/util/dom.ts +68 -0
- package/src/util/events.ts +54 -0
- package/src/util/feature-icons.ts +163 -0
- package/src/util/language-names.ts +41 -0
- package/src/util/svg.ts +93 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Critical CSS inlined by the loader. Kept minimal so the loader stays ~4 KB gzip.
|
|
3
|
+
* Uses only `data-aw-*` attributes on <html>, never touches host DOM.
|
|
4
|
+
*
|
|
5
|
+
* The primaryColor + offset + zIndex are interpolated at runtime so brands
|
|
6
|
+
* can theme and layout without a build step.
|
|
7
|
+
*/
|
|
8
|
+
export interface CriticalCssOptions {
|
|
9
|
+
primaryColor: string;
|
|
10
|
+
hideOnPrint: boolean;
|
|
11
|
+
offsetX: number;
|
|
12
|
+
offsetY: number;
|
|
13
|
+
zIndex: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function buildCriticalCss(opts: CriticalCssOptions): string {
|
|
17
|
+
const { primaryColor, hideOnPrint, offsetX, offsetY, zIndex } = opts;
|
|
18
|
+
return (
|
|
19
|
+
// base CSS variables
|
|
20
|
+
'html[data-aw-instant]{--aw-font-scale:1;--aw-line-height:1.5;--aw-letter-spacing:0em}' +
|
|
21
|
+
// typography applied via rem-safe inheritance
|
|
22
|
+
'html[data-aw-instant] body,html[data-aw-instant] p,html[data-aw-instant] li,html[data-aw-instant] td,html[data-aw-instant] span,html[data-aw-instant] a,html[data-aw-instant] button,html[data-aw-instant] input,html[data-aw-instant] textarea{font-size:calc(1em * var(--aw-font-scale));line-height:var(--aw-line-height);letter-spacing:var(--aw-letter-spacing)}' +
|
|
23
|
+
// contrast modes (filter-only — no DOM mutation)
|
|
24
|
+
'html[data-aw-contrast="high"]{filter:contrast(1.35)}' +
|
|
25
|
+
'html[data-aw-contrast="dark"]{filter:invert(1) hue-rotate(180deg)}' +
|
|
26
|
+
'html[data-aw-contrast="dark"] img,html[data-aw-contrast="dark"] video,html[data-aw-contrast="dark"] picture{filter:invert(1) hue-rotate(180deg)}' +
|
|
27
|
+
'html[data-aw-contrast="invert"]{filter:invert(1) hue-rotate(180deg)}' +
|
|
28
|
+
'html[data-aw-grayscale]{filter:grayscale(1)}' +
|
|
29
|
+
'html[data-aw-invert]{filter:invert(1) hue-rotate(180deg)}' +
|
|
30
|
+
'html[data-aw-invert] img,html[data-aw-invert] video{filter:invert(1) hue-rotate(180deg)}' +
|
|
31
|
+
// dyslexia
|
|
32
|
+
'html[data-aw-dyslexia] *{font-family:"OpenDyslexic","Comic Sans MS",sans-serif!important}' +
|
|
33
|
+
// links
|
|
34
|
+
'html[data-aw-highlight-links] a{text-decoration:underline!important;outline:2px solid #ffeb3b!important;background:#fffde7!important;color:#000!important}' +
|
|
35
|
+
// motion
|
|
36
|
+
'html[data-aw-pause-animations] *,html[data-aw-pause-animations] *::before,html[data-aw-pause-animations] *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}' +
|
|
37
|
+
// big cursor (embedded SVG — no extra request)
|
|
38
|
+
'html[data-aw-big-cursor],html[data-aw-big-cursor] *{cursor:url("data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2248%22 height=%2248%22 viewBox=%220 0 48 48%22><path d=%22M6 4 L42 24 L26 28 L22 44 Z%22 fill=%22%23000%22 stroke=%22%23fff%22 stroke-width=%222%22/></svg>") 0 0,auto!important}' +
|
|
39
|
+
// thick focus
|
|
40
|
+
'html[data-aw-focus] *:focus,html[data-aw-focus] *:focus-visible{outline:4px solid #ff6a00!important;outline-offset:2px!important}' +
|
|
41
|
+
// FAB
|
|
42
|
+
`.aw-fab{position:fixed;width:48px;height:48px;border-radius:50%;background:${primaryColor};color:#fff;border:2px solid #fff;box-shadow:0 4px 12px rgba(0,0,0,.25);cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:${zIndex};padding:0;transition:transform .15s}` +
|
|
43
|
+
'.aw-fab:hover,.aw-fab:focus-visible{outline:3px solid #ff6a00;outline-offset:2px;transform:scale(1.05)}' +
|
|
44
|
+
'.aw-fab svg{width:28px;height:28px;fill:currentColor}' +
|
|
45
|
+
`.aw-fab--bottom-right{bottom:${offsetY}px;right:${offsetX}px}` +
|
|
46
|
+
`.aw-fab--bottom-left{bottom:${offsetY}px;left:${offsetX}px}` +
|
|
47
|
+
`.aw-fab--top-right{top:${offsetY}px;right:${offsetX}px}` +
|
|
48
|
+
`.aw-fab--top-left{top:${offsetY}px;left:${offsetX}px}` +
|
|
49
|
+
// Drag: when data-aw-fab-pos=custom, ignore corner-based anchoring and
|
|
50
|
+
// honor the inline --aw-fab-x / --aw-fab-y custom properties set by
|
|
51
|
+
// the loader. Explicit unsets override the corner-class rules above.
|
|
52
|
+
'.aw-fab[data-aw-fab-pos="custom"]{top:var(--aw-fab-y)!important;left:var(--aw-fab-x)!important;right:auto!important;bottom:auto!important}' +
|
|
53
|
+
(hideOnPrint ? '@media print{.aw-fab{display:none!important}}' : '') +
|
|
54
|
+
'@media (prefers-reduced-motion:reduce){.aw-fab{transition:none}}'
|
|
55
|
+
);
|
|
56
|
+
}
|