@willwade/aac-processors 0.2.3 → 0.2.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/dist/browser/core/treeStructure.js +3 -1
- package/dist/browser/metrics.js +2 -0
- package/dist/browser/processors/astericsGridProcessor.js +21 -12
- package/dist/browser/processors/gridset/helpers.js +3 -3
- package/dist/browser/processors/gridsetProcessor.js +269 -239
- package/dist/browser/processors/obfProcessor.js +4 -4
- package/dist/browser/processors/snap/helpers.js +3 -3
- package/dist/browser/processors/snapProcessor.js +2 -2
- package/dist/browser/processors/touchchatProcessor.js +6 -6
- package/dist/browser/utilities/analytics/metrics/core.js +213 -8
- package/dist/browser/utilities/analytics/metrics/vocabulary.js +13 -1
- package/dist/browser/utilities/analytics/morphology/engine.js +910 -0
- package/dist/browser/utilities/analytics/morphology/grid3VerbsParser.js +455 -0
- package/dist/browser/utilities/analytics/morphology/index.js +3 -0
- package/dist/browser/utilities/analytics/morphology/types.js +1 -0
- package/dist/browser/utilities/analytics/morphology/wordFormGenerator.js +74 -0
- package/dist/core/treeStructure.d.ts +17 -1
- package/dist/core/treeStructure.js +3 -1
- package/dist/index.node.d.ts +2 -0
- package/dist/index.node.js +6 -1
- package/dist/metrics.d.ts +3 -0
- package/dist/metrics.js +5 -1
- package/dist/processors/astericsGridProcessor.js +21 -12
- package/dist/processors/excelProcessor.js +5 -1
- package/dist/processors/gridset/helpers.js +3 -3
- package/dist/processors/gridset/imageDebug.js +2 -2
- package/dist/processors/gridsetProcessor.js +269 -239
- package/dist/processors/obfProcessor.js +4 -4
- package/dist/processors/snap/helpers.js +3 -3
- package/dist/processors/snapProcessor.js +2 -2
- package/dist/processors/touchchatProcessor.js +6 -6
- package/dist/utilities/analytics/metrics/core.d.ts +14 -0
- package/dist/utilities/analytics/metrics/core.js +213 -8
- package/dist/utilities/analytics/metrics/types.d.ts +18 -3
- package/dist/utilities/analytics/metrics/vocabulary.d.ts +3 -0
- package/dist/utilities/analytics/metrics/vocabulary.js +13 -1
- package/dist/utilities/analytics/morphology/engine.d.ts +30 -0
- package/dist/utilities/analytics/morphology/engine.js +914 -0
- package/dist/utilities/analytics/morphology/grid3VerbsParser.d.ts +36 -0
- package/dist/utilities/analytics/morphology/grid3VerbsParser.js +485 -0
- package/dist/utilities/analytics/morphology/index.d.ts +5 -0
- package/dist/utilities/analytics/morphology/index.js +9 -0
- package/dist/utilities/analytics/morphology/types.d.ts +40 -0
- package/dist/utilities/analytics/morphology/types.js +2 -0
- package/dist/utilities/analytics/morphology/wordFormGenerator.d.ts +10 -0
- package/dist/utilities/analytics/morphology/wordFormGenerator.js +78 -0
- package/package.json +12 -11
|
@@ -613,7 +613,7 @@ class AstericsGridProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
613
613
|
});
|
|
614
614
|
});
|
|
615
615
|
}
|
|
616
|
-
catch (
|
|
616
|
+
catch (_error) {
|
|
617
617
|
// If JSON parsing fails, return empty array
|
|
618
618
|
}
|
|
619
619
|
return texts;
|
|
@@ -1029,7 +1029,7 @@ class AstericsGridProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
1029
1029
|
// Use detected format for filename
|
|
1030
1030
|
imageName = element.image.id || `image.${imageFormat}`;
|
|
1031
1031
|
}
|
|
1032
|
-
catch (
|
|
1032
|
+
catch (_e) {
|
|
1033
1033
|
// Invalid base64 data, skip image
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
@@ -1042,19 +1042,23 @@ class AstericsGridProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
1042
1042
|
audioRecording: audioRecording,
|
|
1043
1043
|
visibility: mapAstericsVisibility(element.hidden),
|
|
1044
1044
|
image: imageName, // Store image filename/reference
|
|
1045
|
-
parameters: imageData
|
|
1046
|
-
? {
|
|
1047
|
-
...{ imageData: imageData }, // Store actual image data in parameters for conversion
|
|
1048
|
-
}
|
|
1049
|
-
: undefined,
|
|
1050
1045
|
style: {
|
|
1051
1046
|
backgroundColor: finalBackgroundColor,
|
|
1052
1047
|
borderColor: colorStyles.borderColor || colorConfig?.elementBorderColor || '#CCCCCC',
|
|
1053
1048
|
borderWidth: colorConfig?.borderWidth || 1,
|
|
1054
1049
|
fontFamily: colorConfig?.fontFamily || 'Arial',
|
|
1055
|
-
fontSize: colorConfig?.fontSizePct ? colorConfig.fontSizePct * 16 : 16,
|
|
1050
|
+
fontSize: colorConfig?.fontSizePct ? colorConfig.fontSizePct * 16 : 16,
|
|
1056
1051
|
fontColor: fontColor,
|
|
1057
1052
|
},
|
|
1053
|
+
wordForms: element.wordForms && element.wordForms.length > 0 ? element.wordForms : undefined,
|
|
1054
|
+
parameters: {
|
|
1055
|
+
...(imageData ? { imageData: imageData } : {}),
|
|
1056
|
+
...(element.actions?.some((a) => a.modelName === 'GridActionWordForm')
|
|
1057
|
+
? {
|
|
1058
|
+
wordFormActions: element.actions.filter((a) => a.modelName === 'GridActionWordForm'),
|
|
1059
|
+
}
|
|
1060
|
+
: {}),
|
|
1061
|
+
},
|
|
1058
1062
|
});
|
|
1059
1063
|
}
|
|
1060
1064
|
async processTexts(filePathOrBuffer, translations, outputPath) {
|
|
@@ -1321,6 +1325,11 @@ class AstericsGridProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
1321
1325
|
});
|
|
1322
1326
|
}
|
|
1323
1327
|
const locale = tree.metadata?.locale || 'en';
|
|
1328
|
+
if (button.parameters?.wordFormActions &&
|
|
1329
|
+
Array.isArray(button.parameters.wordFormActions)) {
|
|
1330
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
1331
|
+
actions.push(...button.parameters.wordFormActions);
|
|
1332
|
+
}
|
|
1324
1333
|
return {
|
|
1325
1334
|
id: button.id,
|
|
1326
1335
|
modelName: 'GridElement',
|
|
@@ -1330,7 +1339,7 @@ class AstericsGridProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
1330
1339
|
x: calculatedX,
|
|
1331
1340
|
y: calculatedY,
|
|
1332
1341
|
label: { [locale]: button.label },
|
|
1333
|
-
wordForms: [],
|
|
1342
|
+
wordForms: button.wordForms || [],
|
|
1334
1343
|
image: {
|
|
1335
1344
|
data: null,
|
|
1336
1345
|
author: undefined,
|
|
@@ -1422,7 +1431,7 @@ class AstericsGridProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
1422
1431
|
audioAction.durationMs = parsedMetadata.durationMs || audioAction.durationMs;
|
|
1423
1432
|
audioAction.filename = parsedMetadata.filename || audioAction.filename;
|
|
1424
1433
|
}
|
|
1425
|
-
catch (
|
|
1434
|
+
catch (_e) {
|
|
1426
1435
|
// Use defaults if metadata parsing fails
|
|
1427
1436
|
}
|
|
1428
1437
|
}
|
|
@@ -1474,7 +1483,7 @@ class AstericsGridProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
1474
1483
|
});
|
|
1475
1484
|
});
|
|
1476
1485
|
}
|
|
1477
|
-
catch (
|
|
1486
|
+
catch (_error) {
|
|
1478
1487
|
// If JSON parsing fails, return empty array
|
|
1479
1488
|
}
|
|
1480
1489
|
return elementIds;
|
|
@@ -1499,7 +1508,7 @@ class AstericsGridProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
1499
1508
|
}
|
|
1500
1509
|
}
|
|
1501
1510
|
}
|
|
1502
|
-
catch (
|
|
1511
|
+
catch (_error) {
|
|
1503
1512
|
// If JSON parsing fails, return false
|
|
1504
1513
|
}
|
|
1505
1514
|
return false;
|
|
@@ -309,7 +309,11 @@ class ExcelProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
309
309
|
// Create internal link to another worksheet
|
|
310
310
|
const sanitizedTargetName = this.sanitizeWorksheetName(targetPageId);
|
|
311
311
|
cell.value = {
|
|
312
|
-
text: cell.value
|
|
312
|
+
text: typeof cell.value === 'string'
|
|
313
|
+
? cell.value
|
|
314
|
+
: typeof cell.value === 'number' || typeof cell.value === 'boolean'
|
|
315
|
+
? String(cell.value)
|
|
316
|
+
: '',
|
|
313
317
|
hyperlink: `#'${sanitizedTargetName}'!A1`,
|
|
314
318
|
};
|
|
315
319
|
}
|
|
@@ -84,7 +84,7 @@ async function openImage(gridsetBuffer, entryPath, password = (0, password_1.res
|
|
|
84
84
|
}
|
|
85
85
|
return data;
|
|
86
86
|
}
|
|
87
|
-
catch (
|
|
87
|
+
catch (_error) {
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -174,7 +174,7 @@ function getCommonDocumentsPath() {
|
|
|
174
174
|
return match[1].trim();
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
catch (
|
|
177
|
+
catch (_error) {
|
|
178
178
|
// Registry access failed, fall back to default
|
|
179
179
|
}
|
|
180
180
|
// Default fallback path
|
|
@@ -230,7 +230,7 @@ async function findGrid3UserPaths(fileAdapter = io_1.defaultFileAdapter) {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
catch (
|
|
233
|
+
catch (_error) {
|
|
234
234
|
// Silently fail if directory access fails
|
|
235
235
|
}
|
|
236
236
|
return results;
|
|
@@ -88,7 +88,7 @@ async function auditGridsetImages(gridsetBuffer, password = (0, password_2.resol
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
catch (
|
|
91
|
+
catch (_e) {
|
|
92
92
|
// FileMap parsing failed, continue without it
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -169,7 +169,7 @@ async function auditGridsetImages(gridsetBuffer, password = (0, password_2.resol
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
catch (
|
|
172
|
+
catch (_e) {
|
|
173
173
|
// Skip grids that can't be processed
|
|
174
174
|
continue;
|
|
175
175
|
}
|