@willwade/aac-processors 0.1.9 → 0.1.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/browser/processors/gridset/resolver.js +8 -0
- package/dist/browser/processors/gridsetProcessor.js +2 -2
- package/dist/gridset.d.ts +1 -0
- package/dist/gridset.js +5 -1
- package/dist/processors/gridset/imageDebug.d.ts +41 -0
- package/dist/processors/gridset/imageDebug.js +222 -0
- package/dist/processors/gridset/resolver.js +8 -0
- package/dist/processors/gridsetProcessor.js +2 -2
- package/examples/example-images/FileMap.xml +51 -0
- package/examples/example-images/Grids/Start/0-1-0-text-0.png +0 -0
- package/examples/example-images/Grids/Start/0-2-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/0-3-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/0-4-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/0-5-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/1-1-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/1-2-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/1-3-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/1-4-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/1-5-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/10-3-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/10-4-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/11-3-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/11-4-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/2-1-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/2-2-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/2-3-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/2-4-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/2-5-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/3-1-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/3-3-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/3-4-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/3-5-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/4-1-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/4-3-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/4-4-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/4-5-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/5-4-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/5-5-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/6-3-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/6-4-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/7-1-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/7-2-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/7-3-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/7-4-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/8-1-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/8-2-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/8-3-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/8-4-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/9-1.png +0 -0
- package/examples/example-images/Grids/Start/9-2.png +0 -0
- package/examples/example-images/Grids/Start/9-3-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/9-4-0-text-0.jpeg +0 -0
- package/examples/example-images/Grids/Start/grid.xml +1325 -0
- package/examples/example-images/Settings0/Styles/styles.xml +39 -0
- package/examples/example-images/Settings0/WebBrowser/webbrowserextensions.xml +3 -0
- package/examples/example-images/Settings0/settings.xml +16 -0
- package/examples/example-images.zip +0 -0
- package/package.json +1 -1
|
@@ -67,6 +67,14 @@ export function resolveGrid3CellImage(zip, args, zipEntries) {
|
|
|
67
67
|
}
|
|
68
68
|
// Direct declared file
|
|
69
69
|
if (imageName) {
|
|
70
|
+
// Check for partial image names that start with '-' (common in Grid3)
|
|
71
|
+
// These are coordinate-based suffixes like "-0-text-0.png" that need
|
|
72
|
+
// to be prefixed with the cell coordinates
|
|
73
|
+
if (imageName.startsWith('-') && x != null && y != null) {
|
|
74
|
+
const coordPrefixed = joinBaseDir(baseDir, `${x}-${y}${imageName}`);
|
|
75
|
+
if (has(coordPrefixed))
|
|
76
|
+
return coordPrefixed;
|
|
77
|
+
}
|
|
70
78
|
const p1 = joinBaseDir(baseDir, imageName);
|
|
71
79
|
if (has(p1))
|
|
72
80
|
return p1;
|
|
@@ -793,8 +793,8 @@ class GridsetProcessor extends BaseProcessor {
|
|
|
793
793
|
const resolvedImageEntry = resolveGrid3CellImage(null, {
|
|
794
794
|
baseDir,
|
|
795
795
|
imageName: declaredImageName,
|
|
796
|
-
x: cellX
|
|
797
|
-
y: cellY
|
|
796
|
+
x: cellX,
|
|
797
|
+
y: cellY,
|
|
798
798
|
dynamicFiles,
|
|
799
799
|
}, entries) || undefined;
|
|
800
800
|
// Check if image is a symbol library reference
|
package/dist/gridset.d.ts
CHANGED
|
@@ -15,3 +15,4 @@ export { parseSymbolReference, isSymbolReference, resolveSymbolReference, getAva
|
|
|
15
15
|
export { extractButtonImage, extractSymbolLibraryImage, convertToAstericsImage, analyzeSymbolExtraction, suggestExtractionStrategy, exportSymbolReferencesToCsv, createSymbolManifest, } from './processors/gridset/symbolExtractor';
|
|
16
16
|
export { parsePixFile, loadSearchIndexes, searchSymbols, searchSymbolsWithReferences, getSymbolFilename, getSymbolDisplayName, getAllSearchTerms, getSearchSuggestions, countLibrarySymbols, getSymbolSearchStats, } from './processors/gridset/symbolSearch';
|
|
17
17
|
export { resolveGridsetPassword, resolveGridsetPasswordFromEnv, } from './processors/gridset/password';
|
|
18
|
+
export { auditGridsetImages, formatImageAuditSummary, type ImageAuditResult, type ImageIssue, } from './processors/gridset/imageDebug';
|
package/dist/gridset.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.getCommandsByPlugin = exports.getCommandDefinition = exports.detectCommand = exports.AUTOCONTENT_TYPES = exports.LIVECELL_TYPES = exports.WORKSPACE_TYPES = exports.Grid3CellType = exports.isRegularCell = exports.isAutoContentCell = exports.isLiveCell = exports.isWorkspaceCell = exports.getCellTypeDisplayName = 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 = exports.getNamedColor = exports.wordlistToXml = exports.updateWordlist = exports.extractWordlists = exports.createWordlist = exports.createFileMapXml = exports.createSettingsXml = exports.generateGrid3Guid = exports.readAllGrid3History = exports.readGrid3HistoryForUser = exports.readGrid3History = exports.isGrid3Installed = exports.findGrid3UserHistory = exports.findGrid3Vocabularies = exports.findGrid3Users = exports.findGrid3HistoryDatabases = exports.findGrid3UserPaths = exports.getCommonDocumentsPath = exports.openImage = exports.getAllowedImageEntries = exports.getPageTokenImageMap = exports.GridsetProcessor = void 0;
|
|
10
|
-
exports.resolveGridsetPasswordFromEnv = exports.resolveGridsetPassword = 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.resolveGrid3CellImage = exports.parseImageSymbolReference = exports.isSymbolLibraryReference = exports.SYMBOL_LIBRARIES = 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 = void 0;
|
|
10
|
+
exports.formatImageAuditSummary = exports.auditGridsetImages = exports.resolveGridsetPasswordFromEnv = exports.resolveGridsetPassword = 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.resolveGrid3CellImage = exports.parseImageSymbolReference = exports.isSymbolLibraryReference = exports.SYMBOL_LIBRARIES = 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 = void 0;
|
|
11
11
|
// Processor class
|
|
12
12
|
var gridsetProcessor_1 = require("./processors/gridsetProcessor");
|
|
13
13
|
Object.defineProperty(exports, "GridsetProcessor", { enumerable: true, get: function () { return gridsetProcessor_1.GridsetProcessor; } });
|
|
@@ -128,3 +128,7 @@ Object.defineProperty(exports, "getSymbolSearchStats", { enumerable: true, get:
|
|
|
128
128
|
var password_1 = require("./processors/gridset/password");
|
|
129
129
|
Object.defineProperty(exports, "resolveGridsetPassword", { enumerable: true, get: function () { return password_1.resolveGridsetPassword; } });
|
|
130
130
|
Object.defineProperty(exports, "resolveGridsetPasswordFromEnv", { enumerable: true, get: function () { return password_1.resolveGridsetPasswordFromEnv; } });
|
|
131
|
+
// === Image Debugging ===
|
|
132
|
+
var imageDebug_1 = require("./processors/gridset/imageDebug");
|
|
133
|
+
Object.defineProperty(exports, "auditGridsetImages", { enumerable: true, get: function () { return imageDebug_1.auditGridsetImages; } });
|
|
134
|
+
Object.defineProperty(exports, "formatImageAuditSummary", { enumerable: true, get: function () { return imageDebug_1.formatImageAuditSummary; } });
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image Debugging Utilities for Grid3 Files
|
|
3
|
+
*
|
|
4
|
+
* These utilities help developers understand why images might not be resolving
|
|
5
|
+
* correctly in Grid3 gridsets.
|
|
6
|
+
*/
|
|
7
|
+
export interface ImageIssue {
|
|
8
|
+
gridName: string;
|
|
9
|
+
cellX: number;
|
|
10
|
+
cellY: number;
|
|
11
|
+
declaredImage: string | undefined;
|
|
12
|
+
expectedPaths: string[];
|
|
13
|
+
issue: 'not_found' | 'symbol_library' | 'external_reference';
|
|
14
|
+
suggestion: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ImageAuditResult {
|
|
17
|
+
totalCells: number;
|
|
18
|
+
cellsWithImages: number;
|
|
19
|
+
resolvedImages: number;
|
|
20
|
+
unresolvedImages: number;
|
|
21
|
+
issues: ImageIssue[];
|
|
22
|
+
availableImages: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Audit a gridset file to find image resolution issues
|
|
26
|
+
*
|
|
27
|
+
* @param gridsetBuffer - The gridset file as a Buffer
|
|
28
|
+
* @returns Detailed audit report of image issues
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const audit = await auditGridsetImages(gridsetBuffer);
|
|
32
|
+
* console.log(`Found ${audit.unresolvedImages} unresolved images`);
|
|
33
|
+
* audit.issues.forEach(issue => {
|
|
34
|
+
* console.log(`Cell (${issue.cellX}, ${issue.cellY}): ${issue.suggestion}`);
|
|
35
|
+
* });
|
|
36
|
+
*/
|
|
37
|
+
export declare function auditGridsetImages(gridsetBuffer: Uint8Array, password?: string | undefined): Promise<ImageAuditResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Get a human-readable summary of image audit results
|
|
40
|
+
*/
|
|
41
|
+
export declare function formatImageAuditSummary(audit: ImageAuditResult): string;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Image Debugging Utilities for Grid3 Files
|
|
4
|
+
*
|
|
5
|
+
* These utilities help developers understand why images might not be resolving
|
|
6
|
+
* correctly in Grid3 gridsets.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.auditGridsetImages = auditGridsetImages;
|
|
10
|
+
exports.formatImageAuditSummary = formatImageAuditSummary;
|
|
11
|
+
const zip_1 = require("../../utils/zip");
|
|
12
|
+
const password_1 = require("./password");
|
|
13
|
+
const password_2 = require("./password");
|
|
14
|
+
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
15
|
+
const io_1 = require("../../utils/io");
|
|
16
|
+
/**
|
|
17
|
+
* Audit a gridset file to find image resolution issues
|
|
18
|
+
*
|
|
19
|
+
* @param gridsetBuffer - The gridset file as a Buffer
|
|
20
|
+
* @returns Detailed audit report of image issues
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const audit = await auditGridsetImages(gridsetBuffer);
|
|
24
|
+
* console.log(`Found ${audit.unresolvedImages} unresolved images`);
|
|
25
|
+
* audit.issues.forEach(issue => {
|
|
26
|
+
* console.log(`Cell (${issue.cellX}, ${issue.cellY}): ${issue.suggestion}`);
|
|
27
|
+
* });
|
|
28
|
+
*/
|
|
29
|
+
async function auditGridsetImages(gridsetBuffer, password = (0, password_2.resolveGridsetPasswordFromEnv)()) {
|
|
30
|
+
const issues = [];
|
|
31
|
+
const availableImages = new Set();
|
|
32
|
+
let totalCells = 0;
|
|
33
|
+
let cellsWithImages = 0;
|
|
34
|
+
let resolvedImages = 0;
|
|
35
|
+
let unresolvedImages = 0;
|
|
36
|
+
try {
|
|
37
|
+
const { zip } = await (0, zip_1.openZipFromInput)(gridsetBuffer);
|
|
38
|
+
const entries = (0, password_1.getZipEntriesFromAdapter)(zip, password);
|
|
39
|
+
const parser = new fast_xml_parser_1.XMLParser();
|
|
40
|
+
// Collect all image files in the gridset
|
|
41
|
+
const imageExtensions = ['.png', '.jpg', '.jpeg', '.bmp', '.gif', '.emf', '.wmf'];
|
|
42
|
+
for (const entry of entries) {
|
|
43
|
+
const name = entry.entryName.toLowerCase();
|
|
44
|
+
if (imageExtensions.some((ext) => name.endsWith(ext))) {
|
|
45
|
+
availableImages.add(entry.entryName);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Process each grid file
|
|
49
|
+
for (const entry of entries) {
|
|
50
|
+
if (!entry.entryName.startsWith('Grids/') || !entry.entryName.endsWith('grid.xml')) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const xmlContent = (0, io_1.decodeText)(await entry.getData());
|
|
55
|
+
const data = parser.parse(xmlContent);
|
|
56
|
+
const grid = data.Grid || data.grid;
|
|
57
|
+
if (!grid)
|
|
58
|
+
continue;
|
|
59
|
+
const gridNameMatch = entry.entryName.match(/^Grids\/([^/]+)\//);
|
|
60
|
+
const gridName = gridNameMatch ? gridNameMatch[1] : entry.entryName;
|
|
61
|
+
const gridEntryPath = entry.entryName.replace(/\\/g, '/');
|
|
62
|
+
const baseDir = gridEntryPath.replace(/\/grid\.xml$/, '/');
|
|
63
|
+
// Check for FileMap.xml
|
|
64
|
+
const fileMapEntry = entries.find((e) => e.entryName === baseDir + 'FileMap.xml');
|
|
65
|
+
const dynamicFilesMap = new Map();
|
|
66
|
+
if (fileMapEntry) {
|
|
67
|
+
try {
|
|
68
|
+
const fmXml = (0, io_1.decodeText)(await fileMapEntry.getData());
|
|
69
|
+
const fmData = parser.parse(fmXml);
|
|
70
|
+
const fileEntries = fmData?.FileMap?.Entries?.Entry || fmData?.fileMap?.entries?.entry;
|
|
71
|
+
if (fileEntries) {
|
|
72
|
+
const arr = Array.isArray(fileEntries) ? fileEntries : [fileEntries];
|
|
73
|
+
for (const ent of arr) {
|
|
74
|
+
const rawStaticFile = ent['@_StaticFile'] || ent.StaticFile || ent.staticFile;
|
|
75
|
+
const staticFile = typeof rawStaticFile === 'string' ? rawStaticFile.replace(/\\/g, '/') : '';
|
|
76
|
+
if (!staticFile)
|
|
77
|
+
continue;
|
|
78
|
+
const df = ent.DynamicFiles || ent.dynamicFiles;
|
|
79
|
+
const candidates = df?.File || df?.file || df?.Files || df?.files;
|
|
80
|
+
const list = Array.isArray(candidates)
|
|
81
|
+
? candidates
|
|
82
|
+
: candidates
|
|
83
|
+
? [candidates]
|
|
84
|
+
: [];
|
|
85
|
+
dynamicFilesMap.set(staticFile, list);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
// FileMap parsing failed, continue without it
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Process cells
|
|
94
|
+
const cells = grid.Cells?.Cell || grid.cells?.cell;
|
|
95
|
+
if (!cells)
|
|
96
|
+
continue;
|
|
97
|
+
const cellArr = Array.isArray(cells) ? cells : [cells];
|
|
98
|
+
for (const cell of cellArr) {
|
|
99
|
+
totalCells++;
|
|
100
|
+
const content = cell.Content;
|
|
101
|
+
if (!content)
|
|
102
|
+
continue;
|
|
103
|
+
const captionAndImage = content.CaptionAndImage || content.captionAndImage;
|
|
104
|
+
const imageCandidate = captionAndImage?.Image ||
|
|
105
|
+
captionAndImage?.image ||
|
|
106
|
+
captionAndImage?.ImageName ||
|
|
107
|
+
captionAndImage?.imageName;
|
|
108
|
+
if (!imageCandidate)
|
|
109
|
+
continue;
|
|
110
|
+
cellsWithImages++;
|
|
111
|
+
const cellX = Math.max(0, parseInt(String(cell['@_X'] || '1'), 10) - 1);
|
|
112
|
+
const cellY = Math.max(0, parseInt(String(cell['@_Y'] || '1'), 10) - 1);
|
|
113
|
+
// Try to resolve the image
|
|
114
|
+
const imageName = String(imageCandidate).trim();
|
|
115
|
+
const imageFound = availableImages.has(`${baseDir}${imageName}`) ||
|
|
116
|
+
availableImages.has(`${baseDir}Images/${imageName}`);
|
|
117
|
+
if (imageFound) {
|
|
118
|
+
resolvedImages++;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
unresolvedImages++;
|
|
122
|
+
// Determine the issue
|
|
123
|
+
const expectedPaths = [
|
|
124
|
+
`${baseDir}${imageName}`,
|
|
125
|
+
`${baseDir}Images/${imageName}`,
|
|
126
|
+
`${baseDir}${cellX + 1}-${cellY + 1}-0-text-0.png`,
|
|
127
|
+
`${baseDir}${cellX + 1}-${cellY + 1}.png`,
|
|
128
|
+
];
|
|
129
|
+
let issue;
|
|
130
|
+
let suggestion;
|
|
131
|
+
if (imageName.startsWith('[')) {
|
|
132
|
+
// Check if it's a symbol library reference
|
|
133
|
+
if (imageName.includes('widgit') || imageName.includes('Widgit')) {
|
|
134
|
+
issue = 'symbol_library';
|
|
135
|
+
suggestion =
|
|
136
|
+
'This is a Widgit symbol library reference. These symbols are not stored in the gridset - they require the Widgit Symbols to be installed on the system.';
|
|
137
|
+
}
|
|
138
|
+
else if (imageName.includes('grid3x') || imageName.includes('Grid3')) {
|
|
139
|
+
issue = 'external_reference';
|
|
140
|
+
suggestion =
|
|
141
|
+
'This is a built-in Grid3 resource reference. These images are not included in the gridset file.';
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
issue = 'symbol_library';
|
|
145
|
+
suggestion = `External symbol library reference: ${imageName}. Symbol libraries are not embedded in gridset files.`;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
issue = 'not_found';
|
|
150
|
+
const similarImages = Array.from(availableImages).filter((img) => img.toLowerCase().includes(imageName.toLowerCase().substring(0, 10)));
|
|
151
|
+
if (similarImages.length > 0) {
|
|
152
|
+
suggestion = `Image not found. Did you mean one of these?\n ${similarImages.slice(0, 3).join('\n ')}`;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
suggestion = `Image file not found in gridset. The file may have been excluded or the path is incorrect.`;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
issues.push({
|
|
159
|
+
gridName,
|
|
160
|
+
cellX: cellX + 1,
|
|
161
|
+
cellY: cellY + 1,
|
|
162
|
+
declaredImage: imageName,
|
|
163
|
+
expectedPaths,
|
|
164
|
+
issue,
|
|
165
|
+
suggestion,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
// Skip grids that can't be processed
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
totalCells,
|
|
177
|
+
cellsWithImages,
|
|
178
|
+
resolvedImages,
|
|
179
|
+
unresolvedImages,
|
|
180
|
+
issues,
|
|
181
|
+
availableImages: Array.from(availableImages).sort(),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
throw new Error(`Failed to audit gridset images: ${error.message}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get a human-readable summary of image audit results
|
|
190
|
+
*/
|
|
191
|
+
function formatImageAuditSummary(audit) {
|
|
192
|
+
const lines = [];
|
|
193
|
+
lines.push('=== Grid3 Image Audit Summary ===');
|
|
194
|
+
lines.push(`Total cells: ${audit.totalCells}`);
|
|
195
|
+
lines.push(`Cells with images: ${audit.cellsWithImages}`);
|
|
196
|
+
lines.push(`Resolved images: ${audit.resolvedImages}`);
|
|
197
|
+
lines.push(`Unresolved images: ${audit.unresolvedImages}`);
|
|
198
|
+
lines.push(`Available image files: ${audit.availableImages.length}`);
|
|
199
|
+
lines.push('');
|
|
200
|
+
if (audit.issues.length > 0) {
|
|
201
|
+
lines.push('=== Image Issues ===');
|
|
202
|
+
// Group by issue type
|
|
203
|
+
const byType = new Map();
|
|
204
|
+
for (const issue of audit.issues) {
|
|
205
|
+
const list = byType.get(issue.issue) || [];
|
|
206
|
+
list.push(issue);
|
|
207
|
+
byType.set(issue.issue, list);
|
|
208
|
+
}
|
|
209
|
+
for (const [type, issues] of byType) {
|
|
210
|
+
lines.push(`\n${type.toUpperCase()} (${issues.length} occurrences):`);
|
|
211
|
+
for (const issue of issues.slice(0, 5)) {
|
|
212
|
+
// Show first 5 of each type
|
|
213
|
+
lines.push(` [${issue.gridName}] Cell (${issue.cellX}, ${issue.cellY}): ${issue.declaredImage}`);
|
|
214
|
+
lines.push(` → ${issue.suggestion}`);
|
|
215
|
+
}
|
|
216
|
+
if (issues.length > 5) {
|
|
217
|
+
lines.push(` ... and ${issues.length - 5} more`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return lines.join('\n');
|
|
222
|
+
}
|
|
@@ -72,6 +72,14 @@ function resolveGrid3CellImage(zip, args, zipEntries) {
|
|
|
72
72
|
}
|
|
73
73
|
// Direct declared file
|
|
74
74
|
if (imageName) {
|
|
75
|
+
// Check for partial image names that start with '-' (common in Grid3)
|
|
76
|
+
// These are coordinate-based suffixes like "-0-text-0.png" that need
|
|
77
|
+
// to be prefixed with the cell coordinates
|
|
78
|
+
if (imageName.startsWith('-') && x != null && y != null) {
|
|
79
|
+
const coordPrefixed = joinBaseDir(baseDir, `${x}-${y}${imageName}`);
|
|
80
|
+
if (has(coordPrefixed))
|
|
81
|
+
return coordPrefixed;
|
|
82
|
+
}
|
|
75
83
|
const p1 = joinBaseDir(baseDir, imageName);
|
|
76
84
|
if (has(p1))
|
|
77
85
|
return p1;
|
|
@@ -819,8 +819,8 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
819
819
|
const resolvedImageEntry = (0, resolver_1.resolveGrid3CellImage)(null, {
|
|
820
820
|
baseDir,
|
|
821
821
|
imageName: declaredImageName,
|
|
822
|
-
x: cellX
|
|
823
|
-
y: cellY
|
|
822
|
+
x: cellX,
|
|
823
|
+
y: cellY,
|
|
824
824
|
dynamicFiles,
|
|
825
825
|
}, entries) || undefined;
|
|
826
826
|
// Check if image is a symbol library reference
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<FileMap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
2
|
+
<Entries>
|
|
3
|
+
<Entry StaticFile="Grids\Start\grid.xml">
|
|
4
|
+
<DynamicFiles>
|
|
5
|
+
<File>Grids\Start\0-1-0-text-0.png</File>
|
|
6
|
+
<File>Grids\Start\0-2-0-text-0.jpeg</File>
|
|
7
|
+
<File>Grids\Start\0-3-0-text-0.jpeg</File>
|
|
8
|
+
<File>Grids\Start\0-4-0-text-0.jpeg</File>
|
|
9
|
+
<File>Grids\Start\0-5-0-text-0.jpeg</File>
|
|
10
|
+
<File>Grids\Start\1-1-0-text-0.jpeg</File>
|
|
11
|
+
<File>Grids\Start\1-2-0-text-0.jpeg</File>
|
|
12
|
+
<File>Grids\Start\1-3-0-text-0.jpeg</File>
|
|
13
|
+
<File>Grids\Start\1-4-0-text-0.jpeg</File>
|
|
14
|
+
<File>Grids\Start\1-5-0-text-0.jpeg</File>
|
|
15
|
+
<File>Grids\Start\10-3-0-text-0.jpeg</File>
|
|
16
|
+
<File>Grids\Start\10-4-0-text-0.jpeg</File>
|
|
17
|
+
<File>Grids\Start\11-3-0-text-0.jpeg</File>
|
|
18
|
+
<File>Grids\Start\11-4-0-text-0.jpeg</File>
|
|
19
|
+
<File>Grids\Start\2-1-0-text-0.jpeg</File>
|
|
20
|
+
<File>Grids\Start\2-2-0-text-0.jpeg</File>
|
|
21
|
+
<File>Grids\Start\2-3-0-text-0.jpeg</File>
|
|
22
|
+
<File>Grids\Start\2-4-0-text-0.jpeg</File>
|
|
23
|
+
<File>Grids\Start\2-5-0-text-0.jpeg</File>
|
|
24
|
+
<File>Grids\Start\3-1-0-text-0.jpeg</File>
|
|
25
|
+
<File>Grids\Start\3-3-0-text-0.jpeg</File>
|
|
26
|
+
<File>Grids\Start\3-4-0-text-0.jpeg</File>
|
|
27
|
+
<File>Grids\Start\3-5-0-text-0.jpeg</File>
|
|
28
|
+
<File>Grids\Start\4-1-0-text-0.jpeg</File>
|
|
29
|
+
<File>Grids\Start\4-3-0-text-0.jpeg</File>
|
|
30
|
+
<File>Grids\Start\4-4-0-text-0.jpeg</File>
|
|
31
|
+
<File>Grids\Start\4-5-0-text-0.jpeg</File>
|
|
32
|
+
<File>Grids\Start\5-4-0-text-0.jpeg</File>
|
|
33
|
+
<File>Grids\Start\5-5-0-text-0.jpeg</File>
|
|
34
|
+
<File>Grids\Start\6-3-0-text-0.jpeg</File>
|
|
35
|
+
<File>Grids\Start\6-4-0-text-0.jpeg</File>
|
|
36
|
+
<File>Grids\Start\7-1-0-text-0.jpeg</File>
|
|
37
|
+
<File>Grids\Start\7-2-0-text-0.jpeg</File>
|
|
38
|
+
<File>Grids\Start\7-3-0-text-0.jpeg</File>
|
|
39
|
+
<File>Grids\Start\7-4-0-text-0.jpeg</File>
|
|
40
|
+
<File>Grids\Start\8-1-0-text-0.jpeg</File>
|
|
41
|
+
<File>Grids\Start\8-2-0-text-0.jpeg</File>
|
|
42
|
+
<File>Grids\Start\8-3-0-text-0.jpeg</File>
|
|
43
|
+
<File>Grids\Start\8-4-0-text-0.jpeg</File>
|
|
44
|
+
<File>Grids\Start\9-1.png</File>
|
|
45
|
+
<File>Grids\Start\9-2.png</File>
|
|
46
|
+
<File>Grids\Start\9-3-0-text-0.jpeg</File>
|
|
47
|
+
<File>Grids\Start\9-4-0-text-0.jpeg</File>
|
|
48
|
+
</DynamicFiles>
|
|
49
|
+
</Entry>
|
|
50
|
+
</Entries>
|
|
51
|
+
</FileMap>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|