@willwade/aac-processors 0.0.10 → 0.0.12
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/cli/index.js +7 -0
- package/dist/core/analyze.js +1 -0
- package/dist/core/baseProcessor.d.ts +3 -0
- package/dist/core/treeStructure.d.ts +14 -2
- package/dist/core/treeStructure.js +8 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +20 -3
- package/dist/{analytics → optional/analytics}/history.d.ts +3 -3
- package/dist/{analytics → optional/analytics}/history.js +3 -3
- package/dist/optional/analytics/index.d.ts +28 -0
- package/dist/optional/analytics/index.js +73 -0
- package/dist/optional/analytics/metrics/comparison.d.ts +36 -0
- package/dist/optional/analytics/metrics/comparison.js +330 -0
- package/dist/optional/analytics/metrics/core.d.ts +36 -0
- package/dist/optional/analytics/metrics/core.js +422 -0
- package/dist/optional/analytics/metrics/effort.d.ts +137 -0
- package/dist/optional/analytics/metrics/effort.js +198 -0
- package/dist/optional/analytics/metrics/index.d.ts +15 -0
- package/dist/optional/analytics/metrics/index.js +36 -0
- package/dist/optional/analytics/metrics/sentence.d.ts +49 -0
- package/dist/optional/analytics/metrics/sentence.js +112 -0
- package/dist/optional/analytics/metrics/types.d.ts +157 -0
- package/dist/optional/analytics/metrics/types.js +7 -0
- package/dist/optional/analytics/metrics/vocabulary.d.ts +65 -0
- package/dist/optional/analytics/metrics/vocabulary.js +140 -0
- package/dist/optional/analytics/reference/index.d.ts +51 -0
- package/dist/optional/analytics/reference/index.js +102 -0
- package/dist/optional/analytics/utils/idGenerator.d.ts +59 -0
- package/dist/optional/analytics/utils/idGenerator.js +96 -0
- 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 +59 -0
- package/dist/processors/index.d.ts +10 -1
- package/dist/processors/index.js +93 -2
- package/dist/processors/obfProcessor.js +25 -2
- package/dist/processors/obfsetProcessor.d.ts +26 -0
- package/dist/processors/obfsetProcessor.js +179 -0
- package/dist/processors/snapProcessor.js +29 -1
- package/dist/processors/touchchatProcessor.js +27 -0
- package/dist/types/aac.d.ts +21 -0
- package/package.json +1 -1
package/dist/processors/index.js
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
17
|
+
exports.getNamedColor = exports.resolveGridsetPasswordFromEnv = exports.resolveGridsetPassword = exports.wordlistToXml = exports.updateWordlist = exports.extractWordlists = exports.createWordlist = exports.resolveGrid3CellImage = exports.readAllGridsetHistory = exports.readGridsetHistoryForUser = exports.readGridsetHistory = exports.isGridsetInstalled = exports.findGridsetUserHistory = exports.findGridsetVocabularies = exports.findGridsetUsers = exports.findGridsetHistoryDatabases = exports.findGridsetUserPaths = exports.getGridsetCommonDocumentsPath = exports.createGridsetFileMapXml = exports.createGridsetSettingsXml = exports.generateGridsetGuid = exports.openGridsetImage = exports.getGridsetAllowedImageEntries = exports.getGridsetPageTokenImageMap = exports.readAllGrid3History = exports.readGrid3HistoryForUser = exports.readGrid3History = exports.isGrid3Installed = exports.findGrid3UserHistory = exports.findGrid3Vocabularies = exports.findGrid3Users = exports.findGrid3HistoryDatabases = exports.findGrid3UserPaths = exports.getCommonDocumentsPath = exports.createFileMapXml = exports.createSettingsXml = exports.generateGrid3Guid = exports.openImage = exports.getAllowedImageEntries = exports.getPageTokenImageMap = exports.ObfsetProcessor = exports.AstericsGridProcessor = exports.TouchChatProcessor = exports.SnapProcessor = exports.OpmlProcessor = exports.ObfProcessor = exports.GridsetProcessor = exports.ExcelProcessor = exports.DotProcessor = exports.ApplePanelsProcessor = void 0;
|
|
18
|
+
exports.symbolReferenceToFilename = exports.getSymbolSearchIndexesDir = exports.getSymbolLibrariesDir = exports.getDefaultGrid3Path = exports.getSymbolLibraryDisplayName = exports.isKnownSymbolLibrary = exports.getSymbolPath = exports.getSymbolLibraryName = exports.createSymbolReference = exports.analyzeSymbolUsage = exports.extractSymbolReferences = exports.getSymbolLibraryInfo = exports.getAvailableSymbolLibraries = exports.resolveSymbolReference = exports.isSymbolReference = exports.parseSymbolReference = exports.Grid3CommandCategory = exports.GRID3_COMMANDS = exports.extractCommandParameters = exports.getAllPluginIds = exports.getAllCommandIds = exports.getCommandsByCategory = exports.getCommandsByPlugin = exports.getCommandDefinition = exports.detectCommand = exports.isRegularCell = exports.isAutoContentCell = exports.isLiveCell = exports.isWorkspaceCell = exports.getCellTypeDisplayName = exports.AUTOCONTENT_TYPES = exports.LIVECELL_TYPES = exports.WORKSPACE_TYPES = exports.Grid3CellType = exports.detectPluginCellType = exports.ensureAlphaChannelFromStyles = exports.SHAPE_NAMES = exports.CellBackgroundShape = exports.createCategoryStyle = exports.createDefaultStylesXml = exports.CATEGORY_STYLES = exports.DEFAULT_GRID3_STYLES = exports.ensureAlphaChannel = exports.normalizeColor = exports.darkenColor = exports.toHexColor = exports.clampAlpha = exports.clampColorChannel = exports.channelToHex = exports.rgbaToHex = void 0;
|
|
19
|
+
exports.openTouchChatImage = exports.getTouchChatAllowedImageEntries = exports.getTouchChatPageTokenImageMap = exports.readSnapUsageForUser = exports.readSnapUsage = exports.isSnapInstalled = exports.findSnapUserHistory = exports.findSnapUserVocabularies = exports.findSnapUsers = exports.findSnapPackagePath = exports.findSnapPackages = exports.openSnapImage = exports.getSnapAllowedImageEntries = exports.getSnapPageTokenImageMap = exports.getSymbolSearchStats = exports.countLibrarySymbols = exports.getSearchSuggestions = exports.getAllSearchTerms = exports.getSymbolDisplayName = exports.getSymbolFilename = exports.searchSymbolsWithReferences = exports.searchSymbols = exports.loadSearchIndexes = exports.parsePixFile = exports.createSymbolManifest = exports.exportSymbolReferencesToCsv = exports.suggestExtractionStrategy = exports.analyzeSymbolExtraction = exports.convertToAstericsImage = exports.extractSymbolLibraryImage = exports.extractButtonImage = exports.getSymbolSearchDir = exports.getSymbolsDir = exports.parseImageSymbolReference = exports.isSymbolLibraryReference = exports.SYMBOL_LIBRARIES = void 0;
|
|
5
20
|
var applePanelsProcessor_1 = require("./applePanelsProcessor");
|
|
6
21
|
Object.defineProperty(exports, "ApplePanelsProcessor", { enumerable: true, get: function () { return applePanelsProcessor_1.ApplePanelsProcessor; } });
|
|
7
22
|
var dotProcessor_1 = require("./dotProcessor");
|
|
@@ -20,6 +35,8 @@ var touchchatProcessor_1 = require("./touchchatProcessor");
|
|
|
20
35
|
Object.defineProperty(exports, "TouchChatProcessor", { enumerable: true, get: function () { return touchchatProcessor_1.TouchChatProcessor; } });
|
|
21
36
|
var astericsGridProcessor_1 = require("./astericsGridProcessor");
|
|
22
37
|
Object.defineProperty(exports, "AstericsGridProcessor", { enumerable: true, get: function () { return astericsGridProcessor_1.AstericsGridProcessor; } });
|
|
38
|
+
var obfsetProcessor_1 = require("./obfsetProcessor");
|
|
39
|
+
Object.defineProperty(exports, "ObfsetProcessor", { enumerable: true, get: function () { return obfsetProcessor_1.ObfsetProcessor; } });
|
|
23
40
|
// Gridset (Grid 3) helpers
|
|
24
41
|
var helpers_1 = require("./gridset/helpers");
|
|
25
42
|
Object.defineProperty(exports, "getPageTokenImageMap", { enumerable: true, get: function () { return helpers_1.getPageTokenImageMap; } });
|
|
@@ -83,9 +100,83 @@ Object.defineProperty(exports, "DEFAULT_GRID3_STYLES", { enumerable: true, get:
|
|
|
83
100
|
Object.defineProperty(exports, "CATEGORY_STYLES", { enumerable: true, get: function () { return styleHelpers_1.CATEGORY_STYLES; } });
|
|
84
101
|
Object.defineProperty(exports, "createDefaultStylesXml", { enumerable: true, get: function () { return styleHelpers_1.createDefaultStylesXml; } });
|
|
85
102
|
Object.defineProperty(exports, "createCategoryStyle", { enumerable: true, get: function () { return styleHelpers_1.createCategoryStyle; } });
|
|
103
|
+
Object.defineProperty(exports, "CellBackgroundShape", { enumerable: true, get: function () { return styleHelpers_1.CellBackgroundShape; } });
|
|
104
|
+
Object.defineProperty(exports, "SHAPE_NAMES", { enumerable: true, get: function () { return styleHelpers_1.SHAPE_NAMES; } });
|
|
86
105
|
// Re-export ensureAlphaChannel from styleHelpers for backward compatibility
|
|
87
106
|
var styleHelpers_2 = require("./gridset/styleHelpers");
|
|
88
107
|
Object.defineProperty(exports, "ensureAlphaChannelFromStyles", { enumerable: true, get: function () { return styleHelpers_2.ensureAlphaChannel; } });
|
|
108
|
+
// Gridset (Grid 3) plugin cell type detection
|
|
109
|
+
var pluginTypes_1 = require("./gridset/pluginTypes");
|
|
110
|
+
Object.defineProperty(exports, "detectPluginCellType", { enumerable: true, get: function () { return pluginTypes_1.detectPluginCellType; } });
|
|
111
|
+
Object.defineProperty(exports, "Grid3CellType", { enumerable: true, get: function () { return pluginTypes_1.Grid3CellType; } });
|
|
112
|
+
Object.defineProperty(exports, "WORKSPACE_TYPES", { enumerable: true, get: function () { return pluginTypes_1.WORKSPACE_TYPES; } });
|
|
113
|
+
Object.defineProperty(exports, "LIVECELL_TYPES", { enumerable: true, get: function () { return pluginTypes_1.LIVECELL_TYPES; } });
|
|
114
|
+
Object.defineProperty(exports, "AUTOCONTENT_TYPES", { enumerable: true, get: function () { return pluginTypes_1.AUTOCONTENT_TYPES; } });
|
|
115
|
+
Object.defineProperty(exports, "getCellTypeDisplayName", { enumerable: true, get: function () { return pluginTypes_1.getCellTypeDisplayName; } });
|
|
116
|
+
Object.defineProperty(exports, "isWorkspaceCell", { enumerable: true, get: function () { return pluginTypes_1.isWorkspaceCell; } });
|
|
117
|
+
Object.defineProperty(exports, "isLiveCell", { enumerable: true, get: function () { return pluginTypes_1.isLiveCell; } });
|
|
118
|
+
Object.defineProperty(exports, "isAutoContentCell", { enumerable: true, get: function () { return pluginTypes_1.isAutoContentCell; } });
|
|
119
|
+
Object.defineProperty(exports, "isRegularCell", { enumerable: true, get: function () { return pluginTypes_1.isRegularCell; } });
|
|
120
|
+
// Gridset (Grid 3) command definitions and detection
|
|
121
|
+
var commands_1 = require("./gridset/commands");
|
|
122
|
+
Object.defineProperty(exports, "detectCommand", { enumerable: true, get: function () { return commands_1.detectCommand; } });
|
|
123
|
+
Object.defineProperty(exports, "getCommandDefinition", { enumerable: true, get: function () { return commands_1.getCommandDefinition; } });
|
|
124
|
+
Object.defineProperty(exports, "getCommandsByPlugin", { enumerable: true, get: function () { return commands_1.getCommandsByPlugin; } });
|
|
125
|
+
Object.defineProperty(exports, "getCommandsByCategory", { enumerable: true, get: function () { return commands_1.getCommandsByCategory; } });
|
|
126
|
+
Object.defineProperty(exports, "getAllCommandIds", { enumerable: true, get: function () { return commands_1.getAllCommandIds; } });
|
|
127
|
+
Object.defineProperty(exports, "getAllPluginIds", { enumerable: true, get: function () { return commands_1.getAllPluginIds; } });
|
|
128
|
+
Object.defineProperty(exports, "extractCommandParameters", { enumerable: true, get: function () { return commands_1.extractCommandParameters; } });
|
|
129
|
+
Object.defineProperty(exports, "GRID3_COMMANDS", { enumerable: true, get: function () { return commands_1.GRID3_COMMANDS; } });
|
|
130
|
+
Object.defineProperty(exports, "Grid3CommandCategory", { enumerable: true, get: function () { return commands_1.Grid3CommandCategory; } });
|
|
131
|
+
// Gridset (Grid 3) enhanced index - re-export everything
|
|
132
|
+
__exportStar(require("./gridset/index"), exports);
|
|
133
|
+
// Gridset (Grid 3) symbol library handling
|
|
134
|
+
var symbols_1 = require("./gridset/symbols");
|
|
135
|
+
Object.defineProperty(exports, "parseSymbolReference", { enumerable: true, get: function () { return symbols_1.parseSymbolReference; } });
|
|
136
|
+
Object.defineProperty(exports, "isSymbolReference", { enumerable: true, get: function () { return symbols_1.isSymbolReference; } });
|
|
137
|
+
Object.defineProperty(exports, "resolveSymbolReference", { enumerable: true, get: function () { return symbols_1.resolveSymbolReference; } });
|
|
138
|
+
Object.defineProperty(exports, "getAvailableSymbolLibraries", { enumerable: true, get: function () { return symbols_1.getAvailableSymbolLibraries; } });
|
|
139
|
+
Object.defineProperty(exports, "getSymbolLibraryInfo", { enumerable: true, get: function () { return symbols_1.getSymbolLibraryInfo; } });
|
|
140
|
+
Object.defineProperty(exports, "extractSymbolReferences", { enumerable: true, get: function () { return symbols_1.extractSymbolReferences; } });
|
|
141
|
+
Object.defineProperty(exports, "analyzeSymbolUsage", { enumerable: true, get: function () { return symbols_1.analyzeSymbolUsage; } });
|
|
142
|
+
Object.defineProperty(exports, "createSymbolReference", { enumerable: true, get: function () { return symbols_1.createSymbolReference; } });
|
|
143
|
+
Object.defineProperty(exports, "getSymbolLibraryName", { enumerable: true, get: function () { return symbols_1.getSymbolLibraryName; } });
|
|
144
|
+
Object.defineProperty(exports, "getSymbolPath", { enumerable: true, get: function () { return symbols_1.getSymbolPath; } });
|
|
145
|
+
Object.defineProperty(exports, "isKnownSymbolLibrary", { enumerable: true, get: function () { return symbols_1.isKnownSymbolLibrary; } });
|
|
146
|
+
Object.defineProperty(exports, "getSymbolLibraryDisplayName", { enumerable: true, get: function () { return symbols_1.getSymbolLibraryDisplayName; } });
|
|
147
|
+
Object.defineProperty(exports, "getDefaultGrid3Path", { enumerable: true, get: function () { return symbols_1.getDefaultGrid3Path; } });
|
|
148
|
+
Object.defineProperty(exports, "getSymbolLibrariesDir", { enumerable: true, get: function () { return symbols_1.getSymbolLibrariesDir; } });
|
|
149
|
+
Object.defineProperty(exports, "getSymbolSearchIndexesDir", { enumerable: true, get: function () { return symbols_1.getSymbolSearchIndexesDir; } });
|
|
150
|
+
Object.defineProperty(exports, "symbolReferenceToFilename", { enumerable: true, get: function () { return symbols_1.symbolReferenceToFilename; } });
|
|
151
|
+
Object.defineProperty(exports, "SYMBOL_LIBRARIES", { enumerable: true, get: function () { return symbols_1.SYMBOL_LIBRARIES; } });
|
|
152
|
+
var resolver_2 = require("./gridset/resolver");
|
|
153
|
+
Object.defineProperty(exports, "isSymbolLibraryReference", { enumerable: true, get: function () { return resolver_2.isSymbolLibraryReference; } });
|
|
154
|
+
Object.defineProperty(exports, "parseImageSymbolReference", { enumerable: true, get: function () { return resolver_2.parseImageSymbolReference; } });
|
|
155
|
+
// Backward compatibility
|
|
156
|
+
var symbols_2 = require("./gridset/symbols");
|
|
157
|
+
Object.defineProperty(exports, "getSymbolsDir", { enumerable: true, get: function () { return symbols_2.getSymbolsDir; } });
|
|
158
|
+
Object.defineProperty(exports, "getSymbolSearchDir", { enumerable: true, get: function () { return symbols_2.getSymbolSearchDir; } });
|
|
159
|
+
// Gridset (Grid 3) symbol extraction for conversion
|
|
160
|
+
var symbolExtractor_1 = require("./gridset/symbolExtractor");
|
|
161
|
+
Object.defineProperty(exports, "extractButtonImage", { enumerable: true, get: function () { return symbolExtractor_1.extractButtonImage; } });
|
|
162
|
+
Object.defineProperty(exports, "extractSymbolLibraryImage", { enumerable: true, get: function () { return symbolExtractor_1.extractSymbolLibraryImage; } });
|
|
163
|
+
Object.defineProperty(exports, "convertToAstericsImage", { enumerable: true, get: function () { return symbolExtractor_1.convertToAstericsImage; } });
|
|
164
|
+
Object.defineProperty(exports, "analyzeSymbolExtraction", { enumerable: true, get: function () { return symbolExtractor_1.analyzeSymbolExtraction; } });
|
|
165
|
+
Object.defineProperty(exports, "suggestExtractionStrategy", { enumerable: true, get: function () { return symbolExtractor_1.suggestExtractionStrategy; } });
|
|
166
|
+
Object.defineProperty(exports, "exportSymbolReferencesToCsv", { enumerable: true, get: function () { return symbolExtractor_1.exportSymbolReferencesToCsv; } });
|
|
167
|
+
Object.defineProperty(exports, "createSymbolManifest", { enumerable: true, get: function () { return symbolExtractor_1.createSymbolManifest; } });
|
|
168
|
+
// Gridset (Grid 3) symbol search
|
|
169
|
+
var symbolSearch_1 = require("./gridset/symbolSearch");
|
|
170
|
+
Object.defineProperty(exports, "parsePixFile", { enumerable: true, get: function () { return symbolSearch_1.parsePixFile; } });
|
|
171
|
+
Object.defineProperty(exports, "loadSearchIndexes", { enumerable: true, get: function () { return symbolSearch_1.loadSearchIndexes; } });
|
|
172
|
+
Object.defineProperty(exports, "searchSymbols", { enumerable: true, get: function () { return symbolSearch_1.searchSymbols; } });
|
|
173
|
+
Object.defineProperty(exports, "searchSymbolsWithReferences", { enumerable: true, get: function () { return symbolSearch_1.searchSymbolsWithReferences; } });
|
|
174
|
+
Object.defineProperty(exports, "getSymbolFilename", { enumerable: true, get: function () { return symbolSearch_1.getSymbolFilename; } });
|
|
175
|
+
Object.defineProperty(exports, "getSymbolDisplayName", { enumerable: true, get: function () { return symbolSearch_1.getSymbolDisplayName; } });
|
|
176
|
+
Object.defineProperty(exports, "getAllSearchTerms", { enumerable: true, get: function () { return symbolSearch_1.getAllSearchTerms; } });
|
|
177
|
+
Object.defineProperty(exports, "getSearchSuggestions", { enumerable: true, get: function () { return symbolSearch_1.getSearchSuggestions; } });
|
|
178
|
+
Object.defineProperty(exports, "countLibrarySymbols", { enumerable: true, get: function () { return symbolSearch_1.countLibrarySymbols; } });
|
|
179
|
+
Object.defineProperty(exports, "getSymbolSearchStats", { enumerable: true, get: function () { return symbolSearch_1.getSymbolSearchStats; } });
|
|
89
180
|
// Snap helpers
|
|
90
181
|
var helpers_3 = require("./snap/helpers");
|
|
91
182
|
Object.defineProperty(exports, "getSnapPageTokenImageMap", { enumerable: true, get: function () { return helpers_3.getPageTokenImageMap; } });
|
|
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ObfProcessor = void 0;
|
|
7
7
|
const baseProcessor_1 = require("../core/baseProcessor");
|
|
8
8
|
const treeStructure_1 = require("../core/treeStructure");
|
|
9
|
-
|
|
9
|
+
const idGenerator_1 = require("../optional/analytics/utils/idGenerator");
|
|
10
10
|
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
11
11
|
const fs_1 = __importDefault(require("fs"));
|
|
12
|
-
// Removed unused import: path
|
|
13
12
|
const obfValidator_1 = require("../validation/obfValidator");
|
|
14
13
|
const OBF_FORMAT_VERSION = 'open-board-0.1';
|
|
15
14
|
class ObfProcessor extends baseProcessor_1.BaseProcessor {
|
|
@@ -48,6 +47,7 @@ class ObfProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
48
47
|
},
|
|
49
48
|
semanticAction,
|
|
50
49
|
targetPageId: btn.load_board?.path,
|
|
50
|
+
semantic_id: btn.semantic_id, // Extract semantic_id if present
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
const buttonMap = new Map(buttons.map((btn) => [btn.id, btn]));
|
|
@@ -105,6 +105,29 @@ class ObfProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
page.grid = grid;
|
|
108
|
+
// Generate clone_id for buttons in the grid
|
|
109
|
+
const semanticIds = [];
|
|
110
|
+
const cloneIds = [];
|
|
111
|
+
grid.forEach((row, rowIndex) => {
|
|
112
|
+
row.forEach((btn, colIndex) => {
|
|
113
|
+
if (btn) {
|
|
114
|
+
// Generate clone_id based on position and label
|
|
115
|
+
btn.clone_id = (0, idGenerator_1.generateCloneId)(rows, cols, rowIndex, colIndex, btn.label);
|
|
116
|
+
cloneIds.push(btn.clone_id);
|
|
117
|
+
// Track semantic_id if present
|
|
118
|
+
if (btn.semantic_id) {
|
|
119
|
+
semanticIds.push(btn.semantic_id);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
// Track IDs on the page
|
|
125
|
+
if (semanticIds.length > 0) {
|
|
126
|
+
page.semantic_ids = semanticIds;
|
|
127
|
+
}
|
|
128
|
+
if (cloneIds.length > 0) {
|
|
129
|
+
page.clone_ids = cloneIds;
|
|
130
|
+
}
|
|
108
131
|
}
|
|
109
132
|
}
|
|
110
133
|
return page;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OBF Set Processor - Handles JSON-formatted .obfset files
|
|
3
|
+
* These are pre-extracted board sets in JSON array format
|
|
4
|
+
*/
|
|
5
|
+
import { AACTree } from '../core/treeStructure';
|
|
6
|
+
import { BaseProcessor, ProcessorOptions } from '../core/baseProcessor';
|
|
7
|
+
export declare class ObfsetProcessor extends BaseProcessor {
|
|
8
|
+
constructor(options?: ProcessorOptions);
|
|
9
|
+
/**
|
|
10
|
+
* Extract all text content
|
|
11
|
+
*/
|
|
12
|
+
extractTexts(filePathOrBuffer: string | Buffer): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Load an .obfset file (JSON array of boards)
|
|
15
|
+
*/
|
|
16
|
+
loadIntoTree(filePathOrBuffer: string | Buffer): AACTree;
|
|
17
|
+
/**
|
|
18
|
+
* Process texts (not supported for .obfset currently)
|
|
19
|
+
*/
|
|
20
|
+
processTexts(_filePathOrBuffer: string | Buffer, _translations: Map<string, string>, _outputPath: string): Buffer;
|
|
21
|
+
/**
|
|
22
|
+
* Save tree structure back to file
|
|
23
|
+
*/
|
|
24
|
+
saveFromTree(_tree: AACTree, _outputPath: string): void;
|
|
25
|
+
supportsExtension(extension: string): boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* OBF Set Processor - Handles JSON-formatted .obfset files
|
|
4
|
+
* These are pre-extracted board sets in JSON array format
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ObfsetProcessor = void 0;
|
|
11
|
+
const treeStructure_1 = require("../core/treeStructure");
|
|
12
|
+
const treeStructure_2 = require("../core/treeStructure");
|
|
13
|
+
const fs_1 = __importDefault(require("fs"));
|
|
14
|
+
const baseProcessor_1 = require("../core/baseProcessor");
|
|
15
|
+
class ObfsetProcessor extends baseProcessor_1.BaseProcessor {
|
|
16
|
+
constructor(options = {}) {
|
|
17
|
+
super(options);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Extract all text content
|
|
21
|
+
*/
|
|
22
|
+
extractTexts(filePathOrBuffer) {
|
|
23
|
+
const tree = this.loadIntoTree(filePathOrBuffer);
|
|
24
|
+
const texts = new Set();
|
|
25
|
+
Object.values(tree.pages).forEach((page) => {
|
|
26
|
+
if (page.name)
|
|
27
|
+
texts.add(page.name);
|
|
28
|
+
page.buttons.forEach((button) => {
|
|
29
|
+
if (button.label)
|
|
30
|
+
texts.add(button.label);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
return Array.from(texts);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Load an .obfset file (JSON array of boards)
|
|
37
|
+
*/
|
|
38
|
+
loadIntoTree(filePathOrBuffer) {
|
|
39
|
+
const tree = new treeStructure_1.AACTree();
|
|
40
|
+
let content;
|
|
41
|
+
if (Buffer.isBuffer(filePathOrBuffer)) {
|
|
42
|
+
content = filePathOrBuffer.toString('utf-8');
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
content = fs_1.default.readFileSync(filePathOrBuffer, 'utf-8');
|
|
46
|
+
}
|
|
47
|
+
const boards = JSON.parse(content);
|
|
48
|
+
// Track board ID mappings
|
|
49
|
+
const boardMap = new Map();
|
|
50
|
+
// First pass: create all boards
|
|
51
|
+
boards.forEach((boardData) => {
|
|
52
|
+
const rows = boardData.grid?.rows || 4;
|
|
53
|
+
const cols = boardData.grid?.columns || 6;
|
|
54
|
+
const name = boardData.name || boardData.id || `Board ${boardData.id}`;
|
|
55
|
+
const page = new treeStructure_2.AACPage({
|
|
56
|
+
id: boardData.id,
|
|
57
|
+
name,
|
|
58
|
+
grid: { columns: cols, rows: rows },
|
|
59
|
+
buttons: [],
|
|
60
|
+
});
|
|
61
|
+
tree.addPage(page);
|
|
62
|
+
boardMap.set(boardData.id, page);
|
|
63
|
+
});
|
|
64
|
+
// Second pass: process buttons and establish parent relationships
|
|
65
|
+
boards.forEach((boardData) => {
|
|
66
|
+
const page = boardMap.get(boardData.id);
|
|
67
|
+
if (!page)
|
|
68
|
+
return;
|
|
69
|
+
const rows = boardData.grid?.rows || 4;
|
|
70
|
+
const cols = boardData.grid?.columns || 6;
|
|
71
|
+
// Initialize grid with nulls
|
|
72
|
+
page.grid = Array.from({ length: rows }, () => Array.from({ length: cols }, () => null));
|
|
73
|
+
// Create button map by ID
|
|
74
|
+
const buttonMap = new Map();
|
|
75
|
+
const buttons = boardData.buttons || [];
|
|
76
|
+
buttons.forEach((btnData) => {
|
|
77
|
+
buttonMap.set(btnData.id, btnData);
|
|
78
|
+
});
|
|
79
|
+
// Process grid order to place buttons in correct positions
|
|
80
|
+
const gridOrder = boardData.grid?.order || [];
|
|
81
|
+
const semanticIds = [];
|
|
82
|
+
const cloneIds = [];
|
|
83
|
+
gridOrder.forEach((row, rowIndex) => {
|
|
84
|
+
row.forEach((buttonId, colIndex) => {
|
|
85
|
+
const btnData = buttonMap.get(buttonId);
|
|
86
|
+
if (btnData) {
|
|
87
|
+
// Create semantic action
|
|
88
|
+
let semanticAction;
|
|
89
|
+
if (btnData.load_board?.id) {
|
|
90
|
+
// Navigation button
|
|
91
|
+
semanticAction = {
|
|
92
|
+
category: treeStructure_2.AACSemanticCategory.NAVIGATION,
|
|
93
|
+
intent: treeStructure_2.AACSemanticIntent.NAVIGATE_TO,
|
|
94
|
+
targetId: btnData.load_board.id,
|
|
95
|
+
fallback: {
|
|
96
|
+
type: 'NAVIGATE',
|
|
97
|
+
targetPageId: btnData.load_board.id,
|
|
98
|
+
add_to_sentence: btnData.load_board.add_to_sentence,
|
|
99
|
+
temporary_home: btnData.load_board.temporary_home,
|
|
100
|
+
},
|
|
101
|
+
platformData: {
|
|
102
|
+
grid3: {
|
|
103
|
+
commandId: 'GO_TO_BOARD',
|
|
104
|
+
parameters: {
|
|
105
|
+
add_to_sentence: btnData.load_board.add_to_sentence,
|
|
106
|
+
temporary_home: btnData.load_board.temporary_home,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
// Speaking button
|
|
114
|
+
semanticAction = {
|
|
115
|
+
category: treeStructure_2.AACSemanticCategory.COMMUNICATION,
|
|
116
|
+
intent: treeStructure_2.AACSemanticIntent.SPEAK_TEXT,
|
|
117
|
+
text: btnData.label || '',
|
|
118
|
+
fallback: { type: 'SPEAK', message: btnData.label || '' },
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
const button = new treeStructure_2.AACButton({
|
|
122
|
+
id: btnData.id,
|
|
123
|
+
label: btnData.label || '',
|
|
124
|
+
message: btnData.label || '',
|
|
125
|
+
targetPageId: btnData.load_board?.id,
|
|
126
|
+
semanticAction,
|
|
127
|
+
semantic_id: btnData.semantic_id,
|
|
128
|
+
clone_id: btnData.clone_id,
|
|
129
|
+
});
|
|
130
|
+
// Add to grid at the correct position
|
|
131
|
+
if (rowIndex < rows && colIndex < cols) {
|
|
132
|
+
page.grid[rowIndex][colIndex] = button;
|
|
133
|
+
}
|
|
134
|
+
page.buttons.push(button);
|
|
135
|
+
// Track IDs
|
|
136
|
+
if (btnData.semantic_id) {
|
|
137
|
+
semanticIds.push(String(btnData.semantic_id));
|
|
138
|
+
}
|
|
139
|
+
if (btnData.clone_id) {
|
|
140
|
+
cloneIds.push(String(btnData.clone_id));
|
|
141
|
+
}
|
|
142
|
+
// Establish parent relationship if this button links to another board
|
|
143
|
+
if (btnData.load_board?.id) {
|
|
144
|
+
const targetPage = boardMap.get(String(btnData.load_board.id));
|
|
145
|
+
if (targetPage) {
|
|
146
|
+
targetPage.parentId = page.id;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
// Store IDs on page
|
|
153
|
+
page.semantic_ids = semanticIds;
|
|
154
|
+
page.clone_ids = cloneIds;
|
|
155
|
+
});
|
|
156
|
+
// Set root board (first board or one with no parent)
|
|
157
|
+
const rootBoard = Array.from(boardMap.values()).find((p) => !p.parentId);
|
|
158
|
+
if (rootBoard) {
|
|
159
|
+
tree.rootId = rootBoard.id;
|
|
160
|
+
}
|
|
161
|
+
return tree;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Process texts (not supported for .obfset currently)
|
|
165
|
+
*/
|
|
166
|
+
processTexts(_filePathOrBuffer, _translations, _outputPath) {
|
|
167
|
+
throw new Error('processTexts is not supported for .obfset currently');
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Save tree structure back to file
|
|
171
|
+
*/
|
|
172
|
+
saveFromTree(_tree, _outputPath) {
|
|
173
|
+
throw new Error('saveFromTree is not supported for .obfset currently');
|
|
174
|
+
}
|
|
175
|
+
supportsExtension(extension) {
|
|
176
|
+
return extension === '.obfset';
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
exports.ObfsetProcessor = ObfsetProcessor;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.SnapProcessor = void 0;
|
|
7
7
|
const baseProcessor_1 = require("../core/baseProcessor");
|
|
8
8
|
const treeStructure_1 = require("../core/treeStructure");
|
|
9
|
-
|
|
9
|
+
const idGenerator_1 = require("../optional/analytics/utils/idGenerator");
|
|
10
10
|
const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
12
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -226,6 +226,9 @@ class SnapProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
226
226
|
targetPageId: targetPageUniqueId,
|
|
227
227
|
semanticAction: semanticAction,
|
|
228
228
|
audioRecording: audioRecording,
|
|
229
|
+
semantic_id: btnRow.LibrarySymbolId
|
|
230
|
+
? `snap_symbol_${btnRow.LibrarySymbolId}`
|
|
231
|
+
: undefined, // Extract semantic_id from LibrarySymbolId
|
|
229
232
|
style: {
|
|
230
233
|
backgroundColor: btnRow.BackgroundColor
|
|
231
234
|
? `#${btnRow.BackgroundColor.toString(16)}`
|
|
@@ -258,6 +261,10 @@ class SnapProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
258
261
|
gridX < 10 &&
|
|
259
262
|
pageGrid[gridY] &&
|
|
260
263
|
pageGrid[gridY][gridX] === null) {
|
|
264
|
+
// Generate clone_id for button at this position
|
|
265
|
+
const rows = pageGrid.length;
|
|
266
|
+
const cols = pageGrid[0] ? pageGrid[0].length : 10;
|
|
267
|
+
button.clone_id = (0, idGenerator_1.generateCloneId)(rows, cols, gridY, gridX, button.label);
|
|
261
268
|
pageGrid[gridY][gridX] = button;
|
|
262
269
|
}
|
|
263
270
|
}
|
|
@@ -274,6 +281,27 @@ class SnapProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
274
281
|
const currentPage = tree.getPage(uniqueId);
|
|
275
282
|
if (currentPage && pageGrid) {
|
|
276
283
|
currentPage.grid = pageGrid;
|
|
284
|
+
// Track semantic_ids and clone_ids on the page
|
|
285
|
+
const semanticIds = [];
|
|
286
|
+
const cloneIds = [];
|
|
287
|
+
pageGrid.forEach((row) => {
|
|
288
|
+
row.forEach((btn) => {
|
|
289
|
+
if (btn) {
|
|
290
|
+
if (btn.semantic_id) {
|
|
291
|
+
semanticIds.push(btn.semantic_id);
|
|
292
|
+
}
|
|
293
|
+
if (btn.clone_id) {
|
|
294
|
+
cloneIds.push(btn.clone_id);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
if (semanticIds.length > 0) {
|
|
300
|
+
currentPage.semantic_ids = semanticIds;
|
|
301
|
+
}
|
|
302
|
+
if (cloneIds.length > 0) {
|
|
303
|
+
currentPage.clone_ids = cloneIds;
|
|
304
|
+
}
|
|
277
305
|
}
|
|
278
306
|
}
|
|
279
307
|
return tree;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.TouchChatProcessor = void 0;
|
|
7
7
|
const baseProcessor_1 = require("../core/baseProcessor");
|
|
8
8
|
const treeStructure_1 = require("../core/treeStructure");
|
|
9
|
+
const idGenerator_1 = require("../optional/analytics/utils/idGenerator");
|
|
9
10
|
const stringCasing_1 = require("../core/stringCasing");
|
|
10
11
|
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
11
12
|
const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
|
|
@@ -165,6 +166,7 @@ class TouchChatProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
165
166
|
label: cell.label || '',
|
|
166
167
|
message: cell.message || '',
|
|
167
168
|
semanticAction: semanticAction,
|
|
169
|
+
semantic_id: cell.symbol_link_id || cell.symbolLinkId || undefined, // Extract semantic_id from symbol_link_id
|
|
168
170
|
style: {
|
|
169
171
|
backgroundColor: intToHex(style?.body_color),
|
|
170
172
|
borderColor: intToHex(style?.border_color),
|
|
@@ -241,6 +243,31 @@ class TouchChatProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
241
243
|
const page = tree.getPage(pageId);
|
|
242
244
|
if (page) {
|
|
243
245
|
page.grid = grid;
|
|
246
|
+
// Generate clone_id for each button in the grid
|
|
247
|
+
const semanticIds = [];
|
|
248
|
+
const cloneIds = [];
|
|
249
|
+
grid.forEach((row, rowIndex) => {
|
|
250
|
+
row.forEach((btn, colIndex) => {
|
|
251
|
+
if (btn) {
|
|
252
|
+
// Generate clone_id based on position and label
|
|
253
|
+
const rows = grid.length;
|
|
254
|
+
const cols = grid[0] ? grid[0].length : 10;
|
|
255
|
+
btn.clone_id = (0, idGenerator_1.generateCloneId)(rows, cols, rowIndex, colIndex, btn.label);
|
|
256
|
+
cloneIds.push(btn.clone_id);
|
|
257
|
+
// Track semantic_id if present
|
|
258
|
+
if (btn.semantic_id) {
|
|
259
|
+
semanticIds.push(btn.semantic_id);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
// Track IDs on the page
|
|
265
|
+
if (semanticIds.length > 0) {
|
|
266
|
+
page.semantic_ids = semanticIds;
|
|
267
|
+
}
|
|
268
|
+
if (cloneIds.length > 0) {
|
|
269
|
+
page.clone_ids = cloneIds;
|
|
270
|
+
}
|
|
244
271
|
}
|
|
245
272
|
});
|
|
246
273
|
}
|
package/dist/types/aac.d.ts
CHANGED
|
@@ -25,6 +25,25 @@ export interface AACButton {
|
|
|
25
25
|
identifier?: string;
|
|
26
26
|
metadata?: string;
|
|
27
27
|
};
|
|
28
|
+
contentType?: 'Normal' | 'AutoContent' | 'Workspace' | 'LiveCell';
|
|
29
|
+
contentSubType?: string;
|
|
30
|
+
image?: string;
|
|
31
|
+
resolvedImageEntry?: string;
|
|
32
|
+
symbolLibrary?: string;
|
|
33
|
+
symbolPath?: string;
|
|
34
|
+
x?: number;
|
|
35
|
+
y?: number;
|
|
36
|
+
columnSpan?: number;
|
|
37
|
+
rowSpan?: number;
|
|
38
|
+
scanBlocks?: number[];
|
|
39
|
+
visibility?: 'Visible' | 'Hidden' | 'Disabled' | 'PointerAndTouchOnly' | 'Empty';
|
|
40
|
+
directActivate?: boolean;
|
|
41
|
+
audioDescription?: string;
|
|
42
|
+
parameters?: {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
semantic_id?: string;
|
|
46
|
+
clone_id?: string;
|
|
28
47
|
}
|
|
29
48
|
export interface AACPage {
|
|
30
49
|
id: string;
|
|
@@ -37,6 +56,8 @@ export interface AACPage {
|
|
|
37
56
|
descriptionHtml?: string;
|
|
38
57
|
images?: any[];
|
|
39
58
|
sounds?: any[];
|
|
59
|
+
semantic_ids?: string[];
|
|
60
|
+
clone_ids?: string[];
|
|
40
61
|
}
|
|
41
62
|
export interface AACTree {
|
|
42
63
|
pages: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willwade/aac-processors",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
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",
|