@willwade/aac-processors 0.0.30 → 0.1.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 (94) hide show
  1. package/README.md +52 -852
  2. package/dist/browser/core/baseProcessor.js +241 -0
  3. package/dist/browser/core/stringCasing.js +179 -0
  4. package/dist/browser/core/treeStructure.js +255 -0
  5. package/dist/browser/index.browser.js +73 -0
  6. package/dist/browser/processors/applePanelsProcessor.js +582 -0
  7. package/dist/browser/processors/astericsGridProcessor.js +1509 -0
  8. package/dist/browser/processors/dotProcessor.js +221 -0
  9. package/dist/browser/processors/gridset/commands.js +962 -0
  10. package/dist/browser/processors/gridset/crypto.js +53 -0
  11. package/dist/browser/processors/gridset/password.js +49 -0
  12. package/dist/browser/processors/gridset/pluginTypes.js +277 -0
  13. package/dist/browser/processors/gridset/resolver.js +137 -0
  14. package/dist/browser/processors/gridset/symbolAlignment.js +276 -0
  15. package/dist/browser/processors/gridset/symbols.js +464 -0
  16. package/dist/browser/processors/gridsetProcessor.js +2002 -0
  17. package/dist/browser/processors/obfProcessor.js +705 -0
  18. package/dist/browser/processors/opmlProcessor.js +274 -0
  19. package/dist/browser/types/aac.js +38 -0
  20. package/dist/browser/utilities/analytics/utils/idGenerator.js +89 -0
  21. package/dist/browser/utilities/translation/translationProcessor.js +200 -0
  22. package/dist/browser/utils/io.js +95 -0
  23. package/dist/browser/validation/baseValidator.js +156 -0
  24. package/dist/browser/validation/gridsetValidator.js +356 -0
  25. package/dist/browser/validation/obfValidator.js +500 -0
  26. package/dist/browser/validation/validationTypes.js +46 -0
  27. package/dist/cli/index.js +5 -5
  28. package/dist/core/analyze.d.ts +2 -2
  29. package/dist/core/analyze.js +2 -2
  30. package/dist/core/baseProcessor.d.ts +5 -4
  31. package/dist/core/baseProcessor.js +22 -27
  32. package/dist/core/treeStructure.d.ts +5 -5
  33. package/dist/core/treeStructure.js +1 -4
  34. package/dist/index.browser.d.ts +37 -0
  35. package/dist/index.browser.js +99 -0
  36. package/dist/index.d.ts +1 -48
  37. package/dist/index.js +1 -136
  38. package/dist/index.node.d.ts +48 -0
  39. package/dist/index.node.js +152 -0
  40. package/dist/processors/applePanelsProcessor.d.ts +5 -4
  41. package/dist/processors/applePanelsProcessor.js +58 -62
  42. package/dist/processors/astericsGridProcessor.d.ts +7 -6
  43. package/dist/processors/astericsGridProcessor.js +31 -42
  44. package/dist/processors/dotProcessor.d.ts +5 -4
  45. package/dist/processors/dotProcessor.js +25 -33
  46. package/dist/processors/excelProcessor.d.ts +4 -3
  47. package/dist/processors/excelProcessor.js +6 -3
  48. package/dist/processors/gridset/crypto.d.ts +18 -0
  49. package/dist/processors/gridset/crypto.js +57 -0
  50. package/dist/processors/gridset/helpers.d.ts +1 -1
  51. package/dist/processors/gridset/helpers.js +18 -8
  52. package/dist/processors/gridset/password.d.ts +20 -3
  53. package/dist/processors/gridset/password.js +29 -12
  54. package/dist/processors/gridset/symbols.js +63 -46
  55. package/dist/processors/gridset/wordlistHelpers.d.ts +3 -3
  56. package/dist/processors/gridset/wordlistHelpers.js +21 -20
  57. package/dist/processors/gridsetProcessor.d.ts +7 -12
  58. package/dist/processors/gridsetProcessor.js +116 -77
  59. package/dist/processors/obfProcessor.d.ts +9 -7
  60. package/dist/processors/obfProcessor.js +131 -56
  61. package/dist/processors/obfsetProcessor.d.ts +5 -4
  62. package/dist/processors/obfsetProcessor.js +10 -16
  63. package/dist/processors/opmlProcessor.d.ts +5 -4
  64. package/dist/processors/opmlProcessor.js +27 -34
  65. package/dist/processors/snapProcessor.d.ts +8 -7
  66. package/dist/processors/snapProcessor.js +15 -12
  67. package/dist/processors/touchchatProcessor.d.ts +8 -7
  68. package/dist/processors/touchchatProcessor.js +22 -17
  69. package/dist/types/aac.d.ts +0 -2
  70. package/dist/types/aac.js +2 -0
  71. package/dist/utils/io.d.ts +12 -0
  72. package/dist/utils/io.js +107 -0
  73. package/dist/validation/gridsetValidator.js +10 -9
  74. package/dist/validation/snapValidator.js +28 -35
  75. package/docs/BROWSER_USAGE.md +618 -0
  76. package/docs/PAGESET_GETTING_STARTED.md +185 -0
  77. package/examples/README.md +77 -0
  78. package/examples/browser-test-server.js +81 -0
  79. package/examples/browser-test.html +331 -0
  80. package/examples/vitedemo/QUICKSTART.md +75 -0
  81. package/examples/vitedemo/README.md +157 -0
  82. package/examples/vitedemo/index.html +531 -0
  83. package/examples/vitedemo/package-lock.json +1221 -0
  84. package/examples/vitedemo/package.json +18 -0
  85. package/examples/vitedemo/src/main.ts +871 -0
  86. package/examples/vitedemo/test-files/example.dot +14 -0
  87. package/examples/vitedemo/test-files/example.grd +1 -0
  88. package/examples/vitedemo/test-files/example.gridset +0 -0
  89. package/examples/vitedemo/test-files/example.obz +0 -0
  90. package/examples/vitedemo/test-files/example.opml +18 -0
  91. package/examples/vitedemo/test-files/simple.obf +53 -0
  92. package/examples/vitedemo/tsconfig.json +24 -0
  93. package/examples/vitedemo/vite.config.ts +34 -0
  94. package/package.json +21 -4
@@ -0,0 +1,75 @@
1
+ # 🎯 AAC Processors Browser Demo - Quick Start
2
+
3
+ ## 🚀 Running the Demo
4
+
5
+ The demo is already running! Open your browser to:
6
+
7
+ **http://localhost:3000**
8
+
9
+ ## 📁 Test Files Included
10
+
11
+ The `test-files/` folder contains example AAC files you can use:
12
+
13
+ - `example.dot` (392 bytes) - DOT format board
14
+ - `example.opml` (495 bytes) - OPML outline
15
+ - `simple.obf` (2.1 KB) - Open Board Format
16
+ - `example.obz` (13 MB) - Compressed OBF
17
+ - `example.gridset` (1.4 MB) - Grid 3 gridset
18
+ - `example.grd` (21 KB) - Asterics Grid
19
+
20
+ ## 🧪 How to Test
21
+
22
+ ### Option 1: Drag & Drop
23
+ 1. Open http://localhost:3000
24
+ 2. Drag any file from `test-files/` onto the upload area
25
+ 3. Click "Process File"
26
+ 4. Explore pages and buttons!
27
+
28
+ ### Option 2: File Picker
29
+ 1. Click the upload area
30
+ 2. Select a file from `test-files/`
31
+ 3. Click "Process File"
32
+
33
+ ### Option 3: Run Tests
34
+ 1. Click "Run Compatibility Tests"
35
+ 2. See all 9 tests pass!
36
+
37
+ ## ✨ Features to Try
38
+
39
+ - **Text-to-Speech**: Click any SPEAK button to hear the message
40
+ - **Navigation**: Click NAVIGATE buttons to jump between pages
41
+ - **Stats**: See page/button/text counts and load time
42
+ - **Logs**: Watch the processing log in real-time
43
+ - **Pageset Lab**: Open the "Create & Convert" tab to generate a sample pageset or convert an upload to OBF/OBZ
44
+
45
+ ## 🛠️ Development
46
+
47
+ ### Restart Server
48
+ ```bash
49
+ cd examples/vitedemo
50
+ npm run dev
51
+ ```
52
+
53
+ ### Build for Production
54
+ ```bash
55
+ npm run build
56
+ npm run preview
57
+ ```
58
+
59
+ ## 📊 What's Being Tested
60
+
61
+ This demo proves AACProcessors works in browsers with:
62
+ - ✅ Vite bundling
63
+ - ✅ All 6 browser-compatible processors
64
+ - ✅ File upload (drag & drop + picker)
65
+ - ✅ ArrayBuffer handling
66
+ - ✅ Tree structure parsing
67
+ - ✅ Text extraction
68
+ - ✅ Button interaction
69
+ - ✅ Browser Speech API integration
70
+
71
+ ## 🎉 Success!
72
+
73
+ If you can see the demo and process files, congratulations! You now have a working browser-based AAC processor. This can be used as a template for your own browser applications.
74
+
75
+ See `docs/BROWSER_USAGE.md` for integration guides.
@@ -0,0 +1,157 @@
1
+ # AAC Processors Browser Demo
2
+
3
+ A real browser demo that uses Vite to bundle AACProcessors for browser use.
4
+
5
+ ## Features
6
+
7
+ - ✅ **Real file processing** - Upload and process actual AAC files
8
+ - ✅ **All browser-compatible processors** - Tests Dot, OPML, OBF/OBZ, Gridset, ApplePanels, AstericsGrid
9
+ - ✅ **Interactive UI** - Drag & drop files, view pages and buttons
10
+ - ✅ **Text-to-speech** - Click SPEAK buttons to hear messages (browser speech API)
11
+ - ✅ **Navigation** - Click NAVIGATE buttons to jump between pages
12
+ - ✅ **Compatibility tests** - Automated tests for all processors
13
+ - ✅ **Performance metrics** - Load time, page/button/text counts
14
+ - ✅ **TypeScript** - Full type safety and IntelliSense
15
+
16
+ ## Quick Start
17
+
18
+ ### 1. Install Dependencies
19
+
20
+ ```bash
21
+ cd examples/vitedemo
22
+ npm install
23
+ ```
24
+
25
+ ### 2. Run Dev Server
26
+
27
+ ```bash
28
+ npm run dev
29
+ ```
30
+
31
+ The demo will open automatically at: http://localhost:3000
32
+
33
+ ### 3. Build for Production
34
+
35
+ ```bash
36
+ npm run build
37
+ npm run preview
38
+ ```
39
+
40
+ ## How to Use
41
+
42
+ 1. **Upload a file**
43
+ - Drag & drop an AAC file onto the upload area
44
+ - Or click to open file picker
45
+ - Supported formats: .dot, .opml, .obf, .obz, .gridset, .plist, .grd
46
+
47
+ 2. **Process the file**
48
+ - Click "Process File" button
49
+ - View pages and buttons in the right panel
50
+ - Check stats: pages, buttons, texts, load time
51
+
52
+ 3. **Interact with buttons**
53
+ - Click SPEAK buttons to hear text (uses browser speech API)
54
+ - Click NAVIGATE buttons to jump to target pages
55
+
56
+ 4. **Run compatibility tests**
57
+ - Click "Run Compatibility Tests"
58
+ - See test results in the left panel
59
+ - Tests all 6 browser-compatible processors
60
+
61
+ ## Supported File Types
62
+
63
+ | Format | Extensions | Processor |
64
+ |----------|-----------------|-------------------------|
65
+ | DOT | .dot | DotProcessor |
66
+ | OPML | .opml | OpmlProcessor |
67
+ | OBF/OBZ | .obf, .obz | ObfProcessor |
68
+ | Gridset | .gridset | GridsetProcessor |
69
+ | Apple | .plist | ApplePanelsProcessor |
70
+ | Asterics | .grd | AstericsGridProcessor |
71
+
72
+ ## Test Files
73
+
74
+ You can use test files from the parent directory:
75
+
76
+ ```bash
77
+ # From vitedemo directory
78
+ ../../test/assets/dot/example.dot
79
+ ../../test/assets/opml/example.opml
80
+ ../../test/assets/obf/simple.obf
81
+ ../../test/assets/gridset/example.gridset
82
+ ../../test/assets/asterics/example.grd
83
+ ```
84
+
85
+ ## Technical Details
86
+
87
+ ### Vite Configuration
88
+
89
+ The demo uses a custom Vite config to import from the source TypeScript:
90
+
91
+ ```typescript
92
+ // vite.config.ts
93
+ export default defineConfig({
94
+ resolve: {
95
+ alias: {
96
+ 'aac-processors': path.resolve(__dirname, '../../src/index.browser.ts')
97
+ }
98
+ }
99
+ });
100
+ ```
101
+
102
+ This allows direct TypeScript import without pre-building.
103
+
104
+ ### Import Example
105
+
106
+ ```typescript
107
+ import { getProcessor } from 'aac-processors';
108
+
109
+ // Get processor for file type
110
+ const processor = getProcessor('.obf');
111
+
112
+ // Load file from input
113
+ const arrayBuffer = await file.arrayBuffer();
114
+ const tree = await processor.loadIntoTree(arrayBuffer);
115
+
116
+ // Extract texts
117
+ const texts = await processor.extractTexts(arrayBuffer);
118
+ ```
119
+
120
+ ## Troubleshooting
121
+
122
+ ### Module not found errors
123
+
124
+ Make sure you're in the `examples/vitedemo` directory and have run `npm install`.
125
+
126
+ ### TypeScript errors
127
+
128
+ Clear the Vite cache:
129
+ ```bash
130
+ rm -rf node_modules/.vite
131
+ npm run dev
132
+ ```
133
+
134
+ ### File processing errors
135
+
136
+ Check the browser console (F12) for detailed error messages. Common issues:
137
+ - Invalid file format
138
+ - Corrupted file
139
+ - Unsupported file type (check extensions)
140
+
141
+ ## Browser Compatibility
142
+
143
+ - ✅ Chrome/Edge (recommended)
144
+ - ✅ Firefox
145
+ - ✅ Safari
146
+ - ⚠️ Speech API works best in Chrome/Edge
147
+
148
+ ## Next Steps
149
+
150
+ This demonstrates that AACProcessors works in browsers with a bundler. To use in your own project:
151
+
152
+ 1. Install AACProcessors: `npm install @willwade/aac-processors`
153
+ 2. Set up Vite/Webpack/Rollup
154
+ 3. Import from `'aac-processors'`
155
+ 4. Use `getProcessor()` factory function
156
+
157
+ See `docs/BROWSER_USAGE.md` for complete setup guides.