@willwade/aac-processors 0.0.3 → 0.0.5
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/README.md +1 -1
- package/dist/processors/gridset/styleHelpers.d.ts +46 -0
- package/dist/processors/gridset/styleHelpers.js +211 -0
- package/dist/processors/gridset/wordlistHelpers.d.ts +82 -0
- package/dist/processors/gridset/wordlistHelpers.js +234 -0
- package/dist/processors/index.d.ts +2 -0
- package/dist/processors/index.js +14 -1
- package/docs/Grid3-Styling-Guide.md +287 -0
- 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
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# Grid3 Styling Guide
|
|
2
|
+
|
|
3
|
+
This guide explains how to work with Grid3 styles using the AACProcessors library.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Grid3 uses a sophisticated styling system with:
|
|
8
|
+
- **Default styles** for common UI elements
|
|
9
|
+
- **Category styles** for organizing content by semantic meaning
|
|
10
|
+
- **Inline style overrides** for cell-specific customization
|
|
11
|
+
- **Style inheritance** through `BasedOnStyle` references
|
|
12
|
+
|
|
13
|
+
## Default Styles
|
|
14
|
+
|
|
15
|
+
The library provides built-in default styles for common use cases:
|
|
16
|
+
|
|
17
|
+
### Available Default Styles
|
|
18
|
+
|
|
19
|
+
| Style Name | Purpose | Background | Text Color |
|
|
20
|
+
|-----------|---------|-----------|-----------|
|
|
21
|
+
| `Default` | General purpose cells | Light blue (#E2EDF8) | Black |
|
|
22
|
+
| `Workspace` | Message/chat area | White (#FFFFFF) | Black |
|
|
23
|
+
| `Auto content` | Wordlists, predictions | Light blue (#E8F4F8) | Black |
|
|
24
|
+
| `Vocab cell` | Vocabulary cells | Light blue (#E8F4F8) | Black |
|
|
25
|
+
| `Keyboard key` | On-screen keyboard | Light gray (#F0F0F0) | Black |
|
|
26
|
+
|
|
27
|
+
### Category Styles
|
|
28
|
+
|
|
29
|
+
Category styles are used for organizing content by semantic meaning:
|
|
30
|
+
|
|
31
|
+
| Style Name | Color | Use Case |
|
|
32
|
+
|-----------|-------|----------|
|
|
33
|
+
| `Actions category style` | Blue (#4472C4) | Action verbs, commands |
|
|
34
|
+
| `People category style` | Orange (#ED7D31) | Names, people |
|
|
35
|
+
| `Places category style` | Gray (#A5A5A5) | Locations, places |
|
|
36
|
+
| `Descriptive category style` | Green (#70AD47) | Adjectives, descriptors |
|
|
37
|
+
| `Social category style` | Gold (#FFC000) | Social phrases, greetings |
|
|
38
|
+
| `Questions category style` | Light blue (#5B9BD5) | Questions, interrogatives |
|
|
39
|
+
| `Little words category style` | Brown (#C55A11) | Function words, particles |
|
|
40
|
+
|
|
41
|
+
## Using Styles in Code
|
|
42
|
+
|
|
43
|
+
### Import Style Helpers
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import {
|
|
47
|
+
DEFAULT_GRID3_STYLES,
|
|
48
|
+
CATEGORY_STYLES,
|
|
49
|
+
createDefaultStylesXml,
|
|
50
|
+
createCategoryStyle,
|
|
51
|
+
ensureAlphaChannel,
|
|
52
|
+
} from 'aac-processors';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Access Predefined Styles
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
// Get a specific default style
|
|
59
|
+
const defaultStyle = DEFAULT_GRID3_STYLES['Default'];
|
|
60
|
+
console.log(defaultStyle.BackColour); // #E2EDF8FF
|
|
61
|
+
|
|
62
|
+
// Get a category style
|
|
63
|
+
const actionStyle = CATEGORY_STYLES['Actions category style'];
|
|
64
|
+
console.log(actionStyle.BackColour); // #4472C4FF
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Create Custom Category Styles
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
// Create a custom category style with automatic border darkening
|
|
71
|
+
const customStyle = createCategoryStyle(
|
|
72
|
+
'My Category',
|
|
73
|
+
'#FF6B6B', // Background color
|
|
74
|
+
'#FFFFFF' // Font color (optional, defaults to white)
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
// Result:
|
|
78
|
+
// {
|
|
79
|
+
// BackColour: '#FF6B6BFF',
|
|
80
|
+
// TileColour: '#FF6B6BFF',
|
|
81
|
+
// BorderColour: '#CB5555FF', // Automatically darkened
|
|
82
|
+
// FontColour: '#FFFFFFFF',
|
|
83
|
+
// FontName: 'Arial',
|
|
84
|
+
// FontSize: '16'
|
|
85
|
+
// }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Generate Default Styles XML
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
// Generate Settings0/styles.xml with all default and category styles
|
|
92
|
+
const stylesXml = createDefaultStylesXml(true);
|
|
93
|
+
|
|
94
|
+
// Or just default styles without categories
|
|
95
|
+
const basicStylesXml = createDefaultStylesXml(false);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Ensure Color Has Alpha Channel
|
|
99
|
+
|
|
100
|
+
Grid3 requires colors in 8-digit ARGB format (#AARRGGBBFF):
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { ensureAlphaChannel } from 'aac-processors';
|
|
104
|
+
|
|
105
|
+
ensureAlphaChannel('#FF0000'); // Returns: #FF0000FF
|
|
106
|
+
ensureAlphaChannel('#F00'); // Returns: #FF0000FF
|
|
107
|
+
ensureAlphaChannel('#FF0000FF'); // Returns: #FF0000FF (unchanged)
|
|
108
|
+
ensureAlphaChannel(undefined); // Returns: #FFFFFFFF (white)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Applying Styles to Cells
|
|
112
|
+
|
|
113
|
+
### Using BasedOnStyle Reference
|
|
114
|
+
|
|
115
|
+
In Grid3 XML, cells reference styles by name:
|
|
116
|
+
|
|
117
|
+
```xml
|
|
118
|
+
<Cell X="0" Y="0">
|
|
119
|
+
<Content>
|
|
120
|
+
<CaptionAndImage>
|
|
121
|
+
<Caption>Hello</Caption>
|
|
122
|
+
</CaptionAndImage>
|
|
123
|
+
<Style>
|
|
124
|
+
<BasedOnStyle>Actions category style</BasedOnStyle>
|
|
125
|
+
</Style>
|
|
126
|
+
</Content>
|
|
127
|
+
</Cell>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Inline Style Overrides
|
|
131
|
+
|
|
132
|
+
You can override specific properties while keeping the base style:
|
|
133
|
+
|
|
134
|
+
```xml
|
|
135
|
+
<Cell X="1" Y="0">
|
|
136
|
+
<Content>
|
|
137
|
+
<CaptionAndImage>
|
|
138
|
+
<Caption>Custom</Caption>
|
|
139
|
+
</CaptionAndImage>
|
|
140
|
+
<Style>
|
|
141
|
+
<BasedOnStyle>Default</BasedOnStyle>
|
|
142
|
+
<BackColour>#FF0000FF</BackColour> <!-- Override background -->
|
|
143
|
+
<FontSize>20</FontSize> <!-- Override font size -->
|
|
144
|
+
</Style>
|
|
145
|
+
</Content>
|
|
146
|
+
</Cell>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Color Format
|
|
150
|
+
|
|
151
|
+
Grid3 uses 8-digit ARGB hexadecimal format: `#AARRGGBBFF`
|
|
152
|
+
|
|
153
|
+
- **AA**: Alpha channel (FF = fully opaque, 00 = fully transparent)
|
|
154
|
+
- **RR**: Red component (00-FF)
|
|
155
|
+
- **GG**: Green component (00-FF)
|
|
156
|
+
- **BB**: Blue component (00-FF)
|
|
157
|
+
- **FF**: Always FF for Grid3 (fully opaque)
|
|
158
|
+
|
|
159
|
+
### Examples
|
|
160
|
+
|
|
161
|
+
| Color | Hex Code | Description |
|
|
162
|
+
|-------|----------|-------------|
|
|
163
|
+
| White | #FFFFFFFF | Fully opaque white |
|
|
164
|
+
| Black | #000000FF | Fully opaque black |
|
|
165
|
+
| Red | #FF0000FF | Fully opaque red |
|
|
166
|
+
| Blue | #0000FFFF | Fully opaque blue |
|
|
167
|
+
| Green | #00FF00FF | Fully opaque green |
|
|
168
|
+
|
|
169
|
+
## Style Inheritance
|
|
170
|
+
|
|
171
|
+
Grid3 uses a cascading style system:
|
|
172
|
+
|
|
173
|
+
1. **Theme** provides base properties (Modern, Kids/Bubble, Flat/Blocky, Explorer)
|
|
174
|
+
2. **Built-in style** defines category defaults
|
|
175
|
+
3. **Cell-specific overrides** apply on top
|
|
176
|
+
|
|
177
|
+
```xml
|
|
178
|
+
<!-- Example: Override just the background color -->
|
|
179
|
+
<Style>
|
|
180
|
+
<BasedOnStyle>Actions category style</BasedOnStyle>
|
|
181
|
+
<BackColour>#FF0000FF</BackColour> <!-- Override just this property -->
|
|
182
|
+
</Style>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Creating Gridsets with Styles
|
|
186
|
+
|
|
187
|
+
### Using GridsetProcessor
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
import { GridsetProcessor, AACTree, AACPage, AACButton } from 'aac-processors';
|
|
191
|
+
|
|
192
|
+
const processor = new GridsetProcessor();
|
|
193
|
+
const tree = new AACTree();
|
|
194
|
+
|
|
195
|
+
// Create a page with styling
|
|
196
|
+
const page = new AACPage({
|
|
197
|
+
id: 'main-page',
|
|
198
|
+
name: 'Main Board',
|
|
199
|
+
grid: [],
|
|
200
|
+
buttons: [],
|
|
201
|
+
parentId: null,
|
|
202
|
+
style: {
|
|
203
|
+
backgroundColor: '#f0f8ff',
|
|
204
|
+
fontFamily: 'Arial',
|
|
205
|
+
fontSize: 16,
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Create styled buttons
|
|
210
|
+
const button = new AACButton({
|
|
211
|
+
id: 'btn-1',
|
|
212
|
+
label: 'Hello',
|
|
213
|
+
message: 'Hello, how are you?',
|
|
214
|
+
style: {
|
|
215
|
+
backgroundColor: '#4472C4', // Blue (Actions category)
|
|
216
|
+
fontColor: '#FFFFFF',
|
|
217
|
+
fontSize: 18,
|
|
218
|
+
fontFamily: 'Arial',
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
page.addButton(button);
|
|
223
|
+
tree.addPage(page);
|
|
224
|
+
|
|
225
|
+
// Save with styles
|
|
226
|
+
processor.saveFromTree(tree, 'output.gridset');
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Using Grid-Generator
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
import { generateGridset } from '@willwade/grid-generator';
|
|
233
|
+
|
|
234
|
+
const template = {
|
|
235
|
+
aacsystem: 'Grid3',
|
|
236
|
+
homeGrid: {
|
|
237
|
+
enabled: true,
|
|
238
|
+
name: 'Home',
|
|
239
|
+
title: 'Categories',
|
|
240
|
+
},
|
|
241
|
+
wordlists: [
|
|
242
|
+
{
|
|
243
|
+
name: 'Greetings',
|
|
244
|
+
items: ['Hello', 'Hi', 'Hey'],
|
|
245
|
+
partOfSpeech: 'Interjection',
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const gridset = generateGridset(template);
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Best Practices
|
|
254
|
+
|
|
255
|
+
1. **Use category styles** for semantic organization - helps with accessibility and consistency
|
|
256
|
+
2. **Maintain contrast** - ensure text color has sufficient contrast with background
|
|
257
|
+
3. **Use consistent fonts** - stick to standard fonts like Arial, Verdana, or Roboto
|
|
258
|
+
4. **Test in Grid3** - always verify styling in the actual Grid3 application
|
|
259
|
+
5. **Document custom styles** - if creating custom category styles, document their purpose
|
|
260
|
+
6. **Use inline overrides sparingly** - prefer creating new styles for significant variations
|
|
261
|
+
|
|
262
|
+
## Troubleshooting
|
|
263
|
+
|
|
264
|
+
### Styles Not Appearing
|
|
265
|
+
|
|
266
|
+
- Verify `Settings0/styles.xml` exists in the gridset
|
|
267
|
+
- Check that style names in cells match exactly (case-sensitive)
|
|
268
|
+
- Ensure colors are in 8-digit ARGB format
|
|
269
|
+
|
|
270
|
+
### Colors Look Wrong
|
|
271
|
+
|
|
272
|
+
- Verify alpha channel is FF (fully opaque)
|
|
273
|
+
- Check RGB values are correct
|
|
274
|
+
- Test in Grid3 to see actual rendering
|
|
275
|
+
|
|
276
|
+
### Performance Issues
|
|
277
|
+
|
|
278
|
+
- Avoid creating too many unique styles (consolidate similar styles)
|
|
279
|
+
- Use style references instead of inline overrides when possible
|
|
280
|
+
- Keep font sizes reasonable (12-24 points typical)
|
|
281
|
+
|
|
282
|
+
## See Also
|
|
283
|
+
|
|
284
|
+
- [Grid3 XML Format Documentation](./Grid3-XML-Format.md)
|
|
285
|
+
- [Wordlist Helpers Guide](./Grid3-Wordlist-Helpers.md)
|
|
286
|
+
- [AACProcessors API Reference](./API-Reference.md)
|
|
287
|
+
|
package/examples/README.md
CHANGED
|
@@ -1,31 +1,43 @@
|
|
|
1
|
-
# AAC Processors
|
|
1
|
+
# AAC Processors Example Pagesets
|
|
2
2
|
|
|
3
|
-
This directory contains example
|
|
3
|
+
This directory contains example AAC pagesets in various formats used for testing and demonstration purposes.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Available Pagesets
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Grid3 Format (.gridset)
|
|
8
|
+
- **example.gridset** - Main example pageset with multiple grids and wordlists
|
|
9
|
+
- **example-images.gridset** - Example pageset with embedded images
|
|
8
10
|
|
|
9
|
-
###
|
|
11
|
+
### Snap Format (.spb, .sps)
|
|
12
|
+
- **example.spb** - Snap pageset (binary format)
|
|
13
|
+
- **example.sps** - Snap pageset (alternative format)
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
cd examples
|
|
14
|
-
npm install
|
|
15
|
+
### TouchChat Format (.ce)
|
|
16
|
+
- **example.ce** - TouchChat pageset
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
```
|
|
18
|
+
### OBF/OBZ Format (.obf, .obz)
|
|
19
|
+
- **example.obf** - OBF pageset (JSON-based)
|
|
20
|
+
- **example.obz** - OBZ pageset (compressed)
|
|
20
21
|
|
|
21
|
-
###
|
|
22
|
+
### Asterics Grid Format (.grd)
|
|
23
|
+
- **example.grd** - Asterics Grid pageset
|
|
24
|
+
- **example2.grd** - Alternative Asterics Grid pageset
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
### DOT Format (.dot)
|
|
27
|
+
- **example.dot** - Simple DOT format pageset
|
|
28
|
+
- **communikate.dot** - Communikate DOT format pageset
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
+
### OPML Format (.opml)
|
|
31
|
+
- **example.opml** - OPML pageset
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
### Styled Output
|
|
34
|
+
- **styled-output/** - Directory containing example pagesets with styling applied
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
These pagesets are used by:
|
|
39
|
+
- Unit tests in the main test suite
|
|
40
|
+
- Demo scripts in the `scripts/` directory
|
|
41
|
+
- Integration examples
|
|
42
|
+
|
|
43
|
+
To run demo scripts that use these pagesets, see the [scripts/README.md](../scripts/README.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willwade/aac-processors",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "A comprehensive TypeScript library for processing AAC (Augmentative and Alternative Communication) file formats with translation support",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
package/examples/demo.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
// AACProcessors Demo: Showcase all engines and features
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
// Import processors
|
|
5
|
-
const { DotProcessor, OpmlProcessor, SnapProcessor, GridsetProcessor, TouchChatProcessor, ApplePanelsProcessor, ObfProcessor } = require('../dist/processors');
|
|
6
|
-
|
|
7
|
-
// Optional: pretty printer
|
|
8
|
-
let prettyPrint;
|
|
9
|
-
try {
|
|
10
|
-
prettyPrint = require('../dist/viewer/prettyPrint');
|
|
11
|
-
} catch {}
|
|
12
|
-
|
|
13
|
-
// Optional: symbol tools
|
|
14
|
-
let symbolTools;
|
|
15
|
-
try {
|
|
16
|
-
symbolTools = require('../dist/optional/symbolTools');
|
|
17
|
-
} catch {}
|
|
18
|
-
|
|
19
|
-
// --- DotProcessor ---
|
|
20
|
-
console.log('\n=== DOT Example ===');
|
|
21
|
-
try {
|
|
22
|
-
const dotFile = path.join(__dirname, 'example.dot');
|
|
23
|
-
const dotProcessor = new DotProcessor();
|
|
24
|
-
const dotTree = dotProcessor.loadIntoTree(dotFile);
|
|
25
|
-
console.log('DOT tree:', dotTree);
|
|
26
|
-
console.log('DOT texts:', dotProcessor.extractTexts ? dotProcessor.extractTexts(dotFile) : '(no extractTexts)');
|
|
27
|
-
if (prettyPrint) prettyPrint.printTree(dotTree, { showNavigation: true });
|
|
28
|
-
} catch (e) {
|
|
29
|
-
console.warn('DOT demo error:', e.message);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// --- OPMLProcessor ---
|
|
33
|
-
console.log('\n=== OPML Example ===');
|
|
34
|
-
try {
|
|
35
|
-
const opmlFile = path.join(__dirname, 'example.opml');
|
|
36
|
-
const opmlProcessor = new OpmlProcessor();
|
|
37
|
-
const opmlTree = opmlProcessor.loadIntoTree(opmlFile);
|
|
38
|
-
console.log('OPML tree:', opmlTree);
|
|
39
|
-
console.log('OPML texts:', opmlProcessor.extractTexts ? opmlProcessor.extractTexts(opmlFile) : '(no extractTexts)');
|
|
40
|
-
if (prettyPrint) prettyPrint.printTree(opmlTree, { showNavigation: true });
|
|
41
|
-
} catch (e) {
|
|
42
|
-
console.warn('OPML demo error:', e.message);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// --- SnapProcessor (SPB) ---
|
|
48
|
-
console.log('\n=== Snap Example (.spb) ===');
|
|
49
|
-
try {
|
|
50
|
-
const spbFile = path.join(__dirname, 'example.spb');
|
|
51
|
-
const snapProcessor = new SnapProcessor();
|
|
52
|
-
const snapTree = snapProcessor.loadIntoTree(spbFile);
|
|
53
|
-
console.log('Snap tree (.spb):', snapTree);
|
|
54
|
-
console.log('Snap texts (.spb):', snapProcessor.extractTexts(spbFile));
|
|
55
|
-
if (prettyPrint) prettyPrint.printTree(snapTree, { showNavigation: true });
|
|
56
|
-
} catch (e) {
|
|
57
|
-
console.warn('Snap demo error (.spb):', e.message);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// // --- SnapProcessor (SPS) ---
|
|
61
|
-
// console.log('\n=== Snap Example (.sps) ===');
|
|
62
|
-
// try {
|
|
63
|
-
// const spsFile = path.join(__dirname, 'example.sps');
|
|
64
|
-
// const snapProcessor = new SnapProcessor();
|
|
65
|
-
// const snapTree = snapProcessor.loadIntoTree(spsFile);
|
|
66
|
-
// console.log('Snap tree (.sps):', snapTree);
|
|
67
|
-
// console.log('Snap texts (.sps):', snapProcessor.extractTexts(spsFile));
|
|
68
|
-
// if (prettyPrint) prettyPrint.printTree(snapTree, { showNavigation: true });
|
|
69
|
-
// } catch (e) {
|
|
70
|
-
// console.warn('Snap demo error (.sps):', e.message);
|
|
71
|
-
// }
|
|
72
|
-
|
|
73
|
-
// --- GridsetProcessor ---
|
|
74
|
-
console.log('\n=== Gridset Example ===');
|
|
75
|
-
try {
|
|
76
|
-
const gridsetFile = path.join(__dirname, 'example.gridset');
|
|
77
|
-
const gridsetProcessor = new GridsetProcessor();
|
|
78
|
-
const gridTree = gridsetProcessor.loadIntoTree(gridsetFile);
|
|
79
|
-
console.log('Gridset tree:', gridTree);
|
|
80
|
-
console.log('Gridset texts:', gridsetProcessor.extractTexts(gridsetFile));
|
|
81
|
-
if (prettyPrint) prettyPrint.printTree(gridTree, { showNavigation: true });
|
|
82
|
-
} catch (e) {
|
|
83
|
-
console.warn('Gridset demo error:', e.message);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// --- TouchChatProcessor ---
|
|
87
|
-
console.log('\n=== TouchChat Example ===');
|
|
88
|
-
try {
|
|
89
|
-
const touchchatFile = path.join(__dirname, 'example.ce');
|
|
90
|
-
const touchchatProcessor = new TouchChatProcessor();
|
|
91
|
-
const tcTree = touchchatProcessor.loadIntoTree(touchchatFile);
|
|
92
|
-
console.log('TouchChat tree:', tcTree);
|
|
93
|
-
console.log('TouchChat texts:', touchchatProcessor.extractTexts(touchchatFile));
|
|
94
|
-
if (prettyPrint) prettyPrint.printTree(tcTree, { showNavigation: true });
|
|
95
|
-
} catch (e) {
|
|
96
|
-
console.warn('TouchChat demo error:', e.message);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// --- OBF/OBZ Processor ---
|
|
100
|
-
console.log('\n=== OBF/OBZ Example ===');
|
|
101
|
-
try {
|
|
102
|
-
// Use ObfProcessor from dist, matching others
|
|
103
|
-
const obfProcessor = new ObfProcessor();
|
|
104
|
-
const obzFile = path.join(__dirname, 'example.obz');
|
|
105
|
-
// If loadIntoTree is async, use then/catch. If not, call directly.
|
|
106
|
-
let obTree;
|
|
107
|
-
try {
|
|
108
|
-
obTree = obfProcessor.loadIntoTree(obzFile);
|
|
109
|
-
console.log('OBZ tree:', obTree);
|
|
110
|
-
// Try extractTexts if available
|
|
111
|
-
if (obfProcessor.extractTexts) {
|
|
112
|
-
try {
|
|
113
|
-
const texts = obfProcessor.extractTexts(obzFile);
|
|
114
|
-
console.log('OBZ texts:', texts);
|
|
115
|
-
} catch (e) {
|
|
116
|
-
console.warn('OBZ extractTexts error:', e.message);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
if (prettyPrint) prettyPrint.printTree(obTree, { showNavigation: true });
|
|
120
|
-
console.log('\nDemo complete.');
|
|
121
|
-
} catch (e) {
|
|
122
|
-
console.warn('OBZ demo error:', e.message);
|
|
123
|
-
console.log('\nDemo complete.');
|
|
124
|
-
}
|
|
125
|
-
// Return here so the rest of the demo waits for async
|
|
126
|
-
return;
|
|
127
|
-
} catch (e) {
|
|
128
|
-
console.warn('OBZ demo error:', e.message);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// --- ApplePanelsProcessor (if implemented) ---
|
|
132
|
-
// console.log('\n=== Apple Panels Example ===');
|
|
133
|
-
// try {
|
|
134
|
-
// const applePanelsFile = path.join(__dirname, 'example.ascconfig');
|
|
135
|
-
// const applePanelsProcessor = new ApplePanelsProcessor();
|
|
136
|
-
// const apTree = applePanelsProcessor.loadIntoTree(applePanelsFile);
|
|
137
|
-
// console.log('Apple Panels tree:', apTree);
|
|
138
|
-
// if (prettyPrint) prettyPrint.printTree(apTree, { showNavigation: true });
|
|
139
|
-
// } catch (e) {
|
|
140
|
-
// console.warn('Apple Panels demo error:', e.message);
|
|
141
|
-
// }
|
|
142
|
-
|
|
143
|
-
console.log('\nDemo complete.');
|