@jfdevelops/react-layout 0.15.0 → 0.16.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 (55) hide show
  1. package/dist/create-config/define-layout.cjs +15 -4
  2. package/dist/create-config/define-layout.cjs.map +1 -1
  3. package/dist/create-config/define-layout.d.cts +31 -5
  4. package/dist/create-config/define-layout.d.cts.map +1 -1
  5. package/dist/create-config/define-layout.d.mts +31 -5
  6. package/dist/create-config/define-layout.d.mts.map +1 -1
  7. package/dist/create-config/define-layout.mjs +14 -3
  8. package/dist/create-config/define-layout.mjs.map +1 -1
  9. package/dist/create-config/for-resources/create-component.d.cts +284 -0
  10. package/dist/create-config/for-resources/create-component.d.cts.map +1 -0
  11. package/dist/create-config/for-resources/create-component.d.mts +284 -0
  12. package/dist/create-config/for-resources/create-component.d.mts.map +1 -0
  13. package/dist/create-config/{for-resources.cjs → for-resources/create-for-resources.cjs} +82 -42
  14. package/dist/create-config/for-resources/create-for-resources.cjs.map +1 -0
  15. package/dist/create-config/for-resources/create-for-resources.d.cts +1 -0
  16. package/dist/create-config/for-resources/create-for-resources.d.mts +1 -0
  17. package/dist/create-config/{for-resources.mjs → for-resources/create-for-resources.mjs} +81 -41
  18. package/dist/create-config/for-resources/create-for-resources.mjs.map +1 -0
  19. package/dist/create-config/for-resources/index.d.cts +1 -0
  20. package/dist/create-config/for-resources/index.d.mts +1 -0
  21. package/dist/create-config/for-resources/resource-selection.d.cts +47 -0
  22. package/dist/create-config/for-resources/resource-selection.d.cts.map +1 -0
  23. package/dist/create-config/for-resources/resource-selection.d.mts +47 -0
  24. package/dist/create-config/for-resources/resource-selection.d.mts.map +1 -0
  25. package/dist/create-config/for-resources/scoped-layout.d.cts +185 -0
  26. package/dist/create-config/for-resources/scoped-layout.d.cts.map +1 -0
  27. package/dist/create-config/for-resources/scoped-layout.d.mts +185 -0
  28. package/dist/create-config/for-resources/scoped-layout.d.mts.map +1 -0
  29. package/dist/create-config/for-resources/scoped-render.cjs +103 -0
  30. package/dist/create-config/for-resources/scoped-render.cjs.map +1 -0
  31. package/dist/create-config/for-resources/scoped-render.d.cts +18 -0
  32. package/dist/create-config/for-resources/scoped-render.d.cts.map +1 -0
  33. package/dist/create-config/for-resources/scoped-render.d.mts +18 -0
  34. package/dist/create-config/for-resources/scoped-render.d.mts.map +1 -0
  35. package/dist/create-config/for-resources/scoped-render.mjs +100 -0
  36. package/dist/create-config/for-resources/scoped-render.mjs.map +1 -0
  37. package/dist/create-config/index.d.cts +1 -1
  38. package/dist/create-config/index.d.mts +1 -1
  39. package/dist/index.d.cts +3 -3
  40. package/dist/index.d.mts +3 -3
  41. package/dist/props.d.cts +28 -2
  42. package/dist/props.d.cts.map +1 -1
  43. package/dist/props.d.mts +28 -2
  44. package/dist/props.d.mts.map +1 -1
  45. package/dist/utils.cjs.map +1 -1
  46. package/dist/utils.d.cts.map +1 -1
  47. package/dist/utils.d.mts.map +1 -1
  48. package/dist/utils.mjs.map +1 -1
  49. package/package.json +3 -3
  50. package/dist/create-config/for-resources.cjs.map +0 -1
  51. package/dist/create-config/for-resources.d.cts +0 -358
  52. package/dist/create-config/for-resources.d.cts.map +0 -1
  53. package/dist/create-config/for-resources.d.mts +0 -358
  54. package/dist/create-config/for-resources.d.mts.map +0 -1
  55. package/dist/create-config/for-resources.mjs.map +0 -1
@@ -0,0 +1,284 @@
1
+ import { BaseComponent, Show } from "../../utils.cjs";
2
+ import { ResourceDefinition } from "../../resource.cjs";
3
+ import { InPropsDefinition, InPropsObject, IncludedProps, MergedLayoutInProps, PropsContextRender, PropsRenderDefinition, ResolvedIncludedPropsAsDefined } from "../../props.cjs";
4
+ import { SelectedLayoutResources } from "./resource-selection.cjs";
5
+ import { ScopedRenderResult } from "./scoped-render.cjs";
6
+ import { LayoutIncludeProps, LayoutProps } from "../define-layout.cjs";
7
+ import { ComposableComponents } from "@jfdevelops/react-layout-composables";
8
+ import { ComponentType, JSX, ReactNode } from "react";
9
+ import { ResolveProps, ResolvedBuiltPropShape } from "@jfdevelops/react-layout-validator";
10
+
11
+ //#region src/create-config/for-resources/create-component.d.ts
12
+ type ScopedComponentAvailableProps<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject> = MergedLayoutInProps<Resources, InProps, Composables> & LayoutCustomProps;
13
+ type ScopedResourceComponentProps<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<Resources, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, Resource extends string> = Show<Omit<ResolvedIncludedPropsAsDefined<ScopedComponentAvailableProps<Resources, InProps, Composables, LayoutCustomProps>, ComponentIncludeProps> & ResolvedBuiltPropShape<ComponentCustomProps>, 'children' | 'resource'> & {
14
+ children?: ReactNode;
15
+ resource: Resource;
16
+ }>;
17
+ /**
18
+ * Call-site props for a createComponent result: declared include/custom props
19
+ * plus props of any component type returned from the top-level `render`.
20
+ *
21
+ * Mirrors scoped-component inference (`PropsFromScopedRender`), but for the
22
+ * outer component: `<Directory requiredProp="x" />` must type-check when
23
+ * `render` returns a component that requires `requiredProp`.
24
+ *
25
+ * These extras are applied only to the *external* call signature — not to the
26
+ * `render` `props` parameter — so inference stays non-circular (return type
27
+ * cannot depend on a props type that already includes that return).
28
+ *
29
+ * `children` / `resource` stay owned by the wrapper (not taken from the return).
30
+ */
31
+ type ScopedResourceComponentCallProps<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<Resources, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, Resource extends string, RenderResult = never> = Show<ScopedResourceComponentProps<Resources, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource> & Omit<PropsFromRenderResult<RenderResult>, 'children' | 'resource'>>;
32
+ /**
33
+ * Fields reverse-inferred from each scoped component declaration.
34
+ *
35
+ * `props` reverse-maps as-is. `render` cannot reverse-map as a full function
36
+ * type (that becomes `unknown`), so only its return type is preserved via
37
+ * `(...args: any) => Return`. Call-site props and compound statics are then
38
+ * read from that return type — prefer the raw capture intersection on entries
39
+ * when both `props` and a returned component type must survive together.
40
+ */
41
+ type ScopedComponentShape = {
42
+ props?: InPropsObject;
43
+ render?: (...args: never[]) => unknown;
44
+ };
45
+ /**
46
+ * Homomorphic pick of reverse-mapped scoped-component fields. Paired with a
47
+ * mapped type over the components object, this lets each entry's inferred
48
+ * `props` (and render return when inference succeeds) flow into signatures.
49
+ */
50
+ type JustScopedComponent<T> = { [Key in keyof T & keyof ScopedComponentShape]: Key extends 'render' ? T[Key] extends ((...args: any) => infer Return) ? (...args: any) => Return : unknown : T[Key] };
51
+ /**
52
+ * Resources with no `components` reverse-infer as `unknown`. Treat that as an
53
+ * empty map so sibling/context access stays closed.
54
+ */
55
+ type NormalizeScopedComponentsMap<Components> = unknown extends Components ? {} : Components extends Record<string, unknown> ? Components : {};
56
+ /** Extracts the prop definitions declared on a scoped component. */
57
+ type ScopedComponentOwnProps<Definition> = Definition extends {
58
+ props: infer Props;
59
+ } ? Props extends InPropsObject ? Props : {} : {};
60
+ /**
61
+ * True when a scoped `render` returned a component type (callable), not a
62
+ * React node like `null` / an element.
63
+ */
64
+ type IsScopedRenderableComponentType<Result> = [Result] extends [never] ? false : [Result] extends [(...args: any) => any] ? true : [Result] extends [ComponentType<any>] ? true : false;
65
+ /**
66
+ * Props of a component type returned from a scoped `render`. Empty when the
67
+ * render returns a node (or a component with no props).
68
+ */
69
+ type PropsFromRenderResult<Result> = [Result] extends [never] ? {} : IsScopedRenderableComponentType<Result> extends true ? Result extends ((props: infer Props) => any) ? unknown extends Props ? {} : Props extends object ? Props : {} : [Result] extends [ComponentType<infer Props>] ? Props : {} : {};
70
+ /**
71
+ * Call-site props inferred from a scoped component's `render` return type.
72
+ */
73
+ type PropsFromScopedRender<Definition> = Definition extends {
74
+ render: (...args: any) => infer Result;
75
+ } ? PropsFromRenderResult<Result> : {};
76
+ /**
77
+ * Call-site props for a scoped component: declared `props` plus props of any
78
+ * component type returned from `render`.
79
+ */
80
+ type ScopedComponentCallProps<Definition> = Show<ResolvedBuiltPropShape<ScopedComponentOwnProps<Definition>> & PropsFromScopedRender<Definition>>;
81
+ /**
82
+ * A scoped component's call signature. Components that declare no props are
83
+ * callable with no arguments.
84
+ */
85
+ type ScopedComponentSignature<Props> = {} extends Props ? (props?: Props) => JSX.Element : (props: Props) => JSX.Element;
86
+ /**
87
+ * Function-prototype / React statics that must not appear as compound
88
+ * component keys on a scoped component resolved from a returned component type.
89
+ */
90
+ type ScopedComponentCompoundStaticKey = 'apply' | 'arguments' | 'bind' | 'call' | 'caller' | 'childContextTypes' | 'contextTypes' | 'defaultProps' | 'displayName' | 'length' | 'name' | 'propTypes' | 'prototype' | 'toLocaleString' | 'toString' | 'valueOf' | '$$typeof';
91
+ /**
92
+ * Compound statics (e.g. `DataTable.Loading`) taken from a component type
93
+ * returned by scoped `render`.
94
+ *
95
+ * Types alone are not enough: the runtime wrapper must expose the same keys
96
+ * (see `withScopedCompoundStatics`), otherwise `components.DataTable.Loading`
97
+ * type-checks but throws at runtime.
98
+ */
99
+ type ScopedComponentCompoundStatics<Result> = [Result] extends [never] ? {} : IsScopedRenderableComponentType<Result> extends true ? { [Key in keyof Result as Key extends ScopedComponentCompoundStaticKey ? never : Result[Key] extends ((...args: any) => any) ? Key & string : never]: Result[Key] extends ((props: infer Props) => any) ? ScopedComponentSignature<Props extends object ? Props : {}> : never } : {};
100
+ /**
101
+ * A resolved scoped component: call signature from declared + returned-component
102
+ * props, plus any compound statics on the returned component type.
103
+ */
104
+ type ResolvedScopedComponent<Definition> = ScopedComponentSignature<ScopedComponentCallProps<Definition>> & ScopedComponentCompoundStatics<Definition extends {
105
+ render: (...args: any) => infer Result;
106
+ } ? Result : never>;
107
+ /**
108
+ * The sibling / context components for one resource, keyed by their declared
109
+ * names with call-site prop types (and compound statics when applicable).
110
+ */
111
+ type ResolvedScopedComponentsMap<Components> = { [Name in keyof NormalizeScopedComponentsMap<Components>]: ResolvedScopedComponent<NormalizeScopedComponentsMap<Components>[Name]> };
112
+ /**
113
+ * Call-site props for `context.<Resource>`: outermost createComponent
114
+ * include/custom props (minus `resource`).
115
+ */
116
+ type ScopedResourceContextCallProps<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, Resource extends string> = Show<Omit<ScopedResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource>, 'resource'>>;
117
+ type ScopedResourceComponentRenderContext<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, ComponentsByResource> = {
118
+ /**
119
+ * The resource layout for the component's current `resource`, created
120
+ * internally from that resource's entry options. Accepts the layout's
121
+ * custom props.
122
+ */
123
+ Root: (props: Show<ResolveProps<LayoutCustomProps>>) => JSX.Element;
124
+ } & { [Resource in keyof ComponentsByResource as Capitalize<Resource & string>]-?: ScopedComponentSignature<ScopedResourceContextCallProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource & string>> & ResolvedScopedComponentsMap<ComponentsByResource[Resource]> };
125
+ /**
126
+ * Reverse-mapped `resources` constraint.
127
+ *
128
+ * `ComponentsByResource` is inferred from each entry's `components` object.
129
+ * Mapping back over those keys types every nested `render`'s second argument
130
+ * with the other components for that resource — excluding the current
131
+ * component when typing a scoped component's own `render`.
132
+ *
133
+ * The parameter must not carry a default: TypeScript contextually types from a
134
+ * parameter's default when it has one, and `{}` would silently degrade every
135
+ * nested render to `any`.
136
+ *
137
+ * Entry keys are only `name`, `components`, and `render`. Layout option values
138
+ * like `title` are excess-property errors here — they belong on
139
+ * `context.<Resource>` / the outer component call site.
140
+ *
141
+ * Each scoped component is `JustScopedComponent<Captured> & Precise & Captured`:
142
+ * the homomorphic pick reverse-infers `props`, the precise `render`
143
+ * contextually types parameters, and the raw capture keeps the literal for
144
+ * call-site resolution.
145
+ */
146
+ type ScopedComponentResourceEntry<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, Resource extends string, Components> = {
147
+ /**
148
+ * Overrides the layout name used by `context.Root` for this resource.
149
+ * Defaults to the scope's configured name, then the capitalized resource.
150
+ */
151
+ name?: string;
152
+ /**
153
+ * Components scoped to this resource. Each becomes a component on this
154
+ * resource's render context, on `context.<Resource>`, and on the component
155
+ * returned by `asHOF()`.
156
+ */
157
+ components?: { [Name in keyof Components]: JustScopedComponent<Components[Name]> &
158
+ /**
159
+ * Renders this component. Receives the scoped component's props plus
160
+ * this component's own props, and the other components for this
161
+ * resource (excluding itself).
162
+ *
163
+ * May return a React node or a component type (mounted with the
164
+ * call-site props). Props and compound statics of a returned component
165
+ * type are inferred at call sites from the render return type.
166
+ */
167
+ PropsRenderDefinition<InPropsObject, ScopedResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource> & Show<ResolvedBuiltPropShape<ScopedComponentOwnProps<Components[Name]>>>, ScopedRenderResult, Omit<ResolvedScopedComponentsMap<Components>, Name>> & Components[Name] }; /** Renders this resource's content inside the shared render function. */
168
+ render: PropsContextRender<ScopedResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource>, ResolvedScopedComponentsMap<Components>, ScopedRenderResult>;
169
+ };
170
+ type ScopedComponentResourceEntries<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, ComponentsByResource> = { [Resource in keyof ComponentsByResource]: ScopedComponentResourceEntry<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource & string, ComponentsByResource[Resource]> } & Record<Exclude<keyof ComponentsByResource, SelectedLayoutResources<ResourceDefinitions, Arguments>>, never>;
171
+ /**
172
+ * Props of a resource-bound component. `resource` is supplied by the binding,
173
+ * so it is removed from the call site.
174
+ */
175
+ type ScopedBoundResourceComponentProps<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, Resource extends string, RenderResult = never> = Show<Omit<ScopedResourceComponentCallProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource, RenderResult>, 'resource'>>;
176
+ type ScopedBoundResourceComponent<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, ComponentsByResource, Resource extends string, RenderResult = never> = BaseComponent<string, ScopedBoundResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource, RenderResult>> & ResolvedScopedComponentsMap<Resource extends keyof ComponentsByResource ? ComponentsByResource[Resource] : {}> & {
177
+ (props: ScopedBoundResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource, RenderResult>): JSX.Element;
178
+ /**
179
+ * Type-only property containing the bound resource. This property is
180
+ * `undefined` at runtime.
181
+ */
182
+ readonly resource: Resource;
183
+ };
184
+ type ScopedResourceComponent<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, ComponentsByResource, RenderResult = never> = BaseComponent<string, ScopedResourceComponentCallProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, SelectedLayoutResources<ResourceDefinitions, Arguments>, RenderResult>> & {
185
+ /**
186
+ * The `resource` prop drives the generic, so it is inferred from the call
187
+ * site. Explicit type arguments are never needed.
188
+ */
189
+ <const Resource extends SelectedLayoutResources<ResourceDefinitions, Arguments>>(props: ScopedResourceComponentCallProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource, RenderResult>): JSX.Element;
190
+ /**
191
+ * Returns a factory that binds the component to one resource. The bound
192
+ * component accepts every prop except `resource`, which the binding supplies.
193
+ *
194
+ * Each resource is bound once and cached, so the returned component type is
195
+ * stable across renders.
196
+ *
197
+ * @example
198
+ * const createDirectory = Directory.asHOF()
199
+ * const UsersDirectory = createDirectory('users')
200
+ *
201
+ * <UsersDirectory title='Users' />
202
+ *
203
+ * @returns A factory producing a component bound to the given resource.
204
+ */
205
+ asHOF(): <const Resource extends SelectedLayoutResources<ResourceDefinitions, Arguments>>(resource: Resource) => ScopedBoundResourceComponent<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, ComponentsByResource, Resource, RenderResult>;
206
+ };
207
+ /**
208
+ * Props bag for `setProps` / optional extras: forbids keys already present on
209
+ * the base include/custom from `setProps`.
210
+ */
211
+ type ScopedComponentExtraProps<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, BaseInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables>, BaseCustom extends InPropsObject, ExtraInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables> = {}, ExtraCustom extends InPropsObject = {}> = {
212
+ include?: ExtraInclude & { [Key in keyof BaseInclude & string]?: never };
213
+ custom?: ExtraCustom & { [Key in keyof BaseCustom & string]?: never };
214
+ };
215
+ /**
216
+ * Builds a single resource entry for use under `resources`, typed against
217
+ * setProps base props plus optional CRC extras (keys already on the base are
218
+ * forbidden).
219
+ *
220
+ * `render` is typed with {@link PropsContextRender} (not an open
221
+ * `(...args: any) => …`) so destructured props stay precise — an `any`
222
+ * constraint on Options would collapse them.
223
+ */
224
+ type ScopedCreateResourceComponents<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject, BaseInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables>, BaseCustom extends InPropsObject> = <const Resource extends SelectedLayoutResources<ResourceDefinitions, Arguments>, const Components, const ExtraInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables> = {}, ExtraCustom extends InPropsObject = {}>(options: {
225
+ resource: Resource;
226
+ props?: ScopedComponentExtraProps<ResourceDefinitions, InProps, Composables, BaseInclude, BaseCustom, ExtraInclude, ExtraCustom>;
227
+ name?: string;
228
+ components?: { [Name in keyof Components]: JustScopedComponent<Components[Name]> & PropsRenderDefinition<InPropsObject, ScopedResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, BaseInclude & ExtraInclude, BaseCustom & ExtraCustom, Resource> & Show<ResolvedBuiltPropShape<ScopedComponentOwnProps<Components[Name]>>>, ScopedRenderResult, Omit<ResolvedScopedComponentsMap<Components>, Name>> & Components[Name] };
229
+ render: PropsContextRender<ScopedResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, BaseInclude & ExtraInclude, BaseCustom & ExtraCustom, Resource>, ResolvedScopedComponentsMap<NormalizeScopedComponentsMap<Components>>, ScopedRenderResult>;
230
+ }) => ScopedComponentResourceEntry<ResourceDefinitions, InProps, Composables, LayoutCustomProps, BaseInclude & ExtraInclude, BaseCustom & ExtraCustom, Resource, NormalizeScopedComponentsMap<Components>>;
231
+ /**
232
+ * Options for {@link ScopedCreateComponent}. Extends the shared
233
+ * `{ props?, render }` shape; `props` is the layout include/custom bag, and
234
+ * `render` receives component props plus the resource context (`Root` and
235
+ * capitalized per-resource components).
236
+ *
237
+ * May return a React node or a component type (mounted with the component
238
+ * props). When a component type is returned, its props are merged into the
239
+ * created component's call signature via `RenderResult` /
240
+ * `ScopedResourceComponentCallProps` — they are intentionally *not* added
241
+ * to the `render` `props` parameter (that would circularly depend on the
242
+ * return).
243
+ */
244
+ interface ScopedCreateComponentOptions<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables>, ComponentCustomProps extends InPropsObject, ComponentsByResource, RenderResult extends ScopedRenderResult> extends PropsRenderDefinition<LayoutProps<ResourceDefinitions, InProps, Composables, ComponentIncludeProps, ComponentCustomProps>, ScopedResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, SelectedLayoutResources<ResourceDefinitions, Arguments>>, RenderResult, ScopedResourceComponentRenderContext<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, ComponentsByResource>> {
245
+ /**
246
+ * Per-resource content, keyed by resource. Each entry holds that resource's
247
+ * scoped `components` and its `render` — not layout option values like
248
+ * `title` (those are call-site props on `context.<Resource>` / the outer
249
+ * component).
250
+ */
251
+ resources?: ScopedComponentResourceEntries<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, ComponentsByResource>;
252
+ }
253
+ /**
254
+ * Options for a `setProps` thunk: same as createComponent options, but
255
+ * optional `props` may only add keys not already defined by `setProps`.
256
+ */
257
+ type ScopedCreateComponentWithPropsOptions<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject, BaseInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables>, BaseCustom extends InPropsObject, ExtraInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables>, ExtraCustom extends InPropsObject, ComponentsByResource, RenderResult extends ScopedRenderResult> = Omit<ScopedCreateComponentOptions<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, BaseInclude & ExtraInclude, BaseCustom & ExtraCustom, ComponentsByResource, RenderResult>, 'props'> & {
258
+ props?: ScopedComponentExtraProps<ResourceDefinitions, InProps, Composables, BaseInclude, BaseCustom, ExtraInclude, ExtraCustom>;
259
+ };
260
+ type ScopedCreateComponentFn<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject> = <const ComponentsByResource, const RenderResult extends ScopedRenderResult, const ComponentIncludeProps extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables> = {}, ComponentCustomProps extends InPropsObject = {}>(options: ScopedCreateComponentOptions<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, ComponentsByResource, RenderResult>) => ScopedResourceComponent<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, ComponentsByResource, RenderResult>;
261
+ /**
262
+ * Result of `createComponent.setProps`: a createComponent thunk with base
263
+ * include/custom prefilled, optional extras that cannot redefine base keys,
264
+ * and `createResourceComponents` for shared resource entries.
265
+ *
266
+ * Merged props (base ∪ extras) type the returned component, top-level
267
+ * `render`, and `context.<Resource>` call sites.
268
+ */
269
+ type ScopedCreateComponentWithProps<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject, BaseInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables>, BaseCustom extends InPropsObject> = {
270
+ <const ComponentsByResource, const RenderResult extends ScopedRenderResult, const ExtraInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables> = {}, ExtraCustom extends InPropsObject = {}>(options: ScopedCreateComponentWithPropsOptions<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, BaseInclude, BaseCustom, ExtraInclude, ExtraCustom, ComponentsByResource, RenderResult>): ScopedResourceComponent<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, BaseInclude & ExtraInclude, BaseCustom & ExtraCustom, ComponentsByResource, RenderResult>;
271
+ createResourceComponents: ScopedCreateResourceComponents<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, BaseInclude, BaseCustom>;
272
+ };
273
+ type ScopedCreateComponentSetProps<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject> = <const BaseInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables> = {}, BaseCustom extends InPropsObject = {}>(props: LayoutProps<ResourceDefinitions, InProps, Composables, BaseInclude, BaseCustom>) => ScopedCreateComponentWithProps<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, BaseInclude, BaseCustom>;
274
+ type ScopedCreateComponent<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject> = ScopedCreateComponentFn<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps> & {
275
+ /**
276
+ * Prefills include/custom props for a shared createComponent thunk. The
277
+ * thunk still accepts optional extra props (keys already set here are
278
+ * forbidden) and exposes `createResourceComponents` for reusable entries.
279
+ */
280
+ setProps: ScopedCreateComponentSetProps<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps>;
281
+ };
282
+ //#endregion
283
+ export { ScopedCreateComponent };
284
+ //# sourceMappingURL=create-component.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-component.d.cts","names":[],"sources":["../../../src/create-config/for-resources/create-component.ts"],"mappings":";;;;;;;;;;;KAqBY,6BAAA,mBACQ,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,uBACd,oBAAA,4BACM,aAAA,IACxB,mBAAA,CAAoB,SAAA,EAAW,OAAA,EAAS,WAAA,IAAe,iBAAA;AAAA,KAE/C,4BAAA,mBACQ,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,uBACd,oBAAA,4BACM,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AAkB,mBAAA,uBACd,oBAAA,oBACF,aAAA,qCACQ,aAAA,IACxB,uBAAA,CACF,mBAAA,EACA,OAAA,EACA,WAAA,EACA,SAAA,EACA,iBAAA;EA72BE;;;;;EAo3BF,QAAA,EAAU,6BAAA,CACR,mBAAA,EACA,OAAA,EACA,WAAA,EACA,SAAA,EACA,iBAAA;AAAA"}
@@ -0,0 +1,284 @@
1
+ import { BaseComponent, Show } from "../../utils.mjs";
2
+ import { ResourceDefinition } from "../../resource.mjs";
3
+ import { InPropsDefinition, InPropsObject, IncludedProps, MergedLayoutInProps, PropsContextRender, PropsRenderDefinition, ResolvedIncludedPropsAsDefined } from "../../props.mjs";
4
+ import { SelectedLayoutResources } from "./resource-selection.mjs";
5
+ import { ScopedRenderResult } from "./scoped-render.mjs";
6
+ import { LayoutIncludeProps, LayoutProps } from "../define-layout.mjs";
7
+ import { ComposableComponents } from "@jfdevelops/react-layout-composables";
8
+ import { ResolveProps, ResolvedBuiltPropShape } from "@jfdevelops/react-layout-validator";
9
+ import { ComponentType, JSX, ReactNode } from "react";
10
+
11
+ //#region src/create-config/for-resources/create-component.d.ts
12
+ type ScopedComponentAvailableProps<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject> = MergedLayoutInProps<Resources, InProps, Composables> & LayoutCustomProps;
13
+ type ScopedResourceComponentProps<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<Resources, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, Resource extends string> = Show<Omit<ResolvedIncludedPropsAsDefined<ScopedComponentAvailableProps<Resources, InProps, Composables, LayoutCustomProps>, ComponentIncludeProps> & ResolvedBuiltPropShape<ComponentCustomProps>, 'children' | 'resource'> & {
14
+ children?: ReactNode;
15
+ resource: Resource;
16
+ }>;
17
+ /**
18
+ * Call-site props for a createComponent result: declared include/custom props
19
+ * plus props of any component type returned from the top-level `render`.
20
+ *
21
+ * Mirrors scoped-component inference (`PropsFromScopedRender`), but for the
22
+ * outer component: `<Directory requiredProp="x" />` must type-check when
23
+ * `render` returns a component that requires `requiredProp`.
24
+ *
25
+ * These extras are applied only to the *external* call signature — not to the
26
+ * `render` `props` parameter — so inference stays non-circular (return type
27
+ * cannot depend on a props type that already includes that return).
28
+ *
29
+ * `children` / `resource` stay owned by the wrapper (not taken from the return).
30
+ */
31
+ type ScopedResourceComponentCallProps<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<Resources, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, Resource extends string, RenderResult = never> = Show<ScopedResourceComponentProps<Resources, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource> & Omit<PropsFromRenderResult<RenderResult>, 'children' | 'resource'>>;
32
+ /**
33
+ * Fields reverse-inferred from each scoped component declaration.
34
+ *
35
+ * `props` reverse-maps as-is. `render` cannot reverse-map as a full function
36
+ * type (that becomes `unknown`), so only its return type is preserved via
37
+ * `(...args: any) => Return`. Call-site props and compound statics are then
38
+ * read from that return type — prefer the raw capture intersection on entries
39
+ * when both `props` and a returned component type must survive together.
40
+ */
41
+ type ScopedComponentShape = {
42
+ props?: InPropsObject;
43
+ render?: (...args: never[]) => unknown;
44
+ };
45
+ /**
46
+ * Homomorphic pick of reverse-mapped scoped-component fields. Paired with a
47
+ * mapped type over the components object, this lets each entry's inferred
48
+ * `props` (and render return when inference succeeds) flow into signatures.
49
+ */
50
+ type JustScopedComponent<T> = { [Key in keyof T & keyof ScopedComponentShape]: Key extends 'render' ? T[Key] extends ((...args: any) => infer Return) ? (...args: any) => Return : unknown : T[Key] };
51
+ /**
52
+ * Resources with no `components` reverse-infer as `unknown`. Treat that as an
53
+ * empty map so sibling/context access stays closed.
54
+ */
55
+ type NormalizeScopedComponentsMap<Components> = unknown extends Components ? {} : Components extends Record<string, unknown> ? Components : {};
56
+ /** Extracts the prop definitions declared on a scoped component. */
57
+ type ScopedComponentOwnProps<Definition> = Definition extends {
58
+ props: infer Props;
59
+ } ? Props extends InPropsObject ? Props : {} : {};
60
+ /**
61
+ * True when a scoped `render` returned a component type (callable), not a
62
+ * React node like `null` / an element.
63
+ */
64
+ type IsScopedRenderableComponentType<Result> = [Result] extends [never] ? false : [Result] extends [(...args: any) => any] ? true : [Result] extends [ComponentType<any>] ? true : false;
65
+ /**
66
+ * Props of a component type returned from a scoped `render`. Empty when the
67
+ * render returns a node (or a component with no props).
68
+ */
69
+ type PropsFromRenderResult<Result> = [Result] extends [never] ? {} : IsScopedRenderableComponentType<Result> extends true ? Result extends ((props: infer Props) => any) ? unknown extends Props ? {} : Props extends object ? Props : {} : [Result] extends [ComponentType<infer Props>] ? Props : {} : {};
70
+ /**
71
+ * Call-site props inferred from a scoped component's `render` return type.
72
+ */
73
+ type PropsFromScopedRender<Definition> = Definition extends {
74
+ render: (...args: any) => infer Result;
75
+ } ? PropsFromRenderResult<Result> : {};
76
+ /**
77
+ * Call-site props for a scoped component: declared `props` plus props of any
78
+ * component type returned from `render`.
79
+ */
80
+ type ScopedComponentCallProps<Definition> = Show<ResolvedBuiltPropShape<ScopedComponentOwnProps<Definition>> & PropsFromScopedRender<Definition>>;
81
+ /**
82
+ * A scoped component's call signature. Components that declare no props are
83
+ * callable with no arguments.
84
+ */
85
+ type ScopedComponentSignature<Props> = {} extends Props ? (props?: Props) => JSX.Element : (props: Props) => JSX.Element;
86
+ /**
87
+ * Function-prototype / React statics that must not appear as compound
88
+ * component keys on a scoped component resolved from a returned component type.
89
+ */
90
+ type ScopedComponentCompoundStaticKey = 'apply' | 'arguments' | 'bind' | 'call' | 'caller' | 'childContextTypes' | 'contextTypes' | 'defaultProps' | 'displayName' | 'length' | 'name' | 'propTypes' | 'prototype' | 'toLocaleString' | 'toString' | 'valueOf' | '$$typeof';
91
+ /**
92
+ * Compound statics (e.g. `DataTable.Loading`) taken from a component type
93
+ * returned by scoped `render`.
94
+ *
95
+ * Types alone are not enough: the runtime wrapper must expose the same keys
96
+ * (see `withScopedCompoundStatics`), otherwise `components.DataTable.Loading`
97
+ * type-checks but throws at runtime.
98
+ */
99
+ type ScopedComponentCompoundStatics<Result> = [Result] extends [never] ? {} : IsScopedRenderableComponentType<Result> extends true ? { [Key in keyof Result as Key extends ScopedComponentCompoundStaticKey ? never : Result[Key] extends ((...args: any) => any) ? Key & string : never]: Result[Key] extends ((props: infer Props) => any) ? ScopedComponentSignature<Props extends object ? Props : {}> : never } : {};
100
+ /**
101
+ * A resolved scoped component: call signature from declared + returned-component
102
+ * props, plus any compound statics on the returned component type.
103
+ */
104
+ type ResolvedScopedComponent<Definition> = ScopedComponentSignature<ScopedComponentCallProps<Definition>> & ScopedComponentCompoundStatics<Definition extends {
105
+ render: (...args: any) => infer Result;
106
+ } ? Result : never>;
107
+ /**
108
+ * The sibling / context components for one resource, keyed by their declared
109
+ * names with call-site prop types (and compound statics when applicable).
110
+ */
111
+ type ResolvedScopedComponentsMap<Components> = { [Name in keyof NormalizeScopedComponentsMap<Components>]: ResolvedScopedComponent<NormalizeScopedComponentsMap<Components>[Name]> };
112
+ /**
113
+ * Call-site props for `context.<Resource>`: outermost createComponent
114
+ * include/custom props (minus `resource`).
115
+ */
116
+ type ScopedResourceContextCallProps<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, Resource extends string> = Show<Omit<ScopedResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource>, 'resource'>>;
117
+ type ScopedResourceComponentRenderContext<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, ComponentsByResource> = {
118
+ /**
119
+ * The resource layout for the component's current `resource`, created
120
+ * internally from that resource's entry options. Accepts the layout's
121
+ * custom props.
122
+ */
123
+ Root: (props: Show<ResolveProps<LayoutCustomProps>>) => JSX.Element;
124
+ } & { [Resource in keyof ComponentsByResource as Capitalize<Resource & string>]-?: ScopedComponentSignature<ScopedResourceContextCallProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource & string>> & ResolvedScopedComponentsMap<ComponentsByResource[Resource]> };
125
+ /**
126
+ * Reverse-mapped `resources` constraint.
127
+ *
128
+ * `ComponentsByResource` is inferred from each entry's `components` object.
129
+ * Mapping back over those keys types every nested `render`'s second argument
130
+ * with the other components for that resource — excluding the current
131
+ * component when typing a scoped component's own `render`.
132
+ *
133
+ * The parameter must not carry a default: TypeScript contextually types from a
134
+ * parameter's default when it has one, and `{}` would silently degrade every
135
+ * nested render to `any`.
136
+ *
137
+ * Entry keys are only `name`, `components`, and `render`. Layout option values
138
+ * like `title` are excess-property errors here — they belong on
139
+ * `context.<Resource>` / the outer component call site.
140
+ *
141
+ * Each scoped component is `JustScopedComponent<Captured> & Precise & Captured`:
142
+ * the homomorphic pick reverse-infers `props`, the precise `render`
143
+ * contextually types parameters, and the raw capture keeps the literal for
144
+ * call-site resolution.
145
+ */
146
+ type ScopedComponentResourceEntry<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, Resource extends string, Components> = {
147
+ /**
148
+ * Overrides the layout name used by `context.Root` for this resource.
149
+ * Defaults to the scope's configured name, then the capitalized resource.
150
+ */
151
+ name?: string;
152
+ /**
153
+ * Components scoped to this resource. Each becomes a component on this
154
+ * resource's render context, on `context.<Resource>`, and on the component
155
+ * returned by `asHOF()`.
156
+ */
157
+ components?: { [Name in keyof Components]: JustScopedComponent<Components[Name]> &
158
+ /**
159
+ * Renders this component. Receives the scoped component's props plus
160
+ * this component's own props, and the other components for this
161
+ * resource (excluding itself).
162
+ *
163
+ * May return a React node or a component type (mounted with the
164
+ * call-site props). Props and compound statics of a returned component
165
+ * type are inferred at call sites from the render return type.
166
+ */
167
+ PropsRenderDefinition<InPropsObject, ScopedResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource> & Show<ResolvedBuiltPropShape<ScopedComponentOwnProps<Components[Name]>>>, ScopedRenderResult, Omit<ResolvedScopedComponentsMap<Components>, Name>> & Components[Name] }; /** Renders this resource's content inside the shared render function. */
168
+ render: PropsContextRender<ScopedResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource>, ResolvedScopedComponentsMap<Components>, ScopedRenderResult>;
169
+ };
170
+ type ScopedComponentResourceEntries<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, ComponentsByResource> = { [Resource in keyof ComponentsByResource]: ScopedComponentResourceEntry<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource & string, ComponentsByResource[Resource]> } & Record<Exclude<keyof ComponentsByResource, SelectedLayoutResources<ResourceDefinitions, Arguments>>, never>;
171
+ /**
172
+ * Props of a resource-bound component. `resource` is supplied by the binding,
173
+ * so it is removed from the call site.
174
+ */
175
+ type ScopedBoundResourceComponentProps<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, Resource extends string, RenderResult = never> = Show<Omit<ScopedResourceComponentCallProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource, RenderResult>, 'resource'>>;
176
+ type ScopedBoundResourceComponent<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, ComponentsByResource, Resource extends string, RenderResult = never> = BaseComponent<string, ScopedBoundResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource, RenderResult>> & ResolvedScopedComponentsMap<Resource extends keyof ComponentsByResource ? ComponentsByResource[Resource] : {}> & {
177
+ (props: ScopedBoundResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource, RenderResult>): JSX.Element;
178
+ /**
179
+ * Type-only property containing the bound resource. This property is
180
+ * `undefined` at runtime.
181
+ */
182
+ readonly resource: Resource;
183
+ };
184
+ type ScopedResourceComponent<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends IncludedProps<ScopedComponentAvailableProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps>>, ComponentCustomProps extends InPropsObject, ComponentsByResource, RenderResult = never> = BaseComponent<string, ScopedResourceComponentCallProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, SelectedLayoutResources<ResourceDefinitions, Arguments>, RenderResult>> & {
185
+ /**
186
+ * The `resource` prop drives the generic, so it is inferred from the call
187
+ * site. Explicit type arguments are never needed.
188
+ */
189
+ <const Resource extends SelectedLayoutResources<ResourceDefinitions, Arguments>>(props: ScopedResourceComponentCallProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource, RenderResult>): JSX.Element;
190
+ /**
191
+ * Returns a factory that binds the component to one resource. The bound
192
+ * component accepts every prop except `resource`, which the binding supplies.
193
+ *
194
+ * Each resource is bound once and cached, so the returned component type is
195
+ * stable across renders.
196
+ *
197
+ * @example
198
+ * const createDirectory = Directory.asHOF()
199
+ * const UsersDirectory = createDirectory('users')
200
+ *
201
+ * <UsersDirectory title='Users' />
202
+ *
203
+ * @returns A factory producing a component bound to the given resource.
204
+ */
205
+ asHOF(): <const Resource extends SelectedLayoutResources<ResourceDefinitions, Arguments>>(resource: Resource) => ScopedBoundResourceComponent<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, ComponentsByResource, Resource, RenderResult>;
206
+ };
207
+ /**
208
+ * Props bag for `setProps` / optional extras: forbids keys already present on
209
+ * the base include/custom from `setProps`.
210
+ */
211
+ type ScopedComponentExtraProps<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, BaseInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables>, BaseCustom extends InPropsObject, ExtraInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables> = {}, ExtraCustom extends InPropsObject = {}> = {
212
+ include?: ExtraInclude & { [Key in keyof BaseInclude & string]?: never };
213
+ custom?: ExtraCustom & { [Key in keyof BaseCustom & string]?: never };
214
+ };
215
+ /**
216
+ * Builds a single resource entry for use under `resources`, typed against
217
+ * setProps base props plus optional CRC extras (keys already on the base are
218
+ * forbidden).
219
+ *
220
+ * `render` is typed with {@link PropsContextRender} (not an open
221
+ * `(...args: any) => …`) so destructured props stay precise — an `any`
222
+ * constraint on Options would collapse them.
223
+ */
224
+ type ScopedCreateResourceComponents<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject, BaseInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables>, BaseCustom extends InPropsObject> = <const Resource extends SelectedLayoutResources<ResourceDefinitions, Arguments>, const Components, const ExtraInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables> = {}, ExtraCustom extends InPropsObject = {}>(options: {
225
+ resource: Resource;
226
+ props?: ScopedComponentExtraProps<ResourceDefinitions, InProps, Composables, BaseInclude, BaseCustom, ExtraInclude, ExtraCustom>;
227
+ name?: string;
228
+ components?: { [Name in keyof Components]: JustScopedComponent<Components[Name]> & PropsRenderDefinition<InPropsObject, ScopedResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, BaseInclude & ExtraInclude, BaseCustom & ExtraCustom, Resource> & Show<ResolvedBuiltPropShape<ScopedComponentOwnProps<Components[Name]>>>, ScopedRenderResult, Omit<ResolvedScopedComponentsMap<Components>, Name>> & Components[Name] };
229
+ render: PropsContextRender<ScopedResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, BaseInclude & ExtraInclude, BaseCustom & ExtraCustom, Resource>, ResolvedScopedComponentsMap<NormalizeScopedComponentsMap<Components>>, ScopedRenderResult>;
230
+ }) => ScopedComponentResourceEntry<ResourceDefinitions, InProps, Composables, LayoutCustomProps, BaseInclude & ExtraInclude, BaseCustom & ExtraCustom, Resource, NormalizeScopedComponentsMap<Components>>;
231
+ /**
232
+ * Options for {@link ScopedCreateComponent}. Extends the shared
233
+ * `{ props?, render }` shape; `props` is the layout include/custom bag, and
234
+ * `render` receives component props plus the resource context (`Root` and
235
+ * capitalized per-resource components).
236
+ *
237
+ * May return a React node or a component type (mounted with the component
238
+ * props). When a component type is returned, its props are merged into the
239
+ * created component's call signature via `RenderResult` /
240
+ * `ScopedResourceComponentCallProps` — they are intentionally *not* added
241
+ * to the `render` `props` parameter (that would circularly depend on the
242
+ * return).
243
+ */
244
+ interface ScopedCreateComponentOptions<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject, ComponentIncludeProps extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables>, ComponentCustomProps extends InPropsObject, ComponentsByResource, RenderResult extends ScopedRenderResult> extends PropsRenderDefinition<LayoutProps<ResourceDefinitions, InProps, Composables, ComponentIncludeProps, ComponentCustomProps>, ScopedResourceComponentProps<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, SelectedLayoutResources<ResourceDefinitions, Arguments>>, RenderResult, ScopedResourceComponentRenderContext<ResourceDefinitions, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, ComponentsByResource>> {
245
+ /**
246
+ * Per-resource content, keyed by resource. Each entry holds that resource's
247
+ * scoped `components` and its `render` — not layout option values like
248
+ * `title` (those are call-site props on `context.<Resource>` / the outer
249
+ * component).
250
+ */
251
+ resources?: ScopedComponentResourceEntries<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, ComponentsByResource>;
252
+ }
253
+ /**
254
+ * Options for a `setProps` thunk: same as createComponent options, but
255
+ * optional `props` may only add keys not already defined by `setProps`.
256
+ */
257
+ type ScopedCreateComponentWithPropsOptions<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject, BaseInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables>, BaseCustom extends InPropsObject, ExtraInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables>, ExtraCustom extends InPropsObject, ComponentsByResource, RenderResult extends ScopedRenderResult> = Omit<ScopedCreateComponentOptions<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, BaseInclude & ExtraInclude, BaseCustom & ExtraCustom, ComponentsByResource, RenderResult>, 'props'> & {
258
+ props?: ScopedComponentExtraProps<ResourceDefinitions, InProps, Composables, BaseInclude, BaseCustom, ExtraInclude, ExtraCustom>;
259
+ };
260
+ type ScopedCreateComponentFn<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject> = <const ComponentsByResource, const RenderResult extends ScopedRenderResult, const ComponentIncludeProps extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables> = {}, ComponentCustomProps extends InPropsObject = {}>(options: ScopedCreateComponentOptions<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, ComponentsByResource, RenderResult>) => ScopedResourceComponent<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, ComponentsByResource, RenderResult>;
261
+ /**
262
+ * Result of `createComponent.setProps`: a createComponent thunk with base
263
+ * include/custom prefilled, optional extras that cannot redefine base keys,
264
+ * and `createResourceComponents` for shared resource entries.
265
+ *
266
+ * Merged props (base ∪ extras) type the returned component, top-level
267
+ * `render`, and `context.<Resource>` call sites.
268
+ */
269
+ type ScopedCreateComponentWithProps<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject, BaseInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables>, BaseCustom extends InPropsObject> = {
270
+ <const ComponentsByResource, const RenderResult extends ScopedRenderResult, const ExtraInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables> = {}, ExtraCustom extends InPropsObject = {}>(options: ScopedCreateComponentWithPropsOptions<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, BaseInclude, BaseCustom, ExtraInclude, ExtraCustom, ComponentsByResource, RenderResult>): ScopedResourceComponent<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, BaseInclude & ExtraInclude, BaseCustom & ExtraCustom, ComponentsByResource, RenderResult>;
271
+ createResourceComponents: ScopedCreateResourceComponents<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, BaseInclude, BaseCustom>;
272
+ };
273
+ type ScopedCreateComponentSetProps<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject> = <const BaseInclude extends LayoutIncludeProps<ResourceDefinitions, InProps, Composables> = {}, BaseCustom extends InPropsObject = {}>(props: LayoutProps<ResourceDefinitions, InProps, Composables, BaseInclude, BaseCustom>) => ScopedCreateComponentWithProps<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps, BaseInclude, BaseCustom>;
274
+ type ScopedCreateComponent<ResourceDefinitions extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<ResourceDefinitions>, Composables extends ComposableComponents, Arguments extends ReadonlyArray<unknown>, LayoutCustomProps extends InPropsObject> = ScopedCreateComponentFn<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps> & {
275
+ /**
276
+ * Prefills include/custom props for a shared createComponent thunk. The
277
+ * thunk still accepts optional extra props (keys already set here are
278
+ * forbidden) and exposes `createResourceComponents` for reusable entries.
279
+ */
280
+ setProps: ScopedCreateComponentSetProps<ResourceDefinitions, InProps, Composables, Arguments, LayoutCustomProps>;
281
+ };
282
+ //#endregion
283
+ export { ScopedCreateComponent };
284
+ //# sourceMappingURL=create-component.d.mts.map