@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.
Files changed (99) hide show
  1. package/cli.js +132 -21
  2. package/dist/bundle.js +1 -1
  3. package/dist/bundle.js.LICENSE.txt +11 -1
  4. package/package.json +42 -36
  5. package/.rush/temp/587277bfc395406ad444e989b6c309b9698f534c.tar.log +0 -15
  6. package/.rush/temp/chunked-rush-logs/ts-res-browser.build.chunks.jsonl +0 -35
  7. package/.rush/temp/operation/build/all.log +0 -35
  8. package/.rush/temp/operation/build/log-chunks.jsonl +0 -35
  9. package/.rush/temp/operation/build/state.json +0 -3
  10. package/.rush/temp/shrinkwrap-deps.json +0 -1225
  11. package/TS_RES_BROWSER_PLAN.md +0 -689
  12. package/babel.config.js +0 -17
  13. package/config/jest.config.json +0 -13
  14. package/config/rig.json +0 -16
  15. package/postcss.config.js +0 -3
  16. package/public/index.html +0 -15
  17. package/rush-logs/ts-res-browser.build.cache.log +0 -3
  18. package/rush-logs/ts-res-browser.build.log +0 -35
  19. package/src/App.tsx +0 -274
  20. package/src/cli.ts +0 -44
  21. package/src/components/common/FileImporter.tsx +0 -143
  22. package/src/components/common/NavigationWarningModal.tsx +0 -62
  23. package/src/components/layout/AppLayout.tsx +0 -46
  24. package/src/components/layout/Header.tsx +0 -22
  25. package/src/components/layout/MessagesWindow.tsx +0 -108
  26. package/src/components/layout/Sidebar.tsx +0 -99
  27. package/src/components/tools/CompiledBrowser.tsx +0 -949
  28. package/src/components/tools/ConfigurationTool.tsx +0 -1405
  29. package/src/components/tools/FilterTool.tsx +0 -1114
  30. package/src/components/tools/ImportTool.tsx +0 -249
  31. package/src/components/tools/ResolutionViewer.tsx +0 -1672
  32. package/src/components/tools/SourceBrowser.tsx +0 -496
  33. package/src/components/tools/ZipLoader.tsx +0 -302
  34. package/src/hooks/useAppState.ts +0 -111
  35. package/src/hooks/useFileImport.ts +0 -86
  36. package/src/hooks/useNavigationWarning.ts +0 -67
  37. package/src/hooks/useResourceManager.ts +0 -295
  38. package/src/hooks/useUrlParams.ts +0 -56
  39. package/src/index.css +0 -38
  40. package/src/main.tsx +0 -16
  41. package/src/types/app.ts +0 -70
  42. package/src/types/fileSystemAccess.d.ts +0 -94
  43. package/src/utils/browserFileTreeAccessors.ts +0 -245
  44. package/src/utils/fileImport.ts +0 -336
  45. package/src/utils/fileTreeConverter.ts +0 -160
  46. package/src/utils/filterResources.ts +0 -677
  47. package/src/utils/tsResIntegration.ts +0 -467
  48. package/src/utils/urlParams.ts +0 -238
  49. package/src/utils/zip/browserZipFileTreeAccessors.ts +0 -385
  50. package/tailwind.config.js +0 -21
  51. package/test-data/README.md +0 -184
  52. package/test-data/config-variations/README.md +0 -64
  53. package/test-data/config-variations/composition-terminology.json +0 -112
  54. package/test-data/config-variations/enterprise-complex.json +0 -129
  55. package/test-data/config-variations/gaming-app.json +0 -87
  56. package/test-data/config-variations/high-priority-language.json +0 -65
  57. package/test-data/config-variations/minimal-basic.json +0 -37
  58. package/test-data/config-variations/qualifier-default-values.json +0 -71
  59. package/test-data/config-variations/territory-first.json +0 -68
  60. package/test-data/config-variations/territory-hierarchy-test.json +0 -31
  61. package/test-data/config-variations/territory-hierarchy-unconstrained.json +0 -32
  62. package/test-data/default-matching-test/greeting.res.json +0 -83
  63. package/test-data/default-matching-test/only-defaults.res.json +0 -48
  64. package/test-data/sample-project/package.json +0 -27
  65. package/test-data/sample-project/src/resources/app-config.json +0 -27
  66. package/test-data/sample-project/src/resources/app.json +0 -177
  67. package/test-data/sample-project/src/resources/config/app.env=development.json +0 -21
  68. package/test-data/sample-project/src/resources/config/app.json +0 -21
  69. package/test-data/sample-project/src/resources/config/app.platform=mobile.json +0 -23
  70. package/test-data/sample-project/src/resources/feature-flags.json +0 -23
  71. package/test-data/sample-project/src/resources/home=CA/common.json +0 -16
  72. package/test-data/sample-project/src/resources/images/density=hdpi.json +0 -29
  73. package/test-data/sample-project/src/resources/images/home.json +0 -29
  74. package/test-data/sample-project/src/resources/images/logout.json +0 -14
  75. package/test-data/sample-project/src/resources/images/settings.json +0 -14
  76. package/test-data/sample-project/src/resources/images/ui-icons.json +0 -29
  77. package/test-data/sample-project/src/resources/images/user.density=hdpi.json +0 -14
  78. package/test-data/sample-project/src/resources/images/user.json +0 -14
  79. package/test-data/sample-project/src/resources/lang=en-US/common.json +0 -15
  80. package/test-data/sample-project/src/resources/language=en-CA/ui-terms.json +0 -19
  81. package/test-data/sample-project/src/resources/language=en-GB/ui-terms.json +0 -30
  82. package/test-data/sample-project/src/resources/language=fr-CA/ui-terms.json +0 -25
  83. package/test-data/sample-project/src/resources/language=nl-BE/ui-terms.json +0 -17
  84. package/test-data/sample-project/src/resources/region=europe/feature-flags.json +0 -17
  85. package/test-data/sample-project/src/resources/region=north-america/feature-flags.json +0 -18
  86. package/test-data/sample-project/src/resources/strings/dashboard.home=CA,language=fr.json +0 -20
  87. package/test-data/sample-project/src/resources/strings/dashboard.json +0 -18
  88. package/test-data/sample-project/src/resources/strings/dashboard.role=admin.json +0 -23
  89. package/test-data/sample-project/src/resources/strings/dashboard.role=user.json +0 -21
  90. package/test-data/sample-project/src/resources/strings/language=en-US.json +0 -16
  91. package/test-data/sample-project/src/resources/strings.json +0 -78
  92. package/test-data/sample-project/src/resources/territory=BE/app-config.json +0 -19
  93. package/test-data/sample-project/src/resources/territory=CA/app-config.json +0 -21
  94. package/test-data/sample-project/src/resources/territory=GB/app-config.json +0 -25
  95. package/test-data/sample-project/src/resources/territory=NL/app-config.json +0 -25
  96. package/test-data/sample-project/src/resources/ui-terms.json +0 -96
  97. package/test-data/sample-project/src/resources-config.json +0 -111
  98. package/tsconfig.json +0 -27
  99. package/webpack.config.js +0 -60
@@ -1,249 +0,0 @@
1
- import React, { useEffect, useRef } from 'react';
2
- import { DocumentArrowUpIcon, CheckCircleIcon, ExclamationTriangleIcon } from '@heroicons/react/24/outline';
3
- import { Message } from '../../types/app';
4
- import { UseFileImportReturn } from '../../hooks/useFileImport';
5
- import { UseResourceManagerReturn } from '../../hooks/useResourceManager';
6
- import FileImporter from '../common/FileImporter';
7
- import { useUrlParams } from '../../hooks/useUrlParams';
8
-
9
- interface ImportToolProps {
10
- onMessage: (type: Message['type'], message: string) => void;
11
- fileImport: UseFileImportReturn;
12
- resourceManager: UseResourceManagerReturn;
13
- }
14
-
15
- const ImportTool: React.FC<ImportToolProps> = ({ onMessage, fileImport, resourceManager }) => {
16
- const { state: fileImportState, actions: fileImportActions } = fileImport;
17
- const { state: resourceState, actions: resourceActions } = resourceManager;
18
- const { urlParams } = useUrlParams();
19
-
20
- // Track if we've already processed the current import to prevent infinite loops
21
- const lastProcessedImport = useRef<{
22
- directory: any;
23
- files: any[];
24
- hasProcessedData: boolean;
25
- }>({
26
- directory: null,
27
- files: [],
28
- hasProcessedData: false
29
- });
30
-
31
- // Handle file import completion
32
- useEffect(() => {
33
- if (fileImportState.hasImportedData) {
34
- const currentDirectory = fileImportState.importedDirectory;
35
- const currentFiles = fileImportState.importedFiles;
36
-
37
- // Check if this is a new import that we haven't processed yet
38
- const isNewImport =
39
- currentDirectory !== lastProcessedImport.current.directory ||
40
- currentFiles !== lastProcessedImport.current.files ||
41
- fileImportState.hasImportedData !== lastProcessedImport.current.hasProcessedData;
42
-
43
- if (isNewImport && !resourceState.isProcessing) {
44
- // Update our tracking reference
45
- lastProcessedImport.current = {
46
- directory: currentDirectory,
47
- files: currentFiles,
48
- hasProcessedData: fileImportState.hasImportedData
49
- };
50
-
51
- if (currentDirectory) {
52
- onMessage('info', 'Directory imported successfully. Processing resources...');
53
- resourceActions.processDirectory(currentDirectory);
54
- } else if (currentFiles.length > 0) {
55
- onMessage('info', `${currentFiles.length} files imported successfully. Processing resources...`);
56
- resourceActions.processFiles(currentFiles);
57
- }
58
- }
59
- }
60
- }, [
61
- fileImportState.hasImportedData,
62
- fileImportState.importedDirectory,
63
- fileImportState.importedFiles,
64
- resourceState.isProcessing,
65
- resourceActions,
66
- onMessage
67
- ]);
68
-
69
- // Handle resource processing completion
70
- useEffect(() => {
71
- if (resourceState.processedResources) {
72
- const resourceCount = resourceState.processedResources.summary.resourceIds.length;
73
- onMessage('success', `Resources processed successfully! Found ${resourceCount} resources.`);
74
- }
75
- }, [resourceState.processedResources, onMessage]);
76
-
77
- // Handle errors
78
- useEffect(() => {
79
- if (fileImportState.error) {
80
- onMessage('error', `Import error: ${fileImportState.error}`);
81
- }
82
- }, [fileImportState.error, onMessage]);
83
-
84
- useEffect(() => {
85
- if (resourceState.error) {
86
- onMessage('error', `Processing error: ${resourceState.error}`);
87
- }
88
- }, [resourceState.error, onMessage]);
89
-
90
- const handleReset = () => {
91
- // Reset the tracking reference
92
- lastProcessedImport.current = {
93
- directory: null,
94
- files: [],
95
- hasProcessedData: false
96
- };
97
-
98
- fileImportActions.reset();
99
- resourceActions.reset();
100
- onMessage('info', 'Import data cleared');
101
- };
102
-
103
- return (
104
- <div className="p-6">
105
- <div className="flex items-center space-x-3 mb-6">
106
- <DocumentArrowUpIcon className="h-8 w-8 text-blue-600" />
107
- <h2 className="text-2xl font-bold text-gray-900">Import Resources</h2>
108
- </div>
109
-
110
- <div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
111
- {/* Left column: File Import */}
112
- <div className="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
113
- <h3 className="text-lg font-semibold text-gray-900 mb-4">Import Files</h3>
114
-
115
- <FileImporter
116
- onDirectoryImported={fileImportActions.handleDirectoryImport}
117
- onFilesImported={fileImportActions.handleFilesImport}
118
- onError={fileImportActions.handleError}
119
- startInDirectory={urlParams.inputStartDir}
120
- />
121
- </div>
122
-
123
- {/* Right column: Status & Info */}
124
- <div className="space-y-6">
125
- {/* Import Status */}
126
- <div className="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
127
- <h3 className="text-lg font-semibold text-gray-900 mb-4">Import Status</h3>
128
-
129
- <div className="space-y-3">
130
- {/* File Import Status */}
131
- <div className="flex items-center space-x-3">
132
- {fileImportState.hasImportedData ? (
133
- <>
134
- <CheckCircleIcon className="w-5 h-5 text-green-500" />
135
- <span className="text-sm text-gray-900">
136
- {fileImportState.importedDirectory
137
- ? 'Directory imported'
138
- : `${fileImportState.importedFiles.length} files imported`}
139
- </span>
140
- </>
141
- ) : (
142
- <>
143
- <div className="w-5 h-5 rounded-full border-2 border-gray-300"></div>
144
- <span className="text-sm text-gray-500">No files imported yet</span>
145
- </>
146
- )}
147
- </div>
148
-
149
- {/* Resource Processing Status */}
150
- <div className="flex items-center space-x-3">
151
- {resourceState.isProcessing ? (
152
- <>
153
- <div className="w-5 h-5 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"></div>
154
- <span className="text-sm text-gray-900">Processing resources...</span>
155
- </>
156
- ) : resourceState.processedResources ? (
157
- <>
158
- <CheckCircleIcon className="w-5 h-5 text-green-500" />
159
- <span className="text-sm text-gray-900">
160
- {resourceState.processedResources.summary.resourceIds.length} resources processed
161
- </span>
162
- </>
163
- ) : (
164
- <>
165
- <div className="w-5 h-5 rounded-full border-2 border-gray-300"></div>
166
- <span className="text-sm text-gray-500">No resources processed yet</span>
167
- </>
168
- )}
169
- </div>
170
- </div>
171
-
172
- {/* Reset Button */}
173
- {(fileImportState.hasImportedData || resourceState.hasProcessedData) && (
174
- <button
175
- onClick={handleReset}
176
- className="mt-4 px-4 py-2 text-sm bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors"
177
- >
178
- Clear Import Data
179
- </button>
180
- )}
181
- </div>
182
-
183
- {/* Resource Summary */}
184
- {resourceState.processedResources && (
185
- <div className="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
186
- <h3 className="text-lg font-semibold text-gray-900 mb-4">Resource Summary</h3>
187
-
188
- <div className="space-y-2 text-sm">
189
- <div className="flex justify-between">
190
- <span className="text-gray-600">Total Resources:</span>
191
- <span className="font-medium">
192
- {resourceState.processedResources.summary.resourceIds.length}
193
- </span>
194
- </div>
195
- <div className="flex justify-between">
196
- <span className="text-gray-600">Total Count:</span>
197
- <span className="font-medium">
198
- {resourceState.processedResources.summary.totalResources}
199
- </span>
200
- </div>
201
- {resourceState.processedResources.summary.warnings.length > 0 && (
202
- <div className="flex justify-between">
203
- <span className="text-gray-600">Warnings:</span>
204
- <span className="font-medium text-yellow-600">
205
- {resourceState.processedResources.summary.warnings.length}
206
- </span>
207
- </div>
208
- )}
209
- {resourceState.processedResources.summary.errorCount > 0 && (
210
- <div className="flex justify-between">
211
- <span className="text-gray-600">Errors:</span>
212
- <span className="font-medium text-red-600">
213
- {resourceState.processedResources.summary.errorCount}
214
- </span>
215
- </div>
216
- )}
217
- </div>
218
-
219
- <div className="mt-4 p-3 bg-green-50 rounded-lg">
220
- <div className="flex items-start space-x-2">
221
- <CheckCircleIcon className="w-5 h-5 text-green-600 mt-0.5" />
222
- <div className="text-sm text-green-800">
223
- <p className="font-medium">Resources Ready!</p>
224
- <p>Use the Source Browser to explore imported resources.</p>
225
- </div>
226
- </div>
227
- </div>
228
- </div>
229
- )}
230
-
231
- {/* Error Display */}
232
- {(fileImportState.error || resourceState.error) && (
233
- <div className="bg-white rounded-lg shadow-sm border border-red-200 p-6">
234
- <div className="flex items-start space-x-2">
235
- <ExclamationTriangleIcon className="w-5 h-5 text-red-600 mt-0.5" />
236
- <div className="text-sm text-red-800">
237
- <p className="font-medium">Error</p>
238
- <p>{fileImportState.error || resourceState.error}</p>
239
- </div>
240
- </div>
241
- </div>
242
- )}
243
- </div>
244
- </div>
245
- </div>
246
- );
247
- };
248
-
249
- export default ImportTool;