@fgv/ts-res 5.1.0-28 → 5.1.0-29

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 (57) hide show
  1. package/dist/packlets/conditions/conditionDecls.js.map +1 -1
  2. package/dist/packlets/conditions/conditionSet.js +14 -5
  3. package/dist/packlets/conditions/conditionSet.js.map +1 -1
  4. package/dist/packlets/conditions/conditionSetDecls.js.map +1 -1
  5. package/dist/packlets/conditions/convert/conditionSetDecls.js +50 -6
  6. package/dist/packlets/conditions/convert/conditionSetDecls.js.map +1 -1
  7. package/dist/packlets/conditions/convert/decls.js +61 -5
  8. package/dist/packlets/conditions/convert/decls.js.map +1 -1
  9. package/dist/packlets/qualifiers/qualifierCollector.js +151 -7
  10. package/dist/packlets/qualifiers/qualifierCollector.js.map +1 -1
  11. package/dist/packlets/resource-json/convert.js +225 -0
  12. package/dist/packlets/resource-json/convert.js.map +1 -1
  13. package/dist/packlets/resource-json/json.js +2 -2
  14. package/dist/packlets/resource-json/json.js.map +1 -1
  15. package/dist/packlets/runtime/context/simpleContextQualifierProvider.js +3 -0
  16. package/dist/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -1
  17. package/dist/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +3 -5
  18. package/dist/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -1
  19. package/dist/ts-res.d.ts +442 -52
  20. package/lib/packlets/conditions/conditionDecls.d.ts +6 -1
  21. package/lib/packlets/conditions/conditionDecls.d.ts.map +1 -1
  22. package/lib/packlets/conditions/conditionDecls.js.map +1 -1
  23. package/lib/packlets/conditions/conditionSet.d.ts.map +1 -1
  24. package/lib/packlets/conditions/conditionSet.js +14 -5
  25. package/lib/packlets/conditions/conditionSet.js.map +1 -1
  26. package/lib/packlets/conditions/conditionSetDecls.d.ts +7 -2
  27. package/lib/packlets/conditions/conditionSetDecls.d.ts.map +1 -1
  28. package/lib/packlets/conditions/conditionSetDecls.js.map +1 -1
  29. package/lib/packlets/conditions/convert/conditionSetDecls.d.ts +30 -2
  30. package/lib/packlets/conditions/convert/conditionSetDecls.d.ts.map +1 -1
  31. package/lib/packlets/conditions/convert/conditionSetDecls.js +51 -5
  32. package/lib/packlets/conditions/convert/conditionSetDecls.js.map +1 -1
  33. package/lib/packlets/conditions/convert/decls.d.ts +39 -3
  34. package/lib/packlets/conditions/convert/decls.d.ts.map +1 -1
  35. package/lib/packlets/conditions/convert/decls.js +63 -5
  36. package/lib/packlets/conditions/convert/decls.js.map +1 -1
  37. package/lib/packlets/qualifiers/qualifierCollector.d.ts +104 -6
  38. package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +1 -1
  39. package/lib/packlets/qualifiers/qualifierCollector.js +150 -6
  40. package/lib/packlets/qualifiers/qualifierCollector.js.map +1 -1
  41. package/lib/packlets/resource-json/convert.d.ts +85 -0
  42. package/lib/packlets/resource-json/convert.d.ts.map +1 -1
  43. package/lib/packlets/resource-json/convert.js +237 -0
  44. package/lib/packlets/resource-json/convert.js.map +1 -1
  45. package/lib/packlets/resource-json/json.d.ts +128 -39
  46. package/lib/packlets/resource-json/json.d.ts.map +1 -1
  47. package/lib/packlets/resource-json/json.js +2 -2
  48. package/lib/packlets/resource-json/json.js.map +1 -1
  49. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts +9 -2
  50. package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +1 -1
  51. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +3 -0
  52. package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +1 -1
  53. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts +8 -1
  54. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +1 -1
  55. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +3 -5
  56. package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +1 -1
  57. package/package.json +9 -9
package/dist/ts-res.d.ts CHANGED
@@ -1357,9 +1357,14 @@ declare class ConditionCollector extends ValidatingCollector<Condition> {
1357
1357
 
1358
1358
  /**
1359
1359
  * Converter for a {@link Conditions.IConditionDecl | condition declaration}.
1360
+ *
1361
+ * @remarks
1362
+ * Accepts any string as the `qualifierName`. Use `typedConditionDecl` to narrow the
1363
+ * accepted set of qualifier names to a literal-string union.
1364
+ *
1360
1365
  * @public
1361
1366
  */
1362
- declare const conditionDecl: ObjectConverter<ILooseConditionDecl, unknown>;
1367
+ declare const conditionDecl: ObjectConverter<IConditionDecl, unknown>;
1363
1368
 
1364
1369
  /**
1365
1370
  * Branded number representing a validated condition index.
@@ -1618,10 +1623,18 @@ declare class ConditionSetCollector extends ValidatingCollector<ConditionSet> {
1618
1623
  }
1619
1624
 
1620
1625
  /**
1621
- * Non-validated declaration of a {@link Conditions.Condition | condition}.
1626
+ * Non-validated declaration of a {@link Conditions.ConditionSet | condition set}.
1627
+ *
1628
+ * @remarks
1629
+ * Parameterized on `TQualifierNames`; defaults to `string`. Both the
1630
+ * array form (`ConditionSetDeclAsArray`) and the record form
1631
+ * (`ConditionSetDeclAsRecord`) inherit the parameter, so a
1632
+ * consumer threading a narrow `TQualifierNames` gets compile-time
1633
+ * rejection of typo'd axis names in either form.
1634
+ *
1622
1635
  * @public
1623
1636
  */
1624
- declare type ConditionSetDecl = ConditionSetDeclAsArray | ConditionSetDeclAsRecord;
1637
+ declare type ConditionSetDecl<TQualifierNames extends string = string> = ConditionSetDeclAsArray<TQualifierNames> | ConditionSetDeclAsRecord<TQualifierNames>;
1625
1638
 
1626
1639
  /**
1627
1640
  * `Converter` for a normalized {@link ResourceJson.Normalized.ConditionSetDecl | condition set declaration}.
@@ -1637,21 +1650,38 @@ declare type ConditionSetDecl_2 = ReadonlyArray<ILooseConditionDecl>;
1637
1650
 
1638
1651
  /**
1639
1652
  * Converter which converts to a {@link Conditions.IConditionSetDecl | condition set declaration}.
1653
+ *
1654
+ * @remarks
1655
+ * Accepts any string as the qualifier name of each contained condition. Use
1656
+ * `typedConditionSetDecl` to narrow the accepted set of qualifier names to a literal-string union.
1657
+ *
1640
1658
  * @public
1641
1659
  */
1642
- declare const conditionSetDecl_2: ObjectConverter<IConditionSetDecl, unknown>;
1660
+ declare const conditionSetDecl_2: ObjectConverter<IConditionSetDecl<string>, unknown>;
1643
1661
 
1644
1662
  /**
1645
- * Non-validated declaration of a {@link Conditions.Condition | condition}.
1663
+ * Non-validated array-form declaration of a {@link Conditions.ConditionSet | condition set}.
1664
+ *
1665
+ * @remarks
1666
+ * Parameterized on `TQualifierNames` via `ILooseConditionDecl`;
1667
+ * defaults to `string` for back-compat with existing untyped callers.
1668
+ *
1646
1669
  * @public
1647
1670
  */
1648
- declare type ConditionSetDeclAsArray = ReadonlyArray<ILooseConditionDecl>;
1671
+ declare type ConditionSetDeclAsArray<TQualifierNames extends string = string> = ReadonlyArray<ILooseConditionDecl<TQualifierNames>>;
1649
1672
 
1650
1673
  /**
1651
- * Non-validated declaration of a {@link Conditions.Condition | condition}.
1674
+ * Non-validated record-form declaration of a {@link Conditions.ConditionSet | condition set}.
1675
+ *
1676
+ * @remarks
1677
+ * Parameterized on `TQualifierNames`; defaults to `string` for back-compat with
1678
+ * existing untyped callers. Uses `Readonly<Partial<Record<...>>>` to align with
1679
+ * runtime reality (missing keys produce `undefined`; the `Partial` makes TypeScript
1680
+ * aware of this, which is a strict type-system tightening).
1681
+ *
1652
1682
  * @public
1653
1683
  */
1654
- declare type ConditionSetDeclAsRecord = Record<string, string | IChildConditionDecl>;
1684
+ declare type ConditionSetDeclAsRecord<TQualifierNames extends string = string> = Readonly<Partial<Record<TQualifierNames, string | IChildConditionDecl>>>;
1655
1685
 
1656
1686
  /**
1657
1687
  * Branded string representing a hash value for a condition set. The hash value
@@ -2210,9 +2240,13 @@ declare namespace Convert_10 {
2210
2240
 
2211
2241
  declare namespace Convert_11 {
2212
2242
  export {
2243
+ typedConditionDecl,
2244
+ typedValidatedConditionDecl,
2213
2245
  conditionDecl,
2214
2246
  IConditionDeclConvertContext,
2215
2247
  validatedConditionDecl,
2248
+ typedConditionSetDecl_2 as typedConditionSetDecl,
2249
+ typedValidatedConditionSetDecl,
2216
2250
  conditionSetDecl_2 as conditionSetDecl,
2217
2251
  IConditionSetDeclConvertContext,
2218
2252
  validatedConditionSetDecl
@@ -2291,6 +2325,18 @@ declare namespace Convert_6 {
2291
2325
 
2292
2326
  declare namespace Convert_7 {
2293
2327
  export {
2328
+ typedLooseConditionDecl,
2329
+ typedConditionSetDecl,
2330
+ typedLooseResourceCandidateDecl,
2331
+ typedImporterResourceCandidateDecl,
2332
+ typedChildResourceCandidateDecl,
2333
+ typedLooseResourceDecl,
2334
+ typedChildResourceDecl,
2335
+ typedContainerContextDecl,
2336
+ typedResourceTreeChildNodeDecl,
2337
+ typedResourceTreeRootDecl,
2338
+ typedResourceCollectionDecl,
2339
+ typedImporterResourceCollectionDecl,
2294
2340
  looseConditionDecl,
2295
2341
  childConditionDecl,
2296
2342
  conditionSetDecl,
@@ -3259,9 +3305,15 @@ declare interface IChildConditionDecl {
3259
3305
 
3260
3306
  /**
3261
3307
  * Non-validated child declaration of a {@link Resources.ResourceCandidate | resource candidate}.
3308
+ *
3309
+ * @remarks
3310
+ * Parameterized on `TQualifierNames` so the `conditions` field can carry a
3311
+ * narrowed axis-name set. Defaults to `string` so existing untyped callers
3312
+ * compile unchanged.
3313
+ *
3262
3314
  * @public
3263
3315
  */
3264
- declare interface IChildResourceCandidateDecl {
3316
+ declare interface IChildResourceCandidateDecl<TQualifierNames extends string = string> {
3265
3317
  /**
3266
3318
  * The JSON value of the resource.
3267
3319
  */
@@ -3269,7 +3321,7 @@ declare interface IChildResourceCandidateDecl {
3269
3321
  /**
3270
3322
  * The conditions that must be met for the resource to be selected.
3271
3323
  */
3272
- readonly conditions?: ConditionSetDecl;
3324
+ readonly conditions?: ConditionSetDecl<TQualifierNames>;
3273
3325
  /**
3274
3326
  * If true, the resource is only a partial representation of the full resource.
3275
3327
  */
@@ -3307,9 +3359,15 @@ declare interface IChildResourceCandidateDecl_2 {
3307
3359
 
3308
3360
  /**
3309
3361
  * Non-validated child declaration of a {@link Resources.Resource | resource}.
3362
+ *
3363
+ * @remarks
3364
+ * Parameterized on `TQualifierNames` so the `candidates` field threads the
3365
+ * narrowed axis-name set down to each candidate. Defaults to `string` for
3366
+ * back-compat.
3367
+ *
3310
3368
  * @public
3311
3369
  */
3312
- declare interface IChildResourceDecl {
3370
+ declare interface IChildResourceDecl<TQualifierNames extends string = string> {
3313
3371
  /**
3314
3372
  * The name of the type of this resource.
3315
3373
  */
@@ -3317,7 +3375,7 @@ declare interface IChildResourceDecl {
3317
3375
  /**
3318
3376
  * Possible candidates for this value.
3319
3377
  */
3320
- readonly candidates?: ReadonlyArray<IChildResourceCandidateDecl>;
3378
+ readonly candidates?: ReadonlyArray<IChildResourceCandidateDecl<TQualifierNames>>;
3321
3379
  }
3322
3380
 
3323
3381
  /**
@@ -3643,9 +3701,14 @@ declare interface IConditionCollectorCreateParams {
3643
3701
 
3644
3702
  /**
3645
3703
  * Non-validated declaration of a {@link Conditions.Condition | condition}.
3704
+ *
3705
+ * @remarks
3706
+ * Parameterized on `TQualifierNames` (defaulting to `string`) so consumers
3707
+ * authoring conditions in code can opt into compile-time axis-name discipline.
3708
+ *
3646
3709
  * @public
3647
3710
  */
3648
- declare type IConditionDecl = ResourceJson.Json.ILooseConditionDecl;
3711
+ declare type IConditionDecl<TQualifierNames extends string = string> = ResourceJson.Json.ILooseConditionDecl<TQualifierNames>;
3649
3712
 
3650
3713
  /**
3651
3714
  * Conversion context to uses when converting
@@ -3686,10 +3749,15 @@ declare interface IConditionSetCollectorCreateParams {
3686
3749
 
3687
3750
  /**
3688
3751
  * Non-validated declaration of a {@link Conditions.ConditionSet | set of conditions}.
3752
+ *
3753
+ * @remarks
3754
+ * Parameterized on `TQualifierNames` (defaulting to `string`) so consumers can
3755
+ * opt into compile-time axis-name discipline by supplying a literal-string union.
3756
+ *
3689
3757
  * @public
3690
3758
  */
3691
- declare interface IConditionSetDecl {
3692
- conditions: IConditionDecl[];
3759
+ declare interface IConditionSetDecl<TQualifierNames extends string = string> {
3760
+ conditions: IConditionDecl<TQualifierNames>[];
3693
3761
  }
3694
3762
 
3695
3763
  /**
@@ -3741,11 +3809,17 @@ declare interface IConfigInitFactory<TConfig, T> {
3741
3809
 
3742
3810
  /**
3743
3811
  * Declared context for a resource container.
3812
+ *
3813
+ * @remarks
3814
+ * Parameterized on `TQualifierNames` so the `conditions` field threads the
3815
+ * narrowed axis-name set to the container context. Defaults to `string` for
3816
+ * back-compat.
3817
+ *
3744
3818
  * @public
3745
3819
  */
3746
- declare interface IContainerContextDecl {
3820
+ declare interface IContainerContextDecl<TQualifierNames extends string = string> {
3747
3821
  readonly baseId?: string;
3748
- readonly conditions?: ConditionSetDecl;
3822
+ readonly conditions?: ConditionSetDecl<TQualifierNames>;
3749
3823
  readonly mergeMethod?: ResourceValueMergeMethod;
3750
3824
  }
3751
3825
 
@@ -4223,9 +4297,14 @@ declare interface IImporterCreateParams {
4223
4297
  /**
4224
4298
  * Non-validated declaration of a resource candidate for import,
4225
4299
  * which can be either a loose or child resource candidate.
4300
+ *
4301
+ * @remarks
4302
+ * Parameterized on `TQualifierNames`; inherits via `IChildResourceCandidateDecl`.
4303
+ * Defaults to `string` for back-compat.
4304
+ *
4226
4305
  * @public
4227
4306
  */
4228
- declare interface IImporterResourceCandidateDecl extends IChildResourceCandidateDecl {
4307
+ declare interface IImporterResourceCandidateDecl<TQualifierNames extends string = string> extends IChildResourceCandidateDecl<TQualifierNames> {
4229
4308
  /**
4230
4309
  * The {@link ResourceId | id} of the resource.
4231
4310
  */
@@ -4254,13 +4333,19 @@ declare interface IImporterResourceCandidateDecl_2 extends IChildResourceCandida
4254
4333
 
4255
4334
  /**
4256
4335
  * Non-validated declaration of a collection of resources for an importer.
4336
+ *
4337
+ * @remarks
4338
+ * Parameterized on `TQualifierNames` so the `context`, `candidates`, and
4339
+ * `resources` fields thread the narrowed axis-name set throughout the
4340
+ * importer collection. Defaults to `string` for back-compat.
4341
+ *
4257
4342
  * @public
4258
4343
  */
4259
- declare interface IImporterResourceCollectionDecl {
4260
- readonly context?: IContainerContextDecl;
4261
- readonly candidates?: ReadonlyArray<IImporterResourceCandidateDecl>;
4262
- readonly resources?: ReadonlyArray<IImporterResourceDecl>;
4263
- readonly collections?: ReadonlyArray<IImporterResourceCollectionDecl>;
4344
+ declare interface IImporterResourceCollectionDecl<TQualifierNames extends string = string> {
4345
+ readonly context?: IContainerContextDecl<TQualifierNames>;
4346
+ readonly candidates?: ReadonlyArray<IImporterResourceCandidateDecl<TQualifierNames>>;
4347
+ readonly resources?: ReadonlyArray<IImporterResourceDecl<TQualifierNames>>;
4348
+ readonly collections?: ReadonlyArray<IImporterResourceCollectionDecl<TQualifierNames>>;
4264
4349
  readonly metadata?: JsonObject;
4265
4350
  }
4266
4351
 
@@ -4280,9 +4365,13 @@ declare interface IImporterResourceCollectionDecl_2 {
4280
4365
  /**
4281
4366
  * Non-validated declaration of a resource for import,
4282
4367
  * which can be either a loose or child resource.
4368
+ *
4369
+ * @remarks
4370
+ * Parameterized on `TQualifierNames`; defaults to `string` for back-compat.
4371
+ *
4283
4372
  * @public
4284
4373
  */
4285
- declare type IImporterResourceDecl = ILooseResourceDecl | IChildResourceDecl;
4374
+ declare type IImporterResourceDecl<TQualifierNames extends string = string> = ILooseResourceDecl<TQualifierNames> | IChildResourceDecl<TQualifierNames>;
4286
4375
 
4287
4376
  /**
4288
4377
  * Normalized non-validated declaration of a resource for import,
@@ -4407,13 +4496,21 @@ declare interface ILiteralValueHierarchyCreateParams<T extends string = string>
4407
4496
 
4408
4497
  /**
4409
4498
  * Non-validated loose declaration of a {@link Conditions.Condition | condition}.
4499
+ *
4500
+ * @remarks
4501
+ * Parameterized on `TQualifierNames` so consumers authoring conditions
4502
+ * in code can opt into compile-time axis-name discipline (e.g. via a
4503
+ * literal-string union derived from a `qualifiers: ['tone'] as const`
4504
+ * decl-array). Defaults to `string`, so existing untyped callers
4505
+ * compile unchanged.
4506
+ *
4410
4507
  * @public
4411
4508
  */
4412
- declare interface ILooseConditionDecl {
4509
+ declare interface ILooseConditionDecl<TQualifierNames extends string = string> {
4413
4510
  /**
4414
4511
  * The name of the {@link Qualifiers.Qualifier | qualifier} to be compared.
4415
4512
  */
4416
- qualifierName: string;
4513
+ qualifierName: TQualifierNames;
4417
4514
  /**
4418
4515
  * The value to be compared.
4419
4516
  */
@@ -4435,9 +4532,14 @@ declare interface ILooseConditionDecl {
4435
4532
 
4436
4533
  /**
4437
4534
  * Non-validated loose declaration of a {@link Resources.ResourceCandidate | resource candidate}.
4535
+ *
4536
+ * @remarks
4537
+ * Parameterized on `TQualifierNames`; inherits via `IChildResourceCandidateDecl`.
4538
+ * Defaults to `string` for back-compat.
4539
+ *
4438
4540
  * @public
4439
4541
  */
4440
- declare interface ILooseResourceCandidateDecl extends IChildResourceCandidateDecl {
4542
+ declare interface ILooseResourceCandidateDecl<TQualifierNames extends string = string> extends IChildResourceCandidateDecl<TQualifierNames> {
4441
4543
  /**
4442
4544
  * The {@link ResourceId | id} of the resource.
4443
4545
  */
@@ -4449,7 +4551,7 @@ declare interface ILooseResourceCandidateDecl extends IChildResourceCandidateDec
4449
4551
  /**
4450
4552
  * The conditions that must be met for the resource to be selected.
4451
4553
  */
4452
- readonly conditions?: ConditionSetDecl;
4554
+ readonly conditions?: ConditionSetDecl<TQualifierNames>;
4453
4555
  /**
4454
4556
  * If true, the resource is only a partial representation of the full resource.
4455
4557
  */
@@ -4499,9 +4601,14 @@ declare interface ILooseResourceCandidateDecl_2 extends IChildResourceCandidateD
4499
4601
 
4500
4602
  /**
4501
4603
  * Non-validated loose declaration of a {@link Resources.Resource | resource}.
4604
+ *
4605
+ * @remarks
4606
+ * Parameterized on `TQualifierNames`; inherits via `IChildResourceDecl`.
4607
+ * Defaults to `string` for back-compat.
4608
+ *
4502
4609
  * @public
4503
4610
  */
4504
- declare interface ILooseResourceDecl extends IChildResourceDecl {
4611
+ declare interface ILooseResourceDecl<TQualifierNames extends string = string> extends IChildResourceDecl<TQualifierNames> {
4505
4612
  /**
4506
4613
  * The id of the resource.
4507
4614
  */
@@ -4513,7 +4620,7 @@ declare interface ILooseResourceDecl extends IChildResourceDecl {
4513
4620
  /**
4514
4621
  * Possible candidates for this value.
4515
4622
  */
4516
- readonly candidates?: ReadonlyArray<IChildResourceCandidateDecl>;
4623
+ readonly candidates?: ReadonlyArray<IChildResourceCandidateDecl<TQualifierNames>>;
4517
4624
  }
4518
4625
 
4519
4626
  /**
@@ -4827,18 +4934,49 @@ declare interface IPathImporterCreateParams {
4827
4934
  /**
4828
4935
  * Parameters for creating a new {@link Qualifiers.QualifierCollector}.
4829
4936
  * @public
4937
+ *
4938
+ * @remarks
4939
+ * `qualifiers` accepts a mixed array of bare axis-name strings and full
4940
+ * {@link Qualifiers.IQualifierDecl | declarations}. A string element is
4941
+ * sugar for "literal qualifier with this name"; the library synthesizes a
4942
+ * {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType} and a
4943
+ * declaration `{ name, typeName: name, defaultPriority: <descending> }`.
4944
+ *
4945
+ * Synthesized priorities are distributed across the
4946
+ * `[MinConditionPriority..MaxConditionPriority]` range adaptively to the
4947
+ * array length: `step = max(1, floor((Max - Min) / length))`,
4948
+ * `priority = max(Min, Max - index * step)`. Earlier elements get higher
4949
+ * priority. The formula never overflows the `ConditionPriority` range
4950
+ * regardless of input length; for inputs whose length exceeds the range
4951
+ * cardinality (\>1000 axes), trailing priorities collapse at
4952
+ * `MinConditionPriority` — supply explicit priorities in that regime
4953
+ * if uniqueness matters.
4954
+ *
4955
+ * `qualifierTypes` may be omitted only when every element of `qualifiers`
4956
+ * is a string. If any element is an {@link Qualifiers.IQualifierDecl},
4957
+ * `qualifierTypes` must be supplied and must contain the referenced
4958
+ * {@link Qualifiers.IQualifierDecl.typeName | typeNames}.
4830
4959
  */
4831
4960
  declare interface IQualifierCollectorCreateParams {
4832
4961
  /**
4833
4962
  * The {@link QualifierTypes.QualifierTypeCollector | qualifier types} used to
4834
4963
  * create {@link Qualifiers.Qualifier | qualifiers} from {@link Qualifiers.IQualifierDecl | declarations}.
4964
+ *
4965
+ * Optional only when every entry in `qualifiers` is a bare axis-name string
4966
+ * (in which case the library synthesizes a literal qualifier type per name).
4835
4967
  */
4836
- qualifierTypes: ReadOnlyQualifierTypeCollector;
4968
+ qualifierTypes?: ReadOnlyQualifierTypeCollector;
4837
4969
  /**
4838
- * Optional list of {@link Qualifiers.IQualifierDecl | declarations} for the qualifiers to add to the collection
4839
- * upon creation.
4970
+ * Optional list of {@link Qualifiers.IQualifierDecl | declarations} or bare
4971
+ * axis-name strings for the qualifiers to add to the collection on creation.
4972
+ *
4973
+ * @remarks
4974
+ * A string element `'foo'` is sugar for a literal qualifier:
4975
+ * `{ name: 'foo', typeName: 'foo', defaultPriority: <descending> }` backed by
4976
+ * a synthesized {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}
4977
+ * named `'foo'`.
4840
4978
  */
4841
- qualifiers?: IQualifierDecl[];
4979
+ qualifiers?: ReadonlyArray<string | IQualifierDecl>;
4842
4980
  }
4843
4981
 
4844
4982
  /**
@@ -5314,13 +5452,19 @@ declare interface IResourceCandidateValidationProperties {
5314
5452
 
5315
5453
  /**
5316
5454
  * Non-validated declaration of a collection of resources.
5455
+ *
5456
+ * @remarks
5457
+ * Parameterized on `TQualifierNames` so the `context`, `candidates`, and
5458
+ * `resources` fields thread the narrowed axis-name set throughout the
5459
+ * collection. Defaults to `string` for back-compat.
5460
+ *
5317
5461
  * @public
5318
5462
  */
5319
- declare interface IResourceCollectionDecl {
5320
- readonly context?: IContainerContextDecl;
5321
- readonly candidates?: ReadonlyArray<ILooseResourceCandidateDecl>;
5322
- readonly resources?: ReadonlyArray<ILooseResourceDecl>;
5323
- readonly collections?: ReadonlyArray<IResourceCollectionDecl>;
5463
+ declare interface IResourceCollectionDecl<TQualifierNames extends string = string> {
5464
+ readonly context?: IContainerContextDecl<TQualifierNames>;
5465
+ readonly candidates?: ReadonlyArray<ILooseResourceCandidateDecl<TQualifierNames>>;
5466
+ readonly resources?: ReadonlyArray<ILooseResourceDecl<TQualifierNames>>;
5467
+ readonly collections?: ReadonlyArray<IResourceCollectionDecl<TQualifierNames>>;
5324
5468
  readonly metadata?: JsonObject;
5325
5469
  }
5326
5470
 
@@ -5644,11 +5788,17 @@ declare interface IResourceTreeBranchInit<T> {
5644
5788
 
5645
5789
  /**
5646
5790
  * Normalized non-validated declaration of a {@link Resources.Resource | resource} tree node.
5791
+ *
5792
+ * @remarks
5793
+ * Parameterized on `TQualifierNames` so the `resources` and `children` fields
5794
+ * thread the narrowed axis-name set throughout the tree. Defaults to `string` for
5795
+ * back-compat.
5796
+ *
5647
5797
  * @public
5648
5798
  */
5649
- declare interface IResourceTreeChildNodeDecl {
5650
- readonly resources?: Record<string, IChildResourceDecl>;
5651
- readonly children?: Record<string, IResourceTreeChildNodeDecl>;
5799
+ declare interface IResourceTreeChildNodeDecl<TQualifierNames extends string = string> {
5800
+ readonly resources?: Record<string, IChildResourceDecl<TQualifierNames>>;
5801
+ readonly children?: Record<string, IResourceTreeChildNodeDecl<TQualifierNames>>;
5652
5802
  }
5653
5803
 
5654
5804
  /**
@@ -5670,12 +5820,18 @@ declare interface IResourceTreeLeafInit<T> {
5670
5820
 
5671
5821
  /**
5672
5822
  * Normalized non-validated declaration of a {@link Resources.Resource | resource} tree root.
5823
+ *
5824
+ * @remarks
5825
+ * Parameterized on `TQualifierNames` so the `context` field threads the
5826
+ * narrowed axis-name set to the tree root context. Defaults to `string` for
5827
+ * back-compat.
5828
+ *
5673
5829
  * @public
5674
5830
  */
5675
- declare interface IResourceTreeRootDecl extends IResourceTreeChildNodeDecl {
5676
- readonly context?: IContainerContextDecl;
5677
- readonly resources?: Record<string, IChildResourceDecl>;
5678
- readonly children?: Record<string, IResourceTreeChildNodeDecl>;
5831
+ declare interface IResourceTreeRootDecl<TQualifierNames extends string = string> extends IResourceTreeChildNodeDecl<TQualifierNames> {
5832
+ readonly context?: IContainerContextDecl<TQualifierNames>;
5833
+ readonly resources?: Record<string, IChildResourceDecl<TQualifierNames>>;
5834
+ readonly children?: Record<string, IResourceTreeChildNodeDecl<TQualifierNames>>;
5679
5835
  readonly metadata?: JsonObject;
5680
5836
  }
5681
5837
 
@@ -5787,8 +5943,15 @@ declare interface ISimpleContextQualifierProviderCreateParams {
5787
5943
  qualifiers: IReadOnlyQualifierCollector;
5788
5944
  /**
5789
5945
  * Optional record of initial qualifier name-value pairs to populate the provider.
5946
+ *
5947
+ * @remarks
5948
+ * Typed as `Readonly<Partial<Record<string, QualifierContextValue>>>` so a
5949
+ * caller can naturally express conditional context construction, e.g.
5950
+ * `tone === 'formal' ? { tone: 'formal' } : {}`. Entries whose value is
5951
+ * `undefined` are skipped on load - semantically equivalent to omitting
5952
+ * the key, which is how the candidate selector treats a missing key.
5790
5953
  */
5791
- qualifierValues?: Record<string, QualifierContextValue>;
5954
+ qualifierValues?: Readonly<Partial<Record<string, QualifierContextValue>>>;
5792
5955
  }
5793
5956
 
5794
5957
  /**
@@ -5804,13 +5967,13 @@ declare function isImportable(i: IImportable): i is Importable;
5804
5967
  * Type guard function to check if a resource candidate declaration is a loose resource candidate declaration.
5805
5968
  * @public
5806
5969
  */
5807
- declare function isLooseResourceCandidateDecl(decl: IImporterResourceCandidateDecl): decl is ILooseResourceCandidateDecl;
5970
+ declare function isLooseResourceCandidateDecl<TQualifierNames extends string = string>(decl: IImporterResourceCandidateDecl<TQualifierNames>): decl is ILooseResourceCandidateDecl<TQualifierNames>;
5808
5971
 
5809
5972
  /**
5810
5973
  * Type guard function to check if a resource declaration is a loose resource declaration.
5811
5974
  * @public
5812
5975
  */
5813
- declare function isLooseResourceDecl(decl: IImporterResourceDecl): decl is ILooseResourceDecl;
5976
+ declare function isLooseResourceDecl<TQualifierNames extends string = string>(decl: IImporterResourceDecl<TQualifierNames>): decl is ILooseResourceDecl<TQualifierNames>;
5814
5977
 
5815
5978
  /**
5816
5979
  * Type guard to determine if an init object represents a leaf node with a resource.
@@ -6321,8 +6484,15 @@ declare interface IValidatingSimpleContextQualifierProviderCreateParams {
6321
6484
  /**
6322
6485
  * Optional record of initial qualifier name-value pairs to populate the provider.
6323
6486
  * Accepts string keys and values which will be converted to strongly-typed values.
6487
+ *
6488
+ * @remarks
6489
+ * Typed as `Readonly<Partial<Record<string, string>>>` so callers can
6490
+ * naturally express conditional context construction, e.g.
6491
+ * `tone === 'formal' ? { tone: 'formal' } : {}`. Entries whose value is
6492
+ * `undefined` are skipped on load - semantically equivalent to omitting
6493
+ * the key.
6324
6494
  */
6325
- qualifierValues?: Record<string, string>;
6495
+ qualifierValues?: Readonly<Partial<Record<string, string>>>;
6326
6496
  }
6327
6497
 
6328
6498
  /**
@@ -7416,16 +7586,83 @@ declare class QualifierCollector extends ValidatingConvertingCollector<Qualifier
7416
7586
  qualifierTypes: ReadOnlyQualifierTypeCollector;
7417
7587
  /**
7418
7588
  * Constructor for a {@link Qualifiers.QualifierCollector | QualifierCollector} object.
7419
- * @param params - Parameters for creating the collector.
7589
+ * @param qualifierTypes - The {@link QualifierTypes.ReadOnlyQualifierTypeCollector | qualifier types}
7590
+ * used to validate declarations.
7591
+ * @param qualifiers - Optional list of fully-resolved {@link Qualifiers.IQualifierDecl | declarations}.
7420
7592
  * @public
7421
7593
  */
7422
- protected constructor(params: IQualifierCollectorCreateParams);
7594
+ protected constructor(qualifierTypes: ReadOnlyQualifierTypeCollector, qualifiers?: ReadonlyArray<IQualifierDecl>);
7423
7595
  /**
7424
7596
  * Creates a new {@link Qualifiers.QualifierCollector | QualifierCollector} object.
7425
7597
  * @param params - {@link Qualifiers.IQualifierCollectorCreateParams | Parameters} for creating a new {@link Qualifiers.QualifierCollector | QualifierCollector}.
7426
7598
  * @returns `Success` with the new collector if successful, or `Failure` if not.
7599
+ *
7600
+ * @remarks
7601
+ * Accepts a mixed array of bare axis-name strings and full
7602
+ * {@link Qualifiers.IQualifierDecl | declarations}. String elements are sugar
7603
+ * for a literal qualifier: the library synthesizes a
7604
+ * {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType} named
7605
+ * after the string and a declaration `{ name, typeName: name, defaultPriority }`.
7606
+ * Synthesized priorities are distributed across the
7607
+ * `[MinConditionPriority..MaxConditionPriority]` range adaptively to the
7608
+ * input length (`step = max(1, floor((Max - Min) / length))`,
7609
+ * `priority = max(Min, Max - index * step)`). Earlier elements get higher
7610
+ * priority — matching the "earlier qualifier wins when multiple match"
7611
+ * mental model — and the formula never overflows the `ConditionPriority`
7612
+ * range regardless of input length.
7613
+ *
7614
+ * `qualifierTypes` may be omitted only when every element of `qualifiers`
7615
+ * is a string. If any element is a declaration, `qualifierTypes` is
7616
+ * required (and must include the referenced typeNames); the error message
7617
+ * names the offending typeName when it is missing.
7427
7618
  */
7428
7619
  static create(params: IQualifierCollectorCreateParams): Result<QualifierCollector>;
7620
+ /**
7621
+ * Resolves the public {@link Qualifiers.IQualifierCollectorCreateParams | create params}
7622
+ * into the concrete `(qualifierTypes, qualifiers)` pair the constructor expects.
7623
+ *
7624
+ * @remarks
7625
+ * Validates the mixed-shape `qualifiers` input through
7626
+ * {@link Converters.oneOf} (string vs {@link Qualifiers.IQualifierDecl})
7627
+ * at the public-API boundary, then partitions into bare-string and decl
7628
+ * buckets to drive type synthesis. If any decl is present and
7629
+ * `qualifierTypes` is omitted, fails with an error that names the
7630
+ * offending typeNames.
7631
+ *
7632
+ * @internal
7633
+ */
7634
+ private static _resolveCreateParams;
7635
+ /**
7636
+ * Returns the provided {@link QualifierTypes.ReadOnlyQualifierTypeCollector | qualifier-type collector}
7637
+ * (or synthesizes a new one) augmented with synthesized literal qualifier types for the supplied
7638
+ * string names that are not already present.
7639
+ *
7640
+ * @internal
7641
+ */
7642
+ private static _resolveQualifierTypes;
7643
+ /**
7644
+ * Normalizes a mixed `(string | IQualifierDecl)[]` into a fully-resolved
7645
+ * `IQualifierDecl[]`, assigning descending default priorities to synthesized
7646
+ * decls within the `[MinConditionPriority..MaxConditionPriority]` range.
7647
+ *
7648
+ * @remarks
7649
+ * Step size is adaptive to input length:
7650
+ * `step = max(1, floor((Max - Min) / length))`. Each synthesized priority
7651
+ * is `max(Min, Max - index * step)` — clamped at the bottom so length
7652
+ * extremes (\>1000 axes) degrade gracefully into a tail of equal-`Min`
7653
+ * priorities rather than overflowing the `ConditionPriority` range.
7654
+ *
7655
+ * @internal
7656
+ */
7657
+ private static _normalizeQualifierDecls;
7658
+ /**
7659
+ * Returns an empty {@link QualifierTypes.ReadOnlyQualifierTypeCollector | qualifier-type collector}
7660
+ * used as a placeholder when no qualifiers are supplied and the caller omits
7661
+ * `qualifierTypes`.
7662
+ *
7663
+ * @internal
7664
+ */
7665
+ private static _emptyQualifierTypes;
7429
7666
  /**
7430
7667
  * {@inheritDoc Qualifiers.IReadOnlyQualifierCollector.getByNameOrToken}
7431
7668
  */
@@ -10400,6 +10637,148 @@ declare function toResourceTypeIndex(index: number): Result<ResourceTypeIndex>;
10400
10637
  */
10401
10638
  declare function toResourceTypeName(name: string): Result<ResourceTypeName>;
10402
10639
 
10640
+ /**
10641
+ * Returns a `Converter` for a `Json.IChildResourceCandidateDecl<TQualifierNames>`
10642
+ * narrowed on a supplied `qualifierName` converter.
10643
+ *
10644
+ * @public
10645
+ */
10646
+ declare function typedChildResourceCandidateDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<Json.IChildResourceCandidateDecl<TQualifierNames>>;
10647
+
10648
+ /**
10649
+ * Returns a `Converter` for a `Json.IChildResourceDecl<TQualifierNames>`
10650
+ * narrowed on a supplied `qualifierName` converter.
10651
+ *
10652
+ * @public
10653
+ */
10654
+ declare function typedChildResourceDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<Json.IChildResourceDecl<TQualifierNames>>;
10655
+
10656
+ /**
10657
+ * Returns a `Converter` for an `IConditionDecl<TQualifierNames>` narrowed on a supplied
10658
+ * `qualifierName` converter.
10659
+ *
10660
+ * @remarks
10661
+ * Pass e.g. `Converters.enumeratedValue(['tone', 'language'] as const)` to reject
10662
+ * typo'd qualifier names at convert time and to narrow the resulting
10663
+ * `IConditionDecl<T>` type to the same literal-string union. The default
10664
+ * `conditionDecl` is the `Converters.string` instantiation of this shape.
10665
+ *
10666
+ * @public
10667
+ */
10668
+ declare function typedConditionDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<IConditionDecl<TQualifierNames>>;
10669
+
10670
+ /**
10671
+ * Returns a `Converter` for a `Json.ConditionSetDecl<TQualifierNames>`
10672
+ * (either array form or record form) narrowed on a supplied `qualifierName`
10673
+ * converter.
10674
+ *
10675
+ * @public
10676
+ */
10677
+ declare function typedConditionSetDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<Json.ConditionSetDecl<TQualifierNames>>;
10678
+
10679
+ /**
10680
+ * Returns a `Converter` for an `IConditionSetDecl<TQualifierNames>` narrowed on a supplied
10681
+ * `qualifierName` converter.
10682
+ *
10683
+ * @remarks
10684
+ * Each contained condition is converted via `typedConditionDecl(qualifierNameConverter)`.
10685
+ *
10686
+ * @public
10687
+ */
10688
+ declare function typedConditionSetDecl_2<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<IConditionSetDecl<TQualifierNames>>;
10689
+
10690
+ /**
10691
+ * Returns a `Converter` for a `Json.IContainerContextDecl<TQualifierNames>`
10692
+ * narrowed on a supplied `qualifierName` converter.
10693
+ *
10694
+ * @public
10695
+ */
10696
+ declare function typedContainerContextDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<Json.IContainerContextDecl<TQualifierNames>>;
10697
+
10698
+ /**
10699
+ * Returns a `Converter` for a `Json.IImporterResourceCandidateDecl<TQualifierNames>`
10700
+ * narrowed on a supplied `qualifierName` converter.
10701
+ *
10702
+ * @public
10703
+ */
10704
+ declare function typedImporterResourceCandidateDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<Json.IImporterResourceCandidateDecl<TQualifierNames>>;
10705
+
10706
+ /**
10707
+ * Returns a `Converter` for a `Json.IImporterResourceCollectionDecl<TQualifierNames>`
10708
+ * narrowed on a supplied `qualifierName` converter.
10709
+ *
10710
+ * @public
10711
+ */
10712
+ declare function typedImporterResourceCollectionDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<Json.IImporterResourceCollectionDecl<TQualifierNames>>;
10713
+
10714
+ /**
10715
+ * Returns a `Converter` for a `Json.ILooseConditionDecl<TQualifierNames>`
10716
+ * narrowed on a supplied `qualifierName` converter.
10717
+ *
10718
+ * @public
10719
+ */
10720
+ declare function typedLooseConditionDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<Json.ILooseConditionDecl<TQualifierNames>>;
10721
+
10722
+ /**
10723
+ * Returns a `Converter` for a `Json.ILooseResourceCandidateDecl<TQualifierNames>`
10724
+ * narrowed on a supplied `qualifierName` converter.
10725
+ *
10726
+ * @public
10727
+ */
10728
+ declare function typedLooseResourceCandidateDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<Json.ILooseResourceCandidateDecl<TQualifierNames>>;
10729
+
10730
+ /**
10731
+ * Returns a `Converter` for a `Json.ILooseResourceDecl<TQualifierNames>`
10732
+ * narrowed on a supplied `qualifierName` converter.
10733
+ *
10734
+ * @public
10735
+ */
10736
+ declare function typedLooseResourceDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<Json.ILooseResourceDecl<TQualifierNames>>;
10737
+
10738
+ /**
10739
+ * Returns a `Converter` for a `Json.IResourceCollectionDecl<TQualifierNames>`
10740
+ * narrowed on a supplied `qualifierName` converter.
10741
+ *
10742
+ * @public
10743
+ */
10744
+ declare function typedResourceCollectionDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<Json.IResourceCollectionDecl<TQualifierNames>>;
10745
+
10746
+ /**
10747
+ * Returns a `Converter` for a `Json.IResourceTreeChildNodeDecl<TQualifierNames>`
10748
+ * narrowed on a supplied `qualifierName` converter.
10749
+ *
10750
+ * @public
10751
+ */
10752
+ declare function typedResourceTreeChildNodeDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<Json.IResourceTreeChildNodeDecl<TQualifierNames>>;
10753
+
10754
+ /**
10755
+ * Returns a `Converter` for a `Json.IResourceTreeRootDecl<TQualifierNames>`
10756
+ * narrowed on a supplied `qualifierName` converter.
10757
+ *
10758
+ * @public
10759
+ */
10760
+ declare function typedResourceTreeRootDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<Json.IResourceTreeRootDecl<TQualifierNames>>;
10761
+
10762
+ /**
10763
+ * Returns a `Converter` for an `IValidatedConditionDecl` narrowed on a supplied
10764
+ * `qualifierName` converter.
10765
+ *
10766
+ * @remarks
10767
+ * The typed sibling layers literal-string narrowing on top of the existing
10768
+ * collector-membership check performed by `validatedConditionDecl`.
10769
+ *
10770
+ * @public
10771
+ */
10772
+ declare function typedValidatedConditionDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<IValidatedConditionDecl, IConditionDeclConvertContext>;
10773
+
10774
+ /**
10775
+ * Returns a `Converter` for an `IValidatedConditionSetDecl` narrowed on a supplied
10776
+ * `qualifierName` converter.
10777
+ *
10778
+ * @public
10779
+ */
10780
+ declare function typedValidatedConditionSetDecl<TQualifierNames extends string>(qualifierNameConverter: Converter<TQualifierNames>): Converter<IValidatedConditionSetDecl, IConditionSetDeclConvertContext>;
10781
+
10403
10782
  /**
10404
10783
  * Creates a copy of the provided {@link Config.Model.ISystemConfiguration | system configuration}
10405
10784
  * with updated qualifier default values.
@@ -10479,6 +10858,12 @@ export { Validate }
10479
10858
  * Converter which constructs a {@link Conditions.IValidatedConditionDecl | validated condition declaration}
10480
10859
  * from a {@link Conditions.IConditionDecl | condition declaration}, instantiating qualifiers by name
10481
10860
  * from a supplied {@link Conditions.Convert.IConditionDeclConvertContext | conversion context}.
10861
+ *
10862
+ * @remarks
10863
+ * Accepts any string as the `qualifierName`; the collector membership check still rejects unknown
10864
+ * names. Use `typedValidatedConditionDecl` to layer literal-string narrowing on top of the
10865
+ * collector check.
10866
+ *
10482
10867
  * @public
10483
10868
  */
10484
10869
  declare const validatedConditionDecl: Converter<IValidatedConditionDecl, IConditionDeclConvertContext>;
@@ -10487,6 +10872,11 @@ declare const validatedConditionDecl: Converter<IValidatedConditionDecl, ICondit
10487
10872
  * Converter which constructs a {@link Conditions.IValidatedConditionSetDecl | validated condition set declaration}
10488
10873
  * from a {@link Conditions.IConditionSetDecl | condition set declaration}, instantiating qualifiers by name
10489
10874
  * from a supplied {@link Conditions.Convert.IConditionSetDeclConvertContext | conversion context}.
10875
+ *
10876
+ * @remarks
10877
+ * Accepts any string as the qualifier name. Use `typedValidatedConditionSetDecl` to layer
10878
+ * literal-string narrowing on top of the collector-membership check.
10879
+ *
10490
10880
  * @public
10491
10881
  */
10492
10882
  declare const validatedConditionSetDecl: Converter<IValidatedConditionSetDecl, IConditionSetDeclConvertContext>;