@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
package/dist/index.d.mts CHANGED
@@ -1,10 +1,11 @@
1
+ import { ChildrenRequirement, CustomPropsObject } from "./custom-props.mjs";
1
2
  import { LayoutConfigurationError, LayoutConfigurationErrorContext } from "./errors/layout-configuration-error.mjs";
2
3
  import { ResourceModuleLoadError, ResourceRenderError, ResourceStateError } from "./errors/resource-state-error.mjs";
3
4
  import { LazyResourceError, LazyResourceErrorMap, LazyResourceModuleShapeError, LazyResourceStateNotFoundError, isLazyResourceError } from "./errors/lazy-resource-error.mjs";
4
5
  import { CreateLazyErrorComponent, LazyErrorHandlers, LazyHandle, LazyOptions, LazyResourceErrorComponent, LazyResourceErrorProps, LazyResourceLoadingComponent, LazyResourceStates, LoadStatus } from "./lazy/types.mjs";
5
6
  import { BaseComponent, MergeIntersection, Show, UnionToIntersection, pick } from "./utils.mjs";
6
7
  import { LayoutResourceKey, NormalizeResource, NormalizeResources, NormalizedResourceDefinition, NormalizedResourceDefinitions, ResourceDefinition, ResourceDefinitionValue, ResourceEnum, ResourceLayoutComponentProps, ResourcePath, ResourceTree, normalizeResource, normalizeResourceDefinitions, normalizeResources, toResourceEnum } from "./resource.mjs";
7
- import { InPropsDefinition, InPropsFunction, InPropsObject, InPropsOptions, IncludedComponentPropDefinitions, IncludedPropBehavior, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, PropsContextRender, PropsRenderDefinition, ResolvedIncludedComponentProps, ResolvedIncludedConfigProps, ResolvedIncludedProps, ResolvedIncludedPropsAsDefined } from "./props.mjs";
8
+ import { InPropsDefinition, InPropsFunction, InPropsObject, InPropsOptions, IncludedComponentPropDefinitions, IncludedPropBehavior, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, PropsContextRender, PropsContract, PropsRenderDefinition, ResolvedIncludedComponentProps, ResolvedIncludedConfigProps, ResolvedIncludedProps, ResolvedIncludedPropsAsDefined } from "./props.mjs";
8
9
  import { AsStateComposable, StateComposable, StateComposableOptions } from "./create-config/state-composable.mjs";
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.mjs";
10
11
  import { LayoutNameCallback, LayoutNameContext, LayoutNameFactory, LayoutNameInput, LayoutNameOptions, LayoutNamePartDefinitions, LayoutNamePartType, LayoutNamePartValues, LayoutNameParts, LayoutNameResolver, ResolvedLayoutName, defineLayoutName } from "./create-config/layout-name.mjs";
@@ -16,6 +17,7 @@ import { ComponentTypes, CreateResourceConfigFn, CreateResourceConfigForResource
16
17
  import { CreateResourceMap, CreateResourceMapFn } from "./create-config/create-resource-links.mjs";
17
18
  import { ScopedComponentRenderFn } from "./lazy/scoped-content.mjs";
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.mjs";
20
+ import { CreateReusable, ReusableArguments, ReusableDefinition, ReusableFunction, ReusableInclude, ReusableInput, ReusableOptionSelection, ReusableOverlap, ReusableProps, ReusableResolved, ReusableSelected } from "./create-config/reusable-types.mjs";
19
21
  import { CreateLazyRenderState, LazyDefaultState } from "./lazy/create-render-state.mjs";
20
22
  import { LazyResourceLayoutComponent, LazyResourceLayoutOptions } from "./create-config/lazy-resource-layout.mjs";
21
23
  import { BoundDefineResourceLayout, CreateDefinedResourceLayoutOptions, CreateDefinedResourceLayoutResult, DefineLazyDefaults, DefinedResourceLayoutInput, NonEmptyResources, createDefinedResourceLayout } from "./create-config/create-defined-resource-layout.mjs";
@@ -33,4 +35,4 @@ import { MissingPathVariableContext, MissingPathVariableError } from "./errors/m
33
35
  import { MissingResourceProviderError } from "./errors/missing-resource-provider.mjs";
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 };
package/dist/index.mjs CHANGED
@@ -1,7 +1,4 @@
1
1
  import { ReactLayoutError } from "./errors/react-layout-error.mjs";
2
- import { LayoutConfigurationError } from "./errors/layout-configuration-error.mjs";
3
- import { ResourceModuleLoadError, ResourceRenderError } from "./errors/resource-state-error.mjs";
4
- import { LazyResourceModuleShapeError, LazyResourceStateNotFoundError, isLazyResourceError } from "./errors/lazy-resource-error.mjs";
5
2
  import { InvalidConfigError } from "./errors/invalid-config.mjs";
6
3
  import { InvalidPathError } from "./errors/invalid-path.mjs";
7
4
  import { InvalidResourceError } from "./errors/invalid-resource.mjs";
@@ -11,6 +8,9 @@ import { InvalidPartError } from "./errors/invalid-part.mjs";
11
8
  import { InvalidPartTypeError } from "./errors/invalid-part-type.mjs";
12
9
  import { MissingPathVariableError } from "./errors/missing-path-variable.mjs";
13
10
  import { MissingResourceProviderError } from "./errors/missing-resource-provider.mjs";
11
+ import { LayoutConfigurationError } from "./errors/layout-configuration-error.mjs";
12
+ import { ResourceModuleLoadError, ResourceRenderError } from "./errors/resource-state-error.mjs";
13
+ import { LazyResourceModuleShapeError, LazyResourceStateNotFoundError, isLazyResourceError } from "./errors/lazy-resource-error.mjs";
14
14
  import { defineLayoutPreview } from "./create-config/preview.mjs";
15
15
  import { normalizeResource, normalizeResourceDefinitions, normalizeResources, toResourceEnum } from "./resource.mjs";
16
16
  import { pick } from "./utils.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"create-render-state.cjs","names":["LayoutConfigurationError","defineResourceLayout"],"sources":["../../src/lazy/create-render-state.tsx"],"sourcesContent":["import { createElement, type ComponentType, type ReactNode } from 'react';\nimport type { ComposableComponents } from '@jfdevelops/react-layout-composables';\nimport { LayoutConfigurationError } from '../errors';\nimport type { ResourceDefinition, ResourcePath } from '../resource';\nimport {\n type ResolvedIncludedComponentProps,\n type IncludedProps,\n type InPropsDefinition,\n type InPropsObject,\n type MergedLayoutInProps,\n} from '../props';\nimport { defineResourceLayout } from '../create-config/define-layout';\nimport type {\n LayoutComposablesDefinition,\n RenderStateContext,\n RenderStateProps,\n OptionalStateChildren,\n} from '../create-config/render-state';\nimport type { ResolveProps } from '@jfdevelops/react-layout-validator';\nimport type {\n LazyResourceErrorProps,\n LazyErrorHandlers,\n CreateLazyErrorComponent,\n} from './types';\n\nexport type LazyDefaultState = 'Loading' | 'Error';\ntype BuiltinProps<\n State extends LazyDefaultState,\n Resource,\n> = State extends 'Error'\n ? LazyResourceErrorProps<Resource>\n : { resource: Resource };\n\n/** Shorthand includes are direct props; explicit supply sources retain their contract. */\ntype LazyDefaultIncludes<Include> = {\n [Key in keyof Include]: Include[Key] extends true\n ? { required: true; suppliedVia: 'component' }\n : Include[Key];\n};\n\ntype LazyRender<State extends LazyDefaultState, Resource, Props, Context> =\n | ((\n props: Props & BuiltinProps<State, Resource>,\n context: Context,\n ) => ReactNode)\n | (State extends 'Error'\n ? LazyErrorHandlers<Resource, Props & object, Context>\n : never);\n\n/** Creates validated, composable-aware fallback components for one factory. */\nexport type CreateLazyRenderState<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n> = <\n const State extends LazyDefaultState,\n const Custom extends InPropsObject = {},\n const Include extends IncludedProps<\n MergedLayoutInProps<Resources, Options, Composables>\n > = {},\n>(definition: {\n state: State;\n props?: { include?: Include; custom?: Custom };\n render: LazyRender<State, ResourcePath<Resources>, RenderStateProps<Resources, Options, Composables, Include, Custom>, RenderStateContext<Composables, Resources, State>>;\n}) => ComponentType<\n OptionalStateChildren<\n ResolveProps<Custom> &\n ResolvedIncludedComponentProps<\n MergedLayoutInProps<Resources, Options, Composables>,\n LazyDefaultIncludes<Include>\n >\n > &\n BuiltinProps<State, ResourcePath<Resources>>\n>;\n\n/** Compatibility helper; custom props keep their existing unchecked contract. */\nexport type CreateBoundLazyErrorComponent<Resource, Context> =\n CreateLazyErrorComponent<Resource, Context>;\n\ntype RuntimeDefinition = {\n state: LazyDefaultState;\n props?: { include?: Record<string, unknown>; custom?: InPropsObject };\n render:\n | ((props: any, context: any) => ReactNode)\n | LazyErrorHandlers<string, object, any>;\n};\n\nexport function createLazyRenderStateBuilder<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n>(configuration: {\n resources: Resources;\n options: Options;\n composables?: LayoutComposablesDefinition<Resources, Composables>;\n}): CreateLazyRenderState<Resources, Options, Composables> {\n function createRenderState(definition: RuntimeDefinition) {\n if (definition.state !== 'Loading' && definition.state !== 'Error') {\n throw new LayoutConfigurationError(\n `Unknown lazy default state \"${definition.state}\"`,\n );\n }\n // Lazy defaults have no create-time configuration call. Included values are\n // supplied by their component caller unless an explicit config source is selected.\n const include = Object.fromEntries(\n Object.entries(definition.props?.include ?? {}).map(([key, behavior]) => [\n key,\n behavior === true\n ? { required: true, suppliedVia: 'component' }\n : behavior,\n ]),\n );\n function RenderLazyDefault({\n props,\n context,\n }: {\n props: any;\n context: any;\n }) {\n if (typeof definition.render === 'function') {\n return definition.render(props, context);\n }\n const errorProps = props as LazyResourceErrorProps;\n const handler =\n definition.render[errorProps.error.code] ?? definition.render.fallback;\n if (!handler) throw errorProps.error;\n return handler(props as never, context);\n }\n const layout = defineResourceLayout({\n resources: configuration.resources,\n options: configuration.options,\n layout: {\n render: {\n default: () => null,\n [definition.state]: {\n composables: configuration.composables,\n props: { include, custom: definition.props?.custom },\n render: (props: any, context: any) =>\n createElement(RenderLazyDefault, { props, context }),\n },\n },\n },\n } as never);\n const components = new Map<string, ComponentType<any>>();\n function LazyDefault(props: { resource: string }) {\n // Nested lazy paths use the factory's top-level resource definitions for\n // option resolution. The callback still receives the complete path.\n const resource = props.resource.split('.')[0]!;\n let Component = components.get(resource);\n if (!Component) {\n const Root = layout.createResourceLayout({\n resource,\n name: 'LazyDefault',\n namespace: false,\n } as never) as unknown as Record<LazyDefaultState, ComponentType<any>>;\n Component = Root[definition.state];\n components.set(resource, Component);\n }\n return createElement(Component, props);\n }\n return LazyDefault;\n }\n return createRenderState as CreateLazyRenderState<\n Resources,\n Options,\n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 {"version":3,"file":"create-render-state.cjs","names":["LayoutConfigurationError","defineResourceLayout"],"sources":["../../src/lazy/create-render-state.tsx"],"sourcesContent":["import type {\n CustomPropsInput,\n CustomPropsObject,\n ResolveRenderProps,\n} from '../custom-props';\nimport { createElement, type ComponentType, type ReactNode } from 'react';\nimport type { ComposableComponents } from '@jfdevelops/react-layout-composables';\nimport { LayoutConfigurationError } from '../errors';\nimport type { ResourceDefinition, ResourcePath } from '../resource';\nimport type {\n ResolvedIncludedComponentProps,\n IncludedProps,\n InPropsDefinition,\n MergedLayoutInProps,\n} from '../props';\nimport { defineResourceLayout } from '../create-config/define-layout';\nimport type {\n LayoutComposablesDefinition,\n RenderStateContext,\n RenderStateProps,\n OptionalStateChildren,\n} from '../create-config/render-state';\n\nimport type {\n LazyResourceErrorProps,\n LazyErrorHandlers,\n CreateLazyErrorComponent,\n} from './types';\n\nexport type LazyDefaultState = 'Loading' | 'Error';\ntype BuiltinProps<\n State extends LazyDefaultState,\n Resource,\n> = State extends 'Error'\n ? LazyResourceErrorProps<Resource>\n : { resource: Resource };\n\n/** Shorthand includes are direct props; explicit supply sources retain their contract. */\ntype LazyDefaultIncludes<Include> = {\n [Key in keyof Include]: Include[Key] extends true\n ? { required: true; suppliedVia: 'component' }\n : Include[Key];\n};\n\ntype LazyRender<State extends LazyDefaultState, Resource, Props, Context> =\n | ((\n props: Props & BuiltinProps<State, Resource>,\n context: Context,\n ) => ReactNode)\n | (State extends 'Error'\n ? LazyErrorHandlers<Resource, Props & object, Context>\n : never);\n\n/** Creates validated, composable-aware fallback components for one factory. */\nexport type CreateLazyRenderState<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n> = <\n const State extends LazyDefaultState,\n const Custom extends CustomPropsObject = {},\n const Include extends IncludedProps<\n MergedLayoutInProps<Resources, Options, Composables>\n > = {},\n>(definition: {\n state: State;\n props?: { include?: Include; custom?: Custom & CustomPropsInput<Custom> };\n render: LazyRender<\n State,\n ResourcePath<Resources>,\n RenderStateProps<Resources, Options, Composables, Include, Custom>,\n RenderStateContext<Composables, Resources, State>\n >;\n}) => ComponentType<\n OptionalStateChildren<\n ResolveRenderProps<Custom> &\n ResolvedIncludedComponentProps<\n MergedLayoutInProps<Resources, Options, Composables>,\n LazyDefaultIncludes<Include>\n >,\n Custom\n > &\n BuiltinProps<State, ResourcePath<Resources>>\n>;\n\n/** Compatibility helper; custom props keep their existing unchecked contract. */\nexport type CreateBoundLazyErrorComponent<Resource, Context> =\n CreateLazyErrorComponent<Resource, Context>;\n\ntype RuntimeDefinition = {\n state: LazyDefaultState;\n props?: { include?: Record<string, unknown>; custom?: CustomPropsObject };\n render:\n | ((props: any, context: any) => ReactNode)\n | LazyErrorHandlers<string, object, any>;\n};\n\nexport function createLazyRenderStateBuilder<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n>(configuration: {\n resources: Resources;\n options: Options;\n composables?: LayoutComposablesDefinition<Resources, Composables>;\n}): CreateLazyRenderState<Resources, Options, Composables> {\n function createRenderState(definition: RuntimeDefinition) {\n if (definition.state !== 'Loading' && definition.state !== 'Error') {\n throw new LayoutConfigurationError(\n `Unknown lazy default state \"${definition.state}\"`,\n );\n }\n // Lazy defaults have no create-time configuration call. Included values are\n // supplied by their component caller unless an explicit config source is selected.\n const include = Object.fromEntries(\n Object.entries(definition.props?.include ?? {}).map(([key, behavior]) => [\n key,\n behavior === true\n ? { required: true, suppliedVia: 'component' }\n : behavior,\n ]),\n );\n function RenderLazyDefault({\n props,\n context,\n }: {\n props: any;\n context: any;\n }) {\n if (typeof definition.render === 'function') {\n return definition.render(props, context);\n }\n const errorProps = props as LazyResourceErrorProps;\n const handler =\n definition.render[errorProps.error.code] ?? definition.render.fallback;\n if (!handler) throw errorProps.error;\n return handler(props as never, context);\n }\n const layout = defineResourceLayout({\n resources: configuration.resources,\n options: configuration.options,\n layout: {\n render: {\n default: () => null,\n [definition.state]: {\n composables: configuration.composables,\n props: { include, custom: definition.props?.custom },\n render: (props: any, context: any) =>\n createElement(RenderLazyDefault, { props, context }),\n },\n },\n },\n } as never);\n const components = new Map<string, ComponentType<any>>();\n function LazyDefault(props: { resource: string }) {\n // Nested lazy paths use the factory's top-level resource definitions for\n // option resolution. The callback still receives the complete path.\n const resource = props.resource.split('.')[0]!;\n let Component = components.get(resource);\n if (!Component) {\n const Root = layout.createResourceLayout({\n resource,\n name: 'LazyDefault',\n namespace: false,\n } as never) as unknown as Record<LazyDefaultState, ComponentType<any>>;\n Component = Root[definition.state];\n components.set(resource, Component);\n }\n return createElement(Component, props);\n }\n return LazyDefault;\n }\n return createRenderState as CreateLazyRenderState<\n Resources,\n Options,\n Composables\n >;\n}\n"],"mappings":";;;;;AAiGA,SAAgB,6BAId,eAIyD;CACzD,SAAS,kBAAkB,YAA+B;EACxD,IAAI,WAAW,UAAU,aAAa,WAAW,UAAU,SACzD,MAAM,IAAIA,4DACR,+BAA+B,WAAW,MAAM,EAClD;EAIF,MAAM,UAAU,OAAO,YACrB,OAAO,QAAQ,WAAW,OAAO,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,cAAc,CACvE,KACA,aAAa,OACT;GAAE,UAAU;GAAM,aAAa;EAAY,IAC3C,QACN,CAAC,CACH;EACA,SAAS,kBAAkB,EACzB,OACA,WAIC;GACD,IAAI,OAAO,WAAW,WAAW,YAC/B,OAAO,WAAW,OAAO,OAAO,OAAO;GAEzC,MAAM,aAAa;GACnB,MAAM,UACJ,WAAW,OAAO,WAAW,MAAM,SAAS,WAAW,OAAO;GAChE,IAAI,CAAC,SAAS,MAAM,WAAW;GAC/B,OAAO,QAAQ,OAAgB,OAAO;EACxC;EACA,MAAM,SAASC,2CAAqB;GAClC,WAAW,cAAc;GACzB,SAAS,cAAc;GACvB,QAAQ,EACN,QAAQ;IACN,eAAe;KACd,WAAW,QAAQ;KAClB,aAAa,cAAc;KAC3B,OAAO;MAAE;MAAS,QAAQ,WAAW,OAAO;KAAO;KACnD,SAAS,OAAY,qCACL,mBAAmB;MAAE;MAAO;KAAQ,CAAC;IACvD;GACF,EACF;EACF,CAAU;EACV,MAAM,6BAAa,IAAI,IAAgC;EACvD,SAAS,YAAY,OAA6B;GAGhD,MAAM,WAAW,MAAM,SAAS,MAAM,GAAG,EAAE;GAC3C,IAAI,YAAY,WAAW,IAAI,QAAQ;GACvC,IAAI,CAAC,WAAW;IAMd,YALa,OAAO,qBAAqB;KACvC;KACA,MAAM;KACN,WAAW;IACb,CACe,EAAE,WAAW;IAC5B,WAAW,IAAI,UAAU,SAAS;GACpC;GACA,gCAAqB,WAAW,KAAK;EACvC;EACA,OAAO;CACT;CACA,OAAO;AAKT"}
@@ -1,10 +1,10 @@
1
+ import { CustomPropsInput, CustomPropsObject, ResolveRenderProps } from "../custom-props.cjs";
1
2
  import { CreateLazyErrorComponent, LazyErrorHandlers, LazyResourceErrorProps } from "./types.cjs";
2
3
  import { ResourceDefinition, ResourcePath } from "../resource.cjs";
3
- import { InPropsDefinition, InPropsObject, IncludedProps, MergedLayoutInProps, ResolvedIncludedComponentProps } from "../props.cjs";
4
+ import { InPropsDefinition, IncludedProps, MergedLayoutInProps, ResolvedIncludedComponentProps } from "../props.cjs";
4
5
  import { OptionalStateChildren, RenderStateContext, RenderStateProps } from "../create-config/render-state.cjs";
5
6
  import { ComposableComponents } from "@jfdevelops/react-layout-composables";
6
7
  import { ComponentType, ReactNode } from "react";
7
- import { ResolveProps } from "@jfdevelops/react-layout-validator";
8
8
 
9
9
  //#region src/lazy/create-render-state.d.ts
10
10
  type LazyDefaultState = 'Loading' | 'Error';
@@ -18,14 +18,14 @@ type LazyDefaultIncludes<Include> = { [Key in keyof Include]: Include[Key] exten
18
18
  } : Include[Key] };
19
19
  type LazyRender<State extends LazyDefaultState, Resource, Props, Context> = ((props: Props & BuiltinProps<State, Resource>, context: Context) => ReactNode) | (State extends 'Error' ? LazyErrorHandlers<Resource, Props & object, Context> : never);
20
20
  /** Creates validated, composable-aware fallback components for one factory. */
21
- type CreateLazyRenderState<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, Composables extends ComposableComponents> = <const State extends LazyDefaultState, const Custom extends InPropsObject = {}, const Include extends IncludedProps<MergedLayoutInProps<Resources, Options, Composables>> = {}>(definition: {
21
+ type CreateLazyRenderState<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, Composables extends ComposableComponents> = <const State extends LazyDefaultState, const Custom extends CustomPropsObject = {}, const Include extends IncludedProps<MergedLayoutInProps<Resources, Options, Composables>> = {}>(definition: {
22
22
  state: State;
23
23
  props?: {
24
24
  include?: Include;
25
- custom?: Custom;
25
+ custom?: Custom & CustomPropsInput<Custom>;
26
26
  };
27
27
  render: LazyRender<State, ResourcePath<Resources>, RenderStateProps<Resources, Options, Composables, Include, Custom>, RenderStateContext<Composables, Resources, State>>;
28
- }) => ComponentType<OptionalStateChildren<ResolveProps<Custom> & ResolvedIncludedComponentProps<MergedLayoutInProps<Resources, Options, Composables>, LazyDefaultIncludes<Include>>> & BuiltinProps<State, ResourcePath<Resources>>>;
28
+ }) => ComponentType<OptionalStateChildren<ResolveRenderProps<Custom> & ResolvedIncludedComponentProps<MergedLayoutInProps<Resources, Options, Composables>, LazyDefaultIncludes<Include>>, Custom> & BuiltinProps<State, ResourcePath<Resources>>>;
29
29
  /** Compatibility helper; custom props keep their existing unchecked contract. */
30
30
  type CreateBoundLazyErrorComponent<Resource, Context> = CreateLazyErrorComponent<Resource, Context>;
31
31
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"create-render-state.d.cts","names":[],"sources":["../../src/lazy/create-render-state.tsx"],"mappings":";;;;;;;;;KAyBY,gBAAA;AAAA,KACP,YAAA,eACW,gBAAA,cAEZ,KAAA,mBACA,sBAAA,CAAuB,QAAA;EACrB,QAAA,EAAU,QAAA;AAAA;;KAGX,mBAAA,4BACW,OAAA,GAAU,OAAA,C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AAgB,WAAA;AAAA,IAClB,OAAA,CAAQ,GAAA;AAAA,KAGT,UAAA,eAAyB,gBAAA,gCAExB,KAAA,EAAO,KAAA,GAAQ,YAAA,CAAa,KAAA,EAAO,QAAA,GACnC,OAAA,EAAS,OAAA,KACN,SAAA,KACJ,KAAA,mBACG,iBAAA,CAAkB,QAAA,EAAU,KAAA,WAAgB,OAAA;;KAIxC,qBAAA,mBACQ,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,uBACd,oBAAA,yBAEA,gBAAA,uBACC,iBAAA,6BACC,aAAA,CACpB,mBAAA,CAAoB,SAAA,EAAW,OAAA,EAAS,WAAA,SAE1C,UAAA;EACA,KAAA,EAAO,KAAA;EACP,KAAA;IAAU,OAAA,GAAU,OAAA;IAAS,MAAA,GAAS,MAAA,GAAS,gBAAA,CAAiB,MAAA;EAAA;EAChE,MAAA,EAAQ,UAAA,CACN,KAAA,EACA,YAAA,CAAa,SAAA,GACb,gBAAA,CAAiB,SAAA,EAAW,OAAA,EAAS,WAAA,EAAa,OAAA,EAAS,MAAA,GAC3D,kBAAA,CAAmB,WAAA,EAAa,SAAA,EAAW,KAAA;AAAA,MAEzC,aAAA,CACJ,qBAAA,CACE,kBAAA,CAAmB,MAAA,IACjB,8BAAA,CACE,mBAAA,CAAoB,SAAA,EAAW,OAAA,EAAS,WAAA,GACxC,mBAAA,CAAoB,OAAA,IAExB,MAAA,IAEA,YAAA,CAAa,KAAA,EAAO,YAAA,CAAa,SAAA;;KAIzB,6BAAA,sBACV,wBAAA,CAAyB,QAAA,EAAU,OAAA"}
@@ -1,10 +1,10 @@
1
+ import { CustomPropsInput, CustomPropsObject, ResolveRenderProps } from "../custom-props.mjs";
1
2
  import { CreateLazyErrorComponent, LazyErrorHandlers, LazyResourceErrorProps } from "./types.mjs";
2
3
  import { ResourceDefinition, ResourcePath } from "../resource.mjs";
3
- import { InPropsDefinition, InPropsObject, IncludedProps, MergedLayoutInProps, ResolvedIncludedComponentProps } from "../props.mjs";
4
+ import { InPropsDefinition, IncludedProps, MergedLayoutInProps, ResolvedIncludedComponentProps } from "../props.mjs";
4
5
  import { OptionalStateChildren, RenderStateContext, RenderStateProps } from "../create-config/render-state.mjs";
5
6
  import { ComposableComponents } from "@jfdevelops/react-layout-composables";
6
7
  import { ComponentType, ReactNode } from "react";
7
- import { ResolveProps } from "@jfdevelops/react-layout-validator";
8
8
 
9
9
  //#region src/lazy/create-render-state.d.ts
10
10
  type LazyDefaultState = 'Loading' | 'Error';
@@ -18,14 +18,14 @@ type LazyDefaultIncludes<Include> = { [Key in keyof Include]: Include[Key] exten
18
18
  } : Include[Key] };
19
19
  type LazyRender<State extends LazyDefaultState, Resource, Props, Context> = ((props: Props & BuiltinProps<State, Resource>, context: Context) => ReactNode) | (State extends 'Error' ? LazyErrorHandlers<Resource, Props & object, Context> : never);
20
20
  /** Creates validated, composable-aware fallback components for one factory. */
21
- type CreateLazyRenderState<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, Composables extends ComposableComponents> = <const State extends LazyDefaultState, const Custom extends InPropsObject = {}, const Include extends IncludedProps<MergedLayoutInProps<Resources, Options, Composables>> = {}>(definition: {
21
+ type CreateLazyRenderState<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, Composables extends ComposableComponents> = <const State extends LazyDefaultState, const Custom extends CustomPropsObject = {}, const Include extends IncludedProps<MergedLayoutInProps<Resources, Options, Composables>> = {}>(definition: {
22
22
  state: State;
23
23
  props?: {
24
24
  include?: Include;
25
- custom?: Custom;
25
+ custom?: Custom & CustomPropsInput<Custom>;
26
26
  };
27
27
  render: LazyRender<State, ResourcePath<Resources>, RenderStateProps<Resources, Options, Composables, Include, Custom>, RenderStateContext<Composables, Resources, State>>;
28
- }) => ComponentType<OptionalStateChildren<ResolveProps<Custom> & ResolvedIncludedComponentProps<MergedLayoutInProps<Resources, Options, Composables>, LazyDefaultIncludes<Include>>> & BuiltinProps<State, ResourcePath<Resources>>>;
28
+ }) => ComponentType<OptionalStateChildren<ResolveRenderProps<Custom> & ResolvedIncludedComponentProps<MergedLayoutInProps<Resources, Options, Composables>, LazyDefaultIncludes<Include>>, Custom> & BuiltinProps<State, ResourcePath<Resources>>>;
29
29
  /** Compatibility helper; custom props keep their existing unchecked contract. */
30
30
  type CreateBoundLazyErrorComponent<Resource, Context> = CreateLazyErrorComponent<Resource, Context>;
31
31
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"create-render-state.d.mts","names":[],"sources":["../../src/lazy/create-render-state.tsx"],"mappings":";;;;;;;;;KAyBY,gBAAA;AAAA,KACP,YAAA,eACW,gBAAA,cAEZ,KAAA,mBACA,sBAAA,CAAuB,QAAA;EACrB,QAAA,EAAU,QAAA;AAAA;;KAGX,mBAAA,4BACW,OAAA,GAAU,OAAA,CAAQ,GAAA;EAC1B,QAAA;EAAgB,WAAA;AAAA,IAClB,OAAA,CAAQ,GAAA;AAAA,KAGT,UAAA,eAAyB,gBAAA,gCAExB,KAAA,EAAO,KAAA,GAAQ,YAAA,CAAa,KAAA,EAAO,QAAA,GACnC,OAAA,EAAS,OAAA,KACN,SAAA,KACJ,KAAA,mBACG,iBAAA,CAAkB,QAAA,EAAU,KAAA,WAAgB,OAAA;;KAIxC,qBAAA,mBACQ,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,uBACd,oBAAA,yBAEA,gBAAA,uBACC,aAAA,6BACC,aAAA,CACpB,mBAAA,CAAoB,SAAA,EAAW,OAAA,EAAS,WAAA,SAE1C,UAAA;EACA,KAAA,EAAO,KAAA;EACP,KAAA;IAAU,OAAA,GAAU,OAAA;IAAS,MAAA,GAAS,MAAA;EAAA;EACtC,MAAA,EAAQ,UAAA,CAAW,KAAA,EAAO,YAAA,CAAa,SAAA,GAAY,gBAAA,CAAiB,SAAA,EAAW,OAAA,EAAS,WAAA,EAAa,OAAA,EAAS,MAAA,GAAS,kBAAA,CAAmB,WAAA,EAAa,SAAA,E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AW,KAAA;AAAA,MAEzC,aAAA,CACJ,qBAAA,CACE,kBAAA,CAAmB,MAAA,IACjB,8BAAA,CACE,mBAAA,CAAoB,SAAA,EAAW,OAAA,EAAS,WAAA,GACxC,mBAAA,CAAoB,OAAA,IAExB,MAAA,IAEA,YAAA,CAAa,KAAA,EAAO,YAAA,CAAa,SAAA;;KAIzB,6BAAA,sBACV,wBAAA,CAAyB,QAAA,EAAU,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-render-state.mjs","names":[],"sources":["../../src/lazy/create-render-state.tsx"],"sourcesContent":["import { createElement, type ComponentType, type ReactNode } from 'react';\nimport type { ComposableComponents } from '@jfdevelops/react-layout-composables';\nimport { LayoutConfigurationError } from '../errors';\nimport type { ResourceDefinition, ResourcePath } from '../resource';\nimport {\n type ResolvedIncludedComponentProps,\n type IncludedProps,\n type InPropsDefinition,\n type InPropsObject,\n type MergedLayoutInProps,\n} from '../props';\nimport { defineResourceLayout } from '../create-config/define-layout';\nimport type {\n LayoutComposablesDefinition,\n RenderStateContext,\n RenderStateProps,\n OptionalStateChildren,\n} from '../create-config/render-state';\nimport type { ResolveProps } from '@jfdevelops/react-layout-validator';\nimport type {\n LazyResourceErrorProps,\n LazyErrorHandlers,\n CreateLazyErrorComponent,\n} from './types';\n\nexport type LazyDefaultState = 'Loading' | 'Error';\ntype BuiltinProps<\n State extends LazyDefaultState,\n Resource,\n> = State extends 'Error'\n ? LazyResourceErrorProps<Resource>\n : { resource: Resource };\n\n/** Shorthand includes are direct props; explicit supply sources retain their contract. */\ntype LazyDefaultIncludes<Include> = {\n [Key in keyof Include]: Include[Key] extends true\n ? { required: true; suppliedVia: 'component' }\n : Include[Key];\n};\n\ntype LazyRender<State extends LazyDefaultState, Resource, Props, Context> =\n | ((\n props: Props & BuiltinProps<State, Resource>,\n context: Context,\n ) => ReactNode)\n | (State extends 'Error'\n ? LazyErrorHandlers<Resource, Props & object, Context>\n : never);\n\n/** Creates validated, composable-aware fallback components for one factory. */\nexport type CreateLazyRenderState<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n> = <\n const State extends LazyDefaultState,\n const Custom extends InPropsObject = {},\n const Include extends IncludedProps<\n MergedLayoutInProps<Resources, Options, Composables>\n > = {},\n>(definition: {\n state: State;\n props?: { include?: Include; custom?: Custom };\n render: LazyRender<State, ResourcePath<Resources>, RenderStateProps<Resources, Options, Composables, Include, Custom>, RenderStateContext<Composables, Resources, State>>;\n}) => ComponentType<\n OptionalStateChildren<\n ResolveProps<Custom> &\n ResolvedIncludedComponentProps<\n MergedLayoutInProps<Resources, Options, Composables>,\n LazyDefaultIncludes<Include>\n >\n > &\n BuiltinProps<State, ResourcePath<Resources>>\n>;\n\n/** Compatibility helper; custom props keep their existing unchecked contract. */\nexport type CreateBoundLazyErrorComponent<Resource, Context> =\n CreateLazyErrorComponent<Resource, Context>;\n\ntype RuntimeDefinition = {\n state: LazyDefaultState;\n props?: { include?: Record<string, unknown>; custom?: InPropsObject };\n render:\n | ((props: any, context: any) => ReactNode)\n | LazyErrorHandlers<string, object, any>;\n};\n\nexport function createLazyRenderStateBuilder<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n>(configuration: {\n resources: Resources;\n options: Options;\n composables?: LayoutComposablesDefinition<Resources, Composables>;\n}): CreateLazyRenderState<Resources, Options, Composables> {\n function createRenderState(definition: RuntimeDefinition) {\n if (definition.state !== 'Loading' && definition.state !== 'Error') {\n throw new LayoutConfigurationError(\n `Unknown lazy default state \"${definition.state}\"`,\n );\n }\n // Lazy defaults have no create-time configuration call. Included values are\n // supplied by their component caller unless an explicit config source is selected.\n const include = Object.fromEntries(\n Object.entries(definition.props?.include ?? {}).map(([key, behavior]) => [\n key,\n behavior === true\n ? { required: true, suppliedVia: 'component' }\n : behavior,\n ]),\n );\n function RenderLazyDefault({\n props,\n context,\n }: {\n props: any;\n context: any;\n }) {\n if (typeof definition.render === 'function') {\n return definition.render(props, context);\n }\n const errorProps = props as LazyResourceErrorProps;\n const handler =\n definition.render[errorProps.error.code] ?? definition.render.fallback;\n if (!handler) throw errorProps.error;\n return handler(props as never, context);\n }\n const layout = defineResourceLayout({\n resources: configuration.resources,\n options: configuration.options,\n layout: {\n render: {\n default: () => null,\n [definition.state]: {\n composables: configuration.composables,\n props: { include, custom: definition.props?.custom },\n render: (props: any, context: any) =>\n createElement(RenderLazyDefault, { props, context }),\n },\n },\n },\n } as never);\n const components = new Map<string, ComponentType<any>>();\n function LazyDefault(props: { resource: string }) {\n // Nested lazy paths use the factory's top-level resource definitions for\n // option resolution. The callback still receives the complete path.\n const resource = props.resource.split('.')[0]!;\n let Component = components.get(resource);\n if (!Component) {\n const Root = layout.createResourceLayout({\n resource,\n name: 'LazyDefault',\n namespace: false,\n } as never) as unknown as Record<LazyDefaultState, ComponentType<any>>;\n Component = Root[definition.state];\n components.set(resource, Component);\n }\n return createElement(Component, props);\n }\n return LazyDefault;\n }\n return createRenderState as CreateLazyRenderState<\n Resources,\n Options,\n Composables\n >;\n}\n"],"mappings":";;;;;AAuFA,SAAgB,6BAId,eAIyD;CACzD,SAAS,kBAAkB,YAA+B;EACxD,IAAI,WAAW,UAAU,aAAa,WAAW,UAAU,SACzD,MAAM,IAAI,yBACR,+BAA+B,WAAW,MAAM,EAClD;EAIF,MAAM,UAAU,OAAO,YACrB,OAAO,QAAQ,WAAW,OAAO,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,cAAc,CACvE,KACA,aAAa,OACT;GAAE,UAAU;GAAM,aAAa;EAAY,IAC3C,QACN,CAAC,CACH;EACA,SAAS,kBAAkB,EACzB,OACA,WAIC;GACD,IAAI,OAAO,WAAW,WAAW,YAC/B,OAAO,WAAW,OAAO,OAAO,OAAO;GAEzC,MAAM,aAAa;GACnB,MAAM,UACJ,WAAW,OAAO,WAAW,MAAM,SAAS,WAAW,OAAO;GAChE,IAAI,CAAC,SAAS,MAAM,WAAW;GAC/B,OAAO,QAAQ,OAAgB,OAAO;EACxC;EACA,MAAM,SAAS,qBAAqB;GAClC,WAAW,cAAc;GACzB,SAAS,cAAc;GACvB,QAAQ,EACN,QAAQ;IACN,eAAe;KACd,WAAW,QAAQ;KAClB,aAAa,cAAc;KAC3B,OAAO;MAAE;MAAS,QAAQ,WAAW,OAAO;KAAO;KACnD,SAAS,OAAY,YACnB,cAAc,mBAAmB;MAAE;MAAO;KAAQ,CAAC;IACvD;GACF,EACF;EACF,CAAU;EACV,MAAM,6BAAa,IAAI,IAAgC;EACvD,SAAS,YAAY,OAA6B;GAGhD,MAAM,WAAW,MAAM,SAAS,MAAM,GAAG,EAAE;GAC3C,IAAI,YAAY,WAAW,IAAI,QAAQ;GACvC,IAAI,CAAC,WAAW;IAMd,YALa,OAAO,qBAAqB;KACvC;KACA,MAAM;KACN,WAAW;IACb,CACe,EAAE,WAAW;IAC5B,WAAW,IAAI,UAAU,SAAS;GACpC;GACA,OAAO,cAAc,WAAW,KAAK;EACvC;EACA,OAAO;CACT;CACA,OAAO;AAKT"}
1
+ {"version":3,"file":"create-render-state.mjs","names":[],"sources":["../../src/lazy/create-render-state.tsx"],"sourcesContent":["import type {\n CustomPropsInput,\n CustomPropsObject,\n ResolveRenderProps,\n} from '../custom-props';\nimport { createElement, type ComponentType, type ReactNode } from 'react';\nimport type { ComposableComponents } from '@jfdevelops/react-layout-composables';\nimport { LayoutConfigurationError } from '../errors';\nimport type { ResourceDefinition, ResourcePath } from '../resource';\nimport type {\n ResolvedIncludedComponentProps,\n IncludedProps,\n InPropsDefinition,\n MergedLayoutInProps,\n} from '../props';\nimport { defineResourceLayout } from '../create-config/define-layout';\nimport type {\n LayoutComposablesDefinition,\n RenderStateContext,\n RenderStateProps,\n OptionalStateChildren,\n} from '../create-config/render-state';\n\nimport type {\n LazyResourceErrorProps,\n LazyErrorHandlers,\n CreateLazyErrorComponent,\n} from './types';\n\nexport type LazyDefaultState = 'Loading' | 'Error';\ntype BuiltinProps<\n State extends LazyDefaultState,\n Resource,\n> = State extends 'Error'\n ? LazyResourceErrorProps<Resource>\n : { resource: Resource };\n\n/** Shorthand includes are direct props; explicit supply sources retain their contract. */\ntype LazyDefaultIncludes<Include> = {\n [Key in keyof Include]: Include[Key] extends true\n ? { required: true; suppliedVia: 'component' }\n : Include[Key];\n};\n\ntype LazyRender<State extends LazyDefaultState, Resource, Props, Context> =\n | ((\n props: Props & BuiltinProps<State, Resource>,\n context: Context,\n ) => ReactNode)\n | (State extends 'Error'\n ? LazyErrorHandlers<Resource, Props & object, Context>\n : never);\n\n/** Creates validated, composable-aware fallback components for one factory. */\nexport type CreateLazyRenderState<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n> = <\n const State extends LazyDefaultState,\n const Custom extends CustomPropsObject = {},\n const Include extends IncludedProps<\n MergedLayoutInProps<Resources, Options, Composables>\n > = {},\n>(definition: {\n state: State;\n props?: { include?: Include; custom?: Custom & CustomPropsInput<Custom> };\n render: LazyRender<\n State,\n ResourcePath<Resources>,\n RenderStateProps<Resources, Options, Composables, Include, Custom>,\n RenderStateContext<Composables, Resources, State>\n >;\n}) => ComponentType<\n OptionalStateChildren<\n ResolveRenderProps<Custom> &\n ResolvedIncludedComponentProps<\n MergedLayoutInProps<Resources, Options, Composables>,\n LazyDefaultIncludes<Include>\n >,\n Custom\n > &\n BuiltinProps<State, ResourcePath<Resources>>\n>;\n\n/** Compatibility helper; custom props keep their existing unchecked contract. */\nexport type CreateBoundLazyErrorComponent<Resource, Context> =\n CreateLazyErrorComponent<Resource, Context>;\n\ntype RuntimeDefinition = {\n state: LazyDefaultState;\n props?: { include?: Record<string, unknown>; custom?: CustomPropsObject };\n render:\n | ((props: any, context: any) => ReactNode)\n | LazyErrorHandlers<string, object, any>;\n};\n\nexport function createLazyRenderStateBuilder<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n>(configuration: {\n resources: Resources;\n options: Options;\n composables?: LayoutComposablesDefinition<Resources, Composables>;\n}): CreateLazyRenderState<Resources, Options, Composables> {\n function createRenderState(definition: RuntimeDefinition) {\n if (definition.state !== 'Loading' && definition.state !== 'Error') {\n throw new LayoutConfigurationError(\n `Unknown lazy default state \"${definition.state}\"`,\n );\n }\n // Lazy defaults have no create-time configuration call. Included values are\n // supplied by their component caller unless an explicit config source is selected.\n const include = Object.fromEntries(\n Object.entries(definition.props?.include ?? {}).map(([key, behavior]) => [\n key,\n behavior === true\n ? { required: true, suppliedVia: 'component' }\n : behavior,\n ]),\n );\n function RenderLazyDefault({\n props,\n context,\n }: {\n props: any;\n context: any;\n }) {\n if (typeof definition.render === 'function') {\n return definition.render(props, context);\n }\n const errorProps = props as LazyResourceErrorProps;\n const handler =\n definition.render[errorProps.error.code] ?? definition.render.fallback;\n if (!handler) throw errorProps.error;\n return handler(props as never, context);\n }\n const layout = defineResourceLayout({\n resources: configuration.resources,\n options: configuration.options,\n layout: {\n render: {\n default: () => null,\n [definition.state]: {\n composables: configuration.composables,\n props: { include, custom: definition.props?.custom },\n render: (props: any, context: any) =>\n createElement(RenderLazyDefault, { props, context }),\n },\n },\n },\n } as never);\n const components = new Map<string, ComponentType<any>>();\n function LazyDefault(props: { resource: string }) {\n // Nested lazy paths use the factory's top-level resource definitions for\n // option resolution. The callback still receives the complete path.\n const resource = props.resource.split('.')[0]!;\n let Component = components.get(resource);\n if (!Component) {\n const Root = layout.createResourceLayout({\n resource,\n name: 'LazyDefault',\n namespace: false,\n } as never) as unknown as Record<LazyDefaultState, ComponentType<any>>;\n Component = Root[definition.state];\n components.set(resource, Component);\n }\n return createElement(Component, props);\n }\n return LazyDefault;\n }\n return createRenderState as CreateLazyRenderState<\n Resources,\n Options,\n Composables\n >;\n}\n"],"mappings":";;;;;AAiGA,SAAgB,6BAId,eAIyD;CACzD,SAAS,kBAAkB,YAA+B;EACxD,IAAI,WAAW,UAAU,aAAa,WAAW,UAAU,SACzD,MAAM,IAAI,yBACR,+BAA+B,WAAW,MAAM,EAClD;EAIF,MAAM,UAAU,OAAO,YACrB,OAAO,QAAQ,WAAW,OAAO,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,cAAc,CACvE,KACA,aAAa,OACT;GAAE,UAAU;GAAM,aAAa;EAAY,IAC3C,QACN,CAAC,CACH;EACA,SAAS,kBAAkB,EACzB,OACA,WAIC;GACD,IAAI,OAAO,WAAW,WAAW,YAC/B,OAAO,WAAW,OAAO,OAAO,OAAO;GAEzC,MAAM,aAAa;GACnB,MAAM,UACJ,WAAW,OAAO,WAAW,MAAM,SAAS,WAAW,OAAO;GAChE,IAAI,CAAC,SAAS,MAAM,WAAW;GAC/B,OAAO,QAAQ,OAAgB,OAAO;EACxC;EACA,MAAM,SAAS,qBAAqB;GAClC,WAAW,cAAc;GACzB,SAAS,cAAc;GACvB,QAAQ,EACN,QAAQ;IACN,eAAe;KACd,WAAW,QAAQ;KAClB,aAAa,cAAc;KAC3B,OAAO;MAAE;MAAS,QAAQ,WAAW,OAAO;KAAO;KACnD,SAAS,OAAY,YACnB,cAAc,mBAAmB;MAAE;MAAO;KAAQ,CAAC;IACvD;GACF,EACF;EACF,CAAU;EACV,MAAM,6BAAa,IAAI,IAAgC;EACvD,SAAS,YAAY,OAA6B;GAGhD,MAAM,WAAW,MAAM,SAAS,MAAM,GAAG,EAAE;GAC3C,IAAI,YAAY,WAAW,IAAI,QAAQ;GACvC,IAAI,CAAC,WAAW;IAMd,YALa,OAAO,qBAAqB;KACvC;KACA,MAAM;KACN,WAAW;IACb,CACe,EAAE,WAAW;IAC5B,WAAW,IAAI,UAAU,SAAS;GACpC;GACA,OAAO,cAAc,WAAW,KAAK;EACvC;EACA,OAAO;CACT;CACA,OAAO;AAKT"}
@@ -1,5 +1,5 @@
1
- const require_render_state_context = require('../create-config/render-state-context.cjs');
2
1
  const require_lazy_resource_error = require('../errors/lazy-resource-error.cjs');
2
+ const require_render_state_context = require('../create-config/render-state-context.cjs');
3
3
  let react = require("react");
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
5
 
@@ -1,5 +1,5 @@
1
- import { RenderStateFallback } from "../create-config/render-state-context.mjs";
2
1
  import { isLazyResourceError } from "../errors/lazy-resource-error.mjs";
2
+ import { RenderStateFallback } from "../create-config/render-state-context.mjs";
3
3
  import { Component, Suspense, useEffect, useReducer } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","names":[],"sources":["../../src/lazy/types.ts"],"sourcesContent":["import type { ComponentType, ReactNode } from 'react';\nimport type { LoadStatus } from '@jfdevelops/react-layout-devtools-core';\nimport type {\n LazyResourceError,\n LazyResourceErrorMap,\n} from '../errors/lazy-resource-error';\n\nexport type { LoadStatus } from '@jfdevelops/react-layout-devtools-core';\n\n/** Options shared by lazy layouts, render states, and scoped content. */\nexport type LazyOptions<\n Module extends Record<string, unknown> = Record<string, unknown>,\n> = {\n load: () => Promise<Module>;\n fallback?: ReactNode;\n};\n\nexport type LazyHandle = {\n preload(): Promise<void>;\n readonly status: LoadStatus;\n};\n\nexport type LazyResourceErrorProps<Resource = string> = {\n error: LazyResourceError;\n retry: () => void;\n resource: Resource;\n};\n\nexport type LazyResourceErrorComponent<Resource = string> = ComponentType<\n LazyResourceErrorProps<Resource>\n>;\nexport type LazyResourceLoadingComponent<Resource = string> = ComponentType<{\n resource: Resource;\n}>;\nexport type LazyResourceStates<Resource = string> = {\n Error?: LazyResourceErrorComponent<Resource>;\n Loading?: LazyResourceLoadingComponent<Resource>;\n};\n\ntype ErrorHandlerContext<Context> = [Context] extends [never]\n ? []\n : [context: Context];\n\nexport type LazyErrorHandlers<\n Resource,\n Custom extends object = {},\n Context = never,\n> = {\n [Code in LazyResourceError['code']]?: (\n props: Custom &\n Omit<LazyResourceErrorProps<Resource>, 'error'> & {\n error: LazyResourceErrorMap[Code];\n },\n ...context: ErrorHandlerContext<Context>\n ) => ReactNode;\n} & {\n fallback?: (\n props: Custom & LazyResourceErrorProps<Resource>,\n ...context: ErrorHandlerContext<Context>\n ) => ReactNode;\n};\n\nexport type CreateLazyErrorComponent<Resource, Context = never> = {\n <Custom extends object = {}>(\n render: (\n props: Custom & LazyResourceErrorProps<Resource>,\n ...context: ErrorHandlerContext<Context>\n ) => ReactNode,\n ): ComponentType<Custom & LazyResourceErrorProps<Resource>>;\n <Custom extends object = {}>(\n handlers: LazyErrorHandlers<Resource, Custom, Context>,\n ): ComponentType<Custom & LazyResourceErrorProps<Resource>>;\n};\n\n/** Internal factory defaults propagated to layouts without publishing metadata. */\nexport const lazyDefaultsSymbol = Symbol('lazyDefaults');\n\nexport const lazyStatesSymbol = Symbol('lazyStates');\n"],"mappings":";;;AA2EA,MAAa,qBAAqB,OAAO,cAAc;AAEvD,MAAa,mBAAmB,OAAO,YAAY"}
1
+ {"version":3,"file":"types.cjs","names":[],"sources":["../../src/lazy/types.ts"],"sourcesContent":["import type { WithChildren } from '@jfdevelops/react-layout-composables';\nimport type { ComponentType, ReactNode } from 'react';\nimport type { LoadStatus } from '@jfdevelops/react-layout-devtools-core';\nimport type {\n LazyResourceError,\n LazyResourceErrorMap,\n} from '../errors/lazy-resource-error';\n\nexport type { LoadStatus } from '@jfdevelops/react-layout-devtools-core';\n\n/** Options shared by lazy layouts, render states, and scoped content. */\nexport type LazyOptions<\n Module extends Record<string, unknown> = Record<string, unknown>,\n> = {\n load: () => Promise<Module>;\n fallback?: ReactNode;\n};\n\nexport type LazyHandle = {\n preload(): Promise<void>;\n readonly status: LoadStatus;\n};\n\nexport type LazyResourceErrorProps<Resource = string> = {\n error: LazyResourceError;\n retry: () => void;\n resource: Resource;\n};\n\nexport type LazyResourceErrorComponent<Resource = string> = ComponentType<\n LazyResourceErrorProps<Resource>\n>;\nexport type LazyResourceLoadingComponent<Resource = string> = ComponentType<{\n resource: Resource;\n}>;\nexport type LazyResourceStates<Resource = string> = {\n Error?: LazyResourceErrorComponent<Resource>;\n Loading?: LazyResourceLoadingComponent<Resource>;\n};\n\ntype ErrorHandlerContext<Context> = [Context] extends [never]\n ? []\n : [context: Context];\n\nexport type LazyErrorHandlers<\n Resource,\n Custom extends object = {},\n Context = never,\n> = {\n [Code in LazyResourceError['code']]?: (\n props: WithChildren<Custom> &\n Omit<LazyResourceErrorProps<Resource>, 'error'> & {\n error: LazyResourceErrorMap[Code];\n },\n ...context: ErrorHandlerContext<Context>\n ) => ReactNode;\n} & {\n fallback?: (\n props: WithChildren<Custom> & LazyResourceErrorProps<Resource>,\n ...context: ErrorHandlerContext<Context>\n ) => ReactNode;\n};\n\nexport type CreateLazyErrorComponent<Resource, Context = never> = {\n <Custom extends object = {}>(\n render: (\n props: WithChildren<Custom> & LazyResourceErrorProps<Resource>,\n ...context: ErrorHandlerContext<Context>\n ) => ReactNode,\n ): ComponentType<WithChildren<Custom> & LazyResourceErrorProps<Resource>>;\n <Custom extends object = {}>(\n handlers: LazyErrorHandlers<Resource, Custom, Context>,\n ): ComponentType<WithChildren<Custom> & LazyResourceErrorProps<Resource>>;\n};\n\n/** Internal factory defaults propagated to layouts without publishing metadata. */\nexport const lazyDefaultsSymbol = Symbol('lazyDefaults');\n\nexport const lazyStatesSymbol = Symbol('lazyStates');\n"],"mappings":";;;AA4EA,MAAa,qBAAqB,OAAO,cAAc;AAEvD,MAAa,mBAAmB,OAAO,YAAY"}
@@ -1,4 +1,5 @@
1
1
  import { LazyResourceError, LazyResourceErrorMap } from "../errors/lazy-resource-error.cjs";
2
+ import { WithChildren } from "@jfdevelops/react-layout-composables";
2
3
  import { ComponentType, ReactNode } from "react";
3
4
  import { LoadStatus, LoadStatus as LoadStatus$1 } from "@jfdevelops/react-layout-devtools-core";
4
5
 
@@ -26,14 +27,14 @@ type LazyResourceStates<Resource = string> = {
26
27
  Loading?: LazyResourceLoadingComponent<Resource>;
27
28
  };
28
29
  type ErrorHandlerContext<Context> = [Context] extends [never] ? [] : [context: Context];
29
- type LazyErrorHandlers<Resource, Custom extends object = {}, Context = never> = { [Code in LazyResourceError['code']]?: (props: Custom & Omit<LazyResourceErrorProps<Resource>, 'error'> & {
30
+ type LazyErrorHandlers<Resource, Custom extends object = {}, Context = never> = { [Code in LazyResourceError['code']]?: (props: WithChildren<Custom> & Omit<LazyResourceErrorProps<Resource>, 'error'> & {
30
31
  error: LazyResourceErrorMap[Code];
31
32
  }, ...context: ErrorHandlerContext<Context>) => ReactNode } & {
32
- fallback?: (props: Custom & LazyResourceErrorProps<Resource>, ...context: ErrorHandlerContext<Context>) => ReactNode;
33
+ fallback?: (props: WithChildren<Custom> & LazyResourceErrorProps<Resource>, ...context: ErrorHandlerContext<Context>) => ReactNode;
33
34
  };
34
35
  type CreateLazyErrorComponent<Resource, Context = never> = {
35
- <Custom extends object = {}>(render: (props: Custom & LazyResourceErrorProps<Resource>, ...context: ErrorHandlerContext<Context>) => ReactNode): ComponentType<Custom & LazyResourceErrorProps<Resource>>;
36
- <Custom extends object = {}>(handlers: LazyErrorHandlers<Resource, Custom, Context>): ComponentType<Custom & LazyResourceErrorProps<Resource>>;
36
+ <Custom extends object = {}>(render: (props: WithChildren<Custom> & LazyResourceErrorProps<Resource>, ...context: ErrorHandlerContext<Context>) => ReactNode): ComponentType<WithChildren<Custom> & LazyResourceErrorProps<Resource>>;
37
+ <Custom extends object = {}>(handlers: LazyErrorHandlers<Resource, Custom, Context>): ComponentType<WithChildren<Custom> & LazyResourceErrorProps<Resource>>;
37
38
  };
38
39
  //#endregion
39
40
  export { CreateLazyErrorComponent, LazyErrorHandlers, LazyHandle, LazyOptions, LazyResourceErrorComponent, LazyResourceErrorProps, LazyResourceLoadingComponent, LazyResourceStates, type LoadStatus$1 as LoadStatus };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/lazy/types.ts"],"mappings":";;;;;;KAUY,WAAA,gBACK,MAAA,oBAA0B,MAAA;EAEzC,IAAA,QAAY,OAAA,CAAQ,M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yResourceError, LazyResourceErrorMap } from "../errors/lazy-resource-error.mjs";
2
+ import { WithChildren } from "@jfdevelops/react-layout-composables";
2
3
  import { ComponentType, ReactNode } from "react";
3
4
  import { LoadStatus, LoadStatus as LoadStatus$1 } from "@jfdevelops/react-layout-devtools-core";
4
5
 
@@ -26,14 +27,14 @@ type LazyResourceStates<Resource = string> = {
26
27
  Loading?: LazyResourceLoadingComponent<Resource>;
27
28
  };
28
29
  type ErrorHandlerContext<Context> = [Context] extends [never] ? [] : [context: Context];
29
- type LazyErrorHandlers<Resource, Custom extends object = {}, Context = never> = { [Code in LazyResourceError['code']]?: (props: Custom & Omit<LazyResourceErrorProps<Resource>, 'error'> & {
30
+ type LazyErrorHandlers<Resource, Custom extends object = {}, Context = never> = { [Code in LazyResourceError['code']]?: (props: WithChildren<Custom> & Omit<LazyResourceErrorProps<Resource>, 'error'> & {
30
31
  error: LazyResourceErrorMap[Code];
31
32
  }, ...context: ErrorHandlerContext<Context>) => ReactNode } & {
32
- fallback?: (props: Custom & LazyResourceErrorProps<Resource>, ...context: ErrorHandlerContext<Context>) => ReactNode;
33
+ fallback?: (props: WithChildren<Custom> & LazyResourceErrorProps<Resource>, ...context: ErrorHandlerContext<Context>) => ReactNode;
33
34
  };
34
35
  type CreateLazyErrorComponent<Resource, Context = never> = {
35
- <Custom extends object = {}>(render: (props: Custom & LazyResourceErrorProps<Resource>, ...context: ErrorHandlerContext<Context>) => ReactNode): ComponentType<Custom & LazyResourceErrorProps<Resource>>;
36
- <Custom extends object = {}>(handlers: LazyErrorHandlers<Resource, Custom, Context>): ComponentType<Custom & LazyResourceErrorProps<Resource>>;
36
+ <Custom extends object = {}>(render: (props: WithChildren<Custom> & LazyResourceErrorProps<Resource>, ...context: ErrorHandlerContext<Context>) => ReactNode): ComponentType<WithChildren<Custom> & LazyResourceErrorProps<Resource>>;
37
+ <Custom extends object = {}>(handlers: LazyErrorHandlers<Resource, Custom, Context>): ComponentType<WithChildren<Custom> & LazyResourceErrorProps<Resource>>;
37
38
  };
38
39
  //#endregion
39
40
  export { CreateLazyErrorComponent, LazyErrorHandlers, LazyHandle, LazyOptions, LazyResourceErrorComponent, LazyResourceErrorProps, LazyResourceLoadingComponent, LazyResourceStates, type LoadStatus$1 as LoadStatus };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/lazy/types.ts"],"mappings":";;;;;;KAUY,WAAA,gBACK,MAAA,oBAA0B,MAAA;EAEzC,IAAA,QAAY,OAAA,CAAQ,MAAA;EACpB,QAAA,GAAW,SAAA;AAAA;AAAA,KAGD,UAAA;EACV,OAAA,IAAW,OAAA;EAAA,SACF,MAAA,EAAQ,UAAU;AAAA;AAAA,KAGjB,sBAAA;EACV,KAAA,EAAO,iBAAA;EACP,KAAA;EACA,QAAA,EAAU,QAAQ;AAAA;AAAA,KAGR,0BAAA,sBAAgD,aAAA,CAC1D,sBAAA,CAAuB,QAAA;AAAA,KAEb,4BAAA,sBAAkD,aAAa;EACzE,QAAA,EAAU,QAAA;AAAA;AAAA,KAEA,kBAAA;EACV,KAAA,GAAQ,0BAAA,CAA2B,QAAA;EACnC,OAAA,GAAU,4BAAA,CAA6B,QAAA;AAAA;AAAA,KAGpC,mBAAA,aAAgC,OAAA,0BAEhC,OAAA,EAAS,OAAO;AAAA,KAET,iBAAA,qEAKD,iBAAA,aACP,KAAA,EAAO,MAAA,GACL,IAAA,CAAK,sBAAA,CAAuB,QAAA;EAC1B,KAAA,EAAO,oBAAA,CAAqB,IAAA;AAAA,MAE7B,OAAA,EAAS,mBAAA,CAAoB,OAAA,MAC7B,SAAA;EAEL,QAAA,IACE,KAAA,EAAO,MAAA,GAAS,sBAAA,CAAuB,QAAA,MACpC,OAAA,EAAS,mBAAA,CAAoB,OAAA,MAC7B,SAAA;AAAA;AAAA,KAGK,wBAAA;EAAA,6BAER,MAAA,GACE,KAAA,EAAO,MAAA,GAAS,sBAAA,CAAuB,QAAA,MACpC,OAAA,EAAS,mBAAA,CAAoB,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A,IAAU,sBAAA,CAAuB,QAAA,MAClD,OAAA,EAAS,mBAAA,CAAoB,OAAA,MAC7B,SAAA,GACJ,aAAA,CAAc,YAAA,CAAa,MAAA,IAAU,sBAAA,CAAuB,QAAA;EAAA,6BAE7D,QAAA,EAAU,iBAAA,CAAkB,QAAA,EAAU,MAAA,EAAQ,OAAA,IAC7C,aAAA,CAAc,YAAA,CAAa,MAAA,IAAU,sBAAA,CAAuB,QAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","names":[],"sources":["../../src/lazy/types.ts"],"sourcesContent":["import type { ComponentType, ReactNode } from 'react';\nimport type { LoadStatus } from '@jfdevelops/react-layout-devtools-core';\nimport type {\n LazyResourceError,\n LazyResourceErrorMap,\n} from '../errors/lazy-resource-error';\n\nexport type { LoadStatus } from '@jfdevelops/react-layout-devtools-core';\n\n/** Options shared by lazy layouts, render states, and scoped content. */\nexport type LazyOptions<\n Module extends Record<string, unknown> = Record<string, unknown>,\n> = {\n load: () => Promise<Module>;\n fallback?: ReactNode;\n};\n\nexport type LazyHandle = {\n preload(): Promise<void>;\n readonly status: LoadStatus;\n};\n\nexport type LazyResourceErrorProps<Resource = string> = {\n error: LazyResourceError;\n retry: () => void;\n resource: Resource;\n};\n\nexport type LazyResourceErrorComponent<Resource = string> = ComponentType<\n LazyResourceErrorProps<Resource>\n>;\nexport type LazyResourceLoadingComponent<Resource = string> = ComponentType<{\n resource: Resource;\n}>;\nexport type LazyResourceStates<Resource = string> = {\n Error?: LazyResourceErrorComponent<Resource>;\n Loading?: LazyResourceLoadingComponent<Resource>;\n};\n\ntype ErrorHandlerContext<Context> = [Context] extends [never]\n ? []\n : [context: Context];\n\nexport type LazyErrorHandlers<\n Resource,\n Custom extends object = {},\n Context = never,\n> = {\n [Code in LazyResourceError['code']]?: (\n props: Custom &\n Omit<LazyResourceErrorProps<Resource>, 'error'> & {\n error: LazyResourceErrorMap[Code];\n },\n ...context: ErrorHandlerContext<Context>\n ) => ReactNode;\n} & {\n fallback?: (\n props: Custom & LazyResourceErrorProps<Resource>,\n ...context: ErrorHandlerContext<Context>\n ) => ReactNode;\n};\n\nexport type CreateLazyErrorComponent<Resource, Context = never> = {\n <Custom extends object = {}>(\n render: (\n props: Custom & LazyResourceErrorProps<Resource>,\n ...context: ErrorHandlerContext<Context>\n ) => ReactNode,\n ): ComponentType<Custom & LazyResourceErrorProps<Resource>>;\n <Custom extends object = {}>(\n handlers: LazyErrorHandlers<Resource, Custom, Context>,\n ): ComponentType<Custom & LazyResourceErrorProps<Resource>>;\n};\n\n/** Internal factory defaults propagated to layouts without publishing metadata. */\nexport const lazyDefaultsSymbol = Symbol('lazyDefaults');\n\nexport const lazyStatesSymbol = Symbol('lazyStates');\n"],"mappings":";;AA2EA,MAAa,qBAAqB,OAAO,cAAc;AAEvD,MAAa,mBAAmB,OAAO,YAAY"}
1
+ {"version":3,"file":"types.mjs","names":[],"sources":["../../src/lazy/types.ts"],"sourcesContent":["import type { WithChildren } from '@jfdevelops/react-layout-composables';\nimport type { ComponentType, ReactNode } from 'react';\nimport type { LoadStatus } from '@jfdevelops/react-layout-devtools-core';\nimport type {\n LazyResourceError,\n LazyResourceErrorMap,\n} from '../errors/lazy-resource-error';\n\nexport type { LoadStatus } from '@jfdevelops/react-layout-devtools-core';\n\n/** Options shared by lazy layouts, render states, and scoped content. */\nexport type LazyOptions<\n Module extends Record<string, unknown> = Record<string, unknown>,\n> = {\n load: () => Promise<Module>;\n fallback?: ReactNode;\n};\n\nexport type LazyHandle = {\n preload(): Promise<void>;\n readonly status: LoadStatus;\n};\n\nexport type LazyResourceErrorProps<Resource = string> = {\n error: LazyResourceError;\n retry: () => void;\n resource: Resource;\n};\n\nexport type LazyResourceErrorComponent<Resource = string> = ComponentType<\n LazyResourceErrorProps<Resource>\n>;\nexport type LazyResourceLoadingComponent<Resource = string> = ComponentType<{\n resource: Resource;\n}>;\nexport type LazyResourceStates<Resource = string> = {\n Error?: LazyResourceErrorComponent<Resource>;\n Loading?: LazyResourceLoadingComponent<Resource>;\n};\n\ntype ErrorHandlerContext<Context> = [Context] extends [never]\n ? []\n : [context: Context];\n\nexport type LazyErrorHandlers<\n Resource,\n Custom extends object = {},\n Context = never,\n> = {\n [Code in LazyResourceError['code']]?: (\n props: WithChildren<Custom> &\n Omit<LazyResourceErrorProps<Resource>, 'error'> & {\n error: LazyResourceErrorMap[Code];\n },\n ...context: ErrorHandlerContext<Context>\n ) => ReactNode;\n} & {\n fallback?: (\n props: WithChildren<Custom> & LazyResourceErrorProps<Resource>,\n ...context: ErrorHandlerContext<Context>\n ) => ReactNode;\n};\n\nexport type CreateLazyErrorComponent<Resource, Context = never> = {\n <Custom extends object = {}>(\n render: (\n props: WithChildren<Custom> & LazyResourceErrorProps<Resource>,\n ...context: ErrorHandlerContext<Context>\n ) => ReactNode,\n ): ComponentType<WithChildren<Custom> & LazyResourceErrorProps<Resource>>;\n <Custom extends object = {}>(\n handlers: LazyErrorHandlers<Resource, Custom, Context>,\n ): ComponentType<WithChildren<Custom> & LazyResourceErrorProps<Resource>>;\n};\n\n/** Internal factory defaults propagated to layouts without publishing metadata. */\nexport const lazyDefaultsSymbol = Symbol('lazyDefaults');\n\nexport const lazyStatesSymbol = Symbol('lazyStates');\n"],"mappings":";;AA4EA,MAAa,qBAAqB,OAAO,cAAc;AAEvD,MAAa,mBAAmB,OAAO,YAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"props.cjs","names":["LayoutConfigurationError"],"sources":["../src/props.ts"],"sourcesContent":["import { LayoutConfigurationError } from './errors';\nimport type {\n ComposableComponents,\n MergePresetProps,\n} from '@jfdevelops/react-layout-composables';\nimport type { InPropsObject } from '@jfdevelops/react-layout-composables';\nimport {\n EnumWrappedProp,\n LiteralWrappedProp,\n ResolveLayoutProps,\n ResolveLayoutPropsAsDefined,\n ResolveProps,\n} from '@jfdevelops/react-layout-validator';\nimport { ResourceDefinition, ResourceEnum } from './resource';\nimport { Show } from './utils';\n\nexport type { InPropsObject };\n\n/**\n * Two-argument `render(props, context)` used by createComponent and scoped\n * resource components. `Context` is sibling components (scoped) or the\n * resource render context (top-level).\n */\nexport type PropsContextRender<RenderProps, Context, Result = unknown> = (\n props: RenderProps,\n context: Context,\n) => Result;\n\n/**\n * Shared `{ props?, render }` shape used by createComponent, scoped\n * components, and anywhere else a value declares props and a two-arg render.\n *\n * @typeParam Props - Declared on the entry (`props`). Often an\n * {@link InPropsObject}, or a layout include/custom bag.\n * @typeParam RenderProps - First argument to `render` (defaults to\n * {@link ResolveProps}<Props> when Props is an {@link InPropsObject})\n * @typeParam Result - `render` return type\n * @typeParam Context - Second argument to `render`\n */\nexport interface PropsRenderDefinition<\n Props = InPropsObject,\n RenderProps = Props extends InPropsObject ? ResolveProps<Props> : unknown,\n Result = unknown,\n Context = unknown,\n> {\n props?: Props;\n render: PropsContextRender<RenderProps, Context, Result>;\n}\n\nexport type InPropsOptions<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Name extends string,\n> = {\n name: LiteralWrappedProp<Name, 'string', 'required'>;\n resource: EnumWrappedProp<ResourceEnum<Resources>, 'string', 'required'>;\n};\nexport type InPropsFunction<\n Resources extends ReadonlyArray<ResourceDefinition>,\n> = <Name extends string>(\n props: Show<InPropsOptions<Resources, Name>>,\n) => InPropsObject;\nexport type InPropsDefinition<\n Resources extends ReadonlyArray<ResourceDefinition>,\n> = InPropsObject | InPropsFunction<Resources>;\nexport type InferredInProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n> = Options extends InPropsFunction<Resources> ? ReturnType<Options> : Options;\nexport type MergedLayoutInProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n> =\n InferredInProps<Resources, Options> extends InPropsObject\n ? InferredInProps<Resources, Options> & MergePresetProps<Composables>\n : never;\nexport type RequiredVariant = true | 'required';\n/**\n * @typeParam RequiredVariant How the required props are selected. In application code,\n * it will always be `true`, but internally we need to support `'required'` as well.\n */\ntype PropsType<Variant extends RequiredVariant = true> = Variant | 'optional';\ntype InternalPropsType = PropsType<'required'>;\ntype IncludedPropSource = 'component' | 'config';\n/** Controls whether an included prop is required and where it is supplied. */\nexport type IncludedPropBehavior = {\n required: boolean;\n suppliedVia: IncludedPropSource;\n};\n\ntype IncludedPropType = PropsType | IncludedPropBehavior;\n/**\n * A map of props to include in the layout.\n */\nexport type IncludedProps<T extends object> = {\n [K in keyof T & string]?: IncludedPropType;\n};\n\ntype PropsKeys<Props extends InPropsObject, T> = T & keyof Props;\nexport type IncludedPropVisibility<Value> = Value extends { required: boolean }\n ? Value['required'] extends true\n ? 'required'\n : 'optional'\n : Value extends true | 'required'\n ? 'required'\n : Value extends 'optional'\n ? 'optional'\n : never;\nexport type IncludedPropSupplySource<Value> = Value extends {\n suppliedVia: IncludedPropSource;\n}\n ? Value['suppliedVia']\n : never;\n/**\n * Internal representation of the supported include behavior.\n */\nexport type NormalizedIncludedPropBehavior<Value> = Value extends\n | { required: boolean }\n | { suppliedVia: IncludedPropSource }\n ? {\n visibility: IncludedPropVisibility<Value>;\n passthrough: IncludedPropSupplySource<Value>;\n }\n : Value;\n\nexport type IncludedPropPassthrough<Value> = Value extends\n | { required: boolean }\n | { suppliedVia: IncludedPropSource }\n ? IncludedPropSupplySource<Value> extends 'component'\n ? IncludedPropVisibility<Value> extends 'optional'\n ? 'component' | 'config'\n : 'component'\n : IncludedPropSupplySource<Value>\n : Value extends true | 'required'\n ? 'config'\n : Value extends 'optional'\n ? 'component' | 'config'\n : never;\n\ntype GetPropsKey<\n IncludeProps extends object,\n Visibility extends InternalPropsType,\n Passthrough extends IncludedPropSource | 'render' = 'render',\n> = {\n [Key in keyof IncludeProps]: IncludedPropVisibility<\n IncludeProps[Key]\n > extends Visibility\n ? Passthrough extends 'render'\n ? Key\n : Passthrough extends IncludedPropPassthrough<IncludeProps[Key]>\n ? Key\n : never\n : never;\n}[keyof IncludeProps];\ntype SelectedIncludedProps<\n Props extends InPropsObject,\n IncludeProps extends IncludedProps<Props>,\n Visibility extends InternalPropsType,\n Passthrough extends IncludedPropSource | 'render' = 'render',\n> = Pick<\n Props,\n PropsKeys<Props, GetPropsKey<IncludeProps, Visibility, Passthrough>>\n>;\n\ntype OptionalPropDefinition<Definition> = Definition extends {\n optional(): infer OptionalDefinition;\n}\n ? OptionalDefinition\n : Definition;\n\n/** Raw validator definitions accepted by a generated component call. */\nexport type IncludedComponentPropDefinitions<\n Props extends InPropsObject,\n IncludeProps extends IncludedProps<Props>,\n> = SelectedIncludedProps<Props, IncludeProps, 'required', 'component'> & {\n [Key in keyof SelectedIncludedProps<\n Props,\n IncludeProps,\n 'optional',\n 'component'\n >]: OptionalPropDefinition<\n SelectedIncludedProps<Props, IncludeProps, 'optional', 'component'>[Key]\n >;\n};\n\nexport type ResolvedIncludedProps<\n Props extends InPropsObject,\n IncludeProps extends IncludedProps<Props>,\n> = ResolveLayoutProps<SelectedIncludedProps<Props, IncludeProps, 'required'>> &\n Partial<\n ResolveLayoutProps<SelectedIncludedProps<Props, IncludeProps, 'optional'>>\n >;\n\nexport type ResolvedIncludedConfigProps<\n Props extends InPropsObject,\n IncludeProps extends IncludedProps<Props>,\n> = ResolveLayoutProps<\n SelectedIncludedProps<Props, IncludeProps, 'required', 'config'>\n> &\n Partial<\n ResolveLayoutProps<\n SelectedIncludedProps<Props, IncludeProps, 'optional', 'config'>\n >\n >;\n\nexport type ResolvedIncludedComponentProps<\n Props extends InPropsObject,\n IncludeProps extends IncludedProps<Props>,\n> = ResolveLayoutProps<\n SelectedIncludedProps<Props, IncludeProps, 'required', 'component'>\n> &\n Partial<\n ResolveLayoutProps<\n SelectedIncludedProps<Props, IncludeProps, 'optional', 'component'>\n >\n >;\n\n/**\n * Like {@link ResolvedIncludedProps}, but keeps included prop keys exactly as\n * declared (no `JSX.Element` capitalization).\n */\nexport type ResolvedIncludedPropsAsDefined<\n Props extends InPropsObject,\n IncludeProps extends IncludedProps<Props>,\n> = ResolveLayoutPropsAsDefined<\n SelectedIncludedProps<Props, IncludeProps, 'required'>\n> &\n Partial<\n ResolveLayoutPropsAsDefined<\n SelectedIncludedProps<Props, IncludeProps, 'optional'>\n >\n >;\nexport type LayoutRenderProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents = {},\n IncludeProps extends IncludedProps<\n MergedLayoutInProps<Resources, Options, Composables>\n > = {},\n CustomProps extends InPropsObject = {},\n> = Show<\n ResolveProps<CustomProps> &\n ResolvedIncludedProps<\n MergedLayoutInProps<Resources, Options, Composables>,\n IncludeProps\n >\n>;\n\nexport function getIncludedPropBehavior(value: unknown): {\n visibility: 'required' | 'optional';\n passthrough: 'component' | 'config';\n} | null {\n if (value === null || typeof value !== 'object') {\n return null;\n }\n\n if ('visibility' in value || 'passthrough' in value) {\n throw new LayoutConfigurationError(\n 'Include properties visibility and passthrough were removed; use required and suppliedVia.',\n );\n }\n\n const required =\n 'required' in value && typeof value.required === 'boolean'\n ? value.required\n : undefined;\n const suppliedVia = 'suppliedVia' in value ? value.suppliedVia : undefined;\n\n if (\n required === undefined ||\n (suppliedVia !== 'component' && suppliedVia !== 'config')\n ) {\n return null;\n }\n\n return {\n visibility: required ? 'required' : 'optional',\n passthrough: suppliedVia,\n };\n}\n"],"mappings":";;;AAwPA,SAAgB,wBAAwB,OAG/B;CACP,IAAI,UAAU,QAAQ,OAAO,UAAU,UACrC,OAAO;CAGT,IAAI,gBAAgB,SAAS,iBAAiB,OAC5C,MAAM,IAAIA,4DACR,2FACF;CAGF,MAAM,WACJ,cAAc,SAAS,OAAO,MAAM,aAAa,YAC7C,MAAM,WACN;CACN,MAAM,cAAc,iBAAiB,QAAQ,MAAM,cAAc;CAEjE,IACE,aAAa,UACZ,gBAAgB,eAAe,gBAAgB,UAEhD,OAAO;CAGT,OAAO;EACL,YAAY,WAAW,aAAa;EACpC,aAAa;CACf;AACF"}
1
+ {"version":3,"file":"props.cjs","names":["LayoutConfigurationError"],"sources":["../src/props.ts"],"sourcesContent":["import type { WithChildren } from '@jfdevelops/react-layout-composables';\nimport type { CustomPropsObject, ResolveRenderProps } from './custom-props';\nimport { LayoutConfigurationError } from './errors';\nimport type {\n ComposableComponents,\n MergePresetProps,\n} from '@jfdevelops/react-layout-composables';\nimport type { InPropsObject } from '@jfdevelops/react-layout-composables';\nimport {\n EnumWrappedProp,\n LiteralWrappedProp,\n ResolveLayoutProps,\n ResolveLayoutPropsAsDefined,\n ResolveProps,\n} from '@jfdevelops/react-layout-validator';\nimport { ResourceDefinition, ResourceEnum } from './resource';\nimport { Show } from './utils';\n\nexport type { InPropsObject };\n\n/** Shared include/custom contract used by configurable layout helpers. */\nexport type PropsContract<Include extends object = object, Custom extends object = object> = {\n include?: Include;\n custom?: Custom;\n};\n\n/**\n * Two-argument `render(props, context)` used by createComponent and scoped\n * resource components. `Context` is sibling components (scoped) or the\n * resource render context (top-level).\n */\nexport type PropsContextRender<RenderProps, Context, Result = unknown> = (\n props: WithChildren<RenderProps>,\n context: Context,\n) => Result;\n\n/**\n * Shared `{ props?, render }` shape used by createComponent, scoped\n * components, and anywhere else a value declares props and a two-arg render.\n *\n * @typeParam Props - Declared on the entry (`props`). Often an\n * {@link InPropsObject}, or a layout include/custom bag.\n * @typeParam RenderProps - First argument to `render` (defaults to\n * {@link ResolveProps}<Props> when Props is an {@link InPropsObject})\n * @typeParam Result - `render` return type\n * @typeParam Context - Second argument to `render`\n */\nexport interface PropsRenderDefinition<\n Props = InPropsObject,\n RenderProps = Props extends InPropsObject ? ResolveProps<Props> : unknown,\n Result = unknown,\n Context = unknown,\n> {\n props?: Props;\n render: PropsContextRender<RenderProps, Context, Result>;\n}\n\nexport type InPropsOptions<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Name extends string,\n> = {\n name: LiteralWrappedProp<Name, 'string', 'required'>;\n resource: EnumWrappedProp<ResourceEnum<Resources>, 'string', 'required'>;\n};\nexport type InPropsFunction<\n Resources extends ReadonlyArray<ResourceDefinition>,\n> = <Name extends string>(\n props: Show<InPropsOptions<Resources, Name>>,\n) => InPropsObject;\nexport type InPropsDefinition<\n Resources extends ReadonlyArray<ResourceDefinition>,\n> = InPropsObject | InPropsFunction<Resources>;\nexport type InferredInProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n> = Options extends InPropsFunction<Resources> ? ReturnType<Options> : Options;\nexport type MergedLayoutInProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n> =\n InferredInProps<Resources, Options> extends InPropsObject\n ? InferredInProps<Resources, Options> & MergePresetProps<Composables>\n : never;\nexport type RequiredVariant = true | 'required';\n/**\n * @typeParam RequiredVariant How the required props are selected. In application code,\n * it will always be `true`, but internally we need to support `'required'` as well.\n */\ntype PropsType<Variant extends RequiredVariant = true> = Variant | 'optional';\ntype InternalPropsType = PropsType<'required'>;\ntype IncludedPropSource = 'component' | 'config';\n/** Controls whether an included prop is required and where it is supplied. */\nexport type IncludedPropBehavior = {\n required: boolean;\n suppliedVia: IncludedPropSource;\n};\n\ntype IncludedPropType = PropsType | IncludedPropBehavior;\n/**\n * A map of props to include in the layout.\n */\nexport type IncludedProps<T extends object> = {\n [K in keyof T & string]?: IncludedPropType;\n};\n\ntype PropsKeys<Props extends InPropsObject, T> = T & keyof Props;\nexport type IncludedPropVisibility<Value> = Value extends { required: boolean }\n ? Value['required'] extends true\n ? 'required'\n : 'optional'\n : Value extends true | 'required'\n ? 'required'\n : Value extends 'optional'\n ? 'optional'\n : never;\nexport type IncludedPropSupplySource<Value> = Value extends {\n suppliedVia: IncludedPropSource;\n}\n ? Value['suppliedVia']\n : never;\n/**\n * Internal representation of the supported include behavior.\n */\nexport type NormalizedIncludedPropBehavior<Value> = Value extends\n | { required: boolean }\n | { suppliedVia: IncludedPropSource }\n ? {\n visibility: IncludedPropVisibility<Value>;\n passthrough: IncludedPropSupplySource<Value>;\n }\n : Value;\n\nexport type IncludedPropPassthrough<Value> = Value extends\n | { required: boolean }\n | { suppliedVia: IncludedPropSource }\n ? IncludedPropSupplySource<Value> extends 'component'\n ? IncludedPropVisibility<Value> extends 'optional'\n ? 'component' | 'config'\n : 'component'\n : IncludedPropSupplySource<Value>\n : Value extends true | 'required'\n ? 'config'\n : Value extends 'optional'\n ? 'component' | 'config'\n : never;\n\ntype GetPropsKey<\n IncludeProps extends object,\n Visibility extends InternalPropsType,\n Passthrough extends IncludedPropSource | 'render' = 'render',\n> = {\n [Key in keyof IncludeProps]: IncludedPropVisibility<\n IncludeProps[Key]\n > extends Visibility\n ? Passthrough extends 'render'\n ? Key\n : Passthrough extends IncludedPropPassthrough<IncludeProps[Key]>\n ? Key\n : never\n : never;\n}[keyof IncludeProps];\ntype SelectedIncludedProps<\n Props extends InPropsObject,\n IncludeProps extends IncludedProps<Props>,\n Visibility extends InternalPropsType,\n Passthrough extends IncludedPropSource | 'render' = 'render',\n> = Pick<\n Props,\n PropsKeys<Props, GetPropsKey<IncludeProps, Visibility, Passthrough>>\n>;\n\ntype OptionalPropDefinition<Definition> = Definition extends {\n optional(): infer OptionalDefinition;\n}\n ? OptionalDefinition\n : Definition;\n\n/** Raw validator definitions accepted by a generated component call. */\nexport type IncludedComponentPropDefinitions<\n Props extends InPropsObject,\n IncludeProps extends IncludedProps<Props>,\n> = SelectedIncludedProps<Props, IncludeProps, 'required', 'component'> & {\n [Key in keyof SelectedIncludedProps<\n Props,\n IncludeProps,\n 'optional',\n 'component'\n >]: OptionalPropDefinition<\n SelectedIncludedProps<Props, IncludeProps, 'optional', 'component'>[Key]\n >;\n};\n\nexport type ResolvedIncludedProps<\n Props extends InPropsObject,\n IncludeProps extends IncludedProps<Props>,\n> = ResolveLayoutProps<SelectedIncludedProps<Props, IncludeProps, 'required'>> &\n Partial<\n ResolveLayoutProps<SelectedIncludedProps<Props, IncludeProps, 'optional'>>\n >;\n\nexport type ResolvedIncludedConfigProps<\n Props extends InPropsObject,\n IncludeProps extends IncludedProps<Props>,\n> = ResolveLayoutProps<\n SelectedIncludedProps<Props, IncludeProps, 'required', 'config'>\n> &\n Partial<\n ResolveLayoutProps<\n SelectedIncludedProps<Props, IncludeProps, 'optional', 'config'>\n >\n >;\n\nexport type ResolvedIncludedComponentProps<\n Props extends InPropsObject,\n IncludeProps extends IncludedProps<Props>,\n> = ResolveLayoutProps<\n SelectedIncludedProps<Props, IncludeProps, 'required', 'component'>\n> &\n Partial<\n ResolveLayoutProps<\n SelectedIncludedProps<Props, IncludeProps, 'optional', 'component'>\n >\n >;\n\n/**\n * Like {@link ResolvedIncludedProps}, but keeps included prop keys exactly as\n * declared (no `JSX.Element` capitalization).\n */\nexport type ResolvedIncludedPropsAsDefined<\n Props extends InPropsObject,\n IncludeProps extends IncludedProps<Props>,\n> = ResolveLayoutPropsAsDefined<\n SelectedIncludedProps<Props, IncludeProps, 'required'>\n> &\n Partial<\n ResolveLayoutPropsAsDefined<\n SelectedIncludedProps<Props, IncludeProps, 'optional'>\n >\n >;\nexport type LayoutRenderProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents = {},\n IncludeProps extends IncludedProps<\n MergedLayoutInProps<Resources, Options, Composables>\n > = {},\n CustomProps extends CustomPropsObject = {},\n> = Show<\n ResolveRenderProps<CustomProps> &\n ResolvedIncludedProps<\n MergedLayoutInProps<Resources, Options, Composables>,\n IncludeProps\n >\n>;\n\nexport function getIncludedPropBehavior(value: unknown): {\n visibility: 'required' | 'optional';\n passthrough: 'component' | 'config';\n} | null {\n if (value === null || typeof value !== 'object') {\n return null;\n }\n\n if ('visibility' in value || 'passthrough' in value) {\n throw new LayoutConfigurationError(\n 'Include properties visibility and passthrough were removed; use required and suppliedVia.',\n );\n }\n\n const required =\n 'required' in value && typeof value.required === 'boolean'\n ? value.required\n : undefined;\n const suppliedVia = 'suppliedVia' in value ? value.suppliedVia : undefined;\n\n if (\n required === undefined ||\n (suppliedVia !== 'component' && suppliedVia !== 'config')\n ) {\n return null;\n }\n\n return {\n visibility: required ? 'required' : 'optional',\n passthrough: suppliedVia,\n };\n}\n"],"mappings":";;;AAgQA,SAAgB,wBAAwB,OAG/B;CACP,IAAI,UAAU,QAAQ,OAAO,UAAU,UACrC,OAAO;CAGT,IAAI,gBAAgB,SAAS,iBAAiB,OAC5C,MAAM,IAAIA,4DACR,2FACF;CAGF,MAAM,WACJ,cAAc,SAAS,OAAO,MAAM,aAAa,YAC7C,MAAM,WACN;CACN,MAAM,cAAc,iBAAiB,QAAQ,MAAM,cAAc;CAEjE,IACE,aAAa,UACZ,gBAAgB,eAAe,gBAAgB,UAEhD,OAAO;CAGT,OAAO;EACL,YAAY,WAAW,aAAa;EACpC,aAAa;CACf;AACF"}
package/dist/props.d.cts CHANGED
@@ -1,15 +1,21 @@
1
+ import { CustomPropsObject, ResolveRenderProps } from "./custom-props.cjs";
1
2
  import { Show } from "./utils.cjs";
2
3
  import { ResourceDefinition, ResourceEnum } from "./resource.cjs";
3
- import { ComposableComponents, InPropsObject, MergePresetProps } from "@jfdevelops/react-layout-composables";
4
+ import { ComposableComponents, InPropsObject, MergePresetProps, WithChildren } from "@jfdevelops/react-layout-composables";
4
5
  import { EnumWrappedProp, LiteralWrappedProp, ResolveLayoutProps, ResolveLayoutPropsAsDefined, ResolveProps } from "@jfdevelops/react-layout-validator";
5
6
 
6
7
  //#region src/props.d.ts
8
+ /** Shared include/custom contract used by configurable layout helpers. */
9
+ type PropsContract<Include extends object = object, Custom extends object = object> = {
10
+ include?: Include;
11
+ custom?: Custom;
12
+ };
7
13
  /**
8
14
  * Two-argument `render(props, context)` used by createComponent and scoped
9
15
  * resource components. `Context` is sibling components (scoped) or the
10
16
  * resource render context (top-level).
11
17
  */
12
- type PropsContextRender<RenderProps, Context, Result = unknown> = (props: RenderProps, context: Context) => Result;
18
+ type PropsContextRender<RenderProps, Context, Result = unknown> = (props: WithChildren<RenderProps>, context: Context) => Result;
13
19
  /**
14
20
  * Shared `{ props?, render }` shape used by createComponent, scoped
15
21
  * components, and anywhere else a value declares props and a two-arg render.
@@ -89,7 +95,7 @@ type ResolvedIncludedComponentProps<Props extends InPropsObject, IncludeProps ex
89
95
  * declared (no `JSX.Element` capitalization).
90
96
  */
91
97
  type ResolvedIncludedPropsAsDefined<Props extends InPropsObject, IncludeProps extends IncludedProps<Props>> = ResolveLayoutPropsAsDefined<SelectedIncludedProps<Props, IncludeProps, 'required'>> & Partial<ResolveLayoutPropsAsDefined<SelectedIncludedProps<Props, IncludeProps, 'optional'>>>;
92
- type LayoutRenderProps<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, Composables extends ComposableComponents = {}, IncludeProps extends IncludedProps<MergedLayoutInProps<Resources, Options, Composables>> = {}, CustomProps extends InPropsObject = {}> = Show<ResolveProps<CustomProps> & ResolvedIncludedProps<MergedLayoutInProps<Resources, Options, Composables>, IncludeProps>>;
98
+ type LayoutRenderProps<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, Composables extends ComposableComponents = {}, IncludeProps extends IncludedProps<MergedLayoutInProps<Resources, Options, Composables>> = {}, CustomProps extends CustomPropsObject = {}> = Show<ResolveRenderProps<CustomProps> & ResolvedIncludedProps<MergedLayoutInProps<Resources, Options, Composables>, IncludeProps>>;
93
99
  //#endregion
94
- export { InPropsDefinition, InPropsFunction, type InPropsObject, InPropsOptions, IncludedComponentPropDefinitions, IncludedPropBehavior, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, NormalizedIncludedPropBehavior, PropsContextRender, PropsRenderDefinition, ResolvedIncludedComponentProps, ResolvedIncludedConfigProps, ResolvedIncludedProps, ResolvedIncludedPropsAsDefined };
100
+ export { InPropsDefinition, InPropsFunction, type InPropsObject, InPropsOptions, IncludedComponentPropDefinitions, IncludedPropBehavior, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, NormalizedIncludedPropBehavior, PropsContextRender, PropsContract, PropsRenderDefinition, ResolvedIncludedComponentProps, ResolvedIncludedConfigProps, ResolvedIncludedProps, ResolvedIncludedPropsAsDefined };
95
101
  //# sourceMappingURL=props.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.cts","names":[],"sources":["../src/props.ts"],"mappings":";;;;;;AAuBA;;;;;AAAA,KAAY,kBAAA,4CACV,KAAA,EAAO,WAAA,EACP,OAAA,EAAS,OAAA,KACN,MAAA;;;;;;;;;;;;UAaY,qBAAA,SACP,aAAA,iBACM,KAAA,SAAc,aAAA,GAAgB,YAAA,CAAa,KAAA;EAIzD,KAAA,GAAQ,KAAA;EACR,MAAA,EAAQ,kBAAA,CAAmB,WAAA,EAAa,OAAA,EAAS,MAAA;AAAA;AAAA,KAGvC,cAAA,mBACQ,aAAA,CAAc,kBAAA;EAGhC,IAAA,EAAM,kBAAA,CAAmB,IAAA;EACzB,QAAA,EAAU,eAAA,CAAgB,YAAA,CAAa,SAAA;AAAA;AAAA,KAE7B,eAAA,mBACQ,aAAA,CAAc,kBAAA,2BAEhC,KAAA,EAAO,IAAA,CAAK,cAAA,CAAe,SAAA,EAAW,IAAA,OACnC,aAAA;AAAA,KACO,iBAAA,mBACQ,aAAA,CAAc,kBAAA,KAC9B,aAAA,GAAgB,eAAA,CAAgB,SAAA;AAAA,KACxB,eAAA,mBACQ,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,KAChC,OAAA,SAAgB,eAAA,CAAgB,SAAA,IAAa,UAAA,CAAW,OAAA,IAAW,OAAA;AAAA,KAC3D,mBAAA,mBACQ,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,uBACd,oBAAA,IAEpB,eAAA,CAAgB,SAAA,EAAW,OAAA,UAAiB,aAAA,GACxC,eAAA,CAAgB,SAAA,EAAW,OAAA,IAAW,gBAAA,CAAiB,WAAA;AAAA,KAEjD,eAAA;;;;;KAKP,SAAA,iBAA0B,eAAA,WAA0B,OAA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B,qBAAA,CACZ,KAAA,EACA,YAAA,6BAGE,sBAAA,CACF,qBAAA,CAAsB,KAAA,EAAO,YAAA,2BAAuC,GAAA;AAAA,KAI5D,qBAAA,eACI,aAAA,uBACO,aAAA,CAAc,KAAA,KACjC,kBAAA,CAAmB,qBAAA,CAAsB,KAAA,EAAO,YAAA,iBAClD,OAAA,CACE,kBAAA,CAAmB,qBAAA,CAAsB,KAAA,EAAO,YAAA;AAAA,KAGxC,2BAAA,eACI,aAAA,uBACO,aAAA,CAAc,KAAA,KACjC,kBAAA,CACF,qBAAA,CAAsB,KAAA,EAAO,YAAA,2BAE7B,OAAA,CACE,kBAAA,CACE,qBAAA,CAAsB,KAAA,EAAO,YAAA;AAAA,KAIvB,8BAAA,eACI,aAAA,uBACO,aAAA,CAAc,KAAA,KACjC,kBAAA,CACF,qBAAA,CAAsB,KAAA,EAAO,YAAA,8BAE7B,OAAA,CACE,kBAAA,CACE,qBAAA,CAAsB,KAAA,EAAO,YAAA;;;;;KAQvB,8BAAA,eACI,aAAA,uBACO,aAAA,CAAc,KAAA,KACjC,2BAAA,CACF,qBAAA,CAAsB,KAAA,EAAO,YAAA,iBAE7B,OAAA,CACE,2BAAA,CACE,qBAAA,CAAsB,KAAA,EAAO,YAAA;AAAA,KAGvB,iBAAA,mBACQ,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,uBACd,oBAAA,4BACC,aAAA,CACnB,mBAAA,CAAoB,SAAA,EAAW,OAAA,EAAS,WAAA,6BAEtB,iBAAA,SAClB,IAAA,CACF,kBAAA,CAAmB,WAAA,IACjB,qBAAA,CACE,mBAAA,CAAoB,SAAA,EAAW,OAAA,EAAS,WAAA,GACxC,YAAA"}
package/dist/props.d.mts CHANGED
@@ -1,15 +1,21 @@
1
+ import { CustomPropsObject, ResolveRenderProps } from "./custom-props.mjs";
1
2
  import { Show } from "./utils.mjs";
2
3
  import { ResourceDefinition, ResourceEnum } from "./resource.mjs";
3
- import { ComposableComponents, InPropsObject, MergePresetProps } from "@jfdevelops/react-layout-composables";
4
+ import { ComposableComponents, InPropsObject, MergePresetProps, WithChildren } from "@jfdevelops/react-layout-composables";
4
5
  import { EnumWrappedProp, LiteralWrappedProp, ResolveLayoutProps, ResolveLayoutPropsAsDefined, ResolveProps } from "@jfdevelops/react-layout-validator";
5
6
 
6
7
  //#region src/props.d.ts
8
+ /** Shared include/custom contract used by configurable layout helpers. */
9
+ type PropsContract<Include extends object = object, Custom extends object = object> = {
10
+ include?: Include;
11
+ custom?: Custom;
12
+ };
7
13
  /**
8
14
  * Two-argument `render(props, context)` used by createComponent and scoped
9
15
  * resource components. `Context` is sibling components (scoped) or the
10
16
  * resource render context (top-level).
11
17
  */
12
- type PropsContextRender<RenderProps, Context, Result = unknown> = (props: RenderProps, context: Context) => Result;
18
+ type PropsContextRender<RenderProps, Context, Result = unknown> = (props: WithChildren<RenderProps>, context: Context) => Result;
13
19
  /**
14
20
  * Shared `{ props?, render }` shape used by createComponent, scoped
15
21
  * components, and anywhere else a value declares props and a two-arg render.
@@ -89,7 +95,7 @@ type ResolvedIncludedComponentProps<Props extends InPropsObject, IncludeProps ex
89
95
  * declared (no `JSX.Element` capitalization).
90
96
  */
91
97
  type ResolvedIncludedPropsAsDefined<Props extends InPropsObject, IncludeProps extends IncludedProps<Props>> = ResolveLayoutPropsAsDefined<SelectedIncludedProps<Props, IncludeProps, 'required'>> & Partial<ResolveLayoutPropsAsDefined<SelectedIncludedProps<Props, IncludeProps, 'optional'>>>;
92
- type LayoutRenderProps<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, Composables extends ComposableComponents = {}, IncludeProps extends IncludedProps<MergedLayoutInProps<Resources, Options, Composables>> = {}, CustomProps extends InPropsObject = {}> = Show<ResolveProps<CustomProps> & ResolvedIncludedProps<MergedLayoutInProps<Resources, Options, Composables>, IncludeProps>>;
98
+ type LayoutRenderProps<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, Composables extends ComposableComponents = {}, IncludeProps extends IncludedProps<MergedLayoutInProps<Resources, Options, Composables>> = {}, CustomProps extends CustomPropsObject = {}> = Show<ResolveRenderProps<CustomProps> & ResolvedIncludedProps<MergedLayoutInProps<Resources, Options, Composables>, IncludeProps>>;
93
99
  //#endregion
94
- export { InPropsDefinition, InPropsFunction, type InPropsObject, InPropsOptions, IncludedComponentPropDefinitions, IncludedPropBehavior, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, NormalizedIncludedPropBehavior, PropsContextRender, PropsRenderDefinition, ResolvedIncludedComponentProps, ResolvedIncludedConfigProps, ResolvedIncludedProps, ResolvedIncludedPropsAsDefined };
100
+ export { InPropsDefinition, InPropsFunction, type InPropsObject, InPropsOptions, IncludedComponentPropDefinitions, IncludedPropBehavior, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, NormalizedIncludedPropBehavior, PropsContextRender, PropsContract, PropsRenderDefinition, ResolvedIncludedComponentProps, ResolvedIncludedConfigProps, ResolvedIncludedProps, ResolvedIncludedPropsAsDefined };
95
101
  //# sourceMappingURL=props.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.mts","names":[],"sources":["../src/props.ts"],"mappings":";;;;;;AAuBA;;;;;AAAA,KAAY,kBAAA,4CACV,KAAA,EAAO,WAAA,EACP,OAAA,EAAS,OAAA,KACN,MAAA;;;;;;;;;;;;UAaY,qBAAA,SACP,aAAA,iBACM,KAAA,SAAc,aAAA,GAAgB,YAAA,CAAa,KAAA;EAIzD,KAAA,GAAQ,KAAA;EACR,MAAA,EAAQ,kBAAA,CAAmB,WAAA,EAAa,OAAA,EAAS,MAAA;AAAA;AAAA,KAGvC,cAAA,mBACQ,aAAA,CAAc,kBAAA;EAGhC,IAAA,EAAM,kBAAA,CAAmB,IAAA;EACzB,QAAA,EAAU,eAAA,CAAgB,YAAA,CAAa,SAAA;AAAA;AAAA,KAE7B,eAAA,mBACQ,aAAA,CAAc,kBAAA,2BAEhC,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