@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,160 +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 { FileTree, Result, succeed, fail } from '@fgv/ts-utils';
24
- import { ImportedDirectory, ImportedFile } from './fileImport';
25
-
26
- /**
27
- * Converts a FileTree item (directory or file) to ImportedDirectory/ImportedFile format
28
- * for compatibility with existing resource processing pipeline.
29
- */
30
- export class FileTreeConverter {
31
- /**
32
- * Converts a FileTree directory to ImportedDirectory format.
33
- */
34
- public static convertDirectory(
35
- fileTree: FileTree.FileTree,
36
- directoryPath: string
37
- ): Result<ImportedDirectory> {
38
- try {
39
- const itemResult = fileTree.getItem(directoryPath);
40
- if (itemResult.isFailure()) {
41
- return fail(`Directory not found: ${directoryPath}`);
42
- }
43
-
44
- const item = itemResult.value;
45
- if (item.type !== 'directory') {
46
- return fail(`Path is not a directory: ${directoryPath}`);
47
- }
48
-
49
- const childrenResult = item.getChildren();
50
- if (childrenResult.isFailure()) {
51
- return fail(`Failed to get directory children: ${childrenResult.message}`);
52
- }
53
-
54
- const files: ImportedFile[] = [];
55
- const directories: ImportedDirectory[] = [];
56
-
57
- for (const child of childrenResult.value) {
58
- if (child.type === 'file') {
59
- const fileResult = this.convertFile(child);
60
- if (fileResult.isSuccess()) {
61
- files.push(fileResult.value);
62
- }
63
- } else if (child.type === 'directory') {
64
- const dirResult = this.convertDirectory(fileTree, child.absolutePath);
65
- if (dirResult.isSuccess()) {
66
- directories.push(dirResult.value);
67
- }
68
- }
69
- }
70
-
71
- const importedDirectory: ImportedDirectory = {
72
- name: item.name,
73
- path: item.absolutePath,
74
- files,
75
- directories
76
- };
77
-
78
- return succeed(importedDirectory);
79
- } catch (error) {
80
- return fail(`Failed to convert directory: ${error instanceof Error ? error.message : String(error)}`);
81
- }
82
- }
83
-
84
- /**
85
- * Converts a FileTree file item to ImportedFile format.
86
- */
87
- public static convertFile(fileItem: FileTree.IFileTreeFileItem): Result<ImportedFile> {
88
- try {
89
- const contentsResult = fileItem.getRawContents();
90
- if (contentsResult.isFailure()) {
91
- return fail(`Failed to read file contents: ${contentsResult.message}`);
92
- }
93
-
94
- const importedFile: ImportedFile = {
95
- name: fileItem.name,
96
- path: fileItem.absolutePath,
97
- content: contentsResult.value
98
- };
99
-
100
- return succeed(importedFile);
101
- } catch (error) {
102
- return fail(`Failed to convert file: ${error instanceof Error ? error.message : String(error)}`);
103
- }
104
- }
105
-
106
- /**
107
- * Converts multiple FileTree files to ImportedFile format.
108
- */
109
- public static convertFiles(fileItems: FileTree.IFileTreeFileItem[]): Result<ImportedFile[]> {
110
- try {
111
- const importedFiles: ImportedFile[] = [];
112
-
113
- for (const fileItem of fileItems) {
114
- const fileResult = this.convertFile(fileItem);
115
- if (fileResult.isSuccess()) {
116
- importedFiles.push(fileResult.value);
117
- } else {
118
- return fail(`Failed to convert file ${fileItem.name}: ${fileResult.message}`);
119
- }
120
- }
121
-
122
- return succeed(importedFiles);
123
- } catch (error) {
124
- return fail(`Failed to convert files: ${error instanceof Error ? error.message : String(error)}`);
125
- }
126
- }
127
-
128
- /**
129
- * Converts a FileTree path to ImportedDirectory or ImportedFile format,
130
- * automatically detecting the type.
131
- */
132
- public static convertPath(
133
- fileTree: FileTree.FileTree,
134
- path: string
135
- ): Result<ImportedDirectory | ImportedFile[]> {
136
- try {
137
- const itemResult = fileTree.getItem(path);
138
- if (itemResult.isFailure()) {
139
- return fail(`Path not found: ${path}`);
140
- }
141
-
142
- const item = itemResult.value;
143
-
144
- if (item.type === 'directory') {
145
- return this.convertDirectory(fileTree, path);
146
- } else if (item.type === 'file') {
147
- const fileResult = this.convertFile(item);
148
- if (fileResult.isSuccess()) {
149
- return succeed([fileResult.value]);
150
- } else {
151
- return fileResult;
152
- }
153
- } else {
154
- return fail(`Unknown item type: ${path}`);
155
- }
156
- } catch (error) {
157
- return fail(`Failed to convert path: ${error instanceof Error ? error.message : String(error)}`);
158
- }
159
- }
160
- }