@fgv/ts-res-ui-components 5.0.0-10

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 (231) hide show
  1. package/.rush/temp/03c8b056281d9db0a97d8a6e25eea798a160d393.tar.log +271 -0
  2. package/.rush/temp/chunked-rush-logs/ts-res-ui-components.build.chunks.jsonl +9 -0
  3. package/.rush/temp/operation/build/all.log +9 -0
  4. package/.rush/temp/operation/build/log-chunks.jsonl +9 -0
  5. package/.rush/temp/operation/build/state.json +3 -0
  6. package/.rush/temp/shrinkwrap-deps.json +1111 -0
  7. package/README.md +18 -0
  8. package/REFACTORING_PLAN.md +171 -0
  9. package/config/jest.config.json +16 -0
  10. package/config/jest.setup.js +64 -0
  11. package/config/rig.json +16 -0
  12. package/lib/components/common/QualifierContextControl.d.ts +14 -0
  13. package/lib/components/common/QualifierContextControl.d.ts.map +1 -0
  14. package/lib/components/common/QualifierContextControl.js +78 -0
  15. package/lib/components/common/QualifierContextControl.js.map +1 -0
  16. package/lib/components/common/ResourceListView.d.ts +11 -0
  17. package/lib/components/common/ResourceListView.d.ts.map +1 -0
  18. package/lib/components/common/ResourceListView.js +20 -0
  19. package/lib/components/common/ResourceListView.js.map +1 -0
  20. package/lib/components/common/ResourceTreeView.d.ts +12 -0
  21. package/lib/components/common/ResourceTreeView.d.ts.map +1 -0
  22. package/lib/components/common/ResourceTreeView.js +162 -0
  23. package/lib/components/common/ResourceTreeView.js.map +1 -0
  24. package/lib/components/forms/HierarchyEditor.d.ts +10 -0
  25. package/lib/components/forms/HierarchyEditor.d.ts.map +1 -0
  26. package/lib/components/forms/HierarchyEditor.js +106 -0
  27. package/lib/components/forms/HierarchyEditor.js.map +1 -0
  28. package/lib/components/forms/QualifierEditForm.d.ts +11 -0
  29. package/lib/components/forms/QualifierEditForm.d.ts.map +1 -0
  30. package/lib/components/forms/QualifierEditForm.js +181 -0
  31. package/lib/components/forms/QualifierEditForm.js.map +1 -0
  32. package/lib/components/forms/QualifierTypeEditForm.d.ts +10 -0
  33. package/lib/components/forms/QualifierTypeEditForm.d.ts.map +1 -0
  34. package/lib/components/forms/QualifierTypeEditForm.js +172 -0
  35. package/lib/components/forms/QualifierTypeEditForm.js.map +1 -0
  36. package/lib/components/forms/ResourceTypeEditForm.d.ts +10 -0
  37. package/lib/components/forms/ResourceTypeEditForm.d.ts.map +1 -0
  38. package/lib/components/forms/ResourceTypeEditForm.js +188 -0
  39. package/lib/components/forms/ResourceTypeEditForm.js.map +1 -0
  40. package/lib/components/forms/index.d.ts +9 -0
  41. package/lib/components/forms/index.d.ts.map +1 -0
  42. package/lib/components/forms/index.js +5 -0
  43. package/lib/components/forms/index.js.map +1 -0
  44. package/lib/components/orchestrator/ResourceOrchestrator.d.ts +14 -0
  45. package/lib/components/orchestrator/ResourceOrchestrator.d.ts.map +1 -0
  46. package/lib/components/orchestrator/ResourceOrchestrator.js +278 -0
  47. package/lib/components/orchestrator/ResourceOrchestrator.js.map +1 -0
  48. package/lib/components/views/CompiledView/index.d.ts +5 -0
  49. package/lib/components/views/CompiledView/index.d.ts.map +1 -0
  50. package/lib/components/views/CompiledView/index.js +595 -0
  51. package/lib/components/views/CompiledView/index.js.map +1 -0
  52. package/lib/components/views/ConfigurationView/index.d.ts +5 -0
  53. package/lib/components/views/ConfigurationView/index.d.ts.map +1 -0
  54. package/lib/components/views/ConfigurationView/index.js +363 -0
  55. package/lib/components/views/ConfigurationView/index.js.map +1 -0
  56. package/lib/components/views/FilterView/index.d.ts +5 -0
  57. package/lib/components/views/FilterView/index.d.ts.map +1 -0
  58. package/lib/components/views/FilterView/index.js +463 -0
  59. package/lib/components/views/FilterView/index.js.map +1 -0
  60. package/lib/components/views/ImportView/index.d.ts +5 -0
  61. package/lib/components/views/ImportView/index.d.ts.map +1 -0
  62. package/lib/components/views/ImportView/index.js +514 -0
  63. package/lib/components/views/ImportView/index.js.map +1 -0
  64. package/lib/components/views/ResolutionView/EditableJsonView.d.ts +21 -0
  65. package/lib/components/views/ResolutionView/EditableJsonView.d.ts.map +1 -0
  66. package/lib/components/views/ResolutionView/EditableJsonView.js +109 -0
  67. package/lib/components/views/ResolutionView/EditableJsonView.js.map +1 -0
  68. package/lib/components/views/ResolutionView/ResolutionEditControls.d.ts +19 -0
  69. package/lib/components/views/ResolutionView/ResolutionEditControls.d.ts.map +1 -0
  70. package/lib/components/views/ResolutionView/ResolutionEditControls.js +82 -0
  71. package/lib/components/views/ResolutionView/ResolutionEditControls.js.map +1 -0
  72. package/lib/components/views/ResolutionView/index.d.ts +5 -0
  73. package/lib/components/views/ResolutionView/index.d.ts.map +1 -0
  74. package/lib/components/views/ResolutionView/index.js +255 -0
  75. package/lib/components/views/ResolutionView/index.js.map +1 -0
  76. package/lib/components/views/SourceView/index.d.ts +5 -0
  77. package/lib/components/views/SourceView/index.d.ts.map +1 -0
  78. package/lib/components/views/SourceView/index.js +316 -0
  79. package/lib/components/views/SourceView/index.js.map +1 -0
  80. package/lib/components/views/ZipLoaderView/index.d.ts +5 -0
  81. package/lib/components/views/ZipLoaderView/index.d.ts.map +1 -0
  82. package/lib/components/views/ZipLoaderView/index.js +313 -0
  83. package/lib/components/views/ZipLoaderView/index.js.map +1 -0
  84. package/lib/hooks/useConfigurationState.d.ts +46 -0
  85. package/lib/hooks/useConfigurationState.d.ts.map +1 -0
  86. package/lib/hooks/useConfigurationState.js +239 -0
  87. package/lib/hooks/useConfigurationState.js.map +1 -0
  88. package/lib/hooks/useFilterState.d.ts +7 -0
  89. package/lib/hooks/useFilterState.d.ts.map +1 -0
  90. package/lib/hooks/useFilterState.js +80 -0
  91. package/lib/hooks/useFilterState.js.map +1 -0
  92. package/lib/hooks/useResolutionState.d.ts +8 -0
  93. package/lib/hooks/useResolutionState.d.ts.map +1 -0
  94. package/lib/hooks/useResolutionState.js +253 -0
  95. package/lib/hooks/useResolutionState.js.map +1 -0
  96. package/lib/hooks/useResourceData.d.ts +19 -0
  97. package/lib/hooks/useResourceData.d.ts.map +1 -0
  98. package/lib/hooks/useResourceData.js +368 -0
  99. package/lib/hooks/useResourceData.js.map +1 -0
  100. package/lib/hooks/useViewState.d.ts +10 -0
  101. package/lib/hooks/useViewState.d.ts.map +1 -0
  102. package/lib/hooks/useViewState.js +29 -0
  103. package/lib/hooks/useViewState.js.map +1 -0
  104. package/lib/index.d.ts +27 -0
  105. package/lib/index.d.ts.map +1 -0
  106. package/lib/index.js +34 -0
  107. package/lib/index.js.map +1 -0
  108. package/lib/test/helpers/testDataLoader.d.ts +37 -0
  109. package/lib/test/helpers/testDataLoader.d.ts.map +1 -0
  110. package/lib/test/helpers/testDataLoader.js +171 -0
  111. package/lib/test/helpers/testDataLoader.js.map +1 -0
  112. package/lib/test/unit/utils/configurationUtils.test.d.ts +2 -0
  113. package/lib/test/unit/utils/configurationUtils.test.d.ts.map +1 -0
  114. package/lib/test/unit/utils/configurationUtils.test.js +497 -0
  115. package/lib/test/unit/utils/configurationUtils.test.js.map +1 -0
  116. package/lib/test/unit/utils/fileProcessing.test.d.ts +2 -0
  117. package/lib/test/unit/utils/fileProcessing.test.d.ts.map +1 -0
  118. package/lib/test/unit/utils/fileProcessing.test.js +321 -0
  119. package/lib/test/unit/utils/fileProcessing.test.js.map +1 -0
  120. package/lib/test/unit/utils/filterResources.test.d.ts +2 -0
  121. package/lib/test/unit/utils/filterResources.test.d.ts.map +1 -0
  122. package/lib/test/unit/utils/filterResources.test.js +403 -0
  123. package/lib/test/unit/utils/filterResources.test.js.map +1 -0
  124. package/lib/test/unit/utils/resolutionEditing.test.d.ts +2 -0
  125. package/lib/test/unit/utils/resolutionEditing.test.d.ts.map +1 -0
  126. package/lib/test/unit/utils/resolutionEditing.test.js +439 -0
  127. package/lib/test/unit/utils/resolutionEditing.test.js.map +1 -0
  128. package/lib/test/unit/utils/resolutionUtils.test.d.ts +2 -0
  129. package/lib/test/unit/utils/resolutionUtils.test.d.ts.map +1 -0
  130. package/lib/test/unit/utils/resolutionUtils.test.js +397 -0
  131. package/lib/test/unit/utils/resolutionUtils.test.js.map +1 -0
  132. package/lib/test/unit/utils/tsResIntegration.test.d.ts +2 -0
  133. package/lib/test/unit/utils/tsResIntegration.test.d.ts.map +1 -0
  134. package/lib/test/unit/utils/tsResIntegration.test.js +376 -0
  135. package/lib/test/unit/utils/tsResIntegration.test.js.map +1 -0
  136. package/lib/types/index.d.ts +251 -0
  137. package/lib/types/index.d.ts.map +1 -0
  138. package/lib/types/index.js +2 -0
  139. package/lib/types/index.js.map +1 -0
  140. package/lib/utils/configurationUtils.d.ts +74 -0
  141. package/lib/utils/configurationUtils.d.ts.map +1 -0
  142. package/lib/utils/configurationUtils.js +359 -0
  143. package/lib/utils/configurationUtils.js.map +1 -0
  144. package/lib/utils/fileProcessing.d.ts +18 -0
  145. package/lib/utils/fileProcessing.d.ts.map +1 -0
  146. package/lib/utils/fileProcessing.js +142 -0
  147. package/lib/utils/fileProcessing.js.map +1 -0
  148. package/lib/utils/filterResources.d.ts +38 -0
  149. package/lib/utils/filterResources.d.ts.map +1 -0
  150. package/lib/utils/filterResources.js +153 -0
  151. package/lib/utils/filterResources.js.map +1 -0
  152. package/lib/utils/resolutionEditing.d.ts +58 -0
  153. package/lib/utils/resolutionEditing.d.ts.map +1 -0
  154. package/lib/utils/resolutionEditing.js +246 -0
  155. package/lib/utils/resolutionEditing.js.map +1 -0
  156. package/lib/utils/resolutionUtils.d.ts +28 -0
  157. package/lib/utils/resolutionUtils.d.ts.map +1 -0
  158. package/lib/utils/resolutionUtils.js +216 -0
  159. package/lib/utils/resolutionUtils.js.map +1 -0
  160. package/lib/utils/tsResIntegration.d.ts +71 -0
  161. package/lib/utils/tsResIntegration.d.ts.map +1 -0
  162. package/lib/utils/tsResIntegration.js +294 -0
  163. package/lib/utils/tsResIntegration.js.map +1 -0
  164. package/lib/utils/zipLoader/browserZipLoader.d.ts +48 -0
  165. package/lib/utils/zipLoader/browserZipLoader.d.ts.map +1 -0
  166. package/lib/utils/zipLoader/browserZipLoader.js +247 -0
  167. package/lib/utils/zipLoader/browserZipLoader.js.map +1 -0
  168. package/lib/utils/zipLoader/index.d.ts +8 -0
  169. package/lib/utils/zipLoader/index.d.ts.map +1 -0
  170. package/lib/utils/zipLoader/index.js +13 -0
  171. package/lib/utils/zipLoader/index.js.map +1 -0
  172. package/lib/utils/zipLoader/nodeZipBuilder.d.ts +55 -0
  173. package/lib/utils/zipLoader/nodeZipBuilder.d.ts.map +1 -0
  174. package/lib/utils/zipLoader/nodeZipBuilder.js +98 -0
  175. package/lib/utils/zipLoader/nodeZipBuilder.js.map +1 -0
  176. package/lib/utils/zipLoader/types.d.ts +139 -0
  177. package/lib/utils/zipLoader/types.d.ts.map +1 -0
  178. package/lib/utils/zipLoader/types.js +2 -0
  179. package/lib/utils/zipLoader/types.js.map +1 -0
  180. package/lib/utils/zipLoader/zipUtils.d.ts +53 -0
  181. package/lib/utils/zipLoader/zipUtils.d.ts.map +1 -0
  182. package/lib/utils/zipLoader/zipUtils.js +229 -0
  183. package/lib/utils/zipLoader/zipUtils.js.map +1 -0
  184. package/package.json +69 -0
  185. package/rush-logs/ts-res-ui-components.build.cache.log +3 -0
  186. package/rush-logs/ts-res-ui-components.build.log +9 -0
  187. package/src/components/common/QualifierContextControl.tsx +151 -0
  188. package/src/components/common/ResourceListView.tsx +63 -0
  189. package/src/components/common/ResourceTreeView.tsx +271 -0
  190. package/src/components/forms/HierarchyEditor.tsx +204 -0
  191. package/src/components/forms/QualifierEditForm.tsx +355 -0
  192. package/src/components/forms/QualifierTypeEditForm.tsx +347 -0
  193. package/src/components/forms/ResourceTypeEditForm.tsx +331 -0
  194. package/src/components/forms/index.ts +11 -0
  195. package/src/components/orchestrator/ResourceOrchestrator.tsx +372 -0
  196. package/src/components/views/CompiledView/index.tsx +922 -0
  197. package/src/components/views/ConfigurationView/index.tsx +800 -0
  198. package/src/components/views/FilterView/index.tsx +825 -0
  199. package/src/components/views/ImportView/index.tsx +717 -0
  200. package/src/components/views/ResolutionView/EditableJsonView.tsx +214 -0
  201. package/src/components/views/ResolutionView/ResolutionEditControls.tsx +170 -0
  202. package/src/components/views/ResolutionView/index.tsx +591 -0
  203. package/src/components/views/SourceView/index.tsx +536 -0
  204. package/src/components/views/ZipLoaderView/index.tsx +485 -0
  205. package/src/hooks/useConfigurationState.ts +374 -0
  206. package/src/hooks/useFilterState.ts +97 -0
  207. package/src/hooks/useResolutionState.ts +355 -0
  208. package/src/hooks/useResourceData.ts +467 -0
  209. package/src/hooks/useViewState.ts +44 -0
  210. package/src/index.ts +45 -0
  211. package/src/test/helpers/testDataLoader.ts +195 -0
  212. package/src/test/unit/utils/configurationUtils.test.ts +630 -0
  213. package/src/test/unit/utils/fileProcessing.test.ts +391 -0
  214. package/src/test/unit/utils/filterResources.test.ts +574 -0
  215. package/src/test/unit/utils/resolutionEditing.test.ts +556 -0
  216. package/src/test/unit/utils/resolutionUtils.test.ts +521 -0
  217. package/src/test/unit/utils/tsResIntegration.test.ts +433 -0
  218. package/src/types/index.ts +322 -0
  219. package/src/utils/configurationUtils.ts +424 -0
  220. package/src/utils/fileProcessing.ts +160 -0
  221. package/src/utils/filterResources.ts +206 -0
  222. package/src/utils/resolutionEditing.ts +319 -0
  223. package/src/utils/resolutionUtils.ts +289 -0
  224. package/src/utils/tsResIntegration.ts +440 -0
  225. package/src/utils/zipLoader/browserZipLoader.ts +319 -0
  226. package/src/utils/zipLoader/index.ts +26 -0
  227. package/src/utils/zipLoader/nodeZipBuilder.ts +153 -0
  228. package/src/utils/zipLoader/types.ts +175 -0
  229. package/src/utils/zipLoader/zipUtils.ts +266 -0
  230. package/temp/build/typescript/ts_gZid87Hu.json +1 -0
  231. package/tsconfig.json +15 -0
@@ -0,0 +1,278 @@
1
+ import React, { useCallback, useMemo, useState } from 'react';
2
+ import { useResourceData } from '../../hooks/useResourceData';
3
+ import { useFilterState } from '../../hooks/useFilterState';
4
+ import { useViewState } from '../../hooks/useViewState';
5
+ import { useResolutionState } from '../../hooks/useResolutionState';
6
+ import { createFilteredResourceManagerSimple, analyzeFilteredResources } from '../../utils/filterResources';
7
+ export const ResourceOrchestrator = ({ children, initialConfiguration, onStateChange }) => {
8
+ // Core hooks
9
+ const resourceData = useResourceData();
10
+ const filterState = useFilterState();
11
+ const viewState = useViewState();
12
+ // System update handler for resolution editing
13
+ const handleSystemUpdate = useCallback((updatedResources) => {
14
+ resourceData.actions.updateProcessedResources(updatedResources);
15
+ viewState.addMessage('success', 'Resource system updated with edits');
16
+ }, [resourceData.actions, viewState]);
17
+ const resolutionData = useResolutionState(resourceData.state.processedResources, viewState.addMessage, handleSystemUpdate);
18
+ // Local state for filter results
19
+ const [filterResult, setFilterResult] = useState(null);
20
+ // Track if filtering is in progress to prevent concurrent operations
21
+ const isFilteringInProgress = React.useRef(false);
22
+ // Initialize with configuration if provided
23
+ React.useEffect(() => {
24
+ if (initialConfiguration && !resourceData.state.activeConfiguration) {
25
+ resourceData.actions.applyConfiguration(initialConfiguration);
26
+ }
27
+ }, [initialConfiguration, resourceData.state.activeConfiguration, resourceData.actions]);
28
+ // Notify parent of state changes
29
+ React.useEffect(() => {
30
+ if (onStateChange) {
31
+ onStateChange({
32
+ resources: resourceData.state.processedResources,
33
+ configuration: resourceData.state.activeConfiguration,
34
+ filterState: filterState.state,
35
+ filterResult,
36
+ selectedResourceId: viewState.selectedResourceId,
37
+ isProcessing: resourceData.state.isProcessing,
38
+ error: resourceData.state.error,
39
+ messages: viewState.messages
40
+ });
41
+ }
42
+ }, [
43
+ resourceData.state,
44
+ filterState.state,
45
+ filterResult,
46
+ viewState.selectedResourceId,
47
+ viewState.messages,
48
+ onStateChange
49
+ ]);
50
+ // Internal filtering logic (used by both manual and automatic application)
51
+ const performFiltering = useCallback(async (filterValues) => {
52
+ // Prevent concurrent filtering operations
53
+ if (isFilteringInProgress.current) {
54
+ console.log('Filtering already in progress, skipping...');
55
+ return null;
56
+ }
57
+ if (!resourceData.state.processedResources || !filterState.state.enabled) {
58
+ setFilterResult(null);
59
+ return null;
60
+ }
61
+ // Check if we have any filter values to work with
62
+ const hasFilterValues = Object.values(filterValues).some((value) => value !== undefined && value !== '');
63
+ if (!hasFilterValues) {
64
+ setFilterResult(null);
65
+ return null;
66
+ }
67
+ isFilteringInProgress.current = true;
68
+ try {
69
+ const { system } = resourceData.state.processedResources;
70
+ viewState.addMessage('info', 'Starting filtering process...');
71
+ console.log('Filtering with values:', filterValues);
72
+ console.log('Filter state:', filterState.state);
73
+ // Try the simplified filtering approach using provided values
74
+ let filteredResult = await createFilteredResourceManagerSimple(system, filterValues, {
75
+ partialContextMatch: true,
76
+ enableDebugLogging: true, // Enable debug logging to see what's happening
77
+ reduceQualifiers: filterState.state.reduceQualifiers
78
+ });
79
+ if (filteredResult.isFailure()) {
80
+ const result = {
81
+ success: false,
82
+ error: `Filtering failed: ${filteredResult.message}`
83
+ };
84
+ setFilterResult(result);
85
+ viewState.addMessage('error', `Filtering failed: ${filteredResult.message}`);
86
+ return result;
87
+ }
88
+ // Analyze filtered resources compared to original
89
+ const originalResources = resourceData.state.processedResources.summary.resourceIds || [];
90
+ console.log('Original resources count:', originalResources.length);
91
+ const analysis = analyzeFilteredResources(originalResources, filteredResult.value, resourceData.state.processedResources);
92
+ console.log('Analysis result:', {
93
+ success: analysis.success,
94
+ filteredResourcesCount: analysis.filteredResources.length,
95
+ warningsCount: analysis.warnings.length,
96
+ hasProcessedResources: !!analysis.processedResources
97
+ });
98
+ console.log('Filtered resources breakdown:', analysis.filteredResources.map((r) => ({
99
+ id: r.id,
100
+ originalCandidates: r.originalCandidateCount,
101
+ filteredCandidates: r.filteredCandidateCount,
102
+ reduction: r.originalCandidateCount - r.filteredCandidateCount,
103
+ hasWarning: r.hasWarning
104
+ })));
105
+ const result = {
106
+ success: true,
107
+ processedResources: analysis.processedResources,
108
+ filteredResources: analysis.filteredResources,
109
+ warnings: analysis.warnings
110
+ };
111
+ console.log('Setting filter result:', result);
112
+ setFilterResult(result);
113
+ if (analysis.warnings.length > 0) {
114
+ viewState.addMessage('warning', `Filtering completed with ${analysis.warnings.length} warning(s)`);
115
+ }
116
+ else {
117
+ viewState.addMessage('success', `Filtering completed: ${analysis.filteredResources.length} resources`);
118
+ }
119
+ return result;
120
+ }
121
+ catch (error) {
122
+ const errorMessage = error instanceof Error ? error.message : String(error);
123
+ const result = {
124
+ success: false,
125
+ error: errorMessage
126
+ };
127
+ setFilterResult(result);
128
+ viewState.addMessage('error', `Filtering error: ${errorMessage}`);
129
+ return result;
130
+ }
131
+ finally {
132
+ isFilteringInProgress.current = false;
133
+ }
134
+ }, [resourceData.state.processedResources, filterState.state, viewState]);
135
+ // Manual apply filter action (for the Apply button)
136
+ const applyFilter = useCallback(async () => {
137
+ // Capture the current values before applying them
138
+ const currentValues = { ...filterState.state.values };
139
+ // First apply the pending values to make them the applied values
140
+ filterState.actions.applyFilterValues();
141
+ // Then perform filtering with the captured values
142
+ const result = await performFiltering(currentValues);
143
+ return result;
144
+ }, [performFiltering, filterState.actions]);
145
+ // Reset filter action
146
+ const resetFilter = useCallback(() => {
147
+ setFilterResult(null);
148
+ filterState.actions.resetFilterValues();
149
+ viewState.addMessage('info', 'Filter reset');
150
+ }, [filterState.actions, viewState]);
151
+ // Automatically apply filter when applied filter values change
152
+ // TEMPORARILY DISABLED to fix responsiveness issue
153
+ // React.useEffect(() => {
154
+ // if (!resourceData.state.processedResources || !filterState.state.enabled) {
155
+ // setFilterResult(null);
156
+ // return;
157
+ // }
158
+ // const hasAppliedFilterValues = hasFilterValues(filterState.state.appliedValues);
159
+ // if (!hasAppliedFilterValues) {
160
+ // setFilterResult(null);
161
+ // return;
162
+ // }
163
+ // // Apply filter automatically when appliedValues change using the applied values
164
+ // performFiltering(filterState.state.appliedValues);
165
+ // }, [
166
+ // filterState.state.appliedValues,
167
+ // filterState.state.enabled,
168
+ // resourceData.state.processedResources,
169
+ // performFiltering
170
+ // ]);
171
+ // Combined state
172
+ const state = useMemo(() => ({
173
+ resources: resourceData.state.processedResources,
174
+ configuration: resourceData.state.activeConfiguration,
175
+ filterState: filterState.state,
176
+ filterResult,
177
+ resolutionState: resolutionData.state,
178
+ selectedResourceId: viewState.selectedResourceId,
179
+ isProcessing: resourceData.state.isProcessing,
180
+ error: resourceData.state.error,
181
+ messages: viewState.messages
182
+ }), [
183
+ resourceData.state,
184
+ filterState.state,
185
+ filterResult,
186
+ resolutionData.state,
187
+ viewState.selectedResourceId,
188
+ viewState.messages
189
+ ]);
190
+ // Combined actions
191
+ const actions = useMemo(() => ({
192
+ // Resource management
193
+ importDirectory: async (directory) => {
194
+ viewState.addMessage('info', 'Importing directory...');
195
+ await resourceData.actions.processDirectory(directory);
196
+ if (!resourceData.state.error) {
197
+ viewState.addMessage('success', 'Directory imported successfully');
198
+ }
199
+ else {
200
+ viewState.addMessage('error', resourceData.state.error);
201
+ }
202
+ },
203
+ importDirectoryWithConfig: async (directory, config) => {
204
+ viewState.addMessage('info', 'Importing directory with configuration...');
205
+ await resourceData.actions.processDirectoryWithConfig(directory, config);
206
+ if (!resourceData.state.error) {
207
+ viewState.addMessage('success', 'Directory imported successfully');
208
+ }
209
+ else {
210
+ viewState.addMessage('error', resourceData.state.error);
211
+ }
212
+ },
213
+ importFiles: async (files) => {
214
+ viewState.addMessage('info', 'Importing files...');
215
+ await resourceData.actions.processFiles(files);
216
+ if (!resourceData.state.error) {
217
+ viewState.addMessage('success', 'Files imported successfully');
218
+ }
219
+ },
220
+ importBundle: async (bundle) => {
221
+ viewState.addMessage('info', 'Importing bundle...');
222
+ await resourceData.actions.processBundleFile(bundle);
223
+ if (!resourceData.state.error) {
224
+ viewState.addMessage('success', 'Bundle imported successfully');
225
+ }
226
+ },
227
+ clearResources: () => {
228
+ resourceData.actions.reset();
229
+ setFilterResult(null);
230
+ viewState.addMessage('info', 'Resources cleared');
231
+ },
232
+ // Configuration management
233
+ updateConfiguration: (config) => {
234
+ resourceData.actions.applyConfiguration(config);
235
+ viewState.addMessage('info', 'Configuration updated');
236
+ },
237
+ applyConfiguration: (config) => {
238
+ resourceData.actions.applyConfiguration(config);
239
+ viewState.addMessage('success', 'Configuration applied');
240
+ },
241
+ // Filter management
242
+ updateFilterState: (updates) => {
243
+ if (updates.enabled !== undefined) {
244
+ filterState.actions.updateFilterEnabled(updates.enabled);
245
+ }
246
+ if (updates.values !== undefined) {
247
+ filterState.actions.updateFilterValues(updates.values);
248
+ }
249
+ if (updates.reduceQualifiers !== undefined) {
250
+ filterState.actions.updateReduceQualifiers(updates.reduceQualifiers);
251
+ }
252
+ },
253
+ applyFilter,
254
+ resetFilter,
255
+ // Resolution management
256
+ updateResolutionContext: resolutionData.actions.updateContextValue,
257
+ applyResolutionContext: resolutionData.actions.applyContext,
258
+ selectResourceForResolution: resolutionData.actions.selectResource,
259
+ setResolutionViewMode: resolutionData.actions.setViewMode,
260
+ resetResolutionCache: resolutionData.actions.resetCache,
261
+ // Resolution editing actions
262
+ saveResourceEdit: resolutionData.actions.saveEdit,
263
+ getEditedValue: resolutionData.actions.getEditedValue,
264
+ hasResourceEdit: resolutionData.actions.hasEdit,
265
+ clearResourceEdits: resolutionData.actions.clearEdits,
266
+ applyResourceEdits: resolutionData.actions.applyEdits,
267
+ discardResourceEdits: resolutionData.actions.discardEdits,
268
+ // UI state management
269
+ selectResource: viewState.selectResource,
270
+ addMessage: viewState.addMessage,
271
+ clearMessages: viewState.clearMessages,
272
+ // Resource resolution
273
+ resolveResource: resourceData.actions.resolveResource
274
+ }), [resourceData.actions, filterState.actions, resolutionData.actions, viewState, applyFilter, resetFilter]);
275
+ return React.createElement(React.Fragment, null, children({ state, actions }));
276
+ };
277
+ export default ResourceOrchestrator;
278
+ //# sourceMappingURL=ResourceOrchestrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceOrchestrator.js","sourceRoot":"","sources":["../../../src/components/orchestrator/ResourceOrchestrator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAazE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,CAAC,CAAI,CAAC;AAC7C,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import React, { ReactNode, useCallback, useMemo, useState } from 'react';\nimport { Result } from '@fgv/ts-utils';\nimport { Config, Bundle } from '@fgv/ts-res';\nimport {\n OrchestratorState,\n OrchestratorActions,\n ImportedDirectory,\n ImportedFile,\n ProcessedResources,\n FilterState,\n FilterResult,\n Message\n} from '../../types';\nimport { useResourceData } from '../../hooks/useResourceData';\nimport { useFilterState } from '../../hooks/useFilterState';\nimport { useViewState } from '../../hooks/useViewState';\nimport { useResolutionState } from '../../hooks/useResolutionState';\nimport { createSimpleContext } from '../../utils/tsResIntegration';\nimport {\n createFilteredResourceManagerSimple,\n analyzeFilteredResources,\n hasFilterValues,\n FilterResult as FilterUtilResult\n} from '../../utils/filterResources';\nimport { Runtime } from '@fgv/ts-res';\n\nexport interface ResourceOrchestratorProps {\n children: (orchestrator: { state: OrchestratorState; actions: OrchestratorActions }) => ReactNode;\n initialConfiguration?: Config.Model.ISystemConfiguration;\n onStateChange?: (state: Partial<OrchestratorState>) => void;\n}\n\nexport const ResourceOrchestrator: React.FC<ResourceOrchestratorProps> = ({\n children,\n initialConfiguration,\n onStateChange\n}) => {\n // Core hooks\n const resourceData = useResourceData();\n const filterState = useFilterState();\n const viewState = useViewState();\n // System update handler for resolution editing\n const handleSystemUpdate = useCallback(\n (updatedResources: ProcessedResources) => {\n resourceData.actions.updateProcessedResources(updatedResources);\n viewState.addMessage('success', 'Resource system updated with edits');\n },\n [resourceData.actions, viewState]\n );\n\n const resolutionData = useResolutionState(\n resourceData.state.processedResources,\n viewState.addMessage,\n handleSystemUpdate\n );\n\n // Local state for filter results\n const [filterResult, setFilterResult] = useState<FilterResult | null>(null);\n\n // Track if filtering is in progress to prevent concurrent operations\n const isFilteringInProgress = React.useRef(false);\n\n // Initialize with configuration if provided\n React.useEffect(() => {\n if (initialConfiguration && !resourceData.state.activeConfiguration) {\n resourceData.actions.applyConfiguration(initialConfiguration);\n }\n }, [initialConfiguration, resourceData.state.activeConfiguration, resourceData.actions]);\n\n // Notify parent of state changes\n React.useEffect(() => {\n if (onStateChange) {\n onStateChange({\n resources: resourceData.state.processedResources,\n configuration: resourceData.state.activeConfiguration,\n filterState: filterState.state,\n filterResult,\n selectedResourceId: viewState.selectedResourceId,\n isProcessing: resourceData.state.isProcessing,\n error: resourceData.state.error,\n messages: viewState.messages\n });\n }\n }, [\n resourceData.state,\n filterState.state,\n filterResult,\n viewState.selectedResourceId,\n viewState.messages,\n onStateChange\n ]);\n\n // Internal filtering logic (used by both manual and automatic application)\n const performFiltering = useCallback(\n async (filterValues: Record<string, string | undefined>): Promise<FilterResult | null> => {\n // Prevent concurrent filtering operations\n if (isFilteringInProgress.current) {\n console.log('Filtering already in progress, skipping...');\n return null;\n }\n\n if (!resourceData.state.processedResources || !filterState.state.enabled) {\n setFilterResult(null);\n return null;\n }\n\n // Check if we have any filter values to work with\n const hasFilterValues = Object.values(filterValues).some(\n (value) => value !== undefined && value !== ''\n );\n if (!hasFilterValues) {\n setFilterResult(null);\n return null;\n }\n\n isFilteringInProgress.current = true;\n\n try {\n const { system } = resourceData.state.processedResources;\n\n viewState.addMessage('info', 'Starting filtering process...');\n console.log('Filtering with values:', filterValues);\n console.log('Filter state:', filterState.state);\n\n // Try the simplified filtering approach using provided values\n let filteredResult = await createFilteredResourceManagerSimple(system, filterValues, {\n partialContextMatch: true,\n enableDebugLogging: true, // Enable debug logging to see what's happening\n reduceQualifiers: filterState.state.reduceQualifiers\n });\n\n if (filteredResult.isFailure()) {\n const result: FilterResult = {\n success: false,\n error: `Filtering failed: ${filteredResult.message}`\n };\n setFilterResult(result);\n viewState.addMessage('error', `Filtering failed: ${filteredResult.message}`);\n return result;\n }\n\n // Analyze filtered resources compared to original\n const originalResources = resourceData.state.processedResources.summary.resourceIds || [];\n console.log('Original resources count:', originalResources.length);\n\n const analysis = analyzeFilteredResources(\n originalResources,\n filteredResult.value,\n resourceData.state.processedResources\n );\n\n console.log('Analysis result:', {\n success: analysis.success,\n filteredResourcesCount: analysis.filteredResources.length,\n warningsCount: analysis.warnings.length,\n hasProcessedResources: !!analysis.processedResources\n });\n\n console.log(\n 'Filtered resources breakdown:',\n analysis.filteredResources.map((r) => ({\n id: r.id,\n originalCandidates: r.originalCandidateCount,\n filteredCandidates: r.filteredCandidateCount,\n reduction: r.originalCandidateCount - r.filteredCandidateCount,\n hasWarning: r.hasWarning\n }))\n );\n\n const result: FilterResult = {\n success: true,\n processedResources: analysis.processedResources,\n filteredResources: analysis.filteredResources,\n warnings: analysis.warnings\n };\n\n console.log('Setting filter result:', result);\n setFilterResult(result);\n\n if (analysis.warnings.length > 0) {\n viewState.addMessage('warning', `Filtering completed with ${analysis.warnings.length} warning(s)`);\n } else {\n viewState.addMessage(\n 'success',\n `Filtering completed: ${analysis.filteredResources.length} resources`\n );\n }\n\n return result;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n const result: FilterResult = {\n success: false,\n error: errorMessage\n };\n setFilterResult(result);\n viewState.addMessage('error', `Filtering error: ${errorMessage}`);\n return result;\n } finally {\n isFilteringInProgress.current = false;\n }\n },\n [resourceData.state.processedResources, filterState.state, viewState]\n );\n\n // Manual apply filter action (for the Apply button)\n const applyFilter = useCallback(async (): Promise<FilterResult | null> => {\n // Capture the current values before applying them\n const currentValues = { ...filterState.state.values };\n\n // First apply the pending values to make them the applied values\n filterState.actions.applyFilterValues();\n\n // Then perform filtering with the captured values\n const result = await performFiltering(currentValues);\n\n return result;\n }, [performFiltering, filterState.actions]);\n\n // Reset filter action\n const resetFilter = useCallback(() => {\n setFilterResult(null);\n filterState.actions.resetFilterValues();\n viewState.addMessage('info', 'Filter reset');\n }, [filterState.actions, viewState]);\n\n // Automatically apply filter when applied filter values change\n // TEMPORARILY DISABLED to fix responsiveness issue\n // React.useEffect(() => {\n // if (!resourceData.state.processedResources || !filterState.state.enabled) {\n // setFilterResult(null);\n // return;\n // }\n\n // const hasAppliedFilterValues = hasFilterValues(filterState.state.appliedValues);\n // if (!hasAppliedFilterValues) {\n // setFilterResult(null);\n // return;\n // }\n\n // // Apply filter automatically when appliedValues change using the applied values\n // performFiltering(filterState.state.appliedValues);\n // }, [\n // filterState.state.appliedValues,\n // filterState.state.enabled,\n // resourceData.state.processedResources,\n // performFiltering\n // ]);\n\n // Combined state\n const state: OrchestratorState = useMemo(\n () => ({\n resources: resourceData.state.processedResources,\n configuration: resourceData.state.activeConfiguration,\n filterState: filterState.state,\n filterResult,\n resolutionState: resolutionData.state,\n selectedResourceId: viewState.selectedResourceId,\n isProcessing: resourceData.state.isProcessing,\n error: resourceData.state.error,\n messages: viewState.messages\n }),\n [\n resourceData.state,\n filterState.state,\n filterResult,\n resolutionData.state,\n viewState.selectedResourceId,\n viewState.messages\n ]\n );\n\n // Combined actions\n const actions: OrchestratorActions = useMemo(\n () => ({\n // Resource management\n importDirectory: async (directory: ImportedDirectory) => {\n viewState.addMessage('info', 'Importing directory...');\n await resourceData.actions.processDirectory(directory);\n if (!resourceData.state.error) {\n viewState.addMessage('success', 'Directory imported successfully');\n } else {\n viewState.addMessage('error', resourceData.state.error);\n }\n },\n importDirectoryWithConfig: async (\n directory: ImportedDirectory,\n config: Config.Model.ISystemConfiguration\n ) => {\n viewState.addMessage('info', 'Importing directory with configuration...');\n await resourceData.actions.processDirectoryWithConfig(directory, config);\n if (!resourceData.state.error) {\n viewState.addMessage('success', 'Directory imported successfully');\n } else {\n viewState.addMessage('error', resourceData.state.error);\n }\n },\n importFiles: async (files: ImportedFile[]) => {\n viewState.addMessage('info', 'Importing files...');\n await resourceData.actions.processFiles(files);\n if (!resourceData.state.error) {\n viewState.addMessage('success', 'Files imported successfully');\n }\n },\n importBundle: async (bundle: Bundle.IBundle) => {\n viewState.addMessage('info', 'Importing bundle...');\n await resourceData.actions.processBundleFile(bundle);\n if (!resourceData.state.error) {\n viewState.addMessage('success', 'Bundle imported successfully');\n }\n },\n clearResources: () => {\n resourceData.actions.reset();\n setFilterResult(null);\n viewState.addMessage('info', 'Resources cleared');\n },\n\n // Configuration management\n updateConfiguration: (config: Config.Model.ISystemConfiguration) => {\n resourceData.actions.applyConfiguration(config);\n viewState.addMessage('info', 'Configuration updated');\n },\n applyConfiguration: (config: Config.Model.ISystemConfiguration) => {\n resourceData.actions.applyConfiguration(config);\n viewState.addMessage('success', 'Configuration applied');\n },\n\n // Filter management\n updateFilterState: (updates: Partial<FilterState>) => {\n if (updates.enabled !== undefined) {\n filterState.actions.updateFilterEnabled(updates.enabled);\n }\n if (updates.values !== undefined) {\n filterState.actions.updateFilterValues(updates.values);\n }\n if (updates.reduceQualifiers !== undefined) {\n filterState.actions.updateReduceQualifiers(updates.reduceQualifiers);\n }\n },\n applyFilter,\n resetFilter,\n\n // Resolution management\n updateResolutionContext: resolutionData.actions.updateContextValue,\n applyResolutionContext: resolutionData.actions.applyContext,\n selectResourceForResolution: resolutionData.actions.selectResource,\n setResolutionViewMode: resolutionData.actions.setViewMode,\n resetResolutionCache: resolutionData.actions.resetCache,\n\n // Resolution editing actions\n saveResourceEdit: resolutionData.actions.saveEdit,\n getEditedValue: resolutionData.actions.getEditedValue,\n hasResourceEdit: resolutionData.actions.hasEdit,\n clearResourceEdits: resolutionData.actions.clearEdits,\n applyResourceEdits: resolutionData.actions.applyEdits,\n discardResourceEdits: resolutionData.actions.discardEdits,\n\n // UI state management\n selectResource: viewState.selectResource,\n addMessage: viewState.addMessage,\n clearMessages: viewState.clearMessages,\n\n // Resource resolution\n resolveResource: resourceData.actions.resolveResource\n }),\n [resourceData.actions, filterState.actions, resolutionData.actions, viewState, applyFilter, resetFilter]\n );\n\n return <>{children({ state, actions })}</>;\n};\n\nexport default ResourceOrchestrator;\n"]}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { CompiledViewProps } from '../../../types';
3
+ export declare const CompiledView: React.FC<CompiledViewProps>;
4
+ export default CompiledView;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/views/CompiledView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAazE,OAAO,EAAE,iBAAiB,EAAiD,MAAM,gBAAgB,CAAC;AAWlG,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA8bpD,CAAC;AAmcF,eAAe,YAAY,CAAC"}