@fgv/ts-res-ui-components 5.0.0-24 → 5.0.0-26
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/README.md +314 -102
- package/dist/ts-res-ui-components.d.ts +6670 -0
- package/eslint.config.js +18 -0
- package/lib/components/common/QualifierContextControl.d.ts +5 -5
- package/lib/components/common/ResolutionContextOptionsControl.d.ts +6 -6
- package/lib/components/common/ResolutionContextOptionsControl.js +1 -1
- package/lib/components/common/ResolutionResults/index.d.ts +34 -37
- package/lib/components/common/ResolutionResults/index.js +36 -54
- package/lib/components/common/ResourceListView.d.ts +2 -2
- package/lib/components/common/ResourcePickerOptionsControl.d.ts +5 -5
- package/lib/components/common/ResourceTreeView.d.ts +2 -2
- package/lib/components/common/SourceResourceDetail/index.d.ts +5 -8
- package/lib/components/common/SourceResourceDetail/index.js +19 -18
- package/lib/components/forms/GenericQualifierTypeEditForm.d.ts +2 -2
- package/lib/components/forms/GenericQualifierTypeEditForm.js +63 -29
- package/lib/components/forms/HierarchyEditor.d.ts +2 -2
- package/lib/components/forms/QualifierEditForm.d.ts +4 -2
- package/lib/components/forms/QualifierEditForm.js +98 -21
- package/lib/components/forms/QualifierTypeEditForm.d.ts +2 -2
- package/lib/components/forms/QualifierTypeEditForm.js +122 -29
- package/lib/components/forms/ResourceTypeEditForm.d.ts +3 -3
- package/lib/components/forms/ResourceTypeEditForm.js +90 -55
- package/lib/components/forms/index.d.ts +5 -5
- package/lib/components/orchestrator/ResourceOrchestrator.d.ts +6 -6
- package/lib/components/orchestrator/ResourceOrchestrator.js +61 -40
- package/lib/components/pickers/ResourcePicker/ResourceItem.d.ts +2 -2
- package/lib/components/pickers/ResourcePicker/ResourceItem.js +1 -0
- package/lib/components/pickers/ResourcePicker/ResourcePickerList.d.ts +3 -3
- package/lib/components/pickers/ResourcePicker/ResourcePickerTree.d.ts +3 -3
- package/lib/components/pickers/ResourcePicker/ResourcePickerTree.js +36 -44
- package/lib/components/pickers/ResourcePicker/index.d.ts +3 -3
- package/lib/components/pickers/ResourcePicker/index.js +5 -3
- package/lib/components/pickers/ResourcePicker/types.d.ts +30 -30
- package/lib/components/pickers/ResourcePicker/utils/treeNavigation.d.ts +4 -4
- package/lib/components/views/CompiledView/index.d.ts +36 -3
- package/lib/components/views/CompiledView/index.js +318 -329
- package/lib/components/views/ConfigurationView/index.d.ts +2 -3
- package/lib/components/views/ConfigurationView/index.js +193 -189
- package/lib/components/views/FilterView/index.d.ts +2 -3
- package/lib/components/views/FilterView/index.js +15 -81
- package/lib/components/views/GridView/EditableGridCell.d.ts +8 -14
- package/lib/components/views/GridView/EditableGridCell.js +39 -14
- package/lib/components/views/GridView/GridSelector.d.ts +4 -4
- package/lib/components/views/GridView/MultiGridView.d.ts +2 -2
- package/lib/components/views/GridView/MultiGridView.js +8 -8
- package/lib/components/views/GridView/ResourceGrid.d.ts +7 -9
- package/lib/components/views/GridView/ResourceGrid.js +14 -7
- package/lib/components/views/GridView/SharedContextControls.d.ts +7 -7
- package/lib/components/views/GridView/cells/BooleanCell.d.ts +4 -4
- package/lib/components/views/GridView/cells/DropdownCell.d.ts +4 -4
- package/lib/components/views/GridView/cells/StringCell.d.ts +4 -4
- package/lib/components/views/GridView/cells/TriStateCell.d.ts +4 -4
- package/lib/components/views/GridView/cells/index.d.ts +4 -4
- package/lib/components/views/GridView/index.d.ts +2 -2
- package/lib/components/views/GridView/index.js +6 -5
- package/lib/components/views/ImportView/index.d.ts +2 -3
- package/lib/components/views/ImportView/index.js +52 -39
- package/lib/components/views/MessagesWindow/index.d.ts +19 -31
- package/lib/components/views/MessagesWindow/index.js +20 -32
- package/lib/components/views/ResolutionView/EditableJsonView.d.ts +6 -5
- package/lib/components/views/ResolutionView/NewResourceModal.d.ts +2 -2
- package/lib/components/views/ResolutionView/UnifiedChangeControls.d.ts +2 -2
- package/lib/components/views/ResolutionView/index.d.ts +2 -3
- package/lib/components/views/ResolutionView/index.js +13 -11
- package/lib/components/views/SourceView/index.d.ts +2 -3
- package/lib/components/views/SourceView/index.js +15 -14
- package/lib/contexts/ObservabilityContext.d.ts +2 -2
- package/lib/contexts/index.d.ts +1 -1
- package/lib/hooks/useConfigurationState.d.ts +16 -16
- package/lib/hooks/useConfigurationState.js +11 -11
- package/lib/hooks/useFilterState.d.ts +5 -5
- package/lib/hooks/useResolutionState.d.ts +5 -7
- package/lib/hooks/useResolutionState.js +131 -145
- package/lib/hooks/useResourceData.d.ts +9 -9
- package/lib/hooks/useResourceData.js +21 -4
- package/lib/hooks/useSmartObservability.d.ts +61 -0
- package/lib/hooks/useSmartObservability.js +159 -0
- package/lib/hooks/useViewState.d.ts +10 -10
- package/lib/hooks/useViewState.js +8 -8
- package/lib/index.d.ts +3 -4
- package/lib/index.js +1 -3
- package/lib/namespaces/ConfigurationTools.d.ts +2 -3
- package/lib/namespaces/ConfigurationTools.js +1 -2
- package/lib/namespaces/DownloadTools.d.ts +3 -0
- package/lib/namespaces/DownloadTools.js +3 -0
- package/lib/namespaces/FilterTools.d.ts +2 -3
- package/lib/namespaces/FilterTools.js +0 -1
- package/lib/namespaces/GridTools.d.ts +1 -1
- package/lib/namespaces/ImportTools.d.ts +1 -2
- package/lib/namespaces/ImportTools.js +0 -1
- package/lib/namespaces/ObservabilityTools.d.ts +2 -1
- package/lib/namespaces/ObservabilityTools.js +1 -1
- package/lib/namespaces/PickerTools.d.ts +2 -2
- package/lib/namespaces/ResolutionTools.d.ts +4 -5
- package/lib/namespaces/ResolutionTools.js +0 -1
- package/lib/namespaces/ResourceTools.d.ts +1 -1
- package/lib/namespaces/TsResTools.d.ts +1 -3
- package/lib/namespaces/TsResTools.js +0 -2
- package/lib/namespaces/ViewStateTools.d.ts +17 -21
- package/lib/namespaces/ViewStateTools.js +15 -19
- package/lib/namespaces/ZipTools.d.ts +1 -2
- package/lib/namespaces/ZipTools.js +0 -1
- package/lib/namespaces/index.d.ts +13 -11
- package/lib/namespaces/index.js +13 -11
- package/lib/types/index.d.ts +181 -164
- package/lib/utils/cellValidation.d.ts +5 -24
- package/lib/utils/cellValidation.js +12 -12
- package/lib/utils/configurationUtils.d.ts +8 -8
- package/lib/utils/configurationUtils.js +2 -2
- package/lib/utils/downloadHelper.d.ts +54 -60
- package/lib/utils/downloadHelper.js +165 -180
- package/lib/utils/fileProcessing.d.ts +5 -5
- package/lib/utils/fileProcessing.js +5 -1
- package/lib/utils/filterResources.d.ts +4 -4
- package/lib/utils/observability/factories.d.ts +12 -0
- package/lib/utils/observability/factories.js +16 -1
- package/lib/utils/observability/implementations.d.ts +57 -0
- package/lib/utils/observability/implementations.js +101 -0
- package/lib/utils/observability/index.d.ts +3 -2
- package/lib/utils/observability/index.js +3 -3
- package/lib/utils/resolutionEditing.d.ts +9 -9
- package/lib/utils/resolutionEditing.js +1 -1
- package/lib/utils/resolutionUtils.d.ts +9 -9
- package/lib/utils/resolutionUtils.js +3 -3
- package/lib/utils/resourceSelector.d.ts +12 -12
- package/lib/utils/resourceSelector.js +137 -118
- package/lib/utils/tsResIntegration.d.ts +23 -4
- package/lib/utils/tsResIntegration.js +12 -14
- package/lib/utils/zipLoader/zipProcessingHelpers.d.ts +5 -5
- package/lib/utils/zipLoader/zipProcessingHelpers.js +2 -2
- package/package.json +13 -13
- package/tsconfig.tsbuildinfo +1 -0
- package/config/api-extractor.json +0 -89
- package/config/jest.setup.js +0 -77
- package/config/rig.json +0 -16
package/README.md
CHANGED
|
@@ -50,11 +50,14 @@ This library requires the following peer dependencies:
|
|
|
50
50
|
|
|
51
51
|
```tsx
|
|
52
52
|
import React from 'react';
|
|
53
|
-
import { ResourceOrchestrator, ObservabilityProvider } from '@fgv/ts-res-ui-components';
|
|
53
|
+
import { ResourceOrchestrator, ObservabilityProvider, ObservabilityTools } from '@fgv/ts-res-ui-components';
|
|
54
54
|
|
|
55
55
|
function App() {
|
|
56
|
+
// Set up observability context for development
|
|
57
|
+
const observabilityContext = ObservabilityTools.createConsoleObservabilityContext('info', 'info');
|
|
58
|
+
|
|
56
59
|
return (
|
|
57
|
-
<ObservabilityProvider>
|
|
60
|
+
<ObservabilityProvider observabilityContext={observabilityContext}>
|
|
58
61
|
<ResourceOrchestrator />
|
|
59
62
|
</ObservabilityProvider>
|
|
60
63
|
);
|
|
@@ -85,12 +88,215 @@ The library is organized into specialized namespaces, each containing related co
|
|
|
85
88
|
- **ObservabilityTools**: Logging and debugging infrastructure
|
|
86
89
|
|
|
87
90
|
### Built-in Observability
|
|
88
|
-
All operations include comprehensive logging for debugging and user feedback:
|
|
91
|
+
All operations include comprehensive logging for debugging and user feedback through the enhanced observability context system:
|
|
92
|
+
|
|
93
|
+
- **Smart Observability**: `useSmartObservability()` hook automatically detects and connects to observability contexts
|
|
94
|
+
- **Unified Logging**: `o11y.user.*` for user-facing messages, `o11y.diag.*` for diagnostic information
|
|
95
|
+
- **ViewState Integration**: Automatic connection to ViewState message system when available
|
|
96
|
+
- **No Breaking Changes**: Components work with or without observability context
|
|
97
|
+
- **Configurable Contexts**: Console output for development, silent for production, or custom loggers
|
|
98
|
+
|
|
99
|
+
#### Quick Observability Reference
|
|
100
|
+
|
|
101
|
+
**For Component Developers:**
|
|
102
|
+
```tsx
|
|
103
|
+
// Add observability to any component
|
|
104
|
+
import { useSmartObservability } from '@fgv/ts-res-ui-components';
|
|
105
|
+
|
|
106
|
+
function MyComponent() {
|
|
107
|
+
const o11y = useSmartObservability();
|
|
108
|
+
o11y.user.info('User message'); // Shows in UI
|
|
109
|
+
o11y.diag.info('Debug message'); // Shows in console/logs
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**For Host Applications:**
|
|
114
|
+
```tsx
|
|
115
|
+
// Provide observability context
|
|
116
|
+
import { ObservabilityProvider, ObservabilityTools } from '@fgv/ts-res-ui-components';
|
|
117
|
+
|
|
118
|
+
<ObservabilityProvider observabilityContext={myContext}>
|
|
119
|
+
<MyComponents />
|
|
120
|
+
</ObservabilityProvider>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### Quick Observability Setup
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import { ObservabilityProvider, ObservabilityTools } from '@fgv/ts-res-ui-components';
|
|
127
|
+
|
|
128
|
+
// Development: Console logging
|
|
129
|
+
const devContext = ObservabilityTools.createConsoleObservabilityContext('debug', 'info');
|
|
130
|
+
|
|
131
|
+
// Production: Silent operation
|
|
132
|
+
const prodContext = ObservabilityTools.createNoOpObservabilityContext();
|
|
133
|
+
|
|
134
|
+
// With ViewState integration (recommended)
|
|
135
|
+
function App() {
|
|
136
|
+
const { viewState } = useViewState();
|
|
137
|
+
const observabilityContext = ObservabilityTools.createViewStateObservabilityContext(
|
|
138
|
+
viewState.addMessage
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<ObservabilityProvider observabilityContext={observabilityContext}>
|
|
143
|
+
<YourComponents />
|
|
144
|
+
</ObservabilityProvider>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Simple development setup
|
|
149
|
+
<ObservabilityProvider observabilityContext={devContext}>
|
|
150
|
+
<ResourceOrchestrator />
|
|
151
|
+
</ObservabilityProvider>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### Building Observability-Aware Components
|
|
155
|
+
|
|
156
|
+
When creating new components, opt into observability with the `useSmartObservability()` hook:
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
import { useSmartObservability } from '@fgv/ts-res-ui-components';
|
|
160
|
+
|
|
161
|
+
function MyCustomComponent({ data }: { data: any[] }) {
|
|
162
|
+
const o11y = useSmartObservability();
|
|
163
|
+
|
|
164
|
+
const handleOperation = async () => {
|
|
165
|
+
try {
|
|
166
|
+
o11y.user.info('Starting data processing...');
|
|
167
|
+
o11y.diag.info('Processing items:', data.length);
|
|
168
|
+
|
|
169
|
+
const result = await processData(data);
|
|
170
|
+
|
|
171
|
+
o11y.user.success(`Successfully processed ${result.length} items`);
|
|
172
|
+
o11y.diag.info('Processing result:', result);
|
|
173
|
+
return result;
|
|
174
|
+
} catch (error) {
|
|
175
|
+
o11y.user.error(`Processing failed: ${error.message}`);
|
|
176
|
+
o11y.diag.error('Full error details:', error);
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
89
180
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
181
|
+
return (
|
|
182
|
+
<div>
|
|
183
|
+
<button onClick={handleOperation}>Process Data</button>
|
|
184
|
+
{/* Component automatically sends messages to observability context */}
|
|
185
|
+
</div>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Key Guidelines:**
|
|
191
|
+
- Use `o11y.user.*` for messages users should see (success, error, warnings)
|
|
192
|
+
- Use `o11y.diag.*` for developer/debugging information
|
|
193
|
+
- Components work automatically whether observability context is provided or not
|
|
194
|
+
|
|
195
|
+
#### Custom Observability Contexts
|
|
196
|
+
|
|
197
|
+
Hosts can provide their own observability implementation for complete control over logging:
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
import { IObservabilityContext, ObservabilityProvider } from '@fgv/ts-res-ui-components';
|
|
201
|
+
|
|
202
|
+
// Create custom observability context
|
|
203
|
+
const customObservabilityContext: IObservabilityContext = {
|
|
204
|
+
user: {
|
|
205
|
+
info: (message: string) => myNotificationSystem.showInfo(message),
|
|
206
|
+
success: (message: string) => myNotificationSystem.showSuccess(message),
|
|
207
|
+
warn: (message: string) => myNotificationSystem.showWarning(message),
|
|
208
|
+
error: (message: string) => myNotificationSystem.showError(message)
|
|
209
|
+
},
|
|
210
|
+
diag: {
|
|
211
|
+
info: (message: string, ...args: any[]) => myLogger.info(message, ...args),
|
|
212
|
+
warn: (message: string, ...args: any[]) => myLogger.warn(message, ...args),
|
|
213
|
+
error: (message: string, ...args: any[]) => myLogger.error(message, ...args)
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// Use your custom context
|
|
218
|
+
function App() {
|
|
219
|
+
return (
|
|
220
|
+
<ObservabilityProvider observabilityContext={customObservabilityContext}>
|
|
221
|
+
<MyComponents />
|
|
222
|
+
</ObservabilityProvider>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Built-in Context Factories:**
|
|
228
|
+
```tsx
|
|
229
|
+
// Console logging for development
|
|
230
|
+
const devContext = ObservabilityTools.createConsoleObservabilityContext('debug', 'info');
|
|
231
|
+
|
|
232
|
+
// Silent operation for production
|
|
233
|
+
const prodContext = ObservabilityTools.createNoOpObservabilityContext();
|
|
234
|
+
|
|
235
|
+
// Integration with external message system
|
|
236
|
+
const customContext = ObservabilityTools.createViewStateObservabilityContext(
|
|
237
|
+
(type, message) => myMessageHandler(type, message)
|
|
238
|
+
);
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
#### Advanced Observability Patterns
|
|
242
|
+
|
|
243
|
+
**Conditional Observability in Libraries:**
|
|
244
|
+
```tsx
|
|
245
|
+
// For library components that may or may not have observability
|
|
246
|
+
function MyLibraryComponent() {
|
|
247
|
+
const o11y = useSmartObservability();
|
|
248
|
+
|
|
249
|
+
const handleCriticalOperation = () => {
|
|
250
|
+
// This will work whether observability context exists or not
|
|
251
|
+
o11y.user.info('Operation started');
|
|
252
|
+
|
|
253
|
+
try {
|
|
254
|
+
const result = performOperation();
|
|
255
|
+
o11y.user.success('Operation completed');
|
|
256
|
+
return result;
|
|
257
|
+
} catch (error) {
|
|
258
|
+
// Always log errors, even without observability context
|
|
259
|
+
o11y.user.error('Operation failed');
|
|
260
|
+
o11y.diag.error('Details:', error);
|
|
261
|
+
throw error;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Multi-Level Observability (Host + ViewState):**
|
|
268
|
+
```tsx
|
|
269
|
+
function App() {
|
|
270
|
+
// Host-level notifications for critical errors
|
|
271
|
+
const hostObservability: IObservabilityContext = {
|
|
272
|
+
user: {
|
|
273
|
+
error: (msg) => showCriticalAlert(msg),
|
|
274
|
+
// Other messages go to ViewState
|
|
275
|
+
info: (msg) => viewState.addMessage('info', msg),
|
|
276
|
+
success: (msg) => viewState.addMessage('success', msg),
|
|
277
|
+
warn: (msg) => viewState.addMessage('warning', msg)
|
|
278
|
+
},
|
|
279
|
+
diag: {
|
|
280
|
+
error: (msg, ...args) => console.error(msg, ...args),
|
|
281
|
+
warn: (msg, ...args) => console.warn(msg, ...args),
|
|
282
|
+
info: (msg, ...args) => console.info(msg, ...args)
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
return (
|
|
287
|
+
<ObservabilityProvider observabilityContext={hostObservability}>
|
|
288
|
+
<MyApplication />
|
|
289
|
+
</ObservabilityProvider>
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**Environment-Specific Contexts:**
|
|
295
|
+
```tsx
|
|
296
|
+
const observabilityContext = process.env.NODE_ENV === 'production'
|
|
297
|
+
? ObservabilityTools.createNoOpObservabilityContext()
|
|
298
|
+
: ObservabilityTools.createConsoleObservabilityContext('debug', 'info');
|
|
299
|
+
```
|
|
94
300
|
|
|
95
301
|
## Architecture
|
|
96
302
|
|
|
@@ -159,13 +365,14 @@ Visual configuration management for ts-res system settings including qualifier t
|
|
|
159
365
|
> 📚 **[See ConfigurationView documentation →](./docs/ts-res-ui-components.configurationview.md)**
|
|
160
366
|
|
|
161
367
|
```tsx
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
/>
|
|
368
|
+
<ObservabilityProvider observabilityContext={myObservabilityContext}>
|
|
369
|
+
<ConfigurationView
|
|
370
|
+
configuration={state.activeConfiguration}
|
|
371
|
+
onConfigurationChange={actions.applyConfiguration}
|
|
372
|
+
onSave={actions.saveConfiguration}
|
|
373
|
+
hasUnsavedChanges={state.hasConfigurationChanges}
|
|
374
|
+
/>
|
|
375
|
+
</ObservabilityProvider>
|
|
169
376
|
```
|
|
170
377
|
|
|
171
378
|
**Key features:**
|
|
@@ -183,17 +390,18 @@ Handles importing resource files, directories, bundles, and ZIP files. Uses the
|
|
|
183
390
|
> 📚 **[See ImportView documentation →](./docs/ts-res-ui-components.importview.md)**
|
|
184
391
|
|
|
185
392
|
```tsx
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
/>
|
|
393
|
+
<ObservabilityProvider observabilityContext={myObservabilityContext}>
|
|
394
|
+
<ImportView
|
|
395
|
+
onImport={actions.importDirectory}
|
|
396
|
+
onBundleImport={actions.importBundle}
|
|
397
|
+
onZipImport={(zipData, config) => {
|
|
398
|
+
// zipData contains files and directory structure from ZIP
|
|
399
|
+
// config contains any configuration found in the ZIP
|
|
400
|
+
actions.importDirectory(zipData, config);
|
|
401
|
+
}}
|
|
402
|
+
acceptedFileTypes={['.json', '.ts', '.js']}
|
|
403
|
+
/>
|
|
404
|
+
</ObservabilityProvider>
|
|
197
405
|
```
|
|
198
406
|
|
|
199
407
|
### ResourcePicker
|
|
@@ -248,12 +456,13 @@ is a generic component used by all of the views, which can also be used to power
|
|
|
248
456
|
A debugging/design tool for interactively configuring ResourcePicker behavior. Hidden by default for production use, but can be enabled in development:
|
|
249
457
|
|
|
250
458
|
```tsx
|
|
251
|
-
// All view components support pickerOptionsPresentation
|
|
252
|
-
<
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
/>
|
|
459
|
+
// All view components support pickerOptionsPresentation
|
|
460
|
+
<ObservabilityProvider observabilityContext={myObservabilityContext}>
|
|
461
|
+
<SourceView
|
|
462
|
+
resources={state.processedResources}
|
|
463
|
+
pickerOptionsPresentation="collapsible" // Enable picker options UI
|
|
464
|
+
/>
|
|
465
|
+
</ObservabilityProvider>
|
|
257
466
|
|
|
258
467
|
// Direct usage in custom components
|
|
259
468
|
<PickerTools.ResourcePickerOptionsControl
|
|
@@ -279,16 +488,17 @@ Displays the source resource collection with search and navigation capabilities
|
|
|
279
488
|
> 📚 **[See SourceView documentation →](./docs/ts-res-ui-components.sourceview.md)**
|
|
280
489
|
|
|
281
490
|
```tsx
|
|
282
|
-
<
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
/>
|
|
491
|
+
<ObservabilityProvider observabilityContext={myObservabilityContext}>
|
|
492
|
+
<SourceView
|
|
493
|
+
resources={state.processedResources}
|
|
494
|
+
onExport={actions.exportData}
|
|
495
|
+
pickerOptions={{
|
|
496
|
+
defaultView: "list",
|
|
497
|
+
enableSearch: true,
|
|
498
|
+
searchPlaceholder: "Search resources..."
|
|
499
|
+
}}
|
|
500
|
+
/>
|
|
501
|
+
</ObservabilityProvider>
|
|
292
502
|
```
|
|
293
503
|
|
|
294
504
|
### FilterView
|
|
@@ -298,18 +508,19 @@ Provides filtering capabilities with context value specification and dual-resour
|
|
|
298
508
|
> 📚 **[See FilterView documentation →](./docs/ts-res-ui-components.filterview.md)**
|
|
299
509
|
|
|
300
510
|
```tsx
|
|
301
|
-
<
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
/>
|
|
511
|
+
<ObservabilityProvider observabilityContext={myObservabilityContext}>
|
|
512
|
+
<FilterView
|
|
513
|
+
resources={state.processedResources}
|
|
514
|
+
filterState={filterState}
|
|
515
|
+
filterActions={filterActions}
|
|
516
|
+
filterResult={filterResult}
|
|
517
|
+
onFilterResult={setFilterResult}
|
|
518
|
+
pickerOptions={{
|
|
519
|
+
enableSearch: true,
|
|
520
|
+
searchPlaceholder: "Search resources..."
|
|
521
|
+
}}
|
|
522
|
+
/>
|
|
523
|
+
</ObservabilityProvider>
|
|
313
524
|
```
|
|
314
525
|
|
|
315
526
|
### CompiledView
|
|
@@ -319,17 +530,18 @@ Shows the compiled resource structure with detailed candidate information using
|
|
|
319
530
|
> 📚 **[See CompiledView documentation →](./docs/ts-res-ui-components.compiledview.md)**
|
|
320
531
|
|
|
321
532
|
```tsx
|
|
322
|
-
<
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
/>
|
|
533
|
+
<ObservabilityProvider observabilityContext={myObservabilityContext}>
|
|
534
|
+
<CompiledView
|
|
535
|
+
resources={state.processedResources}
|
|
536
|
+
filterResult={filterResult}
|
|
537
|
+
useNormalization={true}
|
|
538
|
+
onExport={(data, type) => exportData(data, type)}
|
|
539
|
+
pickerOptions={{
|
|
540
|
+
defaultView: "tree",
|
|
541
|
+
enableSearch: true
|
|
542
|
+
}}
|
|
543
|
+
/>
|
|
544
|
+
</ObservabilityProvider>
|
|
333
545
|
```
|
|
334
546
|
|
|
335
547
|
### ResolutionView
|
|
@@ -339,35 +551,36 @@ Interactive resource resolution testing with context management and support for
|
|
|
339
551
|
> 📚 **[See ResolutionView documentation →](./docs/ts-res-ui-components.resolutionview.md)**
|
|
340
552
|
|
|
341
553
|
```tsx
|
|
342
|
-
<
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
/>
|
|
554
|
+
<ObservabilityProvider observabilityContext={myObservabilityContext}>
|
|
555
|
+
<ResolutionView
|
|
556
|
+
resources={state.processedResources}
|
|
557
|
+
resolutionState={resolutionState}
|
|
558
|
+
resolutionActions={resolutionActions}
|
|
559
|
+
availableQualifiers={availableQualifiers}
|
|
560
|
+
resourceEditorFactory={myResourceEditorFactory}
|
|
561
|
+
pickerOptions={{
|
|
562
|
+
defaultView: "list",
|
|
563
|
+
enableSearch: true,
|
|
564
|
+
searchPlaceholder: "Search resources for resolution testing..."
|
|
565
|
+
}}
|
|
566
|
+
// Optional: Host-controlled resolution
|
|
567
|
+
contextOptions={{
|
|
568
|
+
hostManagedValues: {
|
|
569
|
+
language: 'en-US',
|
|
570
|
+
platform: 'web',
|
|
571
|
+
market: 'eastern-europe'
|
|
572
|
+
},
|
|
573
|
+
showContextControls: true // Can hide controls for host-only resolution
|
|
574
|
+
}}
|
|
575
|
+
// Optional: Resource creation with pending/apply workflow
|
|
576
|
+
allowResourceCreation={true}
|
|
577
|
+
defaultResourceType="json" // Optional: Host-controlled resource type
|
|
578
|
+
showPendingResourcesInList={true} // Show pending resources in the picker (default: true)
|
|
579
|
+
onPendingResourcesApplied={(added, deleted) => {
|
|
580
|
+
console.log(`Applied ${added.length} new resources, ${deleted.length} deletions`);
|
|
581
|
+
}}
|
|
582
|
+
/>
|
|
583
|
+
</ObservabilityProvider>
|
|
371
584
|
```
|
|
372
585
|
|
|
373
586
|
#### Host-Controlled Resolution
|
|
@@ -831,7 +1044,6 @@ function MyFilterTool() {
|
|
|
831
1044
|
updateReduceQualifiers: (reduce) => actions.updateFilterState({ reduceQualifiers: reduce })
|
|
832
1045
|
}}
|
|
833
1046
|
filterResult={state.filterResult}
|
|
834
|
-
onMessage={(type, message) => console.log(`${type}: ${message}`)}
|
|
835
1047
|
/>
|
|
836
1048
|
);
|
|
837
1049
|
}
|
|
@@ -1071,9 +1283,11 @@ function MyResourceTool() {
|
|
|
1071
1283
|
return (
|
|
1072
1284
|
<div className="flex flex-col h-screen">
|
|
1073
1285
|
<div className="flex-1">
|
|
1074
|
-
<
|
|
1075
|
-
|
|
1076
|
-
|
|
1286
|
+
<ObservabilityProvider observabilityContext={observabilityContext}>
|
|
1287
|
+
<ImportView onImport={handleFileImport} />
|
|
1288
|
+
<FilterView onFilter={handleResourceFilter} />
|
|
1289
|
+
{/* Components automatically use observability context */}
|
|
1290
|
+
</ObservabilityProvider>
|
|
1077
1291
|
</div>
|
|
1078
1292
|
|
|
1079
1293
|
<ViewTools.MessagesWindow
|
|
@@ -1091,8 +1305,8 @@ function MyResourceTool() {
|
|
|
1091
1305
|
- **warning**: Non-critical issues, fallback behaviors, deprecated features used
|
|
1092
1306
|
- **error**: Operation failures, validation errors, unexpected conditions
|
|
1093
1307
|
|
|
1094
|
-
**
|
|
1095
|
-
|
|
1308
|
+
**Observability Integration:**
|
|
1309
|
+
All components in this library automatically use the observability context when available. This provides consistent feedback across all operations through the unified `o11y.user.*` and `o11y.diag.*` patterns.
|
|
1096
1310
|
|
|
1097
1311
|
## Hooks API
|
|
1098
1312
|
|
|
@@ -1406,7 +1620,6 @@ export default function App() {
|
|
|
1406
1620
|
allowResourceCreation
|
|
1407
1621
|
defaultResourceType="json"
|
|
1408
1622
|
showPendingResourcesInList
|
|
1409
|
-
onMessage={actions.addMessage}
|
|
1410
1623
|
/>
|
|
1411
1624
|
)}
|
|
1412
1625
|
</ResourceOrchestrator>
|
|
@@ -1672,11 +1885,10 @@ import {
|
|
|
1672
1885
|
// Type-safe component with enhanced resource selection
|
|
1673
1886
|
interface MyResourceViewProps<T = unknown> {
|
|
1674
1887
|
resources: ProcessedResources;
|
|
1675
|
-
onMessage: (type: Message['type'], message: string) => void;
|
|
1676
1888
|
onResourceSelect: (selection: ResourceSelection<T>) => void;
|
|
1677
1889
|
}
|
|
1678
1890
|
|
|
1679
|
-
const MyResourceView = <T = unknown>({ resources,
|
|
1891
|
+
const MyResourceView = <T = unknown>({ resources, onResourceSelect }: MyResourceViewProps<T>) => {
|
|
1680
1892
|
return (
|
|
1681
1893
|
<ResourcePicker<T>
|
|
1682
1894
|
resources={resources}
|