@fgv/ts-res-ui-components 5.0.0-17 → 5.0.0-19

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 (64) hide show
  1. package/README.md +323 -13
  2. package/dist/ts-res-ui-components.d.ts +364 -30
  3. package/lib/components/common/QualifierContextControl.d.ts +59 -1
  4. package/lib/components/common/QualifierContextControl.js +101 -17
  5. package/lib/components/common/ResolutionContextOptionsControl.d.ts +59 -0
  6. package/lib/components/common/ResolutionContextOptionsControl.js +182 -0
  7. package/lib/components/common/ResourcePickerOptionsControl.d.ts +43 -0
  8. package/lib/components/common/ResourcePickerOptionsControl.js +142 -0
  9. package/lib/components/orchestrator/ResourceOrchestrator.d.ts +5 -1
  10. package/lib/components/orchestrator/ResourceOrchestrator.js +5 -2
  11. package/lib/components/pickers/ResourcePicker/index.d.ts +1 -1
  12. package/lib/components/pickers/ResourcePicker/index.js +3 -1
  13. package/lib/components/pickers/ResourcePicker/types.d.ts +57 -20
  14. package/lib/components/views/CompiledView/index.js +20 -2
  15. package/lib/components/views/FilterView/index.js +83 -12
  16. package/lib/components/views/ResolutionView/index.js +92 -18
  17. package/lib/components/views/SourceView/index.js +21 -3
  18. package/lib/hooks/useResourceData.d.ts +14 -2
  19. package/lib/hooks/useResourceData.js +24 -34
  20. package/lib/namespaces/PickerTools.d.ts +16 -3
  21. package/lib/namespaces/PickerTools.js +15 -2
  22. package/lib/namespaces/ResolutionTools.d.ts +3 -1
  23. package/lib/namespaces/ResolutionTools.js +1 -0
  24. package/lib/types/index.d.ts +114 -0
  25. package/lib/utils/configurationUtils.d.ts +4 -4
  26. package/lib/utils/configurationUtils.js +36 -269
  27. package/lib/utils/tsResIntegration.d.ts +3 -3
  28. package/lib/utils/tsResIntegration.js +9 -6
  29. package/lib/utils/zipLoader/zipProcessingHelpers.js +3 -15
  30. package/lib-commonjs/components/common/QualifierContextControl.js +101 -17
  31. package/lib-commonjs/components/common/ResolutionContextOptionsControl.js +187 -0
  32. package/lib-commonjs/components/common/ResourcePickerOptionsControl.js +147 -0
  33. package/lib-commonjs/components/orchestrator/ResourceOrchestrator.js +5 -2
  34. package/lib-commonjs/components/pickers/ResourcePicker/index.js +3 -1
  35. package/lib-commonjs/components/views/CompiledView/index.js +20 -2
  36. package/lib-commonjs/components/views/FilterView/index.js +83 -12
  37. package/lib-commonjs/components/views/ResolutionView/index.js +91 -17
  38. package/lib-commonjs/components/views/SourceView/index.js +20 -2
  39. package/lib-commonjs/hooks/useResourceData.js +24 -34
  40. package/lib-commonjs/namespaces/PickerTools.js +17 -3
  41. package/lib-commonjs/namespaces/ResolutionTools.js +3 -1
  42. package/lib-commonjs/utils/configurationUtils.js +36 -269
  43. package/lib-commonjs/utils/tsResIntegration.js +9 -6
  44. package/lib-commonjs/utils/zipLoader/zipProcessingHelpers.js +2 -14
  45. package/package.json +7 -7
  46. package/src/components/common/QualifierContextControl.tsx +112 -19
  47. package/src/components/common/ResolutionContextOptionsControl.tsx +409 -0
  48. package/src/components/common/ResourcePickerOptionsControl.tsx +351 -0
  49. package/src/components/orchestrator/ResourceOrchestrator.tsx +19 -11
  50. package/src/components/pickers/ResourcePicker/README.md +93 -0
  51. package/src/components/pickers/ResourcePicker/index.tsx +14 -10
  52. package/src/components/pickers/ResourcePicker/types.ts +61 -25
  53. package/src/components/views/CompiledView/index.tsx +41 -8
  54. package/src/components/views/FilterView/index.tsx +164 -48
  55. package/src/components/views/ResolutionView/index.tsx +199 -65
  56. package/src/components/views/SourceView/index.tsx +43 -9
  57. package/src/hooks/useConfigurationState.ts +0 -1
  58. package/src/hooks/useResourceData.ts +58 -32
  59. package/src/namespaces/PickerTools.ts +20 -2
  60. package/src/namespaces/ResolutionTools.ts +5 -1
  61. package/src/types/index.ts +120 -0
  62. package/src/utils/configurationUtils.ts +38 -276
  63. package/src/utils/tsResIntegration.ts +35 -6
  64. package/src/utils/zipLoader/zipProcessingHelpers.ts +6 -12
package/README.md CHANGED
@@ -14,6 +14,7 @@ This packlet is largely AI written, and it shows.
14
14
  - **🔄 Resource Management**: Import, process, and manage ts-res configurations and bundles
15
15
  - **🔍 Advanced Filtering**: Filter resources by context with qualifier reduction
16
16
  - **🎯 Resource Resolution**: Test resource resolution with dynamic context values
17
+ - **🔒 View Mode Locking**: Lock to single view mode for simplified interfaces
17
18
  - **📊 Visualization**: Multiple views for exploring resource structures and compiled output
18
19
  - **⚙️ Configuration**: Visual configuration management for qualifier types, qualifiers, and resource types
19
20
  - **📁 File Handling**: Support for directory imports, ZIP files via ts-res zip-archive packlet, and bundle loading
@@ -247,9 +248,12 @@ is a generic component used by all of the views, which can also be used to power
247
248
  console.log(`Pending ${selection.pendingType} operation`);
248
249
  }
249
250
  }}
250
- defaultView="tree"
251
- enableSearch={true}
252
- searchPlaceholder="Search resources..."
251
+ options={{
252
+ defaultView: "tree",
253
+ enableSearch: true,
254
+ searchPlaceholder: "Search resources...",
255
+ height: "500px"
256
+ }}
253
257
  resourceAnnotations={{
254
258
  'user.welcome': {
255
259
  badge: { text: '3', variant: 'info' },
@@ -257,7 +261,6 @@ is a generic component used by all of the views, which can also be used to power
257
261
  }
258
262
  }}
259
263
  pendingResources={pendingChanges}
260
- height="500px"
261
264
  />
262
265
  ```
263
266
 
@@ -268,6 +271,36 @@ is a generic component used by all of the views, which can also be used to power
268
271
  - **Pending resources**: Show unsaved changes with visual distinction
269
272
  - **Branch isolation**: Focus on specific parts of large resource trees
270
273
  - **Type safety**: Full TypeScript support with generic resource types
274
+ - **Debug controls**: Optional ResourcePickerOptionsControl for development and debugging
275
+
276
+ #### ResourcePickerOptionsControl
277
+
278
+ A debugging/design tool for interactively configuring ResourcePicker behavior. Hidden by default for production use, but can be enabled in development:
279
+
280
+ ```tsx
281
+ // All view components support pickerOptionsPresentation
282
+ <SourceView
283
+ resources={state.processedResources}
284
+ pickerOptionsPresentation="collapsible" // Enable picker options UI
285
+ onMessage={(type, message) => console.log(`${type}: ${message}`)}
286
+ />
287
+
288
+ // Direct usage in custom components
289
+ <PickerTools.ResourcePickerOptionsControl
290
+ options={pickerOptions}
291
+ onOptionsChange={setPickerOptions}
292
+ presentation="popup" // 'hidden' | 'inline' | 'collapsible' | 'popup' | 'popover'
293
+ title="Picker Configuration"
294
+ showAdvanced={true}
295
+ />
296
+ ```
297
+
298
+ **Presentation modes:**
299
+ - `'hidden'`: Not displayed (default for production)
300
+ - `'inline'`: Always visible with expanded controls
301
+ - `'collapsible'`: Expandable/collapsible section
302
+ - `'popup'`: Full modal dialog overlay
303
+ - `'popover'`: Small dropdown overlay
271
304
 
272
305
  ### SourceView
273
306
 
@@ -278,9 +311,13 @@ Displays the source resource collection with search and navigation capabilities
278
311
  ```tsx
279
312
  <SourceView
280
313
  resources={state.processedResources}
281
- selectedResourceId={selectedId}
282
- onResourceSelect={(selection) => setSelectedId(selection.resourceId)}
283
314
  onExport={actions.exportData}
315
+ onMessage={(type, message) => console.log(`${type}: ${message}`)}
316
+ pickerOptions={{
317
+ defaultView: "list",
318
+ enableSearch: true,
319
+ searchPlaceholder: "Search resources..."
320
+ }}
284
321
  />
285
322
  ```
286
323
 
@@ -297,9 +334,10 @@ Provides filtering capabilities with context value specification and dual-resour
297
334
  filterActions={filterActions}
298
335
  filterResult={filterResult}
299
336
  onFilterResult={setFilterResult}
300
- onResourceSelect={(selection) => {
301
- setSelectedId(selection.resourceId);
302
- // Enhanced callback provides comprehensive selection data
337
+ onMessage={(type, message) => console.log(`${type}: ${message}`)}
338
+ pickerOptions={{
339
+ enableSearch: true,
340
+ searchPlaceholder: "Search resources..."
303
341
  }}
304
342
  />
305
343
  ```
@@ -316,16 +354,17 @@ Shows the compiled resource structure with detailed candidate information using
316
354
  filterResult={filterResult}
317
355
  useNormalization={true}
318
356
  onExport={(data, type) => exportData(data, type)}
319
- onResourceSelect={(selection) => {
320
- // Enhanced callback with comprehensive resource data
321
- setSelectedId(selection.resourceId);
357
+ onMessage={(type, message) => console.log(`${type}: ${message}`)}
358
+ pickerOptions={{
359
+ defaultView: "tree",
360
+ enableSearch: true
322
361
  }}
323
362
  />
324
363
  ```
325
364
 
326
365
  ### ResolutionView
327
366
 
328
- Interactive resource resolution testing with context management and support for custom resource editors via the ResourceEditorFactory pattern.
367
+ Interactive resource resolution testing with context management and support for custom resource editors via the ResourceEditorFactory pattern. Supports locking to a single view mode to simplify the interface for specific use cases.
329
368
 
330
369
  > 📚 **[See ResolutionView documentation →](./docs/ts-res-ui-components.resolutionview.md)**
331
370
 
@@ -336,6 +375,12 @@ Interactive resource resolution testing with context management and support for
336
375
  resolutionActions={resolutionActions}
337
376
  availableQualifiers={availableQualifiers}
338
377
  resourceEditorFactory={myResourceEditorFactory}
378
+ onMessage={(type, message) => console.log(`${type}: ${message}`)}
379
+ pickerOptions={{
380
+ defaultView: "list",
381
+ enableSearch: true,
382
+ searchPlaceholder: "Search resources for resolution testing..."
383
+ }}
339
384
  />
340
385
  ```
341
386
 
@@ -398,6 +443,271 @@ const editorFactory = new MyResourceEditorFactory();
398
443
  - **Extensible**: Easy to add new editors for new resource types
399
444
  - **Error Handling**: Factory failures are caught and reported to users
400
445
 
446
+ #### Context Control Extensibility
447
+
448
+ ResolutionView provides comprehensive control over the context configuration UI, allowing hosts to customize which qualifiers are editable, provide external values, and control the presentation. This is especially useful for applications that need to drive context externally or provide selective user control.
449
+
450
+ **Hide Context UI Entirely (Host-Driven Context):**
451
+ ```tsx
452
+ <ResolutionView
453
+ resources={processedResources}
454
+ resolutionState={resolutionState}
455
+ resolutionActions={resolutionActions}
456
+ contextOptions={{
457
+ showContextControls: false // Hide all context UI
458
+ }}
459
+ />
460
+ ```
461
+
462
+ **Lock to Single View Mode:**
463
+ ```tsx
464
+ <ResolutionView
465
+ resources={processedResources}
466
+ resolutionState={resolutionState}
467
+ resolutionActions={resolutionActions}
468
+ lockedViewMode="composed" // Lock to composed view, hide view selector
469
+ />
470
+ ```
471
+
472
+ **Lock to Best View Mode:**
473
+ ```tsx
474
+ <ResolutionView
475
+ resources={processedResources}
476
+ resolutionState={resolutionState}
477
+ resolutionActions={resolutionActions}
478
+ lockedViewMode="best" // Lock to best view, hide view selector
479
+ />
480
+ ```
481
+
482
+ **Custom Section Titles:**
483
+ ```tsx
484
+ <ResolutionView
485
+ resources={processedResources}
486
+ resolutionState={resolutionState}
487
+ resolutionActions={resolutionActions}
488
+ sectionTitles={{
489
+ resources: "Available Items", // Custom title for resources picker
490
+ results: "Resolution Output" // Custom title for results section
491
+ }}
492
+ />
493
+ ```
494
+
495
+ **Fine-Grained Qualifier Control:**
496
+ ```tsx
497
+ <ResolutionView
498
+ resources={processedResources}
499
+ resolutionState={resolutionState}
500
+ resolutionActions={resolutionActions}
501
+ contextOptions={{
502
+ // Panel visibility control
503
+ showContextControls: true,
504
+ showCurrentContext: true,
505
+ showContextActions: true,
506
+
507
+ // Per-qualifier configuration
508
+ qualifierOptions: {
509
+ language: {
510
+ editable: true,
511
+ placeholder: "Select language..."
512
+ },
513
+ platform: {
514
+ editable: false,
515
+ hostValue: "web",
516
+ showHostValue: true
517
+ },
518
+ environment: {
519
+ visible: false // Hidden from UI entirely
520
+ }
521
+ },
522
+
523
+ // Host-managed values (invisible but active in context)
524
+ hostManagedValues: {
525
+ environment: "production",
526
+ deployment: "us-east-1"
527
+ },
528
+
529
+ // Appearance customization
530
+ contextPanelTitle: "Resolution Context",
531
+ globalPlaceholder: "Enter {qualifierName}..."
532
+ }}
533
+ />
534
+ ```
535
+
536
+ **Visual Indicators:**
537
+ - **🔵 Blue border + light blue background** - Host-managed qualifiers have subtle visual styling
538
+ - **🖱️ Hover tooltip** - "Host-managed value - controlled externally" appears on hover
539
+ - **🎯 Actual values displayed** - Shows real host values instead of generic "Disabled" text
540
+ - **📋 Current context** - Displays combined user + host-managed values
541
+
542
+ **Development & Debug Controls:**
543
+ Enable the context options gear icon during development for interactive configuration:
544
+
545
+ ```tsx
546
+ <ResolutionView
547
+ resources={processedResources}
548
+ pickerOptionsPresentation="collapsible" // Shows both picker & context gear icons
549
+ resolutionState={resolutionState}
550
+ resolutionActions={resolutionActions}
551
+ />
552
+ ```
553
+
554
+ The gear icon provides a live configuration interface for:
555
+ - **Context Panel Visibility** - Show/hide controls, current context display, action buttons
556
+ - **Global Defaults** - Set default visibility and editability for all qualifiers
557
+ - **Per-Qualifier Settings** - Configure visibility, editability, host values, and custom placeholders
558
+ - **Host-Managed Values** - Set external values that override user input
559
+
560
+ This extensibility is perfect for:
561
+ - **Embedded applications** where the host drives context from sidebar controls
562
+ - **Guided workflows** where only specific qualifiers should be user-editable
563
+ - **Multi-tenant applications** where some context is determined by tenant configuration
564
+ - **Progressive disclosure** where advanced qualifiers are hidden from basic users
565
+
566
+ ### FilterView
567
+
568
+ Provides context-based resource filtering with candidate count analysis and export functionality.
569
+
570
+ > 📚 **[See FilterView documentation →](./docs/ts-res-ui-components.filterview.md)**
571
+
572
+ ```tsx
573
+ import { FilterView, ResourceTools } from '@fgv/ts-res-ui-components';
574
+
575
+ function MyFilterTool() {
576
+ const { state, actions } = ResourceTools.useResourceData();
577
+
578
+ return (
579
+ <FilterView
580
+ resources={state.resources}
581
+ filterState={state.filterState}
582
+ filterActions={{
583
+ updateFilterEnabled: (enabled) => actions.updateFilterState({ enabled }),
584
+ updateFilterValues: (values) => actions.updateFilterState({ values }),
585
+ applyFilterValues: () => actions.applyFilter(),
586
+ resetFilterValues: () => actions.resetFilter(),
587
+ updateReduceQualifiers: (reduce) => actions.updateFilterState({ reduceQualifiers: reduce })
588
+ }}
589
+ filterResult={state.filterResult}
590
+ onMessage={(type, message) => console.log(`${type}: ${message}`)}
591
+ />
592
+ );
593
+ }
594
+ ```
595
+
596
+ #### FilterView Context Control Extensibility
597
+
598
+ FilterView provides the same comprehensive context control features as ResolutionView, allowing hosts to customize which qualifiers are editable for filtering, provide external values, and control the presentation. This is especially useful for filtering applications that need to drive filter context externally or provide selective user control.
599
+
600
+ **Hide Context UI Entirely (Host-Driven Filtering):**
601
+ ```tsx
602
+ <FilterView
603
+ resources={processedResources}
604
+ filterState={filterState}
605
+ filterActions={filterActions}
606
+ filterResult={filterResult}
607
+ contextOptions={{
608
+ showContextControls: false // Hide all context filter controls
609
+ }}
610
+ />
611
+ ```
612
+
613
+ **Fine-Grained Filter Context Control:**
614
+ ```tsx
615
+ <FilterView
616
+ resources={processedResources}
617
+ filterState={filterState}
618
+ filterActions={filterActions}
619
+ filterResult={filterResult}
620
+ contextOptions={{
621
+ // Panel appearance
622
+ contextPanelTitle: "Filter Criteria",
623
+ globalPlaceholder: "Filter by {qualifierName}...",
624
+
625
+ // Per-qualifier configuration
626
+ qualifierOptions: {
627
+ language: {
628
+ editable: true,
629
+ placeholder: "Filter by language..."
630
+ },
631
+ platform: {
632
+ editable: false,
633
+ hostValue: "web",
634
+ showHostValue: true
635
+ },
636
+ environment: {
637
+ visible: false // Hidden from filter UI entirely
638
+ }
639
+ },
640
+
641
+ // Host-managed filter values (invisible but active in filter context)
642
+ hostManagedValues: {
643
+ environment: "production",
644
+ deployment: "us-east-1"
645
+ },
646
+
647
+ // UI visibility control
648
+ showCurrentContext: true, // Show pending/applied filter summary
649
+ showContextActions: true // Show filter reset/apply buttons
650
+ }}
651
+ />
652
+ ```
653
+
654
+ **Combined with External Filter Logic:**
655
+ ```tsx
656
+ function SmartFilterView() {
657
+ const [externalContext, setExternalContext] = useState({
658
+ userRole: 'admin',
659
+ tenant: 'enterprise'
660
+ });
661
+
662
+ return (
663
+ <FilterView
664
+ resources={processedResources}
665
+ filterState={filterState}
666
+ filterActions={filterActions}
667
+ contextOptions={{
668
+ contextPanelTitle: "Available Filters",
669
+ qualifierOptions: {
670
+ // Hide sensitive qualifiers from basic users
671
+ environment: {
672
+ visible: externalContext.userRole === 'admin'
673
+ },
674
+ // Lock tenant-specific qualifiers
675
+ tenant: {
676
+ editable: false,
677
+ hostValue: externalContext.tenant
678
+ }
679
+ }
680
+ }}
681
+ />
682
+ );
683
+ }
684
+ ```
685
+
686
+ **Development & Debug Controls:**
687
+ Enable the context options gear icon during development for interactive filter configuration:
688
+
689
+ ```tsx
690
+ <FilterView
691
+ resources={processedResources}
692
+ pickerOptionsPresentation="collapsible" // Shows both picker & context gear icons
693
+ filterState={filterState}
694
+ filterActions={filterActions}
695
+ />
696
+ ```
697
+
698
+ The gear icon provides a live configuration interface for:
699
+ - **Context Panel Visibility** - Show/hide filter controls, current context display, action buttons
700
+ - **Global Defaults** - Set default visibility and editability for all filter qualifiers
701
+ - **Per-Qualifier Settings** - Configure visibility, editability, host values, and custom placeholders
702
+ - **Host-Managed Values** - Set external filter values that override user input
703
+
704
+ This filter extensibility is perfect for:
705
+ - **Dashboard applications** where filters are driven from external controls
706
+ - **Multi-tenant systems** where filter options vary by tenant or user role
707
+ - **Guided filter workflows** where only specific criteria should be user-selectable
708
+ - **Advanced/basic user modes** where filter complexity adapts to user expertise
709
+ - **Integration scenarios** where filter context comes from external systems
710
+
401
711
  ### MessagesWindow
402
712
 
403
713
  Displays and manages application messages with filtering, search, and copy functionality. Perfect for debugging interfaces and development tools where message visibility is critical.