@fgv/ts-res-ui-components 5.0.0-26 → 5.0.0-27

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.
@@ -2,6 +2,7 @@ import { Bundle } from '@fgv/ts-res';
2
2
  import { Config } from '@fgv/ts-res';
3
3
  import { FileTree } from '@fgv/ts-utils';
4
4
  import { Import } from '@fgv/ts-res';
5
+ import { JsonCompatible } from '@fgv/ts-json-base';
5
6
  import { JsonValue } from '@fgv/ts-json-base';
6
7
  import { Logging } from '@fgv/ts-utils';
7
8
  import { MessageLogLevel } from '@fgv/ts-utils';
@@ -1832,13 +1833,13 @@ declare interface IConfigurationViewProps extends IViewBaseProps {
1832
1833
  *
1833
1834
  * @public
1834
1835
  */
1835
- declare interface ICreatePendingResourceParams {
1836
+ declare interface ICreatePendingResourceParams<T = JsonValue, TV extends JsonCompatible<T> = JsonCompatible<T>> {
1836
1837
  /** Full resource ID (e.g., 'platform.languages.az-AZ') - must be unique */
1837
1838
  id: string;
1838
1839
  /** Name of the resource type to use for validation and template creation */
1839
1840
  resourceTypeName: string;
1840
1841
  /** JSON content for the resource candidate. If undefined, the resource type's base template will be used. */
1841
- json?: JsonValue;
1842
+ json?: TV;
1842
1843
  }
1843
1844
 
1844
1845
  /**
@@ -1977,11 +1978,11 @@ declare interface IEditableJsonViewProps {
1977
1978
  *
1978
1979
  * @public
1979
1980
  */
1980
- declare interface IEditedResourceInfo {
1981
+ declare interface IEditedResourceInfo<T = JsonValue, TV extends JsonCompatible<T> = JsonCompatible<T>> {
1981
1982
  /** Unique identifier of the resource being edited */
1982
1983
  resourceId: string;
1983
- originalValue: JsonValue;
1984
- editedValue: JsonValue;
1984
+ originalValue: TV;
1985
+ editedValue: TV;
1985
1986
  timestamp: Date;
1986
1987
  }
1987
1988
 
@@ -3506,7 +3507,7 @@ declare interface IResolutionOptions {
3506
3507
  *
3507
3508
  * @public
3508
3509
  */
3509
- declare interface IResolutionResult {
3510
+ declare interface IResolutionResult<T = JsonValue, TV extends JsonCompatible<T> = JsonCompatible<T>> {
3510
3511
  /** Whether the resolution was successful */
3511
3512
  success: boolean;
3512
3513
  /** ID of the resource that was resolved */
@@ -3520,7 +3521,7 @@ declare interface IResolutionResult {
3520
3521
  /** Detailed information about each candidate's matching process */
3521
3522
  candidateDetails?: ICandidateInfo[];
3522
3523
  /** The final composed/resolved value */
3523
- composedValue?: JsonValue;
3524
+ composedValue?: TV;
3524
3525
  /** Error message if resolution failed */
3525
3526
  error?: string;
3526
3527
  }
@@ -3732,7 +3733,7 @@ declare interface IResourceDetailData {
3732
3733
  *
3733
3734
  * @public
3734
3735
  */
3735
- declare interface IResourceEditorFactory {
3736
+ declare interface IResourceEditorFactory<T = JsonValue, TV extends JsonCompatible<T> = JsonCompatible<T>> {
3736
3737
  /**
3737
3738
  * Attempts to create a resource editor for the given resource.
3738
3739
  *
@@ -3741,7 +3742,7 @@ declare interface IResourceEditorFactory {
3741
3742
  * @param value - The current value of the resource
3742
3743
  * @returns ResourceEditorResult indicating success/failure and the editor component or error message
3743
3744
  */
3744
- createEditor(resourceId: string, resourceType: string, value: JsonValue): ResourceEditorResult;
3745
+ createEditor(resourceId: string, resourceType: string, value: TV): ResourceEditorResult<T, TV>;
3745
3746
  }
3746
3747
 
3747
3748
  /**
@@ -3750,17 +3751,17 @@ declare interface IResourceEditorFactory {
3750
3751
  *
3751
3752
  * @public
3752
3753
  */
3753
- declare interface IResourceEditorProps {
3754
+ declare interface IResourceEditorProps<T = JsonValue, TV extends JsonCompatible<T> = JsonCompatible<T>> {
3754
3755
  /** The original JSON value to edit */
3755
- value: JsonValue;
3756
+ value: TV;
3756
3757
  /** The resource ID for tracking edits */
3757
3758
  resourceId: string;
3758
3759
  /** Whether this resource has been edited */
3759
3760
  isEdited?: boolean;
3760
3761
  /** The current edited value if any */
3761
- editedValue?: JsonValue;
3762
+ editedValue?: TV;
3762
3763
  /** Callback when the user saves an edit */
3763
- onSave?: (resourceId: string, editedValue: JsonValue, originalValue: JsonValue) => void;
3764
+ onSave?: (resourceId: string, editedValue: TV, originalValue: TV) => void;
3764
3765
  /** Callback when the user cancels an edit */
3765
3766
  onCancel?: (resourceId: string) => void;
3766
3767
  /** Whether editing is currently disabled */
@@ -4177,7 +4178,7 @@ declare function isPendingAddition(resourceId: string, pendingResources: Map<str
4177
4178
  *
4178
4179
  * @public
4179
4180
  */
4180
- declare interface IStartNewResourceParams {
4181
+ declare interface IStartNewResourceParams<T = JsonValue, TV extends JsonCompatible<T> = JsonCompatible<T>> {
4181
4182
  /** Resource type to use (optional - will use first available if not provided) */
4182
4183
  defaultTypeName?: string;
4183
4184
  /** Pre-seed with specific ID (optional) */
@@ -4185,7 +4186,7 @@ declare interface IStartNewResourceParams {
4185
4186
  /** Pre-seed with specific resource type name (optional) */
4186
4187
  resourceTypeName?: string;
4187
4188
  /** Pre-seed with specific JSON content (optional) */
4188
- json?: JsonValue;
4189
+ json?: TV;
4189
4190
  }
4190
4191
 
4191
4192
  /**
@@ -5401,11 +5402,11 @@ declare function resolveResourceDetailed(resolver: Runtime.ResourceResolver, res
5401
5402
  *
5402
5403
  * @public
5403
5404
  */
5404
- declare type ResourceEditorResult = {
5405
+ declare type ResourceEditorResult<T = JsonValue, TV extends JsonCompatible<T> = JsonCompatible<T>> = {
5405
5406
  /** Indicates whether the factory was able to create an editor for the resource */
5406
5407
  success: true;
5407
5408
  /** The React component to render for editing this resource */
5408
- editor: React.ComponentType<IResourceEditorProps>;
5409
+ editor: React.ComponentType<IResourceEditorProps<T, TV>>;
5409
5410
  } | {
5410
5411
  /** Indicates the factory could not create an editor for this resource */
5411
5412
  success: false;
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.52.10"
8
+ "packageVersion": "7.52.12"
9
9
  }
10
10
  ]
11
11
  }
@@ -1,6 +1,6 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
2
  import { ResourceJson, Config, Bundle, Resources, Runtime, QualifierTypes, Qualifiers, ResourceTypes, Import } from '@fgv/ts-res';
3
- import { JsonValue } from '@fgv/ts-json-base';
3
+ import { JsonCompatible, JsonValue } from '@fgv/ts-json-base';
4
4
  import type { IObservabilityContext } from '../utils/observability';
5
5
  /**
6
6
  * Configuration options for ResourcePicker components.
@@ -297,11 +297,11 @@ export interface ICompiledViewProps extends IViewBaseProps {
297
297
  *
298
298
  * @public
299
299
  */
300
- export type ResourceEditorResult = {
300
+ export type ResourceEditorResult<T = JsonValue, TV extends JsonCompatible<T> = JsonCompatible<T>> = {
301
301
  /** Indicates whether the factory was able to create an editor for the resource */
302
302
  success: true;
303
303
  /** The React component to render for editing this resource */
304
- editor: React.ComponentType<IResourceEditorProps>;
304
+ editor: React.ComponentType<IResourceEditorProps<T, TV>>;
305
305
  } | {
306
306
  /** Indicates the factory could not create an editor for this resource */
307
307
  success: false;
@@ -314,17 +314,17 @@ export type ResourceEditorResult = {
314
314
  *
315
315
  * @public
316
316
  */
317
- export interface IResourceEditorProps {
317
+ export interface IResourceEditorProps<T = JsonValue, TV extends JsonCompatible<T> = JsonCompatible<T>> {
318
318
  /** The original JSON value to edit */
319
- value: JsonValue;
319
+ value: TV;
320
320
  /** The resource ID for tracking edits */
321
321
  resourceId: string;
322
322
  /** Whether this resource has been edited */
323
323
  isEdited?: boolean;
324
324
  /** The current edited value if any */
325
- editedValue?: JsonValue;
325
+ editedValue?: TV;
326
326
  /** Callback when the user saves an edit */
327
- onSave?: (resourceId: string, editedValue: JsonValue, originalValue: JsonValue) => void;
327
+ onSave?: (resourceId: string, editedValue: TV, originalValue: TV) => void;
328
328
  /** Callback when the user cancels an edit */
329
329
  onCancel?: (resourceId: string) => void;
330
330
  /** Whether editing is currently disabled */
@@ -338,7 +338,7 @@ export interface IResourceEditorProps {
338
338
  *
339
339
  * @public
340
340
  */
341
- export interface IResourceEditorFactory {
341
+ export interface IResourceEditorFactory<T = JsonValue, TV extends JsonCompatible<T> = JsonCompatible<T>> {
342
342
  /**
343
343
  * Attempts to create a resource editor for the given resource.
344
344
  *
@@ -347,7 +347,7 @@ export interface IResourceEditorFactory {
347
347
  * @param value - The current value of the resource
348
348
  * @returns ResourceEditorResult indicating success/failure and the editor component or error message
349
349
  */
350
- createEditor(resourceId: string, resourceType: string, value: JsonValue): ResourceEditorResult;
350
+ createEditor(resourceId: string, resourceType: string, value: TV): ResourceEditorResult<T, TV>;
351
351
  }
352
352
  /**
353
353
  * Props for the ResolutionView component.
@@ -400,11 +400,11 @@ export interface IResolutionViewProps extends IViewBaseProps {
400
400
  *
401
401
  * @public
402
402
  */
403
- export interface IEditedResourceInfo {
403
+ export interface IEditedResourceInfo<T = JsonValue, TV extends JsonCompatible<T> = JsonCompatible<T>> {
404
404
  /** Unique identifier of the resource being edited */
405
405
  resourceId: string;
406
- originalValue: JsonValue;
407
- editedValue: JsonValue;
406
+ originalValue: TV;
407
+ editedValue: TV;
408
408
  timestamp: Date;
409
409
  }
410
410
  /**
@@ -464,13 +464,13 @@ export interface IResolutionState {
464
464
  *
465
465
  * @public
466
466
  */
467
- export interface ICreatePendingResourceParams {
467
+ export interface ICreatePendingResourceParams<T = JsonValue, TV extends JsonCompatible<T> = JsonCompatible<T>> {
468
468
  /** Full resource ID (e.g., 'platform.languages.az-AZ') - must be unique */
469
469
  id: string;
470
470
  /** Name of the resource type to use for validation and template creation */
471
471
  resourceTypeName: string;
472
472
  /** JSON content for the resource candidate. If undefined, the resource type's base template will be used. */
473
- json?: JsonValue;
473
+ json?: TV;
474
474
  }
475
475
  /**
476
476
  * Parameters for starting a new resource with optional pre-seeding.
@@ -492,7 +492,7 @@ export interface ICreatePendingResourceParams {
492
492
  *
493
493
  * @public
494
494
  */
495
- export interface IStartNewResourceParams {
495
+ export interface IStartNewResourceParams<T = JsonValue, TV extends JsonCompatible<T> = JsonCompatible<T>> {
496
496
  /** Resource type to use (optional - will use first available if not provided) */
497
497
  defaultTypeName?: string;
498
498
  /** Pre-seed with specific ID (optional) */
@@ -500,7 +500,7 @@ export interface IStartNewResourceParams {
500
500
  /** Pre-seed with specific resource type name (optional) */
501
501
  resourceTypeName?: string;
502
502
  /** Pre-seed with specific JSON content (optional) */
503
- json?: JsonValue;
503
+ json?: TV;
504
504
  }
505
505
  /**
506
506
  * Actions available for managing resource resolution testing and editing.
@@ -674,7 +674,7 @@ export interface IResolutionContextOptions {
674
674
  *
675
675
  * @public
676
676
  */
677
- export interface IResolutionResult {
677
+ export interface IResolutionResult<T = JsonValue, TV extends JsonCompatible<T> = JsonCompatible<T>> {
678
678
  /** Whether the resolution was successful */
679
679
  success: boolean;
680
680
  /** ID of the resource that was resolved */
@@ -688,7 +688,7 @@ export interface IResolutionResult {
688
688
  /** Detailed information about each candidate's matching process */
689
689
  candidateDetails?: ICandidateInfo[];
690
690
  /** The final composed/resolved value */
691
- composedValue?: JsonValue;
691
+ composedValue?: TV;
692
692
  /** Error message if resolution failed */
693
693
  error?: string;
694
694
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fgv/ts-res-ui-components",
3
- "version": "5.0.0-26",
3
+ "version": "5.0.0-27",
4
4
  "description": "Reusable React components for ts-res resource visualization and management",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -23,11 +23,11 @@
23
23
  "@heroicons/react": "~2.2.0",
24
24
  "tslib": "^2.8.1",
25
25
  "json-edit-react": "~1.28.2",
26
- "@fgv/ts-res": "5.0.0-26",
27
- "@fgv/ts-json": "5.0.0-26",
28
- "@fgv/ts-json-base": "5.0.0-26",
29
- "@fgv/ts-utils": "5.0.0-26",
30
- "@fgv/ts-extras": "5.0.0-26"
26
+ "@fgv/ts-res": "5.0.0-27",
27
+ "@fgv/ts-json-base": "5.0.0-27",
28
+ "@fgv/ts-json": "5.0.0-27",
29
+ "@fgv/ts-extras": "5.0.0-27",
30
+ "@fgv/ts-utils": "5.0.0-27"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": ">=18.0.0",
@@ -55,14 +55,14 @@
55
55
  "rimraf": "^6.0.1",
56
56
  "ts-jest": "^29.4.1",
57
57
  "typescript": "5.8.3",
58
- "@rushstack/heft": "0.74.3",
59
- "@rushstack/heft-web-rig": "0.29.8",
58
+ "@rushstack/heft": "0.74.4",
59
+ "@rushstack/heft-web-rig": "0.29.9",
60
60
  "@rushstack/eslint-config": "4.4.0",
61
- "@rushstack/heft-jest-plugin": "0.16.12",
61
+ "@rushstack/heft-jest-plugin": "0.16.13",
62
62
  "@microsoft/api-documenter": "^7.26.31",
63
63
  "@microsoft/api-extractor": "^7.52.10",
64
64
  "@testing-library/dom": "^10.4.0",
65
- "@fgv/ts-utils-jest": "5.0.0-26"
65
+ "@fgv/ts-utils-jest": "5.0.0-27"
66
66
  },
67
67
  "scripts": {
68
68
  "build": "heft build --clean",