@jfdevelops/react-layout 2.2.0 → 2.4.0

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 (117) hide show
  1. package/dist/create-config/create-defined-resource-layout.cjs +2 -0
  2. package/dist/create-config/create-defined-resource-layout.cjs.map +1 -1
  3. package/dist/create-config/create-defined-resource-layout.d.cts +15 -12
  4. package/dist/create-config/create-defined-resource-layout.d.cts.map +1 -1
  5. package/dist/create-config/create-defined-resource-layout.d.mts +15 -12
  6. package/dist/create-config/create-defined-resource-layout.d.mts.map +1 -1
  7. package/dist/create-config/create-defined-resource-layout.mjs +2 -0
  8. package/dist/create-config/create-defined-resource-layout.mjs.map +1 -1
  9. package/dist/create-config/create-resource-links.cjs.map +1 -1
  10. package/dist/create-config/create-resource-links.d.cts +3 -1
  11. package/dist/create-config/create-resource-links.d.cts.map +1 -1
  12. package/dist/create-config/create-resource-links.d.mts +3 -1
  13. package/dist/create-config/create-resource-links.d.mts.map +1 -1
  14. package/dist/create-config/create-resource-links.mjs.map +1 -1
  15. package/dist/create-config/create-reusable.cjs +213 -0
  16. package/dist/create-config/create-reusable.cjs.map +1 -0
  17. package/dist/create-config/create-reusable.d.cts +1 -0
  18. package/dist/create-config/create-reusable.d.mts +1 -0
  19. package/dist/create-config/create-reusable.mjs +213 -0
  20. package/dist/create-config/create-reusable.mjs.map +1 -0
  21. package/dist/create-config/define-layout.cjs +11 -8
  22. package/dist/create-config/define-layout.cjs.map +1 -1
  23. package/dist/create-config/define-layout.d.cts +43 -42
  24. package/dist/create-config/define-layout.d.cts.map +1 -1
  25. package/dist/create-config/define-layout.d.mts +43 -42
  26. package/dist/create-config/define-layout.d.mts.map +1 -1
  27. package/dist/create-config/define-layout.mjs +11 -8
  28. package/dist/create-config/define-layout.mjs.map +1 -1
  29. package/dist/create-config/for-paths/builder.cjs +1 -0
  30. package/dist/create-config/for-paths/builder.cjs.map +1 -1
  31. package/dist/create-config/for-paths/builder.d.cts +5 -3
  32. package/dist/create-config/for-paths/builder.d.cts.map +1 -1
  33. package/dist/create-config/for-paths/builder.d.mts +5 -3
  34. package/dist/create-config/for-paths/builder.d.mts.map +1 -1
  35. package/dist/create-config/for-paths/builder.mjs +1 -0
  36. package/dist/create-config/for-paths/builder.mjs.map +1 -1
  37. package/dist/create-config/for-resource.cjs.map +1 -1
  38. package/dist/create-config/for-resource.d.cts +7 -6
  39. package/dist/create-config/for-resource.d.cts.map +1 -1
  40. package/dist/create-config/for-resource.d.mts +7 -6
  41. package/dist/create-config/for-resource.d.mts.map +1 -1
  42. package/dist/create-config/for-resource.mjs.map +1 -1
  43. package/dist/create-config/for-resources/create-component.d.cts +34 -33
  44. package/dist/create-config/for-resources/create-component.d.cts.map +1 -1
  45. package/dist/create-config/for-resources/create-component.d.mts +34 -33
  46. package/dist/create-config/for-resources/create-component.d.mts.map +1 -1
  47. package/dist/create-config/for-resources/create-for-resources.cjs +7 -6
  48. package/dist/create-config/for-resources/create-for-resources.cjs.map +1 -1
  49. package/dist/create-config/for-resources/create-for-resources.d.cts +2 -1
  50. package/dist/create-config/for-resources/create-for-resources.d.mts +2 -1
  51. package/dist/create-config/for-resources/create-for-resources.mjs +7 -6
  52. package/dist/create-config/for-resources/create-for-resources.mjs.map +1 -1
  53. package/dist/create-config/for-resources/scoped-layout.d.cts +5 -4
  54. package/dist/create-config/for-resources/scoped-layout.d.cts.map +1 -1
  55. package/dist/create-config/for-resources/scoped-layout.d.mts +5 -4
  56. package/dist/create-config/for-resources/scoped-layout.d.mts.map +1 -1
  57. package/dist/create-config/index.d.cts +1 -0
  58. package/dist/create-config/index.d.mts +1 -0
  59. package/dist/create-config/layout-name.cjs +1 -1
  60. package/dist/create-config/layout-name.mjs +1 -1
  61. package/dist/create-config/lazy-resource-layout.cjs +1 -1
  62. package/dist/create-config/lazy-resource-layout.d.cts +1 -1
  63. package/dist/create-config/lazy-resource-layout.d.mts +1 -1
  64. package/dist/create-config/lazy-resource-layout.mjs +1 -1
  65. package/dist/create-config/merge-layout-props.cjs.map +1 -1
  66. package/dist/create-config/merge-layout-props.mjs.map +1 -1
  67. package/dist/create-config/render-state.cjs +3 -2
  68. package/dist/create-config/render-state.cjs.map +1 -1
  69. package/dist/create-config/render-state.d.cts +27 -25
  70. package/dist/create-config/render-state.d.cts.map +1 -1
  71. package/dist/create-config/render-state.d.mts +27 -25
  72. package/dist/create-config/render-state.d.mts.map +1 -1
  73. package/dist/create-config/render-state.mjs +3 -2
  74. package/dist/create-config/render-state.mjs.map +1 -1
  75. package/dist/create-config/reusable-types.d.cts +131 -0
  76. package/dist/create-config/reusable-types.d.cts.map +1 -0
  77. package/dist/create-config/reusable-types.d.mts +131 -0
  78. package/dist/create-config/reusable-types.d.mts.map +1 -0
  79. package/dist/create-config/state-composable.cjs +1 -1
  80. package/dist/create-config/state-composable.mjs +1 -1
  81. package/dist/custom-props.cjs +15 -0
  82. package/dist/custom-props.cjs.map +1 -0
  83. package/dist/custom-props.d.cts +17 -0
  84. package/dist/custom-props.d.cts.map +1 -0
  85. package/dist/custom-props.d.mts +17 -0
  86. package/dist/custom-props.d.mts.map +1 -0
  87. package/dist/custom-props.mjs +15 -0
  88. package/dist/custom-props.mjs.map +1 -0
  89. package/dist/errors/react-layout-error.cjs +1 -1
  90. package/dist/errors/react-layout-error.mjs +1 -1
  91. package/dist/index.cjs +3 -3
  92. package/dist/index.d.cts +4 -2
  93. package/dist/index.d.mts +4 -2
  94. package/dist/index.mjs +3 -3
  95. package/dist/lazy/create-render-state.cjs.map +1 -1
  96. package/dist/lazy/create-render-state.d.cts +5 -5
  97. package/dist/lazy/create-render-state.d.cts.map +1 -1
  98. package/dist/lazy/create-render-state.d.mts +5 -5
  99. package/dist/lazy/create-render-state.d.mts.map +1 -1
  100. package/dist/lazy/create-render-state.mjs.map +1 -1
  101. package/dist/lazy/lazy-boundary.cjs +1 -1
  102. package/dist/lazy/lazy-boundary.mjs +1 -1
  103. package/dist/lazy/types.cjs.map +1 -1
  104. package/dist/lazy/types.d.cts +5 -4
  105. package/dist/lazy/types.d.cts.map +1 -1
  106. package/dist/lazy/types.d.mts +5 -4
  107. package/dist/lazy/types.d.mts.map +1 -1
  108. package/dist/lazy/types.mjs.map +1 -1
  109. package/dist/props.cjs.map +1 -1
  110. package/dist/props.d.cts +10 -4
  111. package/dist/props.d.cts.map +1 -1
  112. package/dist/props.d.mts +10 -4
  113. package/dist/props.d.mts.map +1 -1
  114. package/dist/props.mjs.map +1 -1
  115. package/dist/resource.d.cts +1 -1
  116. package/dist/resource.d.mts +1 -1
  117. package/package.json +4 -4
@@ -0,0 +1,131 @@
1
+ import { ResourceDefinition, ResourceEnum } from "../resource.cjs";
2
+ import { InPropsDefinition, InPropsObject, InferredInProps, PropsContract } from "../props.cjs";
3
+ import { LayoutResourcesAccessor } from "./define-layout.cjs";
4
+ import { AnyBuiltPropDefinition, ExtractDefinitionValue, ResolvedBuiltPropShape } from "@jfdevelops/react-layout-validator";
5
+
6
+ //#region src/create-config/reusable-types.d.ts
7
+ type Selector<Source> = (source: Source) => unknown;
8
+ type OptionValue<Definition extends AnyBuiltPropDefinition> = ExtractDefinitionValue<Definition> | (Definition['visibility'] extends 'optional' ? undefined : never);
9
+ /** Select or transform resolved option values, or drill into object values. */
10
+ type ReusableOptionSelection<Props extends InPropsObject> = { [Key in keyof Props]?: Props[Key] extends {
11
+ type: 'object';
12
+ properties: infer Shape extends InPropsObject;
13
+ } ? true | Selector<OptionValue<Props[Key]>> | ReusableOptionSelection<Shape> : true | Selector<OptionValue<Props[Key]>> };
14
+ type OptionDefinitions<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = InferredInProps<Resources, Options> extends infer Props extends InPropsObject ? Props : never;
15
+ /** Only data sources declared by the factory are available for selection. */
16
+ type ReusableInclude<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = {
17
+ resources?: true | Selector<LayoutResourcesAccessor<Resources>>;
18
+ } & (keyof OptionDefinitions<Resources, Options> extends never ? {} : {
19
+ options?: true | Selector<ResolvedBuiltPropShape<OptionDefinitions<Resources, Options>>> | ReusableOptionSelection<OptionDefinitions<Resources, Options>>;
20
+ });
21
+ type SelectedOptionValue<Definition extends AnyBuiltPropDefinition, Selection> = Selection extends true ? ExtractDefinitionValue<Definition> : Selection extends ((...args: any[]) => infer Result) ? Result : Definition extends {
22
+ properties: infer Shape extends InPropsObject;
23
+ } ? SelectedOptionProps<Shape, Selection> : never;
24
+ type SelectedOptionProps<Props extends InPropsObject, Selection> = { [Key in keyof Props & keyof Selection as Selection[Key] extends Selector<any> ? Key : Props[Key]['visibility'] extends 'required' ? Key : never]: SelectedOptionValue<Props[Key], Selection[Key]> } & { [Key in keyof Props & keyof Selection as Selection[Key] extends Selector<any> ? never : Props[Key]['visibility'] extends 'optional' ? Key : never]?: SelectedOptionValue<Props[Key], Selection[Key]> };
25
+ /** Options are flattened one level, so `options: { meta: true }` supplies `meta`. */
26
+ type ReusableProps<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject> = (Include extends {
27
+ resources: true;
28
+ } ? {
29
+ resources: ResourceEnum<Resources>[number][];
30
+ } : Include extends {
31
+ resources: (...args: any[]) => infer Result;
32
+ } ? {
33
+ resources: Result;
34
+ } : {}) & (Include extends {
35
+ options: infer Selection;
36
+ } ? Selection extends ((...args: any[]) => infer Result) ? {
37
+ options: Result;
38
+ } : Selection extends true ? ResolvedBuiltPropShape<OptionDefinitions<Resources, Options>> : SelectedOptionProps<OptionDefinitions<Resources, Options>, Selection> : {}) & ResolvedBuiltPropShape<Custom>;
39
+ /** Data selected for the reusable's single callback argument. */
40
+ type ReusableSelected<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Selection> = (Selection extends {
41
+ resources: infer Value;
42
+ } ? {
43
+ resources: Value extends ((...args: any[]) => infer Result) ? Result : LayoutResourcesAccessor<Resources>;
44
+ } : {}) & (Selection extends {
45
+ options: infer Value;
46
+ } ? Value extends ((...args: any[]) => infer Result) ? {
47
+ options: Result;
48
+ } : SelectedValues<OptionDefinitions<Resources, Options>, Value> : {});
49
+ type ReusableOverlap = 'preferProps' | 'preferSelect';
50
+ type SelectionShape<Props extends InPropsObject, Selection> = Selection extends Selector<any> ? 'value' : { [Key in keyof Props & (Selection extends true ? keyof Props : keyof Selection)]: SelectionAt<Selection, Key> extends Selector<any> ? 'value' : Props[Key] extends {
51
+ properties: infer Shape extends InPropsObject;
52
+ } ? SelectionShape<Shape, SelectionAt<Selection, Key>> : 'value' };
53
+ type ContractShape<Props extends InPropsObject, Contract, Custom> = (Contract extends {
54
+ resources: unknown;
55
+ } ? {
56
+ resources: 'value';
57
+ } : {}) & (Contract extends {
58
+ options: infer Selection;
59
+ } ? Selection extends Selector<any> ? {
60
+ options: 'value';
61
+ } : SelectionShape<Props, Selection> : {}) & { [Key in keyof Custom]: 'value' };
62
+ type MergeValue<Left, Right, Overlap, LeftShape, RightShape> = LeftShape extends object ? RightShape extends object ? MergeValues<NonNullable<Left>, NonNullable<Right>, Overlap, LeftShape, RightShape> : Overlap extends 'preferSelect' ? Right : Left : Overlap extends 'preferSelect' ? Right : Left;
63
+ type SharedKeys<Left, Right> = keyof Left & keyof Right;
64
+ type OptionalSharedKeys<Left, Right, Overlap, LeftShape, RightShape> = { [Key in SharedKeys<Left, Right>]: Key extends keyof LeftShape ? Key extends keyof RightShape ? LeftShape[Key] extends object ? RightShape[Key] extends object ? {} extends Pick<Left, Key> ? {} extends Pick<Right, Key> ? Key : never : never : Overlap extends 'preferSelect' ? {} extends Pick<Right, Key> ? Key : never : {} extends Pick<Left, Key> ? Key : never : Overlap extends 'preferSelect' ? {} extends Pick<Right, Key> ? Key : never : {} extends Pick<Left, Key> ? Key : never : never : never }[SharedKeys<Left, Right>];
65
+ type MergeValues<Left, Right, Overlap, LeftShape, RightShape> = Omit<Left, keyof Right> & Omit<Right, keyof Left> & { [Key in Exclude<SharedKeys<Left, Right>, OptionalSharedKeys<Left, Right, Overlap, LeftShape, RightShape>>]: MergeValue<Left[Key], Right[Key], Overlap, Key extends keyof LeftShape ? LeftShape[Key] : 'value', Key extends keyof RightShape ? RightShape[Key] : 'value'> } & { [Key in OptionalSharedKeys<Left, Right, Overlap, LeftShape, RightShape>]?: MergeValue<Left[Key], Right[Key], Overlap, Key extends keyof LeftShape ? LeftShape[Key] : 'value', Key extends keyof RightShape ? RightShape[Key] : 'value'> };
66
+ type IndependentSources<Props extends InPropsObject, Include, Select> = keyof CallerOptions<Props, Include, Select> extends never ? false : keyof (SourceValues<Props, Include, true> & SourceValues<Props, Select, false>) extends never ? false : true;
67
+ type BranchSelection<Selection> = Selection extends Selector<any> ? {} : Selection;
68
+ type GuardedFields<Value, Props extends InPropsObject, Include, Select, Shape, Independent extends boolean> = { [Key in keyof Value]: Key extends keyof Props ? Key extends keyof Shape ? Shape[Key] extends object ? Props[Key] extends {
69
+ properties: infer Nested extends InPropsObject;
70
+ } ? GuardedObject<NonNullable<Value[Key]>, Nested, BranchSelection<SelectionAt<Include, Key>>, BranchSelection<SelectionAt<Select, Key>>, Shape[Key], IndependentSources<Nested, BranchSelection<SelectionAt<Include, Key>>, BranchSelection<SelectionAt<Select, Key>>> extends true ? Independent extends true ? true : Props[Key]['visibility'] extends 'optional' ? true : false : false> | Extract<Value[Key], undefined> : Value[Key] : Value[Key] : Value[Key] : Value[Key] };
71
+ type GuardedObject<Value, Props extends InPropsObject, Include, Select, Shape, Independent extends boolean = false> = Independent extends true ? Partial<GuardedFields<Value, Props, Include, Select, Shape, Independent>> : GuardedFields<Value, Props, Include, Select, Shape, Independent>;
72
+ type MergedShape<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom, Select, Overlap> = MergeValues<ContractShape<OptionDefinitions<Resources, Options>, Include, Custom>, ContractShape<OptionDefinitions<Resources, Options>, Select, {}>, Overlap, ContractShape<OptionDefinitions<Resources, Options>, Include, Custom>, ContractShape<OptionDefinitions<Resources, Options>, Select, {}>>;
73
+ type ReusableResolved<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject, Select, Overlap = undefined> = Expanded<GuardedObject<MergeValues<ReusableProps<Resources, Options, Include, Custom>, ReusableSelected<Resources, Options, Select>, Overlap, ContractShape<OptionDefinitions<Resources, Options>, Include, Custom>, ContractShape<OptionDefinitions<Resources, Options>, Select, {}>>, OptionDefinitions<Resources, Options>, Include extends {
74
+ options: infer Selection;
75
+ } ? Selection : {}, Select extends {
76
+ options: infer Selection;
77
+ } ? Selection : {}, MergedShape<Resources, Options, Include, Custom, Select, Overlap>>>;
78
+ type SelectedValues<Props extends InPropsObject, Selection> = Selection extends ((...args: any[]) => infer Result) ? Result : Selection extends true ? ResolvedBuiltPropShape<Props> : SelectedOptionProps<Props, Selection>;
79
+ /** Sources are derived against the finite definition tree, not arbitrary input keys. */
80
+ type SourceValue<Definition extends AnyBuiltPropDefinition, Selection, CallbacksOnly extends boolean> = Selection extends Selector<any> ? OptionValue<Definition> : Selection extends true ? CallbacksOnly extends true ? never : OptionValue<Definition> : Definition extends {
81
+ properties: infer Shape extends InPropsObject;
82
+ } ? SourceValues<Shape, Selection, CallbacksOnly> : never;
83
+ type SourceKeys<Props extends InPropsObject, Selection, CallbacksOnly extends boolean> = { [Key in keyof Props & keyof Selection]: Selection[Key] extends Selector<any> ? Key : Selection[Key] extends true ? CallbacksOnly extends true ? never : Key : Props[Key] extends {
84
+ properties: infer Shape extends InPropsObject;
85
+ } ? keyof SourceValues<Shape, Selection[Key], CallbacksOnly> extends never ? never : Key : never }[keyof Props & keyof Selection];
86
+ type SourceValues<Props extends InPropsObject, Selection, CallbacksOnly extends boolean> = Selection extends Selector<any> ? ResolvedBuiltPropShape<Props> : Selection extends true ? CallbacksOnly extends true ? {} : ResolvedBuiltPropShape<Props> : { [Key in SourceKeys<Props, Selection, CallbacksOnly> as Props[Key]['visibility'] extends 'required' ? Key : never]: SourceValue<Props[Key], Selection[Key], CallbacksOnly> } & { [Key in SourceKeys<Props, Selection, CallbacksOnly> as Props[Key]['visibility'] extends 'optional' ? Key : never]?: SourceValue<Props[Key], Selection[Key], CallbacksOnly> };
87
+ type OptionSource<Props extends InPropsObject, Contract, CallbacksOnly extends boolean> = Contract extends {
88
+ options: infer Selection;
89
+ } ? SourceValues<Props, Selection, CallbacksOnly> : {};
90
+ /** Expand object intersections for readable public helper signatures. */
91
+ type Expanded<Value> = Value extends Promise<infer Result> ? Promise<Expanded<Result>> : Value extends ((...args: any[]) => any) ? Value : Value extends readonly unknown[] ? Value : Value extends object ? { [Key in keyof Value]: Expanded<Value[Key]> } : Value;
92
+ type SourceInput<Values> = keyof Values extends never ? {} : {} extends Values ? {
93
+ options?: Values;
94
+ } : {
95
+ options: Values;
96
+ };
97
+ type ReusableInput<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject, Select> = Expanded<ReusableProps<Resources, Options, CallerContract<Resources, Options, Include, Select>, Custom> & SourceInput<OptionSource<OptionDefinitions<Resources, Options>, Include, true> & OptionSource<OptionDefinitions<Resources, Options>, Select, false>>>;
98
+ type SelectionAt<Selection, Key extends PropertyKey> = Selection extends true ? true : Key extends keyof Selection ? Selection[Key] : undefined;
99
+ type CallerOptions<Props extends InPropsObject, Include, Select> = { [Key in keyof Props as SelectionAt<Include, Key> extends infer Value ? Value extends Selector<any> | undefined ? never : Value extends true ? SelectionAt<Select, Key> extends true ? never : Props[Key] extends {
100
+ properties: infer Shape extends InPropsObject;
101
+ } ? SelectionAt<Select, Key> extends object ? keyof CallerOptions<Shape, true, SelectionAt<Select, Key>> extends never ? never : Key : Key : Key : Props[Key] extends {
102
+ properties: infer Shape extends InPropsObject;
103
+ } ? keyof CallerOptions<Shape, Value, SelectionAt<Select, Key>> extends never ? never : Key : never : never]: Props[Key] extends {
104
+ properties: infer Shape extends InPropsObject;
105
+ } ? SelectionAt<Include, Key> extends true ? SelectionAt<Select, Key> extends object ? CallerOptions<Shape, true, SelectionAt<Select, Key>> : true : CallerOptions<Shape, SelectionAt<Include, Key>, SelectionAt<Select, Key>> : true };
106
+ type CallerContract<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Select> = (Include extends {
107
+ resources: true;
108
+ } ? {
109
+ resources: true;
110
+ } : {}) & (Include extends {
111
+ options: infer Value;
112
+ } ? Value extends Selector<any> ? {} : {
113
+ options: CallerOptions<OptionDefinitions<Resources, Options>, Value, Select extends {
114
+ options: infer Other;
115
+ } ? Other : {}>;
116
+ } : {});
117
+ type ExactSelection<Selection, Allowed> = { [Key in keyof Selection]: Key extends keyof Allowed ? Selection[Key] extends Selector<any> ? Allowed[Key] : Selection[Key] extends object ? ExactSelection<Selection[Key], Exclude<Allowed[Key], true | undefined | Selector<any>>> : Allowed[Key] : never };
118
+ /** Configuration accepted by the bound reusable factory. */
119
+ type ReusableDefinition<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include extends ReusableInclude<Resources, Options>, Custom extends InPropsObject, Select extends ReusableInclude<Resources, Options>, Result, Overlap extends ReusableOverlap | undefined = undefined> = {
120
+ props?: PropsContract<ReusableInclude<Resources, Options> & Include & ExactSelection<Include, ReusableInclude<Resources, Options>>, Custom>;
121
+ select?: ReusableInclude<Resources, Options> & Select & ExactSelection<Select, ReusableInclude<Resources, Options>>; /** Resolve ambiguous leaf collisions explicitly; the default rejects them. */
122
+ overlap?: Overlap;
123
+ fn: (props: ReusableResolved<Resources, Options, Include, Custom, Select, Overlap>) => Result;
124
+ };
125
+ type ReusableArguments<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject, Select> = {} extends ReusableInput<Resources, Options, Include, Custom, Select> ? [props?: ReusableInput<Resources, Options, Include, Custom, Select>] : [props: ReusableInput<Resources, Options, Include, Custom, Select>];
126
+ type ReusableFunction<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject, Select, Result> = (...args: ReusableArguments<Resources, Options, Include, Custom, Select>) => Expanded<Result>;
127
+ /** Creates a validated function with one merged callback argument. */
128
+ type CreateReusable<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = <const Include extends ReusableInclude<Resources, Options> = {}, const Custom extends InPropsObject = {}, const Select extends ReusableInclude<Resources, Options> = {}, Result = unknown, const Overlap extends ReusableOverlap | undefined = undefined>(definition: ReusableDefinition<Resources, Options, Include, Custom, Select, Result, Overlap>) => ReusableFunction<Resources, Options, Include, Custom, Select, Result>;
129
+ //#endregion
130
+ export { CreateReusable, ReusableArguments, ReusableDefinition, ReusableFunction, ReusableInclude, ReusableInput, ReusableOptionSelection, ReusableOverlap, ReusableProps, ReusableResolved, ReusableSelected };
131
+ //# sourceMappingURL=reusable-types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reusable-types.d.cts","names":[],"sources":["../../src/create-config/reusable-types.ts"],"mappings":";;;;;;KAcK,QAAA,YAAoB,MAAA,EAAQ,MAAM;AAAA,KAClC,WAAA,oBAA+B,sBAAA,IAChC,sBAAA,CAAuB,UAAA,KACtB,UAAA;AAL0D;AAAA,KAQnD,uBAAA,eAAsC,aAAA,oBAClC,KAAA,IAAS,KAAA,CAAM,GAAA;EAC3B,IAAA;EACA,UAAA,sBAAgC,aAAA;AAAA,WAEvB,QAAA,CAAS,WAAA,CAAY,KAAA,CAAM,GAAA,MAAS,uBAAA,CAAwB,KAAA,WAC5D,QAAA,CAAS,WAAA,CAAY,KAAA,CAAM,GAAA;AAAA,KAGnC,iBAAA,4BACwB,kBAAA,oBACX,iBAAA,CAAkB,SAAA,KAChC,eAAA,CACF,SAAA,EACA,OAAA,8BAC4B,aAAA,GAC1B,KAAA;AAtBmC;AAAA,KA0B3B,eAAA,4BACiB,kBAAA,oBACX,iBAAA,CAAkB,SAAA;EAElC,SAAA,UAAmB,QAAA,CAAS,uBAAA,CAAwB,SAAA;AAAA,WAC3C,iBAAA,CAAkB,SAAA,EAAW,OAA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,CAAgB,SAAA,EAAW,OAAA,6BAC5B,aAAA,4BACA,eAAA,CAAgB,SAAA,EAAW,OAAA,gDAE1B,eAAA,0BAEtB,UAAA,EAAY,kBAAA,CACV,SAAA,EACA,OAAA,EACA,OAAA,EACA,MAAA,EACA,MAAA,EACA,MAAA,EACA,OAAA,MAEC,gBAAA,CAAiB,SAAA,EAAW,OAAA,EAAS,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,MAAA"}
@@ -0,0 +1,131 @@
1
+ import { ResourceDefinition, ResourceEnum } from "../resource.mjs";
2
+ import { InPropsDefinition, InPropsObject, InferredInProps, PropsContract } from "../props.mjs";
3
+ import { LayoutResourcesAccessor } from "./define-layout.mjs";
4
+ import { AnyBuiltPropDefinition, ExtractDefinitionValue, ResolvedBuiltPropShape } from "@jfdevelops/react-layout-validator";
5
+
6
+ //#region src/create-config/reusable-types.d.ts
7
+ type Selector<Source> = (source: Source) => unknown;
8
+ type OptionValue<Definition extends AnyBuiltPropDefinition> = ExtractDefinitionValue<Definition> | (Definition['visibility'] extends 'optional' ? undefined : never);
9
+ /** Select or transform resolved option values, or drill into object values. */
10
+ type ReusableOptionSelection<Props extends InPropsObject> = { [Key in keyof Props]?: Props[Key] extends {
11
+ type: 'object';
12
+ properties: infer Shape extends InPropsObject;
13
+ } ? true | Selector<OptionValue<Props[Key]>> | ReusableOptionSelection<Shape> : true | Selector<OptionValue<Props[Key]>> };
14
+ type OptionDefinitions<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = InferredInProps<Resources, Options> extends infer Props extends InPropsObject ? Props : never;
15
+ /** Only data sources declared by the factory are available for selection. */
16
+ type ReusableInclude<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = {
17
+ resources?: true | Selector<LayoutResourcesAccessor<Resources>>;
18
+ } & (keyof OptionDefinitions<Resources, Options> extends never ? {} : {
19
+ options?: true | Selector<ResolvedBuiltPropShape<OptionDefinitions<Resources, Options>>> | ReusableOptionSelection<OptionDefinitions<Resources, Options>>;
20
+ });
21
+ type SelectedOptionValue<Definition extends AnyBuiltPropDefinition, Selection> = Selection extends true ? ExtractDefinitionValue<Definition> : Selection extends ((...args: any[]) => infer Result) ? Result : Definition extends {
22
+ properties: infer Shape extends InPropsObject;
23
+ } ? SelectedOptionProps<Shape, Selection> : never;
24
+ type SelectedOptionProps<Props extends InPropsObject, Selection> = { [Key in keyof Props & keyof Selection as Selection[Key] extends Selector<any> ? Key : Props[Key]['visibility'] extends 'required' ? Key : never]: SelectedOptionValue<Props[Key], Selection[Key]> } & { [Key in keyof Props & keyof Selection as Selection[Key] extends Selector<any> ? never : Props[Key]['visibility'] extends 'optional' ? Key : never]?: SelectedOptionValue<Props[Key], Selection[Key]> };
25
+ /** Options are flattened one level, so `options: { meta: true }` supplies `meta`. */
26
+ type ReusableProps<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject> = (Include extends {
27
+ resources: true;
28
+ } ? {
29
+ resources: ResourceEnum<Resources>[number][];
30
+ } : Include extends {
31
+ resources: (...args: any[]) => infer Result;
32
+ } ? {
33
+ resources: Result;
34
+ } : {}) & (Include extends {
35
+ options: infer Selection;
36
+ } ? Selection extends ((...args: any[]) => infer Result) ? {
37
+ options: Result;
38
+ } : Selection extends true ? ResolvedBuiltPropShape<OptionDefinitions<Resources, Options>> : SelectedOptionProps<OptionDefinitions<Resources, Options>, Selection> : {}) & ResolvedBuiltPropShape<Custom>;
39
+ /** Data selected for the reusable's single callback argument. */
40
+ type ReusableSelected<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Selection> = (Selection extends {
41
+ resources: infer Value;
42
+ } ? {
43
+ resources: Value extends ((...args: any[]) => infer Result) ? Result : LayoutResourcesAccessor<Resources>;
44
+ } : {}) & (Selection extends {
45
+ options: infer Value;
46
+ } ? Value extends ((...args: any[]) => infer Result) ? {
47
+ options: Result;
48
+ } : SelectedValues<OptionDefinitions<Resources, Options>, Value> : {});
49
+ type ReusableOverlap = 'preferProps' | 'preferSelect';
50
+ type SelectionShape<Props extends InPropsObject, Selection> = Selection extends Selector<any> ? 'value' : { [Key in keyof Props & (Selection extends true ? keyof Props : keyof Selection)]: SelectionAt<Selection, Key> extends Selector<any> ? 'value' : Props[Key] extends {
51
+ properties: infer Shape extends InPropsObject;
52
+ } ? SelectionShape<Shape, SelectionAt<Selection, Key>> : 'value' };
53
+ type ContractShape<Props extends InPropsObject, Contract, Custom> = (Contract extends {
54
+ resources: unknown;
55
+ } ? {
56
+ resources: 'value';
57
+ } : {}) & (Contract extends {
58
+ options: infer Selection;
59
+ } ? Selection extends Selector<any> ? {
60
+ options: 'value';
61
+ } : SelectionShape<Props, Selection> : {}) & { [Key in keyof Custom]: 'value' };
62
+ type MergeValue<Left, Right, Overlap, LeftShape, RightShape> = LeftShape extends object ? RightShape extends object ? MergeValues<NonNullable<Left>, NonNullable<Right>, Overlap, LeftShape, RightShape> : Overlap extends 'preferSelect' ? Right : Left : Overlap extends 'preferSelect' ? Right : Left;
63
+ type SharedKeys<Left, Right> = keyof Left & keyof Right;
64
+ type OptionalSharedKeys<Left, Right, Overlap, LeftShape, RightShape> = { [Key in SharedKeys<Left, Right>]: Key extends keyof LeftShape ? Key extends keyof RightShape ? LeftShape[Key] extends object ? RightShape[Key] extends object ? {} extends Pick<Left, Key> ? {} extends Pick<Right, Key> ? Key : never : never : Overlap extends 'preferSelect' ? {} extends Pick<Right, Key> ? Key : never : {} extends Pick<Left, Key> ? Key : never : Overlap extends 'preferSelect' ? {} extends Pick<Right, Key> ? Key : never : {} extends Pick<Left, Key> ? Key : never : never : never }[SharedKeys<Left, Right>];
65
+ type MergeValues<Left, Right, Overlap, LeftShape, RightShape> = Omit<Left, keyof Right> & Omit<Right, keyof Left> & { [Key in Exclude<SharedKeys<Left, Right>, OptionalSharedKeys<Left, Right, Overlap, LeftShape, RightShape>>]: MergeValue<Left[Key], Right[Key], Overlap, Key extends keyof LeftShape ? LeftShape[Key] : 'value', Key extends keyof RightShape ? RightShape[Key] : 'value'> } & { [Key in OptionalSharedKeys<Left, Right, Overlap, LeftShape, RightShape>]?: MergeValue<Left[Key], Right[Key], Overlap, Key extends keyof LeftShape ? LeftShape[Key] : 'value', Key extends keyof RightShape ? RightShape[Key] : 'value'> };
66
+ type IndependentSources<Props extends InPropsObject, Include, Select> = keyof CallerOptions<Props, Include, Select> extends never ? false : keyof (SourceValues<Props, Include, true> & SourceValues<Props, Select, false>) extends never ? false : true;
67
+ type BranchSelection<Selection> = Selection extends Selector<any> ? {} : Selection;
68
+ type GuardedFields<Value, Props extends InPropsObject, Include, Select, Shape, Independent extends boolean> = { [Key in keyof Value]: Key extends keyof Props ? Key extends keyof Shape ? Shape[Key] extends object ? Props[Key] extends {
69
+ properties: infer Nested extends InPropsObject;
70
+ } ? GuardedObject<NonNullable<Value[Key]>, Nested, BranchSelection<SelectionAt<Include, Key>>, BranchSelection<SelectionAt<Select, Key>>, Shape[Key], IndependentSources<Nested, BranchSelection<SelectionAt<Include, Key>>, BranchSelection<SelectionAt<Select, Key>>> extends true ? Independent extends true ? true : Props[Key]['visibility'] extends 'optional' ? true : false : false> | Extract<Value[Key], undefined> : Value[Key] : Value[Key] : Value[Key] : Value[Key] };
71
+ type GuardedObject<Value, Props extends InPropsObject, Include, Select, Shape, Independent extends boolean = false> = Independent extends true ? Partial<GuardedFields<Value, Props, Include, Select, Shape, Independent>> : GuardedFields<Value, Props, Include, Select, Shape, Independent>;
72
+ type MergedShape<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom, Select, Overlap> = MergeValues<ContractShape<OptionDefinitions<Resources, Options>, Include, Custom>, ContractShape<OptionDefinitions<Resources, Options>, Select, {}>, Overlap, ContractShape<OptionDefinitions<Resources, Options>, Include, Custom>, ContractShape<OptionDefinitions<Resources, Options>, Select, {}>>;
73
+ type ReusableResolved<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject, Select, Overlap = undefined> = Expanded<GuardedObject<MergeValues<ReusableProps<Resources, Options, Include, Custom>, ReusableSelected<Resources, Options, Select>, Overlap, ContractShape<OptionDefinitions<Resources, Options>, Include, Custom>, ContractShape<OptionDefinitions<Resources, Options>, Select, {}>>, OptionDefinitions<Resources, Options>, Include extends {
74
+ options: infer Selection;
75
+ } ? Selection : {}, Select extends {
76
+ options: infer Selection;
77
+ } ? Selection : {}, MergedShape<Resources, Options, Include, Custom, Select, Overlap>>>;
78
+ type SelectedValues<Props extends InPropsObject, Selection> = Selection extends ((...args: any[]) => infer Result) ? Result : Selection extends true ? ResolvedBuiltPropShape<Props> : SelectedOptionProps<Props, Selection>;
79
+ /** Sources are derived against the finite definition tree, not arbitrary input keys. */
80
+ type SourceValue<Definition extends AnyBuiltPropDefinition, Selection, CallbacksOnly extends boolean> = Selection extends Selector<any> ? OptionValue<Definition> : Selection extends true ? CallbacksOnly extends true ? never : OptionValue<Definition> : Definition extends {
81
+ properties: infer Shape extends InPropsObject;
82
+ } ? SourceValues<Shape, Selection, CallbacksOnly> : never;
83
+ type SourceKeys<Props extends InPropsObject, Selection, CallbacksOnly extends boolean> = { [Key in keyof Props & keyof Selection]: Selection[Key] extends Selector<any> ? Key : Selection[Key] extends true ? CallbacksOnly extends true ? never : Key : Props[Key] extends {
84
+ properties: infer Shape extends InPropsObject;
85
+ } ? keyof SourceValues<Shape, Selection[Key], CallbacksOnly> extends never ? never : Key : never }[keyof Props & keyof Selection];
86
+ type SourceValues<Props extends InPropsObject, Selection, CallbacksOnly extends boolean> = Selection extends Selector<any> ? ResolvedBuiltPropShape<Props> : Selection extends true ? CallbacksOnly extends true ? {} : ResolvedBuiltPropShape<Props> : { [Key in SourceKeys<Props, Selection, CallbacksOnly> as Props[Key]['visibility'] extends 'required' ? Key : never]: SourceValue<Props[Key], Selection[Key], CallbacksOnly> } & { [Key in SourceKeys<Props, Selection, CallbacksOnly> as Props[Key]['visibility'] extends 'optional' ? Key : never]?: SourceValue<Props[Key], Selection[Key], CallbacksOnly> };
87
+ type OptionSource<Props extends InPropsObject, Contract, CallbacksOnly extends boolean> = Contract extends {
88
+ options: infer Selection;
89
+ } ? SourceValues<Props, Selection, CallbacksOnly> : {};
90
+ /** Expand object intersections for readable public helper signatures. */
91
+ type Expanded<Value> = Value extends Promise<infer Result> ? Promise<Expanded<Result>> : Value extends ((...args: any[]) => any) ? Value : Value extends readonly unknown[] ? Value : Value extends object ? { [Key in keyof Value]: Expanded<Value[Key]> } : Value;
92
+ type SourceInput<Values> = keyof Values extends never ? {} : {} extends Values ? {
93
+ options?: Values;
94
+ } : {
95
+ options: Values;
96
+ };
97
+ type ReusableInput<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject, Select> = Expanded<ReusableProps<Resources, Options, CallerContract<Resources, Options, Include, Select>, Custom> & SourceInput<OptionSource<OptionDefinitions<Resources, Options>, Include, true> & OptionSource<OptionDefinitions<Resources, Options>, Select, false>>>;
98
+ type SelectionAt<Selection, Key extends PropertyKey> = Selection extends true ? true : Key extends keyof Selection ? Selection[Key] : undefined;
99
+ type CallerOptions<Props extends InPropsObject, Include, Select> = { [Key in keyof Props as SelectionAt<Include, Key> extends infer Value ? Value extends Selector<any> | undefined ? never : Value extends true ? SelectionAt<Select, Key> extends true ? never : Props[Key] extends {
100
+ properties: infer Shape extends InPropsObject;
101
+ } ? SelectionAt<Select, Key> extends object ? keyof CallerOptions<Shape, true, SelectionAt<Select, Key>> extends never ? never : Key : Key : Key : Props[Key] extends {
102
+ properties: infer Shape extends InPropsObject;
103
+ } ? keyof CallerOptions<Shape, Value, SelectionAt<Select, Key>> extends never ? never : Key : never : never]: Props[Key] extends {
104
+ properties: infer Shape extends InPropsObject;
105
+ } ? SelectionAt<Include, Key> extends true ? SelectionAt<Select, Key> extends object ? CallerOptions<Shape, true, SelectionAt<Select, Key>> : true : CallerOptions<Shape, SelectionAt<Include, Key>, SelectionAt<Select, Key>> : true };
106
+ type CallerContract<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Select> = (Include extends {
107
+ resources: true;
108
+ } ? {
109
+ resources: true;
110
+ } : {}) & (Include extends {
111
+ options: infer Value;
112
+ } ? Value extends Selector<any> ? {} : {
113
+ options: CallerOptions<OptionDefinitions<Resources, Options>, Value, Select extends {
114
+ options: infer Other;
115
+ } ? Other : {}>;
116
+ } : {});
117
+ type ExactSelection<Selection, Allowed> = { [Key in keyof Selection]: Key extends keyof Allowed ? Selection[Key] extends Selector<any> ? Allowed[Key] : Selection[Key] extends object ? ExactSelection<Selection[Key], Exclude<Allowed[Key], true | undefined | Selector<any>>> : Allowed[Key] : never };
118
+ /** Configuration accepted by the bound reusable factory. */
119
+ type ReusableDefinition<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include extends ReusableInclude<Resources, Options>, Custom extends InPropsObject, Select extends ReusableInclude<Resources, Options>, Result, Overlap extends ReusableOverlap | undefined = undefined> = {
120
+ props?: PropsContract<ReusableInclude<Resources, Options> & Include & ExactSelection<Include, ReusableInclude<Resources, Options>>, Custom>;
121
+ select?: ReusableInclude<Resources, Options> & Select & ExactSelection<Select, ReusableInclude<Resources, Options>>; /** Resolve ambiguous leaf collisions explicitly; the default rejects them. */
122
+ overlap?: Overlap;
123
+ fn: (props: ReusableResolved<Resources, Options, Include, Custom, Select, Overlap>) => Result;
124
+ };
125
+ type ReusableArguments<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject, Select> = {} extends ReusableInput<Resources, Options, Include, Custom, Select> ? [props?: ReusableInput<Resources, Options, Include, Custom, Select>] : [props: ReusableInput<Resources, Options, Include, Custom, Select>];
126
+ type ReusableFunction<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject, Select, Result> = (...args: ReusableArguments<Resources, Options, Include, Custom, Select>) => Expanded<Result>;
127
+ /** Creates a validated function with one merged callback argument. */
128
+ type CreateReusable<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = <const Include extends ReusableInclude<Resources, Options> = {}, const Custom extends InPropsObject = {}, const Select extends ReusableInclude<Resources, Options> = {}, Result = unknown, const Overlap extends ReusableOverlap | undefined = undefined>(definition: ReusableDefinition<Resources, Options, Include, Custom, Select, Result, Overlap>) => ReusableFunction<Resources, Options, Include, Custom, Select, Result>;
129
+ //#endregion
130
+ export { CreateReusable, ReusableArguments, ReusableDefinition, ReusableFunction, ReusableInclude, ReusableInput, ReusableOptionSelection, ReusableOverlap, ReusableProps, ReusableResolved, ReusableSelected };
131
+ //# sourceMappingURL=reusable-types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reusable-types.d.mts","names":[],"sources":["../../src/create-config/reusable-types.ts"],"mappings":";;;;;;KAcK,QAAA,YAAoB,MAAA,EAAQ,MAAM;AAAA,KAClC,WAAA,oBAA+B,sBAAA,IAChC,sBAAA,CAAuB,UAAA,KACtB,UAAA;AAL0D;AAAA,KAQnD,uBAAA,eAAsC,aAAA,oBAClC,KAAA,IAAS,KAAA,CAAM,GAAA;EAC3B,IAAA;EACA,UAAA,sBAAgC,aAAA;AAAA,WAEvB,QAAA,CAAS,WAAA,CAAY,KAAA,CAAM,GAAA,MAAS,uBAAA,CAAwB,KAAA,WAC5D,QAAA,CAAS,WAAA,CAAY,KAAA,CAAM,GAAA;AAAA,KAGnC,iBAAA,4BACwB,kBAAA,oBACX,iBAAA,CAAkB,SAAA,KAChC,eAAA,CACF,SAAA,EACA,OAAA,8BAC4B,aAAA,GAC1B,KAAA;AAtBmC;AAAA,KA0B3B,eAAA,4BACiB,kBAAA,oBACX,iBAAA,CAAkB,SAAA;EAElC,SAAA,UAAmB,QAAA,CAAS,uBAAA,CAAwB,SAAA;AAAA,WAC3C,iBAAA,CAAkB,SAAA,EAAW,OAAA;EAGlC,OAAA,UAEI,QAAA,CACE,sBAAA,CAAuB,iBAAA,CAAkB,SAAA,EAAW,OAAA,MA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E1B,eAAA,0BAEtB,UAAA,EAAY,kBAAA,CACV,SAAA,EACA,OAAA,EACA,OAAA,EACA,MAAA,EACA,MAAA,EACA,MAAA,EACA,OAAA,MAEC,gBAAA,CAAiB,SAAA,EAAW,OAAA,EAAS,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,MAAA"}
@@ -1,5 +1,5 @@
1
- const require_render_state_context = require('./render-state-context.cjs');
2
1
  const require_layout_configuration_error = require('../errors/layout-configuration-error.cjs');
2
+ const require_render_state_context = require('./render-state-context.cjs');
3
3
  const require_capitalize = require('../utils/capitalize.cjs');
4
4
  let react = require("react");
5
5
 
@@ -1,5 +1,5 @@
1
- import { ReferencedRenderStateContext, RenderStateNameContext } from "./render-state-context.mjs";
2
1
  import { LayoutConfigurationError } from "../errors/layout-configuration-error.mjs";
2
+ import { ReferencedRenderStateContext, RenderStateNameContext } from "./render-state-context.mjs";
3
3
  import { capitalize } from "../utils/capitalize.mjs";
4
4
  import { createContext, createElement, useContext } from "react";
5
5
 
@@ -0,0 +1,15 @@
1
+ const require_layout_configuration_error = require('./errors/layout-configuration-error.cjs');
2
+ let _jfdevelops_react_layout_validator = require("@jfdevelops/react-layout-validator");
3
+
4
+ //#region src/custom-props.ts
5
+ function normalizeCustomProps(props) {
6
+ return Object.fromEntries(Object.entries(props).map(([key, definition]) => {
7
+ if (typeof definition !== "string") return [key, definition];
8
+ if (key !== "children" || definition !== "required") throw new require_layout_configuration_error.LayoutConfigurationError("Only custom.children accepts the required shorthand.");
9
+ return [key, _jfdevelops_react_layout_validator.createProp.component({ type: "ReactNode" })];
10
+ }));
11
+ }
12
+
13
+ //#endregion
14
+ exports.normalizeCustomProps = normalizeCustomProps;
15
+ //# sourceMappingURL=custom-props.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-props.cjs","names":["LayoutConfigurationError","createProp"],"sources":["../src/custom-props.ts"],"sourcesContent":["import {\n createProp,\n type AnyBuiltPropDefinition,\n type ResolveProps,\n type ResolvedBuiltPropShape,\n} from '@jfdevelops/react-layout-validator';\nimport type { WithChildren } from '@jfdevelops/react-layout-composables';\nimport { LayoutConfigurationError } from './errors';\n\nexport type ChildrenRequirement = 'required';\nexport type CustomPropsObject = Record<\n string,\n AnyBuiltPropDefinition | ChildrenRequirement\n> & {\n children?: AnyBuiltPropDefinition | ChildrenRequirement;\n};\n\n/** String requirements are reserved for the built-in children slot. */\nexport type CustomPropsInput<Props extends CustomPropsObject> = {\n [Key in keyof Props]: Key extends 'children'\n ? Props[Key]\n : Extract<Props[Key], AnyBuiltPropDefinition>;\n};\n\ntype RequiredChildren = ReturnType<typeof createProp.component<'ReactNode'>>;\nexport type NormalizedCustomProps<Props extends CustomPropsObject> = {\n [Key in keyof Props]: Props[Key] extends AnyBuiltPropDefinition\n ? Props[Key]\n : Key extends 'children'\n ? RequiredChildren\n : never;\n};\n\nexport type ResolveRenderProps<Props extends CustomPropsObject> = WithChildren<\n ResolveProps<NormalizedCustomProps<Props>>\n>;\nexport type ResolveRenderPropsAsDefined<Props extends CustomPropsObject> =\n WithChildren<ResolvedBuiltPropShape<NormalizedCustomProps<Props>>>;\n\nexport function normalizeCustomProps<Props extends CustomPropsObject>(\n props: Props,\n) {\n return Object.fromEntries(\n Object.entries(props).map(([key, definition]) => {\n if (typeof definition !== 'string') return [key, definition];\n if (key !== 'children' || definition !== 'required') {\n throw new LayoutConfigurationError(\n 'Only custom.children accepts the required shorthand.',\n );\n }\n const children = createProp.component({ type: 'ReactNode' });\n return [key, children];\n }),\n ) as NormalizedCustomProps<Props>;\n}\n"],"mappings":";;;;AAuCA,SAAgB,qBACd,OACA;CACA,OAAO,OAAO,YACZ,OAAO,QAAQ,KAAK,EAAE,KAAK,CAAC,KAAK,gBAAgB;EAC/C,IAAI,OAAO,eAAe,UAAU,OAAO,CAAC,KAAK,UAAU;EAC3D,IAAI,QAAQ,cAAc,eAAe,YACvC,MAAM,IAAIA,4DACR,sDACF;EAGF,OAAO,CAAC,KADSC,8CAAW,UAAU,EAAE,MAAM,YAAY,CACtC,CAAC;CACvB,CAAC,CACH;AACF"}
@@ -0,0 +1,17 @@
1
+ import { WithChildren } from "@jfdevelops/react-layout-composables";
2
+ import { AnyBuiltPropDefinition, ResolveProps, ResolvedBuiltPropShape, createProp } from "@jfdevelops/react-layout-validator";
3
+
4
+ //#region src/custom-props.d.ts
5
+ type ChildrenRequirement = 'required';
6
+ type CustomPropsObject = Record<string, AnyBuiltPropDefinition | ChildrenRequirement> & {
7
+ children?: AnyBuiltPropDefinition | ChildrenRequirement;
8
+ };
9
+ /** String requirements are reserved for the built-in children slot. */
10
+ type CustomPropsInput<Props extends CustomPropsObject> = { [Key in keyof Props]: Key extends 'children' ? Props[Key] : Extract<Props[Key], AnyBuiltPropDefinition> };
11
+ type RequiredChildren = ReturnType<typeof createProp.component<'ReactNode'>>;
12
+ type NormalizedCustomProps<Props extends CustomPropsObject> = { [Key in keyof Props]: Props[Key] extends AnyBuiltPropDefinition ? Props[Key] : Key extends 'children' ? RequiredChildren : never };
13
+ type ResolveRenderProps<Props extends CustomPropsObject> = WithChildren<ResolveProps<NormalizedCustomProps<Props>>>;
14
+ type ResolveRenderPropsAsDefined<Props extends CustomPropsObject> = WithChildren<ResolvedBuiltPropShape<NormalizedCustomProps<Props>>>;
15
+ //#endregion
16
+ export { ChildrenRequirement, CustomPropsInput, CustomPropsObject, NormalizedCustomProps, ResolveRenderProps, ResolveRenderPropsAsDefined };
17
+ //# sourceMappingURL=custom-props.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-props.d.cts","names":[],"sources":["../src/custom-props.ts"],"mappings":";;;;KASY,mBAAA;AAAA,KACA,iBAAA,GAAoB,MAAA,SAE9B,sBAAA,GAAyB,mBAAA;EAEzB,QAAA,GAAW,sBAAA,GAAyB,mBAAA;AAAA;;KAI1B,gBAAA,eAA+B,iBAAA,oBAC3B,KAAA,GAAQ,GAAA,sBAClB,KAAA,CAAM,GAAA,IACN,OAAA,CAAQ,KAAA,CAAM,GAAA,GAAM,sBAAA;AAAA,KAGrB,gBAAA,GAAmB,UAAU,QAAQ,UAAA,CAAW,SAAA;AAAA,KACzC,qBAAA,eAAoC,iBAAA,oBAChC,KAAA,GAAQ,KAAA,CAAM,GAAA,UAAa,sBAAA,GACrC,KAAA,CAAM,GAAA,IACN,GAAA,sBACA,gBAAA;AAAA,KAIM,kBAAA,eAAiC,iBAAA,IAAqB,YAAA,CAChE,YAAA,CAAa,qBAAA,CAAsB,KAAA;AAAA,KAEzB,2BAAA,eAA0C,iBAAA,IACpD,YAAA,CAAa,sBAAA,CAAuB,qBAAA,CAAsB,KAAA"}
@@ -0,0 +1,17 @@
1
+ import { WithChildren } from "@jfdevelops/react-layout-composables";
2
+ import { AnyBuiltPropDefinition, ResolveProps, ResolvedBuiltPropShape, createProp } from "@jfdevelops/react-layout-validator";
3
+
4
+ //#region src/custom-props.d.ts
5
+ type ChildrenRequirement = 'required';
6
+ type CustomPropsObject = Record<string, AnyBuiltPropDefinition | ChildrenRequirement> & {
7
+ children?: AnyBuiltPropDefinition | ChildrenRequirement;
8
+ };
9
+ /** String requirements are reserved for the built-in children slot. */
10
+ type CustomPropsInput<Props extends CustomPropsObject> = { [Key in keyof Props]: Key extends 'children' ? Props[Key] : Extract<Props[Key], AnyBuiltPropDefinition> };
11
+ type RequiredChildren = ReturnType<typeof createProp.component<'ReactNode'>>;
12
+ type NormalizedCustomProps<Props extends CustomPropsObject> = { [Key in keyof Props]: Props[Key] extends AnyBuiltPropDefinition ? Props[Key] : Key extends 'children' ? RequiredChildren : never };
13
+ type ResolveRenderProps<Props extends CustomPropsObject> = WithChildren<ResolveProps<NormalizedCustomProps<Props>>>;
14
+ type ResolveRenderPropsAsDefined<Props extends CustomPropsObject> = WithChildren<ResolvedBuiltPropShape<NormalizedCustomProps<Props>>>;
15
+ //#endregion
16
+ export { ChildrenRequirement, CustomPropsInput, CustomPropsObject, NormalizedCustomProps, ResolveRenderProps, ResolveRenderPropsAsDefined };
17
+ //# sourceMappingURL=custom-props.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-props.d.mts","names":[],"sources":["../src/custom-props.ts"],"mappings":";;;;KASY,mBAAA;AAAA,KACA,iBAAA,GAAoB,MAAA,SAE9B,sBAAA,GAAyB,mBAAA;EAEzB,QAAA,GAAW,sBAAA,GAAyB,mBAAA;AAAA;;KAI1B,gBAAA,eAA+B,iBAAA,oBAC3B,KAAA,GAAQ,GAAA,sBAClB,KAAA,CAAM,GAAA,IACN,OAAA,CAAQ,KAAA,CAAM,GAAA,GAAM,sBAAA;AAAA,KAGrB,gBAAA,GAAmB,UAAU,QAAQ,UAAA,CAAW,SAAA;AAAA,KACzC,qBAAA,eAAoC,iBAAA,oBAChC,KAAA,GAAQ,KAAA,CAAM,GAAA,UAAa,sBAAA,GACrC,KAAA,CAAM,GAAA,IACN,GAAA,sBACA,gBAAA;AAAA,KAIM,kBAAA,eAAiC,iBAAA,IAAqB,YAAA,CAChE,YAAA,CAAa,qBAAA,CAAsB,KAAA;AAAA,KAEzB,2BAAA,eAA0C,iBAAA,IACpD,YAAA,CAAa,sBAAA,CAAuB,qBAAA,CAAsB,KAAA"}
@@ -0,0 +1,15 @@
1
+ import { LayoutConfigurationError } from "./errors/layout-configuration-error.mjs";
2
+ import { createProp } from "@jfdevelops/react-layout-validator";
3
+
4
+ //#region src/custom-props.ts
5
+ function normalizeCustomProps(props) {
6
+ return Object.fromEntries(Object.entries(props).map(([key, definition]) => {
7
+ if (typeof definition !== "string") return [key, definition];
8
+ if (key !== "children" || definition !== "required") throw new LayoutConfigurationError("Only custom.children accepts the required shorthand.");
9
+ return [key, createProp.component({ type: "ReactNode" })];
10
+ }));
11
+ }
12
+
13
+ //#endregion
14
+ export { normalizeCustomProps };
15
+ //# sourceMappingURL=custom-props.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-props.mjs","names":[],"sources":["../src/custom-props.ts"],"sourcesContent":["import {\n createProp,\n type AnyBuiltPropDefinition,\n type ResolveProps,\n type ResolvedBuiltPropShape,\n} from '@jfdevelops/react-layout-validator';\nimport type { WithChildren } from '@jfdevelops/react-layout-composables';\nimport { LayoutConfigurationError } from './errors';\n\nexport type ChildrenRequirement = 'required';\nexport type CustomPropsObject = Record<\n string,\n AnyBuiltPropDefinition | ChildrenRequirement\n> & {\n children?: AnyBuiltPropDefinition | ChildrenRequirement;\n};\n\n/** String requirements are reserved for the built-in children slot. */\nexport type CustomPropsInput<Props extends CustomPropsObject> = {\n [Key in keyof Props]: Key extends 'children'\n ? Props[Key]\n : Extract<Props[Key], AnyBuiltPropDefinition>;\n};\n\ntype RequiredChildren = ReturnType<typeof createProp.component<'ReactNode'>>;\nexport type NormalizedCustomProps<Props extends CustomPropsObject> = {\n [Key in keyof Props]: Props[Key] extends AnyBuiltPropDefinition\n ? Props[Key]\n : Key extends 'children'\n ? RequiredChildren\n : never;\n};\n\nexport type ResolveRenderProps<Props extends CustomPropsObject> = WithChildren<\n ResolveProps<NormalizedCustomProps<Props>>\n>;\nexport type ResolveRenderPropsAsDefined<Props extends CustomPropsObject> =\n WithChildren<ResolvedBuiltPropShape<NormalizedCustomProps<Props>>>;\n\nexport function normalizeCustomProps<Props extends CustomPropsObject>(\n props: Props,\n) {\n return Object.fromEntries(\n Object.entries(props).map(([key, definition]) => {\n if (typeof definition !== 'string') return [key, definition];\n if (key !== 'children' || definition !== 'required') {\n throw new LayoutConfigurationError(\n 'Only custom.children accepts the required shorthand.',\n );\n }\n const children = createProp.component({ type: 'ReactNode' });\n return [key, children];\n }),\n ) as NormalizedCustomProps<Props>;\n}\n"],"mappings":";;;;AAuCA,SAAgB,qBACd,OACA;CACA,OAAO,OAAO,YACZ,OAAO,QAAQ,KAAK,EAAE,KAAK,CAAC,KAAK,gBAAgB;EAC/C,IAAI,OAAO,eAAe,UAAU,OAAO,CAAC,KAAK,UAAU;EAC3D,IAAI,QAAQ,cAAc,eAAe,YACvC,MAAM,IAAI,yBACR,sDACF;EAGF,OAAO,CAAC,KADS,WAAW,UAAU,EAAE,MAAM,YAAY,CACtC,CAAC;CACvB,CAAC,CACH;AACF"}
@@ -1,5 +1,5 @@
1
- let arktype = require("arktype");
2
1
  let _jfdevelops_create_error = require("@jfdevelops/create-error");
2
+ let arktype = require("arktype");
3
3
 
4
4
  //#region src/errors/react-layout-error.ts
5
5
  function makeJsonSafe(value) {
@@ -1,5 +1,5 @@
1
- import { type } from "arktype";
2
1
  import { createError } from "@jfdevelops/create-error";
2
+ import { type } from "arktype";
3
3
 
4
4
  //#region src/errors/react-layout-error.ts
5
5
  function makeJsonSafe(value) {
package/dist/index.cjs CHANGED
@@ -1,8 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_react_layout_error = require('./errors/react-layout-error.cjs');
3
- const require_layout_configuration_error = require('./errors/layout-configuration-error.cjs');
4
- const require_resource_state_error = require('./errors/resource-state-error.cjs');
5
- const require_lazy_resource_error = require('./errors/lazy-resource-error.cjs');
6
3
  const require_invalid_config = require('./errors/invalid-config.cjs');
7
4
  const require_invalid_path = require('./errors/invalid-path.cjs');
8
5
  const require_invalid_resource = require('./errors/invalid-resource.cjs');
@@ -12,6 +9,9 @@ const require_invalid_part = require('./errors/invalid-part.cjs');
12
9
  const require_invalid_part_type = require('./errors/invalid-part-type.cjs');
13
10
  const require_missing_path_variable = require('./errors/missing-path-variable.cjs');
14
11
  const require_missing_resource_provider = require('./errors/missing-resource-provider.cjs');
12
+ const require_layout_configuration_error = require('./errors/layout-configuration-error.cjs');
13
+ const require_resource_state_error = require('./errors/resource-state-error.cjs');
14
+ const require_lazy_resource_error = require('./errors/lazy-resource-error.cjs');
15
15
  const require_preview = require('./create-config/preview.cjs');
16
16
  const require_resource = require('./resource.cjs');
17
17
  const require_utils = require('./utils.cjs');
package/dist/index.d.cts CHANGED
@@ -1,10 +1,11 @@
1
+ import { ChildrenRequirement, CustomPropsObject } from "./custom-props.cjs";
1
2
  import { LayoutConfigurationError, LayoutConfigurationErrorContext } from "./errors/layout-configuration-error.cjs";
2
3
  import { ResourceModuleLoadError, ResourceRenderError, ResourceStateError } from "./errors/resource-state-error.cjs";
3
4
  import { LazyResourceError, LazyResourceErrorMap, LazyResourceModuleShapeError, LazyResourceStateNotFoundError, isLazyResourceError } from "./errors/lazy-resource-error.cjs";
4
5
  import { CreateLazyErrorComponent, LazyErrorHandlers, LazyHandle, LazyOptions, LazyResourceErrorComponent, LazyResourceErrorProps, LazyResourceLoadingComponent, LazyResourceStates, LoadStatus } from "./lazy/types.cjs";
5
6
  import { BaseComponent, MergeIntersection, Show, UnionToIntersection, pick } from "./utils.cjs";
6
7
  import { LayoutResourceKey, NormalizeResource, NormalizeResources, NormalizedResourceDefinition, NormalizedResourceDefinitions, ResourceDefinition, ResourceDefinitionValue, ResourceEnum, ResourceLayoutComponentProps, ResourcePath, ResourceTree, normalizeResource, normalizeResourceDefinitions, normalizeResources, toResourceEnum } from "./resource.cjs";
7
- import { InPropsDefinition, InPropsFunction, InPropsObject, InPropsOptions, IncludedComponentPropDefinitions, IncludedPropBehavior, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, PropsContextRender, PropsRenderDefinition, ResolvedIncludedComponentProps, ResolvedIncludedConfigProps, ResolvedIncludedProps, ResolvedIncludedPropsAsDefined } from "./props.cjs";
8
+ import { InPropsDefinition, InPropsFunction, InPropsObject, InPropsOptions, IncludedComponentPropDefinitions, IncludedPropBehavior, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, PropsContextRender, PropsContract, PropsRenderDefinition, ResolvedIncludedComponentProps, ResolvedIncludedConfigProps, ResolvedIncludedProps, ResolvedIncludedPropsAsDefined } from "./props.cjs";
8
9
  import { AsStateComposable, StateComposable, StateComposableOptions } from "./create-config/state-composable.cjs";
9
10
  import { AnyRenderStateDefinition, BuiltinRenderStateName, CreateLayoutBuildingBlocks, CreateLayoutBuildingBlocksArguments, CreateLayoutBuildingBlocksResult, CreateRenderState, CreateRenderStateBuilderArguments, CreateRenderStateBuilderResult, CreateRenderStateFromState, DeferredRenderState, DefineLayoutComposables, LayoutComposablesDefinition, LazyRenderState, RenderStateCallProps, RenderStateCallback, RenderStateComposablesDefinition, RenderStateContext, RenderStateFragment, RenderStateName, RenderStateOverloads, RenderStateProps, RenderStateReferences, TypedRenderStateCallback } from "./create-config/render-state.cjs";
10
11
  import { LayoutNameCallback, LayoutNameContext, LayoutNameFactory, LayoutNameInput, LayoutNameOptions, LayoutNamePartDefinitions, LayoutNamePartType, LayoutNamePartValues, LayoutNameParts, LayoutNameResolver, ResolvedLayoutName, defineLayoutName } from "./create-config/layout-name.cjs";
@@ -16,6 +17,7 @@ import { ComponentTypes, CreateResourceConfigFn, CreateResourceConfigForResource
16
17
  import { CreateResourceMap, CreateResourceMapFn } from "./create-config/create-resource-links.cjs";
17
18
  import { ScopedComponentRenderFn } from "./lazy/scoped-content.cjs";
18
19
  import { ContextualInlineRenderState, ContextualInlineRenderStates, CreateResourceLayoutWithLayoutOptions, CreateViewMapBuiltInRenderStatesOptions, CreateViewMapFunctionRenderOptions, CreateViewMapInlineRenderStatesOptions, CreateViewMapRenderStatesOptions, DefineResourceLayoutWithLayoutFn, DefineResourcesFn, DefinedResourceLayoutWithShell, LayoutRenderResourcesAccessor, LayoutResourcesAccessor, ResourceLayoutProvider, ResourceLayoutProviderProps, ResourceLayoutShellComponent, ResourceLayoutShellProps, ResourceSelection, ShellLayoutDefinition, ShellRenderContext, TypedBuiltInRenderStates, TypedInlineRenderState, defineResourceLayout } from "./create-config/define-layout.cjs";
20
+ import { CreateReusable, ReusableArguments, ReusableDefinition, ReusableFunction, ReusableInclude, ReusableInput, ReusableOptionSelection, ReusableOverlap, ReusableProps, ReusableResolved, ReusableSelected } from "./create-config/reusable-types.cjs";
19
21
  import { CreateLazyRenderState, LazyDefaultState } from "./lazy/create-render-state.cjs";
20
22
  import { LazyResourceLayoutComponent, LazyResourceLayoutOptions } from "./create-config/lazy-resource-layout.cjs";
21
23
  import { BoundDefineResourceLayout, CreateDefinedResourceLayoutOptions, CreateDefinedResourceLayoutResult, DefineLazyDefaults, DefinedResourceLayoutInput, NonEmptyResources, createDefinedResourceLayout } from "./create-config/create-defined-resource-layout.cjs";
@@ -33,4 +35,4 @@ import { MissingPathVariableContext, MissingPathVariableError } from "./errors/m
33
35
  import { MissingResourceProviderError } from "./errors/missing-resource-provider.cjs";
34
36
  import { AnyComposableComponent, ComposableComponent, ComposableComponentCallable, ComposableComponents, ComposableNameContext, ComposablePresetComponent, ComposablePresetComponentCallProps, ComposablePresetMeta, ComposablePresetProps, ComposableResourceLayout, CreateLayoutComposable, DefinedComposableComponentRecord, LayoutComposablePresetProvider, LayoutComposablesFactory, MakeComposable, MakeComposableOptions, MergePresetProps, PresetPropsFromComposable, RequiredPresetLayoutProps, RequiredPresetRenderProps, ResolveLayoutComposables, collectComposablePresetEntries, createComposableComponent, createLayoutComposableFactory, defineComposableComponent, makeComposable, resolveComposablePresetProps, resolveLayoutComposables } from "@jfdevelops/react-layout-composables";
35
37
  import { AnyBuiltPropDefinition, ExtractDefinitionValue, PropError, PropErrorOptions, ResolveLayoutProps, ResolveLayoutPropsAsDefined, ResolveProps, ResolvedBuiltPropShape, createPrimitivePropBuilder, createProp, isPropDefinitionShape, resolvePropDefinitionValues, validateProps } from "@jfdevelops/react-layout-validator";
36
- export { type AnyBuiltPropDefinition, type AnyComposableComponent, type AnyRenderStateDefinition, type AsStateComposable, type BaseComponent, type BoundDefineResourceLayout, type BuiltinRenderStateName, type ComponentTypes, type ComposableComponent, type ComposableComponentCallable, type ComposableComponents, type ComposableNameContext, type ComposablePresetComponent, type ComposablePresetComponentCallProps, type ComposablePresetMeta, type ComposablePresetProps, type ComposableResourceLayout, type ContextualInlineRenderState, type ContextualInlineRenderStates, type CreateDefinedResourceLayoutOptions, type CreateDefinedResourceLayoutResult, type CreateGetComponentForPath, type CreateLayoutBuildingBlocks, type CreateLayoutBuildingBlocksArguments, type CreateLayoutBuildingBlocksResult, type CreateLayoutComposable, type CreateLazyErrorComponent, type CreateLazyRenderState, type CreateRenderState, type CreateRenderStateBuilderArguments, type CreateRenderStateBuilderResult, type CreateRenderStateFromState, type CreateResourceConfigFn, type CreateResourceConfigForResource, type CreateResourceLayoutWithLayoutOptions, type CreateResourceMap, type CreateResourceMapFn, type CreateViewMapBuiltInRenderStatesOptions, type CreateViewMapFunctionRenderOptions, type CreateViewMapInlineRenderStatesOptions, type CreateViewMapRenderStatesOptions, type CreatedResourceConfig, type DeferredRenderState, type DefineLayoutComposables, type DefineLazyDefaults, type DefineResourceLayoutWithLayoutFn, type DefineResourcesFn, type DefinedComposableComponentRecord, type DefinedResourceLayoutInput, type DefinedResourceLayoutWithShell, type ExtractDefinitionValue, type ForPaths, type ForPathsRenderContext, type GetComponentForPath, type InPropsDefinition, type InPropsFunction, type InPropsObject, type InPropsOptions, type IncludedComponentPropDefinitions, type IncludedPropBehavior, type IncludedProps, type InferredInProps, type InvalidComponentContext, InvalidComponentError, type InvalidConfigContext, InvalidConfigError, type InvalidPartContext, InvalidPartError, type InvalidPartTypeContext, InvalidPartTypeError, type InvalidPathContext, InvalidPathError, type InvalidResourceContext, InvalidResourceError, type InvalidSubResourceContext, InvalidSubResourceError, type IsSubResourceKey, LayoutComposablePresetProvider, type LayoutComposablesDefinition, type LayoutComposablesFactory, LayoutConfigurationError, type LayoutConfigurationErrorContext, type LayoutNameCallback, type LayoutNameContext, type LayoutNameFactory, type LayoutNameInput, type LayoutNameOptions, type LayoutNamePartDefinitions, type LayoutNamePartType, type LayoutNamePartValues, type LayoutNameParts, type LayoutNameResolver, type LayoutPreviewProps, type LayoutRenderProps, type LayoutRenderResourcesAccessor, type LayoutResourceKey, type LayoutResourcesAccessor, type LazyDefaultState, type LazyErrorHandlers, type LazyHandle, type LazyOptions, type LazyRenderState, type LazyResourceError, type LazyResourceErrorComponent, type LazyResourceErrorMap, type LazyResourceErrorProps, type LazyResourceLayoutComponent, type LazyResourceLayoutOptions, type LazyResourceLoadingComponent, LazyResourceModuleShapeError, LazyResourceStateNotFoundError, type LazyResourceStates, type LoadStatus, type MakeComposable, type MakeComposableOptions, type MergeIntersection, type MergePresetProps, type MergedLayoutInProps, type MissingPathVariableContext, MissingPathVariableError, MissingResourceProviderError, type NonEmptyResources, type NormalizeResource, type NormalizeResources, type NormalizedResourceDefinition, type NormalizedResourceDefinitions, type ParameterizedResourcePath, type PathVariables, type PresetPropsFromComposable, PropError, type PropErrorOptions, type PropsContextRender, type PropsRenderDefinition, ReactLayoutError, type RenderStateCallProps, type RenderStateCallback, type RenderStateComposablesDefinition, type RenderStateContext, type RenderStateFragment, type RenderStateName, type RenderStateOverloads, type RenderStateProps, type RenderStateReferences, type RenderedPathComponent, type RenderedPathComponentHOF, type RequiredPresetLayoutProps, type RequiredPresetRenderProps, type ResolveLayoutComposables, type ResolveLayoutProps, type ResolveLayoutPropsAsDefined, type ResolveProps, type ResolvedBuiltPropShape, type ResolvedIncludedComponentProps, type ResolvedIncludedConfigProps, type ResolvedIncludedProps, type ResolvedIncludedPropsAsDefined, type ResolvedLayoutName, type ResolvedPathValue, type ResourceConfigFragment, type ResourceDefinition, type ResourceDefinitionValue, type ResourceEnum, type ResourceLayoutComponentProps, type ResourceLayoutProvider, type ResourceLayoutProviderProps, type ResourceLayoutShellComponent, type ResourceLayoutShellProps, type ResourceLayoutShellPublisher, ResourceModuleLoadError, type ResourcePath, ResourceRenderError, type ResourceSelection, type ResourceStateError, type ResourceTree, type ScopedComponentRenderFn, type ShellLayoutDefinition, type ShellRenderContext, type Show, type StateComposable, type StateComposableOptions, type TargetPathBuilder, type TypedBuiltInRenderStates, type TypedInlineRenderState, type TypedRenderStateCallback, type UnionToIntersection, collectComposablePresetEntries, createComposableComponent, createDefinedResourceLayout, createLayoutComposableFactory, createPrimitivePropBuilder, createProp, defineComposableComponent, defineLayoutName, defineLayoutPreview, defineResourceLayout, isLazyResourceError, isPropDefinitionShape, makeComposable, normalizeResource, normalizeResourceDefinitions, normalizeResources, pick, resolveComposablePresetProps, resolveLayoutComposables, resolvePropDefinitionValues, toResourceEnum, validateProps };
38
+ export { type AnyBuiltPropDefinition, type AnyComposableComponent, type AnyRenderStateDefinition, type AsStateComposable, type BaseComponent, type BoundDefineResourceLayout, type BuiltinRenderStateName, type ChildrenRequirement, type ComponentTypes, type ComposableComponent, type ComposableComponentCallable, type ComposableComponents, type ComposableNameContext, type ComposablePresetComponent, type ComposablePresetComponentCallProps, type ComposablePresetMeta, type ComposablePresetProps, type ComposableResourceLayout, type ContextualInlineRenderState, type ContextualInlineRenderStates, type CreateDefinedResourceLayoutOptions, type CreateDefinedResourceLayoutResult, type CreateGetComponentForPath, type CreateLayoutBuildingBlocks, type CreateLayoutBuildingBlocksArguments, type CreateLayoutBuildingBlocksResult, type CreateLayoutComposable, type CreateLazyErrorComponent, type CreateLazyRenderState, type CreateRenderState, type CreateRenderStateBuilderArguments, type CreateRenderStateBuilderResult, type CreateRenderStateFromState, type CreateResourceConfigFn, type CreateResourceConfigForResource, type CreateResourceLayoutWithLayoutOptions, type CreateResourceMap, type CreateResourceMapFn, type CreateReusable, type CreateViewMapBuiltInRenderStatesOptions, type CreateViewMapFunctionRenderOptions, type CreateViewMapInlineRenderStatesOptions, type CreateViewMapRenderStatesOptions, type CreatedResourceConfig, type CustomPropsObject, type DeferredRenderState, type DefineLayoutComposables, type DefineLazyDefaults, type DefineResourceLayoutWithLayoutFn, type DefineResourcesFn, type DefinedComposableComponentRecord, type DefinedResourceLayoutInput, type DefinedResourceLayoutWithShell, type ExtractDefinitionValue, type ForPaths, type ForPathsRenderContext, type GetComponentForPath, type InPropsDefinition, type InPropsFunction, type InPropsObject, type InPropsOptions, type IncludedComponentPropDefinitions, type IncludedPropBehavior, type IncludedProps, type InferredInProps, type InvalidComponentContext, InvalidComponentError, type InvalidConfigContext, InvalidConfigError, type InvalidPartContext, InvalidPartError, type InvalidPartTypeContext, InvalidPartTypeError, type InvalidPathContext, InvalidPathError, type InvalidResourceContext, InvalidResourceError, type InvalidSubResourceContext, InvalidSubResourceError, type IsSubResourceKey, LayoutComposablePresetProvider, type LayoutComposablesDefinition, type LayoutComposablesFactory, LayoutConfigurationError, type LayoutConfigurationErrorContext, type LayoutNameCallback, type LayoutNameContext, type LayoutNameFactory, type LayoutNameInput, type LayoutNameOptions, type LayoutNamePartDefinitions, type LayoutNamePartType, type LayoutNamePartValues, type LayoutNameParts, type LayoutNameResolver, type LayoutPreviewProps, type LayoutRenderProps, type LayoutRenderResourcesAccessor, type LayoutResourceKey, type LayoutResourcesAccessor, type LazyDefaultState, type LazyErrorHandlers, type LazyHandle, type LazyOptions, type LazyRenderState, type LazyResourceError, type LazyResourceErrorComponent, type LazyResourceErrorMap, type LazyResourceErrorProps, type LazyResourceLayoutComponent, type LazyResourceLayoutOptions, type LazyResourceLoadingComponent, LazyResourceModuleShapeError, LazyResourceStateNotFoundError, type LazyResourceStates, type LoadStatus, type MakeComposable, type MakeComposableOptions, type MergeIntersection, type MergePresetProps, type MergedLayoutInProps, type MissingPathVariableContext, MissingPathVariableError, MissingResourceProviderError, type NonEmptyResources, type NormalizeResource, type NormalizeResources, type NormalizedResourceDefinition, type NormalizedResourceDefinitions, type ParameterizedResourcePath, type PathVariables, type PresetPropsFromComposable, PropError, type PropErrorOptions, type PropsContextRender, type PropsContract, type PropsRenderDefinition, ReactLayoutError, type RenderStateCallProps, type RenderStateCallback, type RenderStateComposablesDefinition, type RenderStateContext, type RenderStateFragment, type RenderStateName, type RenderStateOverloads, type RenderStateProps, type RenderStateReferences, type RenderedPathComponent, type RenderedPathComponentHOF, type RequiredPresetLayoutProps, type RequiredPresetRenderProps, type ResolveLayoutComposables, type ResolveLayoutProps, type ResolveLayoutPropsAsDefined, type ResolveProps, type ResolvedBuiltPropShape, type ResolvedIncludedComponentProps, type ResolvedIncludedConfigProps, type ResolvedIncludedProps, type ResolvedIncludedPropsAsDefined, type ResolvedLayoutName, type ResolvedPathValue, type ResourceConfigFragment, type ResourceDefinition, type ResourceDefinitionValue, type ResourceEnum, type ResourceLayoutComponentProps, type ResourceLayoutProvider, type ResourceLayoutProviderProps, type ResourceLayoutShellComponent, type ResourceLayoutShellProps, type ResourceLayoutShellPublisher, ResourceModuleLoadError, type ResourcePath, ResourceRenderError, type ResourceSelection, type ResourceStateError, type ResourceTree, type ReusableArguments, type ReusableDefinition, type ReusableFunction, type ReusableInclude, type ReusableInput, type ReusableOptionSelection, type ReusableOverlap, type ReusableProps, type ReusableResolved, type ReusableSelected, type ScopedComponentRenderFn, type ShellLayoutDefinition, type ShellRenderContext, type Show, type StateComposable, type StateComposableOptions, type TargetPathBuilder, type TypedBuiltInRenderStates, type TypedInlineRenderState, type TypedRenderStateCallback, type UnionToIntersection, collectComposablePresetEntries, createComposableComponent, createDefinedResourceLayout, createLayoutComposableFactory, createPrimitivePropBuilder, createProp, defineComposableComponent, defineLayoutName, defineLayoutPreview, defineResourceLayout, isLazyResourceError, isPropDefinitionShape, makeComposable, normalizeResource, normalizeResourceDefinitions, normalizeResources, pick, resolveComposablePresetProps, resolveLayoutComposables, resolvePropDefinitionValues, toResourceEnum, validateProps };