@fgv/ts-res-browser 1.0.0

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 (95) hide show
  1. package/.rush/temp/5fc90bc7c2ccf812114ea099111568e5429be2a2.tar.log +15 -0
  2. package/.rush/temp/chunked-rush-logs/ts-res-browser.build.chunks.jsonl +35 -0
  3. package/.rush/temp/operation/build/all.log +35 -0
  4. package/.rush/temp/operation/build/log-chunks.jsonl +35 -0
  5. package/.rush/temp/operation/build/state.json +3 -0
  6. package/.rush/temp/shrinkwrap-deps.json +1217 -0
  7. package/README.md +95 -0
  8. package/TS_RES_BROWSER_PLAN.md +689 -0
  9. package/babel.config.js +17 -0
  10. package/config/jest.config.json +13 -0
  11. package/config/rig.json +16 -0
  12. package/dist/bundle.js +2 -0
  13. package/dist/bundle.js.LICENSE.txt +62 -0
  14. package/dist/index.html +1 -0
  15. package/package.json +78 -0
  16. package/postcss.config.js +3 -0
  17. package/public/index.html +15 -0
  18. package/rush-logs/ts-res-browser.build.cache.log +3 -0
  19. package/rush-logs/ts-res-browser.build.log +35 -0
  20. package/src/App.tsx +153 -0
  21. package/src/cli.ts +44 -0
  22. package/src/components/common/FileImporter.tsx +138 -0
  23. package/src/components/common/NavigationWarningModal.tsx +62 -0
  24. package/src/components/layout/AppLayout.tsx +46 -0
  25. package/src/components/layout/Header.tsx +22 -0
  26. package/src/components/layout/MessagesWindow.tsx +108 -0
  27. package/src/components/layout/Sidebar.tsx +92 -0
  28. package/src/components/tools/CompiledBrowser.tsx +949 -0
  29. package/src/components/tools/ConfigurationTool.tsx +1402 -0
  30. package/src/components/tools/FilterTool.tsx +1027 -0
  31. package/src/components/tools/ImportTool.tsx +246 -0
  32. package/src/components/tools/ResolutionViewer.tsx +1672 -0
  33. package/src/components/tools/SourceBrowser.tsx +496 -0
  34. package/src/hooks/useAppState.ts +107 -0
  35. package/src/hooks/useFileImport.ts +86 -0
  36. package/src/hooks/useNavigationWarning.ts +67 -0
  37. package/src/hooks/useResourceManager.ts +244 -0
  38. package/src/index.css +38 -0
  39. package/src/main.tsx +16 -0
  40. package/src/types/app.ts +62 -0
  41. package/src/types/fileSystemAccess.d.ts +94 -0
  42. package/src/utils/browserFileTreeAccessors.ts +245 -0
  43. package/src/utils/fileImport.ts +334 -0
  44. package/src/utils/filterResources.ts +677 -0
  45. package/src/utils/tsResIntegration.ts +467 -0
  46. package/tailwind.config.js +21 -0
  47. package/test-data/README.md +184 -0
  48. package/test-data/config-variations/README.md +64 -0
  49. package/test-data/config-variations/composition-terminology.json +112 -0
  50. package/test-data/config-variations/enterprise-complex.json +129 -0
  51. package/test-data/config-variations/gaming-app.json +87 -0
  52. package/test-data/config-variations/high-priority-language.json +65 -0
  53. package/test-data/config-variations/minimal-basic.json +37 -0
  54. package/test-data/config-variations/qualifier-default-values.json +71 -0
  55. package/test-data/config-variations/territory-first.json +68 -0
  56. package/test-data/config-variations/territory-hierarchy-test.json +31 -0
  57. package/test-data/config-variations/territory-hierarchy-unconstrained.json +32 -0
  58. package/test-data/default-matching-test/greeting.res.json +83 -0
  59. package/test-data/default-matching-test/only-defaults.res.json +48 -0
  60. package/test-data/sample-project/package.json +27 -0
  61. package/test-data/sample-project/src/resources/app-config.json +27 -0
  62. package/test-data/sample-project/src/resources/app.json +177 -0
  63. package/test-data/sample-project/src/resources/config/app.env=development.json +21 -0
  64. package/test-data/sample-project/src/resources/config/app.json +21 -0
  65. package/test-data/sample-project/src/resources/config/app.platform=mobile.json +23 -0
  66. package/test-data/sample-project/src/resources/feature-flags.json +23 -0
  67. package/test-data/sample-project/src/resources/home=CA/common.json +16 -0
  68. package/test-data/sample-project/src/resources/images/density=hdpi.json +29 -0
  69. package/test-data/sample-project/src/resources/images/home.json +29 -0
  70. package/test-data/sample-project/src/resources/images/logout.json +14 -0
  71. package/test-data/sample-project/src/resources/images/settings.json +14 -0
  72. package/test-data/sample-project/src/resources/images/ui-icons.json +29 -0
  73. package/test-data/sample-project/src/resources/images/user.density=hdpi.json +14 -0
  74. package/test-data/sample-project/src/resources/images/user.json +14 -0
  75. package/test-data/sample-project/src/resources/lang=en-US/common.json +15 -0
  76. package/test-data/sample-project/src/resources/language=en-CA/ui-terms.json +19 -0
  77. package/test-data/sample-project/src/resources/language=en-GB/ui-terms.json +30 -0
  78. package/test-data/sample-project/src/resources/language=fr-CA/ui-terms.json +25 -0
  79. package/test-data/sample-project/src/resources/language=nl-BE/ui-terms.json +17 -0
  80. package/test-data/sample-project/src/resources/region=europe/feature-flags.json +17 -0
  81. package/test-data/sample-project/src/resources/region=north-america/feature-flags.json +18 -0
  82. package/test-data/sample-project/src/resources/strings/dashboard.home=CA,language=fr.json +20 -0
  83. package/test-data/sample-project/src/resources/strings/dashboard.json +18 -0
  84. package/test-data/sample-project/src/resources/strings/dashboard.role=admin.json +23 -0
  85. package/test-data/sample-project/src/resources/strings/dashboard.role=user.json +21 -0
  86. package/test-data/sample-project/src/resources/strings/language=en-US.json +16 -0
  87. package/test-data/sample-project/src/resources/strings.json +78 -0
  88. package/test-data/sample-project/src/resources/territory=BE/app-config.json +19 -0
  89. package/test-data/sample-project/src/resources/territory=CA/app-config.json +21 -0
  90. package/test-data/sample-project/src/resources/territory=GB/app-config.json +25 -0
  91. package/test-data/sample-project/src/resources/territory=NL/app-config.json +25 -0
  92. package/test-data/sample-project/src/resources/ui-terms.json +96 -0
  93. package/test-data/sample-project/src/resources-config.json +111 -0
  94. package/tsconfig.json +27 -0
  95. package/webpack.config.js +54 -0
@@ -0,0 +1,67 @@
1
+ import { useState, useCallback } from 'react';
2
+ import { Tool } from '../types/app';
3
+
4
+ export interface NavigationWarningState {
5
+ isWarningOpen: boolean;
6
+ pendingTool: Tool | null;
7
+ hasUnsavedChanges: boolean;
8
+ }
9
+
10
+ export interface NavigationWarningActions {
11
+ setHasUnsavedChanges: (hasChanges: boolean) => void;
12
+ showWarning: (pendingTool: Tool) => void;
13
+ hideWarning: () => void;
14
+ confirmNavigation: () => Tool | null;
15
+ }
16
+
17
+ export const useNavigationWarning = (): {
18
+ state: NavigationWarningState;
19
+ actions: NavigationWarningActions;
20
+ } => {
21
+ const [state, setState] = useState<NavigationWarningState>({
22
+ isWarningOpen: false,
23
+ pendingTool: null,
24
+ hasUnsavedChanges: false
25
+ });
26
+
27
+ const setHasUnsavedChanges = useCallback((hasChanges: boolean) => {
28
+ setState((prev) => ({ ...prev, hasUnsavedChanges: hasChanges }));
29
+ }, []);
30
+
31
+ const showWarning = useCallback((pendingTool: Tool) => {
32
+ setState((prev) => ({
33
+ ...prev,
34
+ isWarningOpen: true,
35
+ pendingTool
36
+ }));
37
+ }, []);
38
+
39
+ const hideWarning = useCallback(() => {
40
+ setState((prev) => ({
41
+ ...prev,
42
+ isWarningOpen: false,
43
+ pendingTool: null
44
+ }));
45
+ }, []);
46
+
47
+ const confirmNavigation = useCallback(() => {
48
+ const toolToNavigateTo = state.pendingTool;
49
+ setState((prev) => ({
50
+ ...prev,
51
+ isWarningOpen: false,
52
+ pendingTool: null,
53
+ hasUnsavedChanges: false
54
+ }));
55
+ return toolToNavigateTo;
56
+ }, [state.pendingTool]);
57
+
58
+ return {
59
+ state,
60
+ actions: {
61
+ setHasUnsavedChanges,
62
+ showWarning,
63
+ hideWarning,
64
+ confirmNavigation
65
+ }
66
+ };
67
+ };
@@ -0,0 +1,244 @@
1
+ import { useState, useCallback } from 'react';
2
+ import { Result, succeed, fail } 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 { Config } from '@fgv/ts-res';
11
+
12
+ export interface ResourceManagerState {
13
+ isProcessing: boolean;
14
+ processedResources: ProcessedResources | null;
15
+ error: string | null;
16
+ hasProcessedData: boolean;
17
+ activeConfiguration: Config.Model.ISystemConfiguration | null;
18
+ }
19
+
20
+ export interface UseResourceManagerReturn {
21
+ state: ResourceManagerState;
22
+ actions: {
23
+ processDirectory: (directory: ImportedDirectory) => Promise<void>;
24
+ processFiles: (files: ImportedFile[]) => Promise<void>;
25
+ clearError: () => void;
26
+ reset: () => void;
27
+ resolveResource: (resourceId: string, context?: Record<string, string>) => Promise<Result<any>>;
28
+ applyConfiguration: (config: Config.Model.ISystemConfiguration) => void;
29
+ };
30
+ }
31
+
32
+ const initialState: ResourceManagerState = {
33
+ isProcessing: false,
34
+ processedResources: null,
35
+ error: null,
36
+ hasProcessedData: false,
37
+ activeConfiguration: null
38
+ };
39
+
40
+ export const useResourceManager = (): UseResourceManagerReturn => {
41
+ const [state, setState] = useState<ResourceManagerState>(initialState);
42
+
43
+ const processDirectory = useCallback(
44
+ async (directory: ImportedDirectory) => {
45
+ console.log('=== STARTING DIRECTORY PROCESSING ===');
46
+ console.log('Directory:', directory.name, 'Files:', directory.files?.length || 0);
47
+
48
+ setState((prev) => ({ ...prev, isProcessing: true, error: null }));
49
+
50
+ try {
51
+ console.log('1. About to call processImportedDirectory...');
52
+
53
+ // Use setTimeout to make this async and allow UI updates
54
+ await new Promise<void>((resolve, reject) => {
55
+ setTimeout(() => {
56
+ try {
57
+ console.log('2. Inside setTimeout, calling processImportedDirectory...');
58
+ const result = processImportedDirectory(directory, state.activeConfiguration || undefined);
59
+ console.log(
60
+ '3. processImportedDirectory returned:',
61
+ result.isSuccess() ? 'SUCCESS' : 'FAILURE'
62
+ );
63
+
64
+ if (result.isSuccess()) {
65
+ console.log('4. Processing succeeded, setting state...');
66
+ console.log(' Resource count:', result.value.summary.resourceIds.length);
67
+ console.log(' Resource IDs:', result.value.summary.resourceIds);
68
+
69
+ setState((prev) => ({
70
+ ...prev,
71
+ isProcessing: false,
72
+ processedResources: result.value,
73
+ hasProcessedData: true
74
+ }));
75
+ console.log('5. State updated successfully');
76
+ resolve();
77
+ } else {
78
+ console.error('4. Processing failed with error:', result.message);
79
+ setState((prev) => ({
80
+ ...prev,
81
+ isProcessing: false,
82
+ error: result.message
83
+ }));
84
+ reject(new Error(result.message));
85
+ }
86
+ } catch (innerError) {
87
+ console.error('4. Exception in setTimeout:', innerError);
88
+ setState((prev) => ({
89
+ ...prev,
90
+ isProcessing: false,
91
+ error: `Processing exception: ${
92
+ innerError instanceof Error ? innerError.message : String(innerError)
93
+ }`
94
+ }));
95
+ reject(innerError);
96
+ }
97
+ }, 100); // Small delay to allow UI update
98
+ });
99
+
100
+ console.log('6. processDirectory completed successfully');
101
+ } catch (error) {
102
+ console.error('=== DIRECTORY PROCESSING ERROR ===');
103
+ console.error('Error:', error);
104
+ setState((prev) => ({
105
+ ...prev,
106
+ isProcessing: false,
107
+ error: `Unexpected error: ${error instanceof Error ? error.message : String(error)}`
108
+ }));
109
+ }
110
+ },
111
+ [state.activeConfiguration]
112
+ );
113
+
114
+ const processFiles = useCallback(
115
+ async (files: ImportedFile[]) => {
116
+ console.log('=== STARTING FILES PROCESSING ===');
117
+ console.log('Files count:', files.length);
118
+ console.log(
119
+ 'Files:',
120
+ files.map((f) => f.name)
121
+ );
122
+
123
+ setState((prev) => ({ ...prev, isProcessing: true, error: null }));
124
+
125
+ try {
126
+ console.log('1. About to call processImportedFiles...');
127
+
128
+ // Use setTimeout to make this async and allow UI updates
129
+ await new Promise<void>((resolve, reject) => {
130
+ setTimeout(() => {
131
+ try {
132
+ console.log('2. Inside setTimeout, calling processImportedFiles...');
133
+ const result = processImportedFiles(files, state.activeConfiguration || undefined);
134
+ console.log('3. processImportedFiles returned:', result.isSuccess() ? 'SUCCESS' : 'FAILURE');
135
+
136
+ if (result.isSuccess()) {
137
+ console.log('4. Processing succeeded, setting state...');
138
+ console.log(' Resource count:', result.value.summary.resourceIds.length);
139
+ console.log(' Resource IDs:', result.value.summary.resourceIds);
140
+
141
+ setState((prev) => ({
142
+ ...prev,
143
+ isProcessing: false,
144
+ processedResources: result.value,
145
+ hasProcessedData: true
146
+ }));
147
+ console.log('5. State updated successfully');
148
+ resolve();
149
+ } else {
150
+ console.error('4. Processing failed with error:', result.message);
151
+ setState((prev) => ({
152
+ ...prev,
153
+ isProcessing: false,
154
+ error: result.message
155
+ }));
156
+ reject(new Error(result.message));
157
+ }
158
+ } catch (innerError) {
159
+ console.error('4. Exception in setTimeout:', innerError);
160
+ setState((prev) => ({
161
+ ...prev,
162
+ isProcessing: false,
163
+ error: `Processing exception: ${
164
+ innerError instanceof Error ? innerError.message : String(innerError)
165
+ }`
166
+ }));
167
+ reject(innerError);
168
+ }
169
+ }, 100); // Small delay to allow UI update
170
+ });
171
+
172
+ console.log('6. processFiles completed successfully');
173
+ } catch (error) {
174
+ console.error('=== FILES PROCESSING ERROR ===');
175
+ console.error('Error:', error);
176
+ setState((prev) => ({
177
+ ...prev,
178
+ isProcessing: false,
179
+ error: `Unexpected error: ${error instanceof Error ? error.message : String(error)}`
180
+ }));
181
+ }
182
+ },
183
+ [state.activeConfiguration]
184
+ );
185
+
186
+ const clearError = useCallback(() => {
187
+ setState((prev) => ({ ...prev, error: null }));
188
+ }, []);
189
+
190
+ const reset = useCallback(() => {
191
+ console.log('Resetting resource manager state');
192
+ setState(initialState);
193
+ }, []);
194
+
195
+ const resolveResource = useCallback(
196
+ async (resourceId: string, context?: Record<string, string>): Promise<Result<any>> => {
197
+ if (!state.processedResources?.resolver) {
198
+ return fail('No resolver available');
199
+ }
200
+
201
+ try {
202
+ const contextProvider = context
203
+ ? createSimpleContext(context, state.processedResources.system)
204
+ : null;
205
+
206
+ if (contextProvider?.isFailure()) {
207
+ return fail(`Failed to create context: ${contextProvider.error}`);
208
+ }
209
+
210
+ const resolveContext = contextProvider?.value || undefined;
211
+ return await state.processedResources.resolver.resolve(resourceId, resolveContext);
212
+ } catch (error) {
213
+ return fail(`Failed to resolve resource: ${error instanceof Error ? error.message : String(error)}`);
214
+ }
215
+ },
216
+ [state.processedResources]
217
+ );
218
+
219
+ const applyConfiguration = useCallback((config: Config.Model.ISystemConfiguration) => {
220
+ console.log('Applying configuration:', config.name || 'Unnamed configuration');
221
+ setState((prev) => ({
222
+ ...prev,
223
+ activeConfiguration: config,
224
+ // Clear processed resources when configuration changes
225
+ processedResources: null,
226
+ hasProcessedData: false,
227
+ error: null
228
+ }));
229
+ }, []);
230
+
231
+ return {
232
+ state,
233
+ actions: {
234
+ processDirectory,
235
+ processFiles,
236
+ clearError,
237
+ reset,
238
+ resolveResource,
239
+ applyConfiguration
240
+ }
241
+ };
242
+ };
243
+
244
+ export default useResourceManager;
package/src/index.css ADDED
@@ -0,0 +1,38 @@
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 ADDED
@@ -0,0 +1,16 @@
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
+ );
@@ -0,0 +1,62 @@
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 = 'import' | 'source' | 'filter' | 'compiled' | 'resolution' | 'configuration';
10
+
11
+ export interface FilterState {
12
+ enabled: boolean;
13
+ values: Record<string, string>;
14
+ appliedValues: Record<string, string>;
15
+ hasPendingChanges: boolean;
16
+ reduceQualifiers: boolean;
17
+ }
18
+
19
+ export interface AppState {
20
+ selectedTool: Tool;
21
+ messages: Message[];
22
+ filterState: FilterState;
23
+ }
24
+
25
+ export interface AppActions {
26
+ setSelectedTool: (tool: Tool, force?: boolean) => void;
27
+ addMessage: (type: Message['type'], message: string) => void;
28
+ clearMessages: () => void;
29
+ updateFilterEnabled: (enabled: boolean) => void;
30
+ updateFilterValues: (values: Record<string, string>) => void;
31
+ applyFilterValues: () => void;
32
+ resetFilterValues: () => void;
33
+ updateReduceQualifiers: (reduceQualifiers: boolean) => void;
34
+ }
35
+
36
+ // Tool-specific types
37
+ export interface SourceBrowserState {
38
+ selectedResource: string | null;
39
+ resources: any[]; // Will be typed with ts-res types
40
+ }
41
+
42
+ export interface CompiledBrowserState {
43
+ selectedResource: string | null;
44
+ compiledResources: any[]; // Will be typed with ts-res types
45
+ }
46
+
47
+ export interface ResolutionViewerState {
48
+ selectedResource: string | null;
49
+ qualifiers: Record<string, any>;
50
+ candidates: any[]; // Will be typed with ts-res types
51
+ viewMode: 'best' | 'all';
52
+ }
53
+
54
+ // File import types
55
+ export interface FileImportOptions {
56
+ types: Array<{
57
+ description: string;
58
+ accept: Record<string, string[]>;
59
+ }>;
60
+ multiple: boolean;
61
+ excludeAcceptAllOption: boolean;
62
+ }
@@ -0,0 +1,94 @@
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 {};