@fgv/ts-res-browser 5.0.0-2 → 5.0.0-21
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/cli.js +132 -21
- package/dist/bundle.js +1 -1
- package/dist/bundle.js.LICENSE.txt +11 -1
- package/package.json +42 -36
- package/.rush/temp/587277bfc395406ad444e989b6c309b9698f534c.tar.log +0 -15
- package/.rush/temp/chunked-rush-logs/ts-res-browser.build.chunks.jsonl +0 -35
- package/.rush/temp/operation/build/all.log +0 -35
- package/.rush/temp/operation/build/log-chunks.jsonl +0 -35
- package/.rush/temp/operation/build/state.json +0 -3
- package/.rush/temp/shrinkwrap-deps.json +0 -1225
- package/TS_RES_BROWSER_PLAN.md +0 -689
- package/babel.config.js +0 -17
- package/config/jest.config.json +0 -13
- package/config/rig.json +0 -16
- package/postcss.config.js +0 -3
- package/public/index.html +0 -15
- package/rush-logs/ts-res-browser.build.cache.log +0 -3
- package/rush-logs/ts-res-browser.build.log +0 -35
- package/src/App.tsx +0 -274
- package/src/cli.ts +0 -44
- package/src/components/common/FileImporter.tsx +0 -143
- package/src/components/common/NavigationWarningModal.tsx +0 -62
- package/src/components/layout/AppLayout.tsx +0 -46
- package/src/components/layout/Header.tsx +0 -22
- package/src/components/layout/MessagesWindow.tsx +0 -108
- package/src/components/layout/Sidebar.tsx +0 -99
- package/src/components/tools/CompiledBrowser.tsx +0 -949
- package/src/components/tools/ConfigurationTool.tsx +0 -1405
- package/src/components/tools/FilterTool.tsx +0 -1114
- package/src/components/tools/ImportTool.tsx +0 -249
- package/src/components/tools/ResolutionViewer.tsx +0 -1672
- package/src/components/tools/SourceBrowser.tsx +0 -496
- package/src/components/tools/ZipLoader.tsx +0 -302
- package/src/hooks/useAppState.ts +0 -111
- package/src/hooks/useFileImport.ts +0 -86
- package/src/hooks/useNavigationWarning.ts +0 -67
- package/src/hooks/useResourceManager.ts +0 -295
- package/src/hooks/useUrlParams.ts +0 -56
- package/src/index.css +0 -38
- package/src/main.tsx +0 -16
- package/src/types/app.ts +0 -70
- package/src/types/fileSystemAccess.d.ts +0 -94
- package/src/utils/browserFileTreeAccessors.ts +0 -245
- package/src/utils/fileImport.ts +0 -336
- package/src/utils/fileTreeConverter.ts +0 -160
- package/src/utils/filterResources.ts +0 -677
- package/src/utils/tsResIntegration.ts +0 -467
- package/src/utils/urlParams.ts +0 -238
- package/src/utils/zip/browserZipFileTreeAccessors.ts +0 -385
- package/tailwind.config.js +0 -21
- package/test-data/README.md +0 -184
- package/test-data/config-variations/README.md +0 -64
- package/test-data/config-variations/composition-terminology.json +0 -112
- package/test-data/config-variations/enterprise-complex.json +0 -129
- package/test-data/config-variations/gaming-app.json +0 -87
- package/test-data/config-variations/high-priority-language.json +0 -65
- package/test-data/config-variations/minimal-basic.json +0 -37
- package/test-data/config-variations/qualifier-default-values.json +0 -71
- package/test-data/config-variations/territory-first.json +0 -68
- package/test-data/config-variations/territory-hierarchy-test.json +0 -31
- package/test-data/config-variations/territory-hierarchy-unconstrained.json +0 -32
- package/test-data/default-matching-test/greeting.res.json +0 -83
- package/test-data/default-matching-test/only-defaults.res.json +0 -48
- package/test-data/sample-project/package.json +0 -27
- package/test-data/sample-project/src/resources/app-config.json +0 -27
- package/test-data/sample-project/src/resources/app.json +0 -177
- package/test-data/sample-project/src/resources/config/app.env=development.json +0 -21
- package/test-data/sample-project/src/resources/config/app.json +0 -21
- package/test-data/sample-project/src/resources/config/app.platform=mobile.json +0 -23
- package/test-data/sample-project/src/resources/feature-flags.json +0 -23
- package/test-data/sample-project/src/resources/home=CA/common.json +0 -16
- package/test-data/sample-project/src/resources/images/density=hdpi.json +0 -29
- package/test-data/sample-project/src/resources/images/home.json +0 -29
- package/test-data/sample-project/src/resources/images/logout.json +0 -14
- package/test-data/sample-project/src/resources/images/settings.json +0 -14
- package/test-data/sample-project/src/resources/images/ui-icons.json +0 -29
- package/test-data/sample-project/src/resources/images/user.density=hdpi.json +0 -14
- package/test-data/sample-project/src/resources/images/user.json +0 -14
- package/test-data/sample-project/src/resources/lang=en-US/common.json +0 -15
- package/test-data/sample-project/src/resources/language=en-CA/ui-terms.json +0 -19
- package/test-data/sample-project/src/resources/language=en-GB/ui-terms.json +0 -30
- package/test-data/sample-project/src/resources/language=fr-CA/ui-terms.json +0 -25
- package/test-data/sample-project/src/resources/language=nl-BE/ui-terms.json +0 -17
- package/test-data/sample-project/src/resources/region=europe/feature-flags.json +0 -17
- package/test-data/sample-project/src/resources/region=north-america/feature-flags.json +0 -18
- package/test-data/sample-project/src/resources/strings/dashboard.home=CA,language=fr.json +0 -20
- package/test-data/sample-project/src/resources/strings/dashboard.json +0 -18
- package/test-data/sample-project/src/resources/strings/dashboard.role=admin.json +0 -23
- package/test-data/sample-project/src/resources/strings/dashboard.role=user.json +0 -21
- package/test-data/sample-project/src/resources/strings/language=en-US.json +0 -16
- package/test-data/sample-project/src/resources/strings.json +0 -78
- package/test-data/sample-project/src/resources/territory=BE/app-config.json +0 -19
- package/test-data/sample-project/src/resources/territory=CA/app-config.json +0 -21
- package/test-data/sample-project/src/resources/territory=GB/app-config.json +0 -25
- package/test-data/sample-project/src/resources/territory=NL/app-config.json +0 -25
- package/test-data/sample-project/src/resources/ui-terms.json +0 -96
- package/test-data/sample-project/src/resources-config.json +0 -111
- package/tsconfig.json +0 -27
- package/webpack.config.js +0 -60
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
import { useState, useCallback } from 'react';
|
|
2
|
-
import { Result, succeed, fail, FileTree } from '@fgv/ts-utils';
|
|
3
|
-
import {
|
|
4
|
-
ProcessedResources,
|
|
5
|
-
processImportedDirectory,
|
|
6
|
-
processImportedFiles,
|
|
7
|
-
createSimpleContext
|
|
8
|
-
} from '../utils/tsResIntegration';
|
|
9
|
-
import { ImportedDirectory, ImportedFile } from '../utils/fileImport';
|
|
10
|
-
import { FileTreeConverter } from '../utils/fileTreeConverter';
|
|
11
|
-
import { Config } from '@fgv/ts-res';
|
|
12
|
-
|
|
13
|
-
export interface ResourceManagerState {
|
|
14
|
-
isProcessing: boolean;
|
|
15
|
-
processedResources: ProcessedResources | null;
|
|
16
|
-
error: string | null;
|
|
17
|
-
hasProcessedData: boolean;
|
|
18
|
-
activeConfiguration: Config.Model.ISystemConfiguration | null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface UseResourceManagerReturn {
|
|
22
|
-
state: ResourceManagerState;
|
|
23
|
-
actions: {
|
|
24
|
-
processDirectory: (directory: ImportedDirectory) => Promise<void>;
|
|
25
|
-
processFiles: (files: ImportedFile[]) => Promise<void>;
|
|
26
|
-
processFileTree: (fileTree: FileTree.FileTree, rootPath?: string) => Promise<void>;
|
|
27
|
-
clearError: () => void;
|
|
28
|
-
reset: () => void;
|
|
29
|
-
resolveResource: (resourceId: string, context?: Record<string, string>) => Promise<Result<any>>;
|
|
30
|
-
applyConfiguration: (config: Config.Model.ISystemConfiguration) => void;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const initialState: ResourceManagerState = {
|
|
35
|
-
isProcessing: false,
|
|
36
|
-
processedResources: null,
|
|
37
|
-
error: null,
|
|
38
|
-
hasProcessedData: false,
|
|
39
|
-
activeConfiguration: null
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const useResourceManager = (): UseResourceManagerReturn => {
|
|
43
|
-
const [state, setState] = useState<ResourceManagerState>(initialState);
|
|
44
|
-
|
|
45
|
-
const processDirectory = useCallback(
|
|
46
|
-
async (directory: ImportedDirectory) => {
|
|
47
|
-
console.log('=== STARTING DIRECTORY PROCESSING ===');
|
|
48
|
-
console.log('Directory:', directory.name, 'Files:', directory.files?.length || 0);
|
|
49
|
-
|
|
50
|
-
setState((prev) => ({ ...prev, isProcessing: true, error: null }));
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
console.log('1. About to call processImportedDirectory...');
|
|
54
|
-
|
|
55
|
-
// Use setTimeout to make this async and allow UI updates
|
|
56
|
-
await new Promise<void>((resolve, reject) => {
|
|
57
|
-
setTimeout(() => {
|
|
58
|
-
try {
|
|
59
|
-
console.log('2. Inside setTimeout, calling processImportedDirectory...');
|
|
60
|
-
const result = processImportedDirectory(directory, state.activeConfiguration || undefined);
|
|
61
|
-
console.log(
|
|
62
|
-
'3. processImportedDirectory returned:',
|
|
63
|
-
result.isSuccess() ? 'SUCCESS' : 'FAILURE'
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
if (result.isSuccess()) {
|
|
67
|
-
console.log('4. Processing succeeded, setting state...');
|
|
68
|
-
console.log(' Resource count:', result.value.summary.resourceIds.length);
|
|
69
|
-
console.log(' Resource IDs:', result.value.summary.resourceIds);
|
|
70
|
-
|
|
71
|
-
setState((prev) => ({
|
|
72
|
-
...prev,
|
|
73
|
-
isProcessing: false,
|
|
74
|
-
processedResources: result.value,
|
|
75
|
-
hasProcessedData: true
|
|
76
|
-
}));
|
|
77
|
-
console.log('5. State updated successfully');
|
|
78
|
-
resolve();
|
|
79
|
-
} else {
|
|
80
|
-
console.error('4. Processing failed with error:', result.message);
|
|
81
|
-
setState((prev) => ({
|
|
82
|
-
...prev,
|
|
83
|
-
isProcessing: false,
|
|
84
|
-
error: result.message
|
|
85
|
-
}));
|
|
86
|
-
reject(new Error(result.message));
|
|
87
|
-
}
|
|
88
|
-
} catch (innerError) {
|
|
89
|
-
console.error('4. Exception in setTimeout:', innerError);
|
|
90
|
-
setState((prev) => ({
|
|
91
|
-
...prev,
|
|
92
|
-
isProcessing: false,
|
|
93
|
-
error: `Processing exception: ${
|
|
94
|
-
innerError instanceof Error ? innerError.message : String(innerError)
|
|
95
|
-
}`
|
|
96
|
-
}));
|
|
97
|
-
reject(innerError);
|
|
98
|
-
}
|
|
99
|
-
}, 100); // Small delay to allow UI update
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
console.log('6. processDirectory completed successfully');
|
|
103
|
-
} catch (error) {
|
|
104
|
-
console.error('=== DIRECTORY PROCESSING ERROR ===');
|
|
105
|
-
console.error('Error:', error);
|
|
106
|
-
setState((prev) => ({
|
|
107
|
-
...prev,
|
|
108
|
-
isProcessing: false,
|
|
109
|
-
error: `Unexpected error: ${error instanceof Error ? error.message : String(error)}`
|
|
110
|
-
}));
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
[state.activeConfiguration]
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
const processFiles = useCallback(
|
|
117
|
-
async (files: ImportedFile[]) => {
|
|
118
|
-
console.log('=== STARTING FILES PROCESSING ===');
|
|
119
|
-
console.log('Files count:', files.length);
|
|
120
|
-
console.log(
|
|
121
|
-
'Files:',
|
|
122
|
-
files.map((f) => f.name)
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
setState((prev) => ({ ...prev, isProcessing: true, error: null }));
|
|
126
|
-
|
|
127
|
-
try {
|
|
128
|
-
console.log('1. About to call processImportedFiles...');
|
|
129
|
-
|
|
130
|
-
// Use setTimeout to make this async and allow UI updates
|
|
131
|
-
await new Promise<void>((resolve, reject) => {
|
|
132
|
-
setTimeout(() => {
|
|
133
|
-
try {
|
|
134
|
-
console.log('2. Inside setTimeout, calling processImportedFiles...');
|
|
135
|
-
const result = processImportedFiles(files, state.activeConfiguration || undefined);
|
|
136
|
-
console.log('3. processImportedFiles returned:', result.isSuccess() ? 'SUCCESS' : 'FAILURE');
|
|
137
|
-
|
|
138
|
-
if (result.isSuccess()) {
|
|
139
|
-
console.log('4. Processing succeeded, setting state...');
|
|
140
|
-
console.log(' Resource count:', result.value.summary.resourceIds.length);
|
|
141
|
-
console.log(' Resource IDs:', result.value.summary.resourceIds);
|
|
142
|
-
|
|
143
|
-
setState((prev) => ({
|
|
144
|
-
...prev,
|
|
145
|
-
isProcessing: false,
|
|
146
|
-
processedResources: result.value,
|
|
147
|
-
hasProcessedData: true
|
|
148
|
-
}));
|
|
149
|
-
console.log('5. State updated successfully');
|
|
150
|
-
resolve();
|
|
151
|
-
} else {
|
|
152
|
-
console.error('4. Processing failed with error:', result.message);
|
|
153
|
-
setState((prev) => ({
|
|
154
|
-
...prev,
|
|
155
|
-
isProcessing: false,
|
|
156
|
-
error: result.message
|
|
157
|
-
}));
|
|
158
|
-
reject(new Error(result.message));
|
|
159
|
-
}
|
|
160
|
-
} catch (innerError) {
|
|
161
|
-
console.error('4. Exception in setTimeout:', innerError);
|
|
162
|
-
setState((prev) => ({
|
|
163
|
-
...prev,
|
|
164
|
-
isProcessing: false,
|
|
165
|
-
error: `Processing exception: ${
|
|
166
|
-
innerError instanceof Error ? innerError.message : String(innerError)
|
|
167
|
-
}`
|
|
168
|
-
}));
|
|
169
|
-
reject(innerError);
|
|
170
|
-
}
|
|
171
|
-
}, 100); // Small delay to allow UI update
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
console.log('6. processFiles completed successfully');
|
|
175
|
-
} catch (error) {
|
|
176
|
-
console.error('=== FILES PROCESSING ERROR ===');
|
|
177
|
-
console.error('Error:', error);
|
|
178
|
-
setState((prev) => ({
|
|
179
|
-
...prev,
|
|
180
|
-
isProcessing: false,
|
|
181
|
-
error: `Unexpected error: ${error instanceof Error ? error.message : String(error)}`
|
|
182
|
-
}));
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
[state.activeConfiguration]
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
const clearError = useCallback(() => {
|
|
189
|
-
setState((prev) => ({ ...prev, error: null }));
|
|
190
|
-
}, []);
|
|
191
|
-
|
|
192
|
-
const reset = useCallback(() => {
|
|
193
|
-
console.log('Resetting resource manager state');
|
|
194
|
-
setState(initialState);
|
|
195
|
-
}, []);
|
|
196
|
-
|
|
197
|
-
const resolveResource = useCallback(
|
|
198
|
-
async (resourceId: string, context?: Record<string, string>): Promise<Result<any>> => {
|
|
199
|
-
if (!state.processedResources?.resolver) {
|
|
200
|
-
return fail('No resolver available');
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
try {
|
|
204
|
-
const contextProvider = context
|
|
205
|
-
? createSimpleContext(context, state.processedResources.system)
|
|
206
|
-
: null;
|
|
207
|
-
|
|
208
|
-
if (contextProvider?.isFailure()) {
|
|
209
|
-
return fail(`Failed to create context: ${contextProvider.error}`);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const resolveContext = contextProvider?.value || undefined;
|
|
213
|
-
return await state.processedResources.resolver.resolve(resourceId, resolveContext);
|
|
214
|
-
} catch (error) {
|
|
215
|
-
return fail(`Failed to resolve resource: ${error instanceof Error ? error.message : String(error)}`);
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
[state.processedResources]
|
|
219
|
-
);
|
|
220
|
-
|
|
221
|
-
const processFileTree = useCallback(
|
|
222
|
-
async (fileTree: FileTree.FileTree, rootPath: string = '/') => {
|
|
223
|
-
console.log('=== STARTING FILETREE PROCESSING ===');
|
|
224
|
-
console.log('Root path:', rootPath);
|
|
225
|
-
|
|
226
|
-
setState((prev) => ({ ...prev, isProcessing: true, error: null }));
|
|
227
|
-
|
|
228
|
-
try {
|
|
229
|
-
console.log('1. Converting FileTree to ImportedDirectory/Files...');
|
|
230
|
-
|
|
231
|
-
const convertResult = FileTreeConverter.convertPath(fileTree, rootPath);
|
|
232
|
-
if (convertResult.isFailure()) {
|
|
233
|
-
setState((prev) => ({
|
|
234
|
-
...prev,
|
|
235
|
-
isProcessing: false,
|
|
236
|
-
error: `Failed to convert FileTree: ${convertResult.message}`
|
|
237
|
-
}));
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
const converted = convertResult.value;
|
|
242
|
-
console.log('2. FileTree converted successfully');
|
|
243
|
-
|
|
244
|
-
// Process based on whether we got a directory or files
|
|
245
|
-
if (Array.isArray(converted)) {
|
|
246
|
-
// Got files
|
|
247
|
-
console.log('3. Processing as files, count:', converted.length);
|
|
248
|
-
await processFiles(converted);
|
|
249
|
-
} else {
|
|
250
|
-
// Got directory
|
|
251
|
-
console.log('3. Processing as directory:', converted.name);
|
|
252
|
-
await processDirectory(converted);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
console.log('4. processFileTree completed successfully');
|
|
256
|
-
} catch (error) {
|
|
257
|
-
console.error('=== FILETREE PROCESSING ERROR ===');
|
|
258
|
-
console.error('Error:', error);
|
|
259
|
-
setState((prev) => ({
|
|
260
|
-
...prev,
|
|
261
|
-
isProcessing: false,
|
|
262
|
-
error: `Unexpected error: ${error instanceof Error ? error.message : String(error)}`
|
|
263
|
-
}));
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
[processFiles, processDirectory]
|
|
267
|
-
);
|
|
268
|
-
|
|
269
|
-
const applyConfiguration = useCallback((config: Config.Model.ISystemConfiguration) => {
|
|
270
|
-
console.log('Applying configuration:', config.name || 'Unnamed configuration');
|
|
271
|
-
setState((prev) => ({
|
|
272
|
-
...prev,
|
|
273
|
-
activeConfiguration: config,
|
|
274
|
-
// Clear processed resources when configuration changes
|
|
275
|
-
processedResources: null,
|
|
276
|
-
hasProcessedData: false,
|
|
277
|
-
error: null
|
|
278
|
-
}));
|
|
279
|
-
}, []);
|
|
280
|
-
|
|
281
|
-
return {
|
|
282
|
-
state,
|
|
283
|
-
actions: {
|
|
284
|
-
processDirectory,
|
|
285
|
-
processFiles,
|
|
286
|
-
processFileTree,
|
|
287
|
-
clearError,
|
|
288
|
-
reset,
|
|
289
|
-
resolveResource,
|
|
290
|
-
applyConfiguration
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
export default useResourceManager;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025 Erik Fortune
|
|
3
|
-
*
|
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
* in the Software without restriction, including without limitation the rights
|
|
7
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
* furnished to do so, subject to the following conditions:
|
|
10
|
-
*
|
|
11
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
* copies or substantial portions of the Software.
|
|
13
|
-
*
|
|
14
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
* SOFTWARE.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
import { useEffect, useState } from 'react';
|
|
24
|
-
import { parseUrlParameters, IUrlConfigOptions } from '../utils/urlParams';
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Hook to parse and provide URL parameters for initial app configuration
|
|
28
|
-
*/
|
|
29
|
-
export function useUrlParams() {
|
|
30
|
-
const [urlParams, setUrlParams] = useState<IUrlConfigOptions>({});
|
|
31
|
-
const [hasUrlParams, setHasUrlParams] = useState(false);
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
const params = parseUrlParameters();
|
|
35
|
-
setUrlParams(params);
|
|
36
|
-
|
|
37
|
-
// Check if any meaningful parameters were provided
|
|
38
|
-
const hasParams = !!(
|
|
39
|
-
params.input ||
|
|
40
|
-
params.config ||
|
|
41
|
-
params.contextFilter ||
|
|
42
|
-
params.qualifierDefaults ||
|
|
43
|
-
params.resourceTypes ||
|
|
44
|
-
params.maxDistance !== undefined ||
|
|
45
|
-
params.reduceQualifiers ||
|
|
46
|
-
params.interactive
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
setHasUrlParams(hasParams);
|
|
50
|
-
}, []);
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
urlParams,
|
|
54
|
-
hasUrlParams
|
|
55
|
-
};
|
|
56
|
-
}
|
package/src/index.css
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
@import 'tailwindcss';
|
|
2
|
-
|
|
3
|
-
/* Custom base styles */
|
|
4
|
-
body {
|
|
5
|
-
margin: 0;
|
|
6
|
-
padding: 0;
|
|
7
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell',
|
|
8
|
-
'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
9
|
-
-webkit-font-smoothing: antialiased;
|
|
10
|
-
-moz-osx-font-smoothing: grayscale;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
code {
|
|
14
|
-
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/* Custom component styles */
|
|
18
|
-
.res-scrollbar {
|
|
19
|
-
scrollbar-width: thin;
|
|
20
|
-
scrollbar-color: #cbd5e1 #f1f5f9;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.res-scrollbar::-webkit-scrollbar {
|
|
24
|
-
width: 8px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.res-scrollbar::-webkit-scrollbar-track {
|
|
28
|
-
background: #f1f5f9;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.res-scrollbar::-webkit-scrollbar-thumb {
|
|
32
|
-
background-color: #cbd5e1;
|
|
33
|
-
border-radius: 4px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.res-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
37
|
-
background-color: #94a3b8;
|
|
38
|
-
}
|
package/src/main.tsx
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom/client';
|
|
3
|
-
import App from './App';
|
|
4
|
-
import './index.css';
|
|
5
|
-
|
|
6
|
-
// Polyfills for broader browser support
|
|
7
|
-
import 'core-js/stable';
|
|
8
|
-
import 'whatwg-fetch';
|
|
9
|
-
|
|
10
|
-
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
|
|
11
|
-
|
|
12
|
-
root.render(
|
|
13
|
-
<React.StrictMode>
|
|
14
|
-
<App />
|
|
15
|
-
</React.StrictMode>
|
|
16
|
-
);
|
package/src/types/app.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// Application state types
|
|
2
|
-
export interface Message {
|
|
3
|
-
id: string;
|
|
4
|
-
type: 'info' | 'warning' | 'error' | 'success';
|
|
5
|
-
message: string;
|
|
6
|
-
timestamp: Date;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type Tool =
|
|
10
|
-
| 'import'
|
|
11
|
-
| 'source'
|
|
12
|
-
| 'filter'
|
|
13
|
-
| 'compiled'
|
|
14
|
-
| 'resolution'
|
|
15
|
-
| 'configuration'
|
|
16
|
-
| 'zip-loader';
|
|
17
|
-
|
|
18
|
-
export interface FilterState {
|
|
19
|
-
enabled: boolean;
|
|
20
|
-
values: Record<string, string>;
|
|
21
|
-
appliedValues: Record<string, string>;
|
|
22
|
-
hasPendingChanges: boolean;
|
|
23
|
-
reduceQualifiers: boolean;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface AppState {
|
|
27
|
-
selectedTool: Tool;
|
|
28
|
-
messages: Message[];
|
|
29
|
-
filterState: FilterState;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface AppActions {
|
|
33
|
-
setSelectedTool: (tool: Tool, force?: boolean) => void;
|
|
34
|
-
setActiveTool: (tool: Tool, force?: boolean) => void; // Alias for setSelectedTool
|
|
35
|
-
addMessage: (type: Message['type'], message: string) => void;
|
|
36
|
-
clearMessages: () => void;
|
|
37
|
-
updateFilterEnabled: (enabled: boolean) => void;
|
|
38
|
-
updateFilterValues: (values: Record<string, string>) => void;
|
|
39
|
-
applyFilterValues: () => void;
|
|
40
|
-
resetFilterValues: () => void;
|
|
41
|
-
updateReduceQualifiers: (reduceQualifiers: boolean) => void;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Tool-specific types
|
|
45
|
-
export interface SourceBrowserState {
|
|
46
|
-
selectedResource: string | null;
|
|
47
|
-
resources: any[]; // Will be typed with ts-res types
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface CompiledBrowserState {
|
|
51
|
-
selectedResource: string | null;
|
|
52
|
-
compiledResources: any[]; // Will be typed with ts-res types
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface ResolutionViewerState {
|
|
56
|
-
selectedResource: string | null;
|
|
57
|
-
qualifiers: Record<string, any>;
|
|
58
|
-
candidates: any[]; // Will be typed with ts-res types
|
|
59
|
-
viewMode: 'best' | 'all';
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// File import types
|
|
63
|
-
export interface FileImportOptions {
|
|
64
|
-
types: Array<{
|
|
65
|
-
description: string;
|
|
66
|
-
accept: Record<string, string[]>;
|
|
67
|
-
}>;
|
|
68
|
-
multiple: boolean;
|
|
69
|
-
excludeAcceptAllOption: boolean;
|
|
70
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
// Type declarations for File System Access API
|
|
2
|
-
// Based on https://wicg.github.io/file-system-access/
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
interface FileSystemHandle {
|
|
6
|
-
readonly kind: 'file' | 'directory';
|
|
7
|
-
readonly name: string;
|
|
8
|
-
isSameEntry(other: FileSystemHandle): Promise<boolean>;
|
|
9
|
-
queryPermission(descriptor?: FileSystemHandlePermissionDescriptor): Promise<PermissionState>;
|
|
10
|
-
requestPermission(descriptor?: FileSystemHandlePermissionDescriptor): Promise<PermissionState>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface FileSystemFileHandle extends FileSystemHandle {
|
|
14
|
-
readonly kind: 'file';
|
|
15
|
-
getFile(): Promise<File>;
|
|
16
|
-
createWritable(options?: FileSystemCreateWritableOptions): Promise<FileSystemWritableFileStream>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface FileSystemDirectoryHandle extends FileSystemHandle {
|
|
20
|
-
readonly kind: 'directory';
|
|
21
|
-
getDirectoryHandle(
|
|
22
|
-
name: string,
|
|
23
|
-
options?: FileSystemGetDirectoryOptions
|
|
24
|
-
): Promise<FileSystemDirectoryHandle>;
|
|
25
|
-
getFileHandle(name: string, options?: FileSystemGetFileOptions): Promise<FileSystemFileHandle>;
|
|
26
|
-
removeEntry(name: string, options?: FileSystemRemoveOptions): Promise<void>;
|
|
27
|
-
resolve(possibleDescendant: FileSystemHandle): Promise<string[] | null>;
|
|
28
|
-
keys(): AsyncIterableIterator<string>;
|
|
29
|
-
values(): AsyncIterableIterator<FileSystemHandle>;
|
|
30
|
-
entries(): AsyncIterableIterator<[string, FileSystemHandle]>;
|
|
31
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemHandle]>;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
interface FileSystemHandlePermissionDescriptor {
|
|
35
|
-
mode?: 'read' | 'readwrite';
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface FileSystemCreateWritableOptions {
|
|
39
|
-
keepExistingData?: boolean;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface FileSystemGetDirectoryOptions {
|
|
43
|
-
create?: boolean;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
interface FileSystemGetFileOptions {
|
|
47
|
-
create?: boolean;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
interface FileSystemRemoveOptions {
|
|
51
|
-
recursive?: boolean;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
interface FileSystemWritableFileStream extends WritableStream {
|
|
55
|
-
write(data: BufferSource | Blob | string): Promise<void>;
|
|
56
|
-
seek(position: number): Promise<void>;
|
|
57
|
-
truncate(size: number): Promise<void>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
interface ShowDirectoryPickerOptions {
|
|
61
|
-
id?: string;
|
|
62
|
-
mode?: 'read' | 'readwrite';
|
|
63
|
-
startIn?: FileSystemHandle | WellKnownDirectory;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
interface ShowOpenFilePickerOptions {
|
|
67
|
-
multiple?: boolean;
|
|
68
|
-
excludeAcceptAllOption?: boolean;
|
|
69
|
-
types?: FilePickerAcceptType[];
|
|
70
|
-
startIn?: FileSystemHandle | WellKnownDirectory;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
interface ShowSaveFilePickerOptions {
|
|
74
|
-
excludeAcceptAllOption?: boolean;
|
|
75
|
-
types?: FilePickerAcceptType[];
|
|
76
|
-
startIn?: FileSystemHandle | WellKnownDirectory;
|
|
77
|
-
suggestedName?: string;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
interface FilePickerAcceptType {
|
|
81
|
-
description: string;
|
|
82
|
-
accept: Record<string, string[]>;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
type WellKnownDirectory = 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos';
|
|
86
|
-
|
|
87
|
-
interface Window {
|
|
88
|
-
showDirectoryPicker(options?: ShowDirectoryPickerOptions): Promise<FileSystemDirectoryHandle>;
|
|
89
|
-
showOpenFilePicker(options?: ShowOpenFilePickerOptions): Promise<FileSystemFileHandle[]>;
|
|
90
|
-
showSaveFilePicker(options?: ShowSaveFilePickerOptions): Promise<FileSystemFileHandle>;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export {};
|