@willwade/aac-processors 0.0.3 → 0.0.4
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/processors/gridset/wordlistHelpers.d.ts +82 -0
- package/dist/processors/gridset/wordlistHelpers.js +234 -0
- package/dist/processors/index.d.ts +1 -0
- package/dist/processors/index.js +7 -1
- package/examples/README.md +33 -21
- package/package.json +1 -1
- package/examples/demo.js +0 -143
- package/examples/gemini_response.txt +0 -845
- package/examples/image-map.js +0 -45
- package/examples/package-lock.json +0 -1326
- package/examples/package.json +0 -10
- package/examples/styling-example.ts +0 -316
- package/examples/translate.js +0 -39
- package/examples/translate_demo.js +0 -254
- package/examples/translation_cache.json +0 -44894
- package/examples/typescript-demo.ts +0 -251
- package/examples/unified-interface-demo.ts +0 -183
package/examples/image-map.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// Example: Resolve images from a Grid 3 gridset and print allow-list
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
// Use compiled dist outputs
|
|
6
|
-
const { GridsetProcessor, getPageTokenImageMap, getAllowedImageEntries, openImage } = require('../dist/processors');
|
|
7
|
-
|
|
8
|
-
(async () => {
|
|
9
|
-
try {
|
|
10
|
-
const file = path.join(__dirname, 'example-images.gridset');
|
|
11
|
-
console.log('Loading gridset:', file);
|
|
12
|
-
|
|
13
|
-
const proc = new GridsetProcessor();
|
|
14
|
-
const tree = proc.loadIntoTree(file);
|
|
15
|
-
|
|
16
|
-
const pageIds = Object.keys(tree.pages);
|
|
17
|
-
const rootId = tree.rootId || pageIds[0];
|
|
18
|
-
console.log('Pages:', pageIds.length, 'root:', rootId);
|
|
19
|
-
|
|
20
|
-
const map = getPageTokenImageMap(tree, rootId);
|
|
21
|
-
console.log('Resolved images on root page:', map.size);
|
|
22
|
-
for (const [token, entry] of map.entries()) {
|
|
23
|
-
console.log(' token', token, '=>', entry);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const allow = getAllowedImageEntries(tree);
|
|
27
|
-
console.log('Allow-list size:', allow.size);
|
|
28
|
-
|
|
29
|
-
// Try to read the first image entry
|
|
30
|
-
const first = Array.from(allow)[0];
|
|
31
|
-
if (first) {
|
|
32
|
-
const buf = fs.readFileSync(file);
|
|
33
|
-
const data = openImage(buf, first);
|
|
34
|
-
if (data) {
|
|
35
|
-
console.log('Read image bytes for', first, 'len=', data.length);
|
|
36
|
-
} else {
|
|
37
|
-
console.warn('Could not read image for', first);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
} catch (e) {
|
|
41
|
-
console.error('Error:', e && e.message ? e.message : e);
|
|
42
|
-
process.exitCode = 1;
|
|
43
|
-
}
|
|
44
|
-
})();
|
|
45
|
-
|