@willwade/aac-processors 0.0.10 → 0.0.11
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/core/baseProcessor.d.ts +3 -0
- package/dist/core/treeStructure.d.ts +3 -1
- package/dist/core/treeStructure.js +3 -1
- package/dist/processors/gridset/colorUtils.d.ts +18 -0
- package/dist/processors/gridset/colorUtils.js +36 -0
- package/dist/processors/gridset/commands.d.ts +103 -0
- package/dist/processors/gridset/commands.js +958 -0
- package/dist/processors/gridset/index.d.ts +45 -0
- package/dist/processors/gridset/index.js +153 -0
- package/dist/processors/gridset/pluginTypes.d.ts +109 -0
- package/dist/processors/gridset/pluginTypes.js +285 -0
- package/dist/processors/gridset/resolver.d.ts +13 -0
- package/dist/processors/gridset/resolver.js +39 -1
- package/dist/processors/gridset/styleHelpers.d.ts +22 -0
- package/dist/processors/gridset/styleHelpers.js +35 -1
- package/dist/processors/gridset/symbolExtractor.d.ts +121 -0
- package/dist/processors/gridset/symbolExtractor.js +362 -0
- package/dist/processors/gridset/symbolSearch.d.ts +117 -0
- package/dist/processors/gridset/symbolSearch.js +280 -0
- package/dist/processors/gridset/symbols.d.ts +199 -0
- package/dist/processors/gridset/symbols.js +468 -0
- package/dist/processors/gridsetProcessor.js +34 -0
- package/dist/processors/index.d.ts +9 -1
- package/dist/processors/index.js +90 -1
- package/dist/types/aac.d.ts +17 -0
- package/package.json +1 -1
|
@@ -7,6 +7,9 @@ export interface ProcessorOptions {
|
|
|
7
7
|
gridsetPassword?: string;
|
|
8
8
|
customButtonFilter?: (button: AACButton) => boolean;
|
|
9
9
|
preserveAllButtons?: boolean;
|
|
10
|
+
grid3SymbolDir?: string;
|
|
11
|
+
grid3Path?: string;
|
|
12
|
+
grid3Locale?: string;
|
|
10
13
|
}
|
|
11
14
|
export interface ExtractedString {
|
|
12
15
|
string: string;
|
|
@@ -115,7 +115,7 @@ export declare class AACButton implements IAACButton {
|
|
|
115
115
|
parameters?: {
|
|
116
116
|
[key: string]: any;
|
|
117
117
|
};
|
|
118
|
-
constructor({ id, label, message, targetPageId, semanticAction, audioRecording, style, contentType, contentSubType, image, resolvedImageEntry, x, y, columnSpan, rowSpan, scanBlocks, visibility, directActivate, parameters, type, action, }: {
|
|
118
|
+
constructor({ id, label, message, targetPageId, semanticAction, audioRecording, style, contentType, contentSubType, image, resolvedImageEntry, symbolLibrary, symbolPath, x, y, columnSpan, rowSpan, scanBlocks, visibility, directActivate, parameters, type, action, }: {
|
|
119
119
|
id: string;
|
|
120
120
|
label?: string;
|
|
121
121
|
message?: string;
|
|
@@ -132,6 +132,8 @@ export declare class AACButton implements IAACButton {
|
|
|
132
132
|
contentSubType?: string;
|
|
133
133
|
image?: string;
|
|
134
134
|
resolvedImageEntry?: string;
|
|
135
|
+
symbolLibrary?: string;
|
|
136
|
+
symbolPath?: string;
|
|
135
137
|
x?: number;
|
|
136
138
|
y?: number;
|
|
137
139
|
columnSpan?: number;
|
|
@@ -43,7 +43,7 @@ var AACSemanticIntent;
|
|
|
43
43
|
AACSemanticIntent["PLATFORM_SPECIFIC"] = "PLATFORM_SPECIFIC";
|
|
44
44
|
})(AACSemanticIntent || (exports.AACSemanticIntent = AACSemanticIntent = {}));
|
|
45
45
|
class AACButton {
|
|
46
|
-
constructor({ id, label = '', message = '', targetPageId, semanticAction, audioRecording, style, contentType, contentSubType, image, resolvedImageEntry, x, y, columnSpan, rowSpan, scanBlocks, visibility, directActivate, parameters,
|
|
46
|
+
constructor({ id, label = '', message = '', targetPageId, semanticAction, audioRecording, style, contentType, contentSubType, image, resolvedImageEntry, symbolLibrary, symbolPath, x, y, columnSpan, rowSpan, scanBlocks, visibility, directActivate, parameters,
|
|
47
47
|
// Legacy input support
|
|
48
48
|
type, action, }) {
|
|
49
49
|
this.id = id;
|
|
@@ -57,6 +57,8 @@ class AACButton {
|
|
|
57
57
|
this.contentSubType = contentSubType;
|
|
58
58
|
this.image = image;
|
|
59
59
|
this.resolvedImageEntry = resolvedImageEntry;
|
|
60
|
+
this.symbolLibrary = symbolLibrary;
|
|
61
|
+
this.symbolPath = symbolPath;
|
|
60
62
|
this.x = x;
|
|
61
63
|
this.y = y;
|
|
62
64
|
this.columnSpan = columnSpan;
|
|
@@ -54,6 +54,24 @@ export declare function toHexColor(value: string): string | undefined;
|
|
|
54
54
|
* @returns Darkened hex color
|
|
55
55
|
*/
|
|
56
56
|
export declare function darkenColor(hex: string, amount: number): string;
|
|
57
|
+
/**
|
|
58
|
+
* Lighten a hex color by a specified amount
|
|
59
|
+
* @param hex - Hex color string
|
|
60
|
+
* @param amount - Amount to lighten (0-255)
|
|
61
|
+
* @returns Lightened hex color
|
|
62
|
+
*/
|
|
63
|
+
export declare function lightenColor(hex: string, amount: number): string;
|
|
64
|
+
/**
|
|
65
|
+
* Convert hex color to RGBA object
|
|
66
|
+
* @param hex - Hex color string (#RRGGBB or #RRGGBBAA)
|
|
67
|
+
* @returns RGBA object with r, g, b, a properties (0-1 for alpha)
|
|
68
|
+
*/
|
|
69
|
+
export declare function hexToRgba(hex: string): {
|
|
70
|
+
r: number;
|
|
71
|
+
g: number;
|
|
72
|
+
b: number;
|
|
73
|
+
a: number;
|
|
74
|
+
};
|
|
57
75
|
/**
|
|
58
76
|
* Normalize any color format to Grid3's 8-digit hex format
|
|
59
77
|
* @param input - Color string in any supported format
|
|
@@ -16,6 +16,8 @@ exports.clampColorChannel = clampColorChannel;
|
|
|
16
16
|
exports.clampAlpha = clampAlpha;
|
|
17
17
|
exports.toHexColor = toHexColor;
|
|
18
18
|
exports.darkenColor = darkenColor;
|
|
19
|
+
exports.lightenColor = lightenColor;
|
|
20
|
+
exports.hexToRgba = hexToRgba;
|
|
19
21
|
exports.normalizeColor = normalizeColor;
|
|
20
22
|
exports.ensureAlphaChannel = ensureAlphaChannel;
|
|
21
23
|
/**
|
|
@@ -288,6 +290,40 @@ function darkenColor(hex, amount) {
|
|
|
288
290
|
const newB = clamp(b - amount);
|
|
289
291
|
return `#${channelToHex(newR)}${channelToHex(newG)}${channelToHex(newB)}${alpha.toUpperCase()}`;
|
|
290
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* Lighten a hex color by a specified amount
|
|
295
|
+
* @param hex - Hex color string
|
|
296
|
+
* @param amount - Amount to lighten (0-255)
|
|
297
|
+
* @returns Lightened hex color
|
|
298
|
+
*/
|
|
299
|
+
function lightenColor(hex, amount) {
|
|
300
|
+
const normalized = ensureAlphaChannel(hex).substring(1); // strip #
|
|
301
|
+
const rgb = normalized.substring(0, 6);
|
|
302
|
+
const alpha = normalized.substring(6) || 'FF';
|
|
303
|
+
const r = parseInt(rgb.substring(0, 2), 16);
|
|
304
|
+
const g = parseInt(rgb.substring(2, 4), 16);
|
|
305
|
+
const b = parseInt(rgb.substring(4, 6), 16);
|
|
306
|
+
const clamp = (val) => Math.max(0, Math.min(255, val));
|
|
307
|
+
const newR = clamp(r + amount);
|
|
308
|
+
const newG = clamp(g + amount);
|
|
309
|
+
const newB = clamp(b + amount);
|
|
310
|
+
return `#${channelToHex(newR)}${channelToHex(newG)}${channelToHex(newB)}${alpha.toUpperCase()}`;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Convert hex color to RGBA object
|
|
314
|
+
* @param hex - Hex color string (#RRGGBB or #RRGGBBAA)
|
|
315
|
+
* @returns RGBA object with r, g, b, a properties (0-1 for alpha)
|
|
316
|
+
*/
|
|
317
|
+
function hexToRgba(hex) {
|
|
318
|
+
const normalized = ensureAlphaChannel(hex).substring(1); // strip #
|
|
319
|
+
const rgb = normalized.substring(0, 6);
|
|
320
|
+
const alphaHex = normalized.substring(6) || 'FF';
|
|
321
|
+
const r = parseInt(rgb.substring(0, 2), 16);
|
|
322
|
+
const g = parseInt(rgb.substring(2, 4), 16);
|
|
323
|
+
const b = parseInt(rgb.substring(4, 6), 16);
|
|
324
|
+
const a = parseInt(alphaHex, 16) / 255;
|
|
325
|
+
return { r, g, b, a };
|
|
326
|
+
}
|
|
291
327
|
/**
|
|
292
328
|
* Normalize any color format to Grid3's 8-digit hex format
|
|
293
329
|
* @param input - Color string in any supported format
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grid 3 Command Definitions and Detection System
|
|
3
|
+
*
|
|
4
|
+
* This module provides comprehensive metadata for all Grid 3 commands,
|
|
5
|
+
* organized by plugin/category. It enables:
|
|
6
|
+
* - Command detection and classification
|
|
7
|
+
* - Parameter extraction
|
|
8
|
+
* - Future extensibility for command execution
|
|
9
|
+
* - Semantic action mapping
|
|
10
|
+
*
|
|
11
|
+
* Grid 3 has 33+ plugins with 200+ commands. This catalog captures
|
|
12
|
+
* the most commonly used and important commands.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Command categories in Grid 3
|
|
16
|
+
*/
|
|
17
|
+
export declare enum Grid3CommandCategory {
|
|
18
|
+
NAVIGATION = "navigation",
|
|
19
|
+
COMMUNICATION = "communication",
|
|
20
|
+
TEXT_EDITING = "text_editing",
|
|
21
|
+
COMPUTER_CONTROL = "computer_control",
|
|
22
|
+
WEB_BROWSER = "web_browser",
|
|
23
|
+
EMAIL = "email",
|
|
24
|
+
PHONE = "phone",
|
|
25
|
+
SMS = "sms",
|
|
26
|
+
SYSTEM = "system",
|
|
27
|
+
SETTINGS = "settings",
|
|
28
|
+
SPEECH = "speech",
|
|
29
|
+
AUTO_CONTENT = "auto_content",
|
|
30
|
+
ENVIRONMENT_CONTROL = "environment_control",
|
|
31
|
+
MOUSE = "mouse",
|
|
32
|
+
WINDOW = "window",
|
|
33
|
+
MEDIA = "media",
|
|
34
|
+
CUSTOM = "custom"
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parameter definition for commands
|
|
38
|
+
*/
|
|
39
|
+
export interface CommandParameter {
|
|
40
|
+
key: string;
|
|
41
|
+
type: 'string' | 'number' | 'boolean' | 'grid' | 'color' | 'font';
|
|
42
|
+
required: boolean;
|
|
43
|
+
description?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Command metadata definition
|
|
47
|
+
*/
|
|
48
|
+
export interface Grid3CommandDefinition {
|
|
49
|
+
id: string;
|
|
50
|
+
category: Grid3CommandCategory;
|
|
51
|
+
pluginId: string;
|
|
52
|
+
displayName: string;
|
|
53
|
+
description: string;
|
|
54
|
+
parameters?: CommandParameter[];
|
|
55
|
+
platforms?: ('desktop' | 'ios' | 'medicare' | 'medicareBionics')[];
|
|
56
|
+
deprecated?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Registry of all Grid 3 commands
|
|
60
|
+
* Key is command ID (e.g., 'Jump.To', 'Action.InsertText')
|
|
61
|
+
*/
|
|
62
|
+
export declare const GRID3_COMMANDS: Record<string, Grid3CommandDefinition>;
|
|
63
|
+
/**
|
|
64
|
+
* Get command definition by ID
|
|
65
|
+
*/
|
|
66
|
+
export declare function getCommandDefinition(commandId: string): Grid3CommandDefinition | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Check if a command ID is known
|
|
69
|
+
*/
|
|
70
|
+
export declare function isKnownCommand(commandId: string): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Get all commands for a specific plugin
|
|
73
|
+
*/
|
|
74
|
+
export declare function getCommandsByPlugin(pluginId: string): Grid3CommandDefinition[];
|
|
75
|
+
/**
|
|
76
|
+
* Get all commands in a category
|
|
77
|
+
*/
|
|
78
|
+
export declare function getCommandsByCategory(category: Grid3CommandCategory): Grid3CommandDefinition[];
|
|
79
|
+
/**
|
|
80
|
+
* Get all command IDs
|
|
81
|
+
*/
|
|
82
|
+
export declare function getAllCommandIds(): string[];
|
|
83
|
+
/**
|
|
84
|
+
* Get all plugin IDs that have commands
|
|
85
|
+
*/
|
|
86
|
+
export declare function getAllPluginIds(): string[];
|
|
87
|
+
/**
|
|
88
|
+
* Extract parameters from a Grid 3 command object
|
|
89
|
+
*/
|
|
90
|
+
export interface ExtractedParameters {
|
|
91
|
+
[key: string]: string | number | boolean;
|
|
92
|
+
}
|
|
93
|
+
export declare function extractCommandParameters(command: any): ExtractedParameters;
|
|
94
|
+
/**
|
|
95
|
+
* Detect and categorize a command from Grid 3
|
|
96
|
+
*/
|
|
97
|
+
export declare function detectCommand(commandObj: any): {
|
|
98
|
+
id: string;
|
|
99
|
+
definition?: Grid3CommandDefinition;
|
|
100
|
+
parameters: ExtractedParameters;
|
|
101
|
+
category: Grid3CommandCategory | 'unknown';
|
|
102
|
+
pluginId: string | 'unknown';
|
|
103
|
+
};
|