@yaronelh/accessibilitytool 1.0.1

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.
Files changed (82) hide show
  1. package/CHANGELOG.md +162 -0
  2. package/LICENSE +21 -0
  3. package/README.md +373 -0
  4. package/dist/common.d.ts +22 -0
  5. package/dist/common.js +215 -0
  6. package/dist/common.js.map +1 -0
  7. package/dist/core/event-utils.d.ts +2 -0
  8. package/dist/core/event-utils.js +15 -0
  9. package/dist/core/event-utils.js.map +1 -0
  10. package/dist/core/hotkeys.d.ts +3 -0
  11. package/dist/core/hotkeys.js +35 -0
  12. package/dist/core/hotkeys.js.map +1 -0
  13. package/dist/core/icon-assets.d.ts +13 -0
  14. package/dist/core/icon-assets.js +148 -0
  15. package/dist/core/icon-assets.js.map +1 -0
  16. package/dist/core/options.d.ts +6 -0
  17. package/dist/core/options.js +58 -0
  18. package/dist/core/options.js.map +1 -0
  19. package/dist/core/security.d.ts +3 -0
  20. package/dist/core/security.js +45 -0
  21. package/dist/core/security.js.map +1 -0
  22. package/dist/core/session.d.ts +14 -0
  23. package/dist/core/session.js +43 -0
  24. package/dist/core/session.js.map +1 -0
  25. package/dist/interfaces/accessibility.interface.d.ts +208 -0
  26. package/dist/interfaces/accessibility.interface.js +23 -0
  27. package/dist/interfaces/accessibility.interface.js.map +1 -0
  28. package/dist/interfaces/common.interface.d.ts +39 -0
  29. package/dist/interfaces/common.interface.js +3 -0
  30. package/dist/interfaces/common.interface.js.map +1 -0
  31. package/dist/interfaces/menu.interface.d.ts +18 -0
  32. package/dist/interfaces/menu.interface.js +3 -0
  33. package/dist/interfaces/menu.interface.js.map +1 -0
  34. package/dist/main.d.ts +84 -0
  35. package/dist/main.js +1771 -0
  36. package/dist/main.js.map +1 -0
  37. package/dist/menu-interface.d.ts +24 -0
  38. package/dist/menu-interface.js +561 -0
  39. package/dist/menu-interface.js.map +1 -0
  40. package/dist/storage.d.ts +9 -0
  41. package/dist/storage.js +40 -0
  42. package/dist/storage.js.map +1 -0
  43. package/dist-cjs/common.d.ts +22 -0
  44. package/dist-cjs/common.js +215 -0
  45. package/dist-cjs/common.js.map +1 -0
  46. package/dist-cjs/core/event-utils.d.ts +2 -0
  47. package/dist-cjs/core/event-utils.js +15 -0
  48. package/dist-cjs/core/event-utils.js.map +1 -0
  49. package/dist-cjs/core/hotkeys.d.ts +3 -0
  50. package/dist-cjs/core/hotkeys.js +35 -0
  51. package/dist-cjs/core/hotkeys.js.map +1 -0
  52. package/dist-cjs/core/icon-assets.d.ts +13 -0
  53. package/dist-cjs/core/icon-assets.js +148 -0
  54. package/dist-cjs/core/icon-assets.js.map +1 -0
  55. package/dist-cjs/core/options.d.ts +6 -0
  56. package/dist-cjs/core/options.js +58 -0
  57. package/dist-cjs/core/options.js.map +1 -0
  58. package/dist-cjs/core/security.d.ts +3 -0
  59. package/dist-cjs/core/security.js +45 -0
  60. package/dist-cjs/core/security.js.map +1 -0
  61. package/dist-cjs/core/session.d.ts +14 -0
  62. package/dist-cjs/core/session.js +43 -0
  63. package/dist-cjs/core/session.js.map +1 -0
  64. package/dist-cjs/interfaces/accessibility.interface.d.ts +208 -0
  65. package/dist-cjs/interfaces/accessibility.interface.js +23 -0
  66. package/dist-cjs/interfaces/accessibility.interface.js.map +1 -0
  67. package/dist-cjs/interfaces/common.interface.d.ts +39 -0
  68. package/dist-cjs/interfaces/common.interface.js +3 -0
  69. package/dist-cjs/interfaces/common.interface.js.map +1 -0
  70. package/dist-cjs/interfaces/menu.interface.d.ts +18 -0
  71. package/dist-cjs/interfaces/menu.interface.js +3 -0
  72. package/dist-cjs/interfaces/menu.interface.js.map +1 -0
  73. package/dist-cjs/main.d.ts +84 -0
  74. package/dist-cjs/main.js +1771 -0
  75. package/dist-cjs/main.js.map +1 -0
  76. package/dist-cjs/menu-interface.d.ts +24 -0
  77. package/dist-cjs/menu-interface.js +561 -0
  78. package/dist-cjs/menu-interface.js.map +1 -0
  79. package/dist-cjs/storage.d.ts +9 -0
  80. package/dist-cjs/storage.js +40 -0
  81. package/dist-cjs/storage.js.map +1 -0
  82. package/package.json +82 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,162 @@
1
+ # Changelog
2
+
3
+ This file tracks versioned changes for the `accessibilitytool` repository.
4
+
5
+ There are no Git tags in this repository. The latest upstream version marker found in commit history is `6.1.0` at commit `1cfaa72` (`master - build version 6.1.0`).
6
+
7
+ All fork work completed after that point is recorded below as the first independent fork release line built on top of `6.1.0`.
8
+
9
+ ## [1.0.1] - 2026-03-23
10
+
11
+ First modernized fork release, built on top of upstream `6.1.0`.
12
+
13
+ ### Added
14
+
15
+ - Added repository-level documentation and review artifacts:
16
+ - `CODE_OVERVIEW.md`
17
+ - `SECURITY_REPORT.md`
18
+ - `MALICIOUS_CODE_REVIEW.md`
19
+ - `SUSPICIOUS_PATTERNS_REPORT.md`
20
+ - `UPGRADE_PLAN.md`
21
+ - Added `CHANGELOG.md` and included it in the published package contents.
22
+ - Added a modern root test setup using `vitest` and `jsdom`.
23
+ - Added smoke tests for:
24
+ - constructor behavior
25
+ - DOM injection
26
+ - keyboard activation
27
+ - destroy cleanup
28
+ - menu accessibility state synchronization
29
+ - Added security regression tests for:
30
+ - DOM attribute sanitization
31
+ - iframe URL restrictions
32
+ - session key migration and legacy restore behavior
33
+ - Added new internal core modules under `src/core/`:
34
+ - `event-utils.ts`
35
+ - `hotkeys.ts`
36
+ - `options.ts`
37
+ - `security.ts`
38
+ - `session.ts`
39
+ - Added new development scripts:
40
+ - `clean`
41
+ - `lint`
42
+ - `typecheck`
43
+ - `test`
44
+ - `test:watch`
45
+ - `format`
46
+ - `prepack`
47
+ - Added ESLint configuration in `eslint.config.mjs`.
48
+ - Added menu accessibility and UI improvements:
49
+ - `aria-controls`
50
+ - `aria-expanded`
51
+ - `aria-hidden`
52
+ - dialog labelling
53
+ - explicit button labels
54
+ - `Escape` to close
55
+ - focus return to the launcher
56
+ - focus-visible styling
57
+ - responsive and reduced-motion menu styling
58
+
59
+ ### Changed
60
+
61
+ - Replaced the deprecated TSLint stack with ESLint.
62
+ - Upgraded root tooling and supporting dependencies:
63
+ - `@types/node` to `25.5.0`
64
+ - `prettier` to `3.8.1`
65
+ - `ts-loader` to `9.5.4`
66
+ - `vite` to `8.0.2`
67
+ - introduced `eslint`, `@typescript-eslint/*`, `eslint-config-prettier`, `vitest`, and `jsdom`
68
+ - Kept `typescript` on `5.9.3` instead of moving to `6.0.2` because the currently compatible lint/tooling stack did not install cleanly with TypeScript 6.
69
+ - Refactored the runtime so `src/main.ts` now delegates option normalization, hotkey parsing, explicit event handling, session persistence, and security helpers to internal modules while preserving the public `new Accessibility(options)` API.
70
+ - Replaced implicit `window.event` usage with explicit event-driven activation handling.
71
+ - Updated menu toggle behavior to keep launcher/menu accessibility state synchronized.
72
+ - Refreshed the injected toolbar and menu styling to improve appearance, responsiveness, focus treatment, and reduced-motion behavior without changing the public API surface.
73
+ - Moved session persistence from the legacy `_accessState` key to `accessibility:session:v1`, while preserving backward-compatible restore behavior from the old key.
74
+ - Changed default icon behavior so the library no longer fetches remote icon fonts unless `icon.allowRemoteFonts` is explicitly enabled.
75
+ - Reworked the default launcher tile to use a single blue background with a bundled Material `accessibility_new` icon sized to fit cleanly inside the tile.
76
+ - Replaced the default menu and header icon set with locally bundled Material Design / Material Symbols SVG assets instead of ad hoc icon geometry.
77
+ - Tightened toolbar and menu density:
78
+ - reduced oversized visual chrome
79
+ - improved close/reset affordances
80
+ - reduced wasted spacing in menu rows
81
+ - replaced improvised glyphs with proper SVG icons
82
+ - Rotated the text-spacing icon treatment so the spacing controls read in the intended orientation.
83
+ - Reworked menu responsiveness so the panel now scales fluidly across desktop viewport widths instead of staying visually fixed until the mobile breakpoint.
84
+ - Added a denser small-screen layout pass for very narrow screens, including tighter header/button sizing and more compact menu row spacing below `480px`.
85
+ - Simplified the closed-menu behavior so it no longer depends on the earlier negative-position width hack.
86
+ - Finalized fork release metadata under version `1.0.1` and aligned package, lockfile, and dry-run publish output to that release number.
87
+ - Updated repository-facing documentation to use the actual repository and package name `accessibilitytool`.
88
+ - Refreshed the README header to mark this as the modernized `accessibilitytool` release, preserve original-project attribution, note MIT license continuity, and credit the fork maintenance work.
89
+ - Corrected usage and playground docs so they match the current build outputs and tarball names:
90
+ - browser script path now references `dist/main.js`
91
+ - README now includes the CommonJS import form
92
+ - `commonjs-test` now points at `accessibility-1.0.1.tgz`
93
+ - Renamed the published package identity from `accessibility` to the scoped package `@yaronelh/accessibilitytool` so the fork no longer carries a separate repository/package identity.
94
+ - Updated install/import/playground references to use `@yaronelh/accessibilitytool` consistently.
95
+ - Cleaned up the playgrounds:
96
+ - removed stale dead `#output` wiring from both playground entry files
97
+ - aligned `commonjs-test` to `vite 8.0.2`
98
+ - refreshed the `commonjs-test` install and lockfile against the `1.0.1` tarball
99
+ - Corrected fork documentation that no longer matched the current implementation:
100
+ - removed stale upstream-only README references
101
+ - replaced outdated session-persistence wording
102
+ - replaced the outdated upstream icon-customization reference
103
+ - corrected the build-command and session-persistence descriptions in `CODE_OVERVIEW.md`
104
+ - Cleaned up npm-facing metadata and README wording before publication:
105
+ - improved the package description
106
+ - removed duplicate/weak keywords and replaced them with a tighter keyword set
107
+ - tightened install/usage headings and grammar in the README
108
+ - clarified that the default icon runtime uses bundled local icons
109
+
110
+ ### Security
111
+
112
+ - Made remote icon font loading opt-in instead of default behavior.
113
+ - Hardened `jsonToHtml()` to strip unsafe `on*` attributes.
114
+ - Blocked unsafe URL schemes such as `javascript:` in generated DOM attributes.
115
+ - Escaped dynamic CSS content used for generated icon rules.
116
+ - Restricted iframe modal URLs through normalization and optional allowed-origin checks.
117
+ - Added safer iframe attributes:
118
+ - `sandbox`
119
+ - `referrerpolicy`
120
+ - `loading`
121
+ - Added `allowedIframeOrigins` as an optional configuration control.
122
+
123
+ ### Removed
124
+
125
+ - Removed `tslint`.
126
+ - Removed `tslint-loader`.
127
+ - Removed `tslint.json`.
128
+ - Removed stale handcrafted/default icon path definitions that were no longer the source of truth after the Material icon migration.
129
+
130
+ ### Verification
131
+
132
+ - Repeatedly verified during fork work with:
133
+ - `npm run lint`
134
+ - `npm run typecheck`
135
+ - `npm run test`
136
+ - `npm run build`
137
+ - `npm run prepack`
138
+ - `npm pack --dry-run --cache /tmp/accessibility-npm-cache`
139
+ - Latest automated verification status at the time of writing:
140
+ - `2` passing test files
141
+ - `13` passing tests
142
+
143
+ ### Notes
144
+
145
+ - Some action-to-icon mappings are now fully Material-backed but still semantically approximate and may be refined further:
146
+ - `gray hues`
147
+ - `reading guide`
148
+ - `disable animations`
149
+ - separate increase/decrease variants for text spacing
150
+ - separate increase/decrease variants for line height
151
+ - Several audit/review markdown files were also updated so historical findings are distinguished from current-state behavior after the modernization work.
152
+
153
+ ## [6.1.0] - Upstream Pre-Fork
154
+
155
+ Latest upstream release marker found in commit history before fork maintenance began.
156
+
157
+ ### Included upstream changes around the 6.1.0 line
158
+
159
+ - Fixed list and button `tabIndex` behavior that harmed accessibility and keyboard control.
160
+ - Fixed reset behavior for `lineHeight`.
161
+ - Added a `tabIndex` attribute-related improvement in the lead-up to the release.
162
+ - Included the upstream build/release commit recorded as `master - build version 6.1.0`.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016 Ran Buchnik
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,373 @@
1
+ # accessibilitytool
2
+
3
+ Modernized fork of the original [ranbuch/accessibility](https://github.com/ranbuch/accessibility).
4
+
5
+ This fork keeps the same MIT license as the original project and was updated by [Yaron Elharar](https://github.com/yaronelh) using GPT-5.4.
6
+
7
+ Great appreciation goes to Ran Buchnik and all contributors to the original library.
8
+
9
+ For the full list of fork changes, see [CHANGELOG.md](./CHANGELOG.md).
10
+
11
+ ![chrome_2026-03-23_21-17-29](https://github.com/user-attachments/assets/c233801c-e417-4bc2-9ead-8af4f1016a02)
12
+
13
+ ## Overview
14
+ Add an **accessibility toolbar** to your website with a single line of code.
15
+
16
+ ![Alt text](https://raw.githubusercontent.com/ranbuch/accessibility/master/accessibility.png "accessibility icon")
17
+
18
+ ### USAGE
19
+
20
+ `npm install @yaronelh/accessibilitytool`
21
+
22
+ Include script:
23
+ `<script type="text/javascript" src="node_modules/@yaronelh/accessibilitytool/dist/main.js"></script>`
24
+
25
+ Or import:
26
+ `import { Accessibility } from '@yaronelh/accessibilitytool';`
27
+
28
+ Or CommonJS:
29
+ `const { Accessibility } = require('@yaronelh/accessibilitytool');`
30
+
31
+ Initialize component:
32
+ `window.addEventListener('load', function() {
33
+ new Accessibility();
34
+ }, false);`
35
+
36
+ ### DESCRIPTION
37
+ **Features:**
38
+ - [x] increase text size
39
+ - [x] decrease text size
40
+ - [x] increase line height
41
+ - [x] decrease line height
42
+ - [x] invert colors
43
+ - [x] gray hues
44
+ - [x] underline links
45
+ - [x] big cursor
46
+ - [x] reading guide
47
+ - [x] text to speech with 3 reading velocities
48
+ - [x] speech to text
49
+ - [x] suppress animations
50
+
51
+ >Does not depend on any other library (**jQuery is not required**).
52
+ Easy to use.
53
+
54
+ ### LIMITATIONS & KNOWN ISSUES
55
+ * Works with html5 browsers only (no IE8 and below)
56
+ * Text to speech & speech to text works in supported browsers and languages only
57
+
58
+ ### MULTI LANGUAGE EXAMPLE
59
+
60
+ ```javascript
61
+ var labels = {
62
+ resetTitle: 'reset (in my language)',
63
+ closeTitle: 'close (in my language)',
64
+ menuTitle: 'title (in my language)',
65
+ increaseText: 'increase text size (in my language)',
66
+ decreaseText: 'decrease text size (in my language)',
67
+ increaseTextSpacing: 'increase text spacing (in my language)',
68
+ decreaseTextSpacing: 'decrease text spacing (in my language)',
69
+ increaseLineHeight: 'increase line height (in my language)',
70
+ decreaseLineHeight: 'decrease line height (in my language)',
71
+ invertColors: 'invert colors (in my language)',
72
+ grayHues: 'gray hues (in my language)',
73
+ underlineLinks: 'underline links (in my language)',
74
+ bigCursor: 'big cursor (in my language)',
75
+ readingGuide: 'reading guide (in my language)',
76
+ textToSpeech: 'text to speech (in my language)',
77
+ speechToText: 'speech to text (in my language)',
78
+ disableAnimations: 'disable animations (in my language)',
79
+ hotkeyPrefix: 'Hotkey: (in my language)',
80
+ };
81
+ ```
82
+
83
+ ```javascript
84
+ var options = { labels: labels };
85
+ options.textToSpeechLang = 'en-US'; // or any other language
86
+ options.speechToTextLang = 'en-US'; // or any other language
87
+ new Accessibility(options);
88
+ ```
89
+
90
+ ### DISABLE FEATURES EXAMPLE
91
+ ```javascript
92
+ options.modules = {
93
+ decreaseText: [true/false],
94
+ increaseText: [true/false],
95
+ invertColors: [true/false],
96
+ increaseTextSpacing: [true/false],
97
+ decreaseTextSpacing: [true/false],
98
+ increaseLineHeight: [true/false],
99
+ decreaseLineHeight: [true/false],
100
+ grayHues: [true/false],
101
+ underlineLinks: [true/false],
102
+ bigCursor: [true/false],
103
+ readingGuide: [true/false],
104
+ textToSpeech: [true/false],
105
+ speechToText: [true/false],
106
+ disableAnimations: [true/false]
107
+ };
108
+ ```
109
+
110
+ >When the default is **true**
111
+
112
+ ### TEXT SIZE MANIPULATION APPROACHES
113
+ If text increase / decrease isn't working for your site, you are probably not using responsive font-size units such as `em` or `rem`.
114
+ In that case you can initialize the accessibility tool like this:
115
+ ```javascript
116
+ new Accessibility({textPixelMode: true})
117
+ ```
118
+ You can change the factor of the font size difference between every iteration (default is 12.5):
119
+ ```javascript
120
+ new Accessibility({textSizeFactor: 4})
121
+ ```
122
+
123
+ ### ANIMATIONS
124
+ Cancel all buttons animations:
125
+ ```javascript
126
+ new Accessibility({animations: {buttons: false}})
127
+ ```
128
+
129
+ ### POSITIONING
130
+ You can position the accessibility icon anywhere on the screen. The default position is bottom right:
131
+ ```css
132
+ body {
133
+ --_access-icon-top: 50px;
134
+ --_access-icon-left: 50px;
135
+ --_access-icon-right: unset;
136
+ --_access-icon-bottom: unset;
137
+ }
138
+ ```
139
+
140
+
141
+ ### ICON IMAGE
142
+ This fork ships with bundled local SVG defaults for the launcher, close button, reset button, and built-in menu actions.
143
+
144
+ You can still replace the launcher and header icons through the `icon` options, for example by providing your own `imgElem`, `closeIconElem`, or `resetIconElem`.
145
+
146
+ ### PERSISTENT SESSION
147
+ Session persistence is enabled by default in the current fork.
148
+
149
+ The modernized implementation stores state under a namespaced key and still restores legacy session data from older installs when available.
150
+
151
+ To disable this feature use:
152
+ ```javascript
153
+ const options = {
154
+ session: {
155
+ persistent: false
156
+ }
157
+ };
158
+ new Accessibility(options);
159
+ ```
160
+
161
+
162
+ ### DIRECT ACCESS TO THE API
163
+ You can toggle the menu buttons directly via the exposed API:
164
+ ```javascript
165
+ var instance = new Accessibility();
166
+
167
+ instance.menuInterface.increaseText();
168
+
169
+ instance.menuInterface.decreaseText();
170
+
171
+ instance.menuInterface.increaseTextSpacing();
172
+
173
+ instance.menuInterface.decreaseTextSpacing();
174
+
175
+ instance.menuInterface.invertColors();
176
+
177
+ instance.menuInterface.grayHues();
178
+
179
+ instance.menuInterface.underlineLinks();
180
+
181
+ instance.menuInterface.bigCursor();
182
+
183
+ instance.menuInterface.readingGuide();
184
+
185
+ instance.menuInterface.textToSpeech();
186
+
187
+ instance.menuInterface.speechToText();
188
+
189
+ instance.menuInterface.disableAnimations();
190
+ ```
191
+
192
+ You can also override the functionality like this:
193
+ ```javascript
194
+ instance.menuInterface.increaseText = function() {
195
+ // My own way to increase text size . . .
196
+ }
197
+ ```
198
+
199
+ ### ADD CUSTOM IFRAME
200
+ You can add buttons that open a modal with custom iframes, for example for accessibility terms:
201
+ ```javascript
202
+ const options = {
203
+ iframeModals: [{
204
+ iframeUrl: 'https://example.com/accessibility-terms',
205
+ buttonText: 'terms',
206
+ icon: 'favorite',
207
+ emoji: '❤️'
208
+ }
209
+ };
210
+ new Accessibility(options);
211
+ ```
212
+
213
+ If you do not provide the `icon` and `emoji`, this setup is used:
214
+
215
+ icon: 'policy',
216
+ emoji: '⚖️'
217
+
218
+ If you are using an icon font for custom button icons, choose names from the icon set you load yourself.
219
+
220
+ ### ADD CUSTOM FUNCTIONS
221
+ You can add buttons that will invoke custom functions like so:
222
+ ```javascript
223
+ const options = {
224
+ customFunctions: [{
225
+ method: (cf, state) => {
226
+ console.log('The provided customFunctions object:', cf);
227
+ console.log('Toggle state:', state);
228
+ },
229
+ buttonText: 'my foo',
230
+ id: 1,
231
+ toggle: true,
232
+ icon: 'psychology_alt',
233
+ emoji: '❓'
234
+ }
235
+ };
236
+ new Accessibility(options);
237
+ ```
238
+
239
+ If you do not provide the `icon` and `emoji`, this setup is used:
240
+
241
+ icon: 'psychology_alt',
242
+ emoji: '❓'
243
+
244
+ If you are using an icon font for custom button icons, choose names from the icon set you load yourself.
245
+
246
+ You must provide the `id` parameter. This is how you identify the button if you are using more than one custom function.
247
+
248
+ You must provide the `toggle` parameter. This determines whether the button toggles an active state on and off.
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+ ### CUSTOMIZE STYLING
257
+ You can use CSS variables to change the styling of the menu. Here is an example of changing the exposed variables to a dark theme:
258
+ ```css
259
+ :root {
260
+ --_access-menu-background-color: #000;
261
+ --_access-menu-item-button-background: #222;
262
+ --_access-menu-item-color: rgba(255,255,255,.6);
263
+ --_access-menu-header-color: rgba(255,255,255,.87);
264
+ --_access-menu-item-button-active-color: #000;
265
+ --_access-menu-item-button-active-background-color: #fff;
266
+ --_access-menu-div-active-background-color: #fff;
267
+ --_access-menu-item-button-hover-color: rgba(255,255,255,.8);
268
+ --_access-menu-item-button-hover-background-color: #121212;
269
+ --_access-menu-item-icon-color: rgba(255,255,255,.6);
270
+ --_access-menu-item-hover-icon-color: rgba(255,255,255,.8);
271
+ --_access-menu-item-active-icon-color: #000;
272
+ }
273
+ ```
274
+
275
+ Alternatively, you can suppress the default CSS injection altogether (not recommended):
276
+ ```javascript
277
+ new Accessibility({suppressCssInjection: true});
278
+ ```
279
+ You can also replace the icons by replacing the content attribute with the CSS variables currently being used.
280
+
281
+ You can suppress the default HTML injection altogether:
282
+ ```javascript
283
+ const instance = new Accessibility({suppressDomInjection: true});
284
+ ```
285
+ You will need to provide your own DOM and call `menuInterface` functions.
286
+
287
+ By default the library does not fetch remote icon fonts. The default runtime uses bundled local icons, so it works without reaching out to Google Fonts.
288
+
289
+ If you already load an icon font yourself from a local or self-hosted stylesheet, you can point the component at that font without enabling remote loading:
290
+ ```javascript
291
+ const options = {
292
+ icon: {
293
+ useEmojis: false,
294
+ fontClass: 'material-icons'
295
+ }
296
+ };
297
+ new Accessibility(options);
298
+ ```
299
+
300
+ If you want the component itself to fetch a remote icon font URL, you must opt in explicitly:
301
+ ```javascript
302
+ const options = {
303
+ icon: {
304
+ useEmojis: false,
305
+ allowRemoteFonts: true,
306
+ fontFaceSrc: ['https://fonts.bunny.net/icon?family=Material+Icons']
307
+ }
308
+ };
309
+ new Accessibility(options);
310
+ ```
311
+
312
+ Another example with font-awesome icons:
313
+ ```javascript
314
+ const options = {
315
+ icon: {
316
+ useEmojis: false,
317
+ allowRemoteFonts: true,
318
+ fontFaceSrc: ['https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/v4-font-face.min.css'],
319
+ fontFamily: '"FontAwesome"',
320
+ img: '[optional - URL for an image that will replace the menu icon]',
321
+ closeIcon: '[optional - replacement text for the close menu icon]',
322
+ resetIcon: '[optional - replacement text for the reset all icon]',
323
+ closeIconElem: {
324
+ type: 'i',
325
+ attrs: {
326
+ 'class': 'fa fa-window-close',
327
+ 'aria-hidden': 'true'
328
+ }
329
+ },
330
+ imgElem: {
331
+ type: 'i',
332
+ attrs: {
333
+ 'class': 'fa fa-universal-access',
334
+ 'aria-hidden': 'true'
335
+ }
336
+ },
337
+ resetIconElem: {
338
+ type: 'i',
339
+ attrs: {
340
+ 'class': 'fa fa-refresh',
341
+ 'aria-hidden': 'true'
342
+ }
343
+ }
344
+ }
345
+ };
346
+ new Accessibility(options);
347
+ ```
348
+
349
+ If your site uses a strict CSP, keep remote font loading disabled and self-host the stylesheet instead.
350
+ ```css
351
+ :root {
352
+ --_access-menu-item-icon-increase-text: "\f062";
353
+ --_access-menu-item-icon-decrease-text: "\f063";
354
+ }
355
+ ```
356
+ Obviously you will need to add the missing variables for the rest of the fonts.
357
+
358
+ ### CHANGE MODULES ORDER
359
+ You can determine the order of the modules:
360
+ ```javascript
361
+ new Accessibility({
362
+ modulesOrder: [
363
+ {
364
+ type: AccessibilityModulesType.textToSpeech,
365
+ order: 0
366
+ }
367
+ ]
368
+ });
369
+ ```
370
+
371
+
372
+ ### LICENSE
373
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://spdx.org/licenses/MIT)
@@ -0,0 +1,22 @@
1
+ import { ICommon, IDeployedObjects, IFormattedDim, IInjectStyleOptions, IJsonToHtml } from './interfaces/common.interface.js';
2
+ export declare class Common implements ICommon {
3
+ static DEFAULT_PIXEL: string;
4
+ private body;
5
+ private deployedMap;
6
+ private _isIOS;
7
+ private _canvas;
8
+ constructor();
9
+ isIOS(): boolean;
10
+ jsonToHtml(obj: IJsonToHtml): HTMLElement;
11
+ injectStyle(css: string, innerOptions?: IInjectStyleOptions): HTMLStyleElement;
12
+ getFormattedDim(value: string): IFormattedDim;
13
+ extend(src: any, dest: any): any;
14
+ injectIconsFont(urls: Array<string>, callback: Function): void;
15
+ getFixedFont(name: string): any;
16
+ getFixedPseudoFont(name: string): any;
17
+ isFontLoaded(fontFamily?: string, callback?: Function): any;
18
+ warn(msg: string): void;
19
+ get deployedObjects(): IDeployedObjects;
20
+ createScreenshot(url: string): Promise<string>;
21
+ getFileExtension(filename: string): string;
22
+ }