@jfdevelops/react-layout 0.15.0 → 0.15.1

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.
@@ -6,9 +6,11 @@ let react = require("react");
6
6
  /**
7
7
  * Names a scoped component cannot use. Scoped components are attached to
8
8
  * function objects, so they collide with the component's own statics and with
9
- * non-writable `Function.prototype` properties, where `Object.assign` throws.
9
+ * non-writable `Function.prototype` properties. `__proto__` is reserved so
10
+ * assignment cannot hit the prototype setter on a normal object.
10
11
  */
11
12
  const reservedScopedComponentNames = new Set([
13
+ "__proto__",
12
14
  "apply",
13
15
  "arguments",
14
16
  "bind",
@@ -76,7 +78,7 @@ function createForResources({ createLayoutForResource, createMakeComposableLayou
76
78
  for (const [name, definition] of Object.entries(entry.components ?? {})) {
77
79
  if (reservedScopedComponentNames.has(name)) throw new Error(`Scoped component "${name}" for resource "${resource}" uses a reserved name`);
78
80
  const ownPropDefinitions = definition.props ?? {};
79
- scopedComponents[name] = function ScopedComponent(ownProps) {
81
+ function ScopedComponent(ownProps) {
80
82
  const componentProps = (0, react.useContext)(componentPropsContext);
81
83
  if (componentProps === void 0) throw new Error(`Scoped component "${name}" must be rendered inside its scoped component`);
82
84
  const resolvedOwnProps = ownProps ?? {};
@@ -86,7 +88,8 @@ function createForResources({ createLayoutForResource, createMakeComposableLayou
86
88
  ...resolvedOwnProps,
87
89
  resource
88
90
  }, scopedComponents);
89
- };
91
+ }
92
+ scopedComponents[name] = ScopedComponent;
90
93
  }
91
94
  resourceScopedComponents.set(resource, scopedComponents);
92
95
  function ResourceRender() {
@@ -134,13 +137,11 @@ function createForResources({ createLayoutForResource, createMakeComposableLayou
134
137
  for (const [key, inclusion] of Object.entries(include)) {
135
138
  const definition = availableDefinitions[key];
136
139
  if (!definition) continue;
137
- const propKey = "type" in definition && definition.type === "JSX.Element" ? require_capitalize.capitalize(key) : key;
138
- if (inclusion === true || propKey in componentProps) definitionsToValidate[propKey] = definition;
140
+ if (inclusion === true || key in componentProps) definitionsToValidate[key] = definition;
139
141
  }
140
142
  for (const [key, definition] of Object.entries(custom)) {
141
143
  if (key === "children" || key === "resource") continue;
142
- const propKey = "type" in definition && definition.type === "JSX.Element" ? require_capitalize.capitalize(key) : key;
143
- definitionsToValidate[propKey] = definition;
144
+ definitionsToValidate[key] = definition;
144
145
  }
145
146
  (0, _jfdevelops_react_layout_validator.validateProps)(definitionsToValidate, componentProps);
146
147
  return (0, react.createElement)(componentPropsContext.Provider, { value: componentProps }, componentOptions.render(componentProps, renderContext));
@@ -1 +1 @@
1
- {"version":3,"file":"for-resources.cjs","names":["capitalize"],"sources":["../../src/create-config/for-resources.ts"],"sourcesContent":["import {\n createContext,\n createElement,\n type JSX,\n type ReactNode,\n useContext,\n} from 'react';\nimport type {\n ComposableComponents,\n ComposableResourceLayout,\n} from '@jfdevelops/react-layout-composables';\nimport {\n type AnyBuiltPropDefinition,\n type ResolveProps,\n validateProps,\n} from '@jfdevelops/react-layout-validator';\nimport type {\n IncludedProps,\n InPropsDefinition,\n InPropsObject,\n MergedLayoutInProps,\n ResolvedIncludedProps,\n} from '../props';\nimport type { LayoutResourceKey, ResourceDefinition } from '../resource';\nimport { capitalize } from '../utils/capitalize';\nimport type { BaseComponent, Show } from '../utils';\nimport type {\n LayoutIncludeProps,\n LayoutPropsForResource,\n ResourceLayoutComponent,\n} from './define-layout';\nimport type {\n CreatedLayoutForResource,\n CreateLayoutForResourceOptions,\n CreateResourceLayoutOptionsBase,\n SetDefaultPropForResourceFn,\n} from './for-resource';\n\ntype CapitalizedResource<Resource extends string> = Resource extends Resource\n ? {\n toLowerCase: () => Lowercase<Capitalize<Resource>>;\n } & Capitalize<Resource>\n : never;\n\ntype ResourceLayoutName<\n Resource extends string,\n Name extends string = string,\n> = Name | ((resource: CapitalizedResource<Resource>) => Name);\n\ntype ResourceLayoutNames<\n Resource extends string,\n CallbackName extends string = string,\n> = {\n [TargetResource in Resource]?:\n | string\n | ((resource: CapitalizedResource<TargetResource>) => CallbackName);\n};\n\ntype AtLeastOneResourceLayoutNameKey<Resource extends string> = {\n [TargetResource in Resource]: Record<TargetResource, unknown> &\n Partial<Record<Exclude<Resource, TargetResource>, unknown>>;\n}[Resource];\n\ntype SelectedResourceLayoutNames<\n Resource extends string,\n SelectedResource extends Resource,\n CallbackName extends string,\n> = {\n [TargetResource in Resource as TargetResource extends SelectedResource\n ? TargetResource\n : never]?:\n | string\n | ((resource: CapitalizedResource<TargetResource>) => CallbackName);\n};\n\ntype ResourcesLayoutName<Resource extends string> =\n | Exclude<ResourceLayoutName<Resource>, string>\n | ResourceLayoutNames<Resource>;\n\ntype ResourceLayoutSelection<\n Resources extends ReadonlyArray<ResourceDefinition>,\n CallbackName extends string = string,\n> = {\n [Resource in LayoutResourceKey<Resources>]?: {\n name?: string | ((resource: CapitalizedResource<Resource>) => CallbackName);\n };\n};\n\ntype AtLeastOneResourceLayoutSelection<\n Resources extends ReadonlyArray<ResourceDefinition>,\n CallbackName extends string,\n> = {\n [Resource in LayoutResourceKey<Resources>]: Required<\n Pick<ResourceLayoutSelection<Resources, CallbackName>, Resource>\n > &\n Omit<ResourceLayoutSelection<Resources, CallbackName>, Resource>;\n}[LayoutResourceKey<Resources>];\n\ntype SelectedLayoutResources<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Arguments extends ReadonlyArray<unknown>,\n> =\n Arguments extends ReadonlyArray<LayoutResourceKey<Resources>>\n ? Arguments[number]\n : Arguments[0] extends {\n resources: ReadonlyArray<infer Resource>;\n }\n ? Resource & LayoutResourceKey<Resources>\n : keyof Arguments[0] & LayoutResourceKey<Resources>;\n\ntype ResolveResourceLayoutName<Name> = Name extends (\n ...args: never[]\n) => infer Result\n ? Result & string\n : Name extends string\n ? Name\n : string;\n\ntype NormalizeCapitalizedResourceName<\n Name extends string,\n Resource extends string,\n> = Name extends Name\n ? NormalizeCapitalizedResourceNameMatch<Name, Resource> extends infer Match\n ? [Match] extends [never]\n ? Name\n : Match\n : never\n : never;\n\ntype NormalizeCapitalizedResourceNameMatch<\n Name extends string,\n Resource extends string,\n> = Resource extends Resource\n ? Name extends `${CapitalizedResource<Resource>}${infer Suffix}`\n ? `${Capitalize<Resource>}${Suffix}`\n : never\n : never;\n\ntype SelectedResourceLayoutName<Arguments, Resource extends string> =\n Arguments extends ReadonlyArray<string>\n ? string\n : Arguments extends readonly [infer Options]\n ? Options extends {\n resources: ReadonlyArray<string>;\n name?: infer Name;\n }\n ? Name extends (...args: never[]) => unknown\n ? ResolveResourceLayoutName<Name>\n : Name extends Record<Resource, infer ResourceName>\n ? ResolveResourceLayoutName<ResourceName>\n : string\n : Options extends Record<Resource, infer ResourceOptions>\n ? ResourceOptions extends { name?: infer Name }\n ? ResolveResourceLayoutName<Name>\n : string\n : string\n : string;\n\ntype NormalizeResourceLayoutNames<Names, CallbackName extends string> = {\n [Resource in keyof Names]: Names[Resource] extends (\n ...args: never[]\n ) => unknown\n ? (\n resource: CapitalizedResource<Resource & string>,\n ) => NormalizeCapitalizedResourceName<CallbackName, Resource & string>\n : Names[Resource];\n};\n\ntype NormalizeResourceLayoutSelection<Selection> = {\n [Resource in keyof Selection]: Selection[Resource] extends {\n name: infer Name;\n }\n ? {\n name: Name extends (...args: never[]) => unknown\n ? (\n resource: CapitalizedResource<Resource & string>,\n ) => NormalizeCapitalizedResourceName<\n ResolveResourceLayoutName<Name>,\n Resource & string\n >\n : Name;\n }\n : Selection[Resource];\n};\n\ntype SharedResourceLayoutArguments<\n Resources extends ReadonlyArray<ResourceDefinition>,\n ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n Name extends string,\n> = readonly [\n {\n resources: ResourceKeys;\n name: (\n resource: CapitalizedResource<ResourceKeys[number]>,\n ) => NormalizeCapitalizedResourceName<Name, ResourceKeys[number]>;\n },\n];\n\ntype MappedResourceLayoutArguments<\n Resources extends ReadonlyArray<ResourceDefinition>,\n ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n Names,\n CallbackName extends string,\n> = readonly [\n {\n resources: ResourceKeys;\n name: NormalizeResourceLayoutNames<Names, CallbackName>;\n },\n];\n\ntype SelectedResourceLayoutArguments<Selection> = readonly [\n NormalizeResourceLayoutSelection<Selection>,\n];\n\ntype HasResourceLayoutName<Arguments, Resource extends string> =\n Arguments extends ReadonlyArray<string>\n ? false\n : Arguments extends readonly [infer Options]\n ? Options extends {\n resources: ReadonlyArray<string>;\n name: infer Name;\n }\n ? Name extends (...args: never[]) => unknown\n ? true\n : Name extends Record<Resource, unknown>\n ? true\n : false\n : Options extends Record<Resource, infer ResourceOptions>\n ? 'name' extends keyof ResourceOptions\n ? true\n : false\n : false\n : false;\n\ntype ScopedCreateResourceLayoutOptions<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n Name extends string,\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Props extends InPropsObject,\n> = LayoutPropsForResource<Resources, InProps, Composables> & {\n resource: Resource;\n props?: Props;\n} & (HasResourceLayoutName<Arguments, Resource> extends true\n ? { name?: Name }\n : { name: Name });\n\ntype ScopedCreateResourceLayoutFnImpl<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n CustomProps extends InPropsObject,\n> = <\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Name extends string = SelectedResourceLayoutName<Arguments, Resource>,\n Props extends InPropsObject = {},\n>(\n options: ScopedCreateResourceLayoutOptions<\n Resources,\n InProps,\n Composables,\n Arguments,\n Name,\n Resource,\n Props\n >,\n) => ResourceLayoutComponent<Name, CustomProps, Composables, Resource>;\n\ntype ScopedCreateLayoutForResource<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n CustomProps extends InPropsObject,\n> = <\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Name extends string = SelectedResourceLayoutName<Arguments, Resource>,\n>(\n options: CreateLayoutForResourceOptions<Resources, Name, Resource>,\n) => CreatedLayoutForResource<\n Resources,\n InProps,\n Composables,\n Name,\n Resource,\n CustomProps\n> & {\n setDefaults: SetDefaultPropForResourceFn<\n Resources,\n InProps,\n Composables,\n Name,\n Resource,\n CustomProps\n >;\n};\n\ntype ScopedCreateResourceLayoutMakeComposableFn<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n> = <\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Name extends string = SelectedResourceLayoutName<Arguments, Resource>,\n Props extends InPropsObject = {},\n>(\n options: Omit<\n CreateResourceLayoutOptionsBase<Resources, Name, Resource>,\n 'name'\n > &\n Partial<LayoutPropsForResource<Resources, InProps, Composables>> & {\n props?: Props;\n } & (HasResourceLayoutName<Arguments, Resource> extends true\n ? { name?: Name }\n : { name: Name }),\n) => ComposableResourceLayout<Composables, Name, any, any, any>;\n\ntype ScopedComponentAvailableProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n> = MergedLayoutInProps<Resources, InProps, Composables> & LayoutCustomProps;\n\ntype ScopedResourceComponentProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n Resource extends string,\n> = Show<\n Omit<\n ResolvedIncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >,\n ComponentIncludeProps\n > &\n ResolveProps<ComponentCustomProps>,\n 'children' | 'resource'\n > & {\n children?: ReactNode;\n resource: Resource;\n }\n>;\n\n/**\n * Shape of a scoped component definition. Used with a reverse mapped type so\n * TypeScript can infer each component's full declaration (including `props`)\n * while still constraining known fields.\n */\ntype ScopedComponentShape = {\n props?: InPropsObject;\n render?: unknown;\n};\n\n/**\n * Homomorphic pick of known scoped-component fields. Paired with a reverse\n * mapped type over the components object, this lets each entry's inferred type\n * flow into sibling render signatures (see TypeScript's reverse mapped types).\n */\ntype JustScopedComponent<T> = {\n [Key in keyof T & keyof ScopedComponentShape]: T[Key];\n};\n\n/**\n * Resources with no `components` reverse-infer as `unknown`. Treat that as an\n * empty map so sibling/context access stays closed.\n */\ntype NormalizeScopedComponentsMap<Components> = unknown extends Components\n ? {}\n : Components extends Record<string, unknown>\n ? Components\n : {};\n\n/** Extracts the prop definitions declared on a scoped component. */\ntype ScopedComponentOwnProps<Definition> = Definition extends {\n props: infer Props;\n}\n ? Props extends InPropsObject\n ? Props\n : {}\n : {};\n\n/**\n * A scoped component's call signature. Components that declare no props are\n * callable with no arguments.\n */\ntype ScopedComponentSignature<Props> = {} extends Props\n ? (props?: Props) => JSX.Element\n : (props: Props) => JSX.Element;\n\n/**\n * The sibling / context components for one resource, keyed by their declared\n * names with call-site prop types.\n */\ntype ResolvedScopedComponentsMap<Components> = {\n [Name in keyof NormalizeScopedComponentsMap<Components>]: ScopedComponentSignature<\n Show<\n ResolveProps<\n ScopedComponentOwnProps<NormalizeScopedComponentsMap<Components>[Name]>\n >\n >\n >;\n};\n\ntype ScopedResourceComponentRenderContext<\n ComponentsByResource,\n LayoutCustomProps extends InPropsObject,\n> = {\n /**\n * The resource layout for the component's current `resource`, created\n * internally from that resource's entry options. Accepts the layout's\n * custom props.\n */\n Root: (props: Show<ResolveProps<LayoutCustomProps>>) => JSX.Element;\n} & {\n [Resource in keyof ComponentsByResource as Capitalize<\n Resource & string\n >]-?: (() => JSX.Element) &\n ResolvedScopedComponentsMap<ComponentsByResource[Resource]>;\n};\n\n/**\n * Reverse-mapped `resources` constraint.\n *\n * `ComponentsByResource` is inferred from each entry's `components` object.\n * Mapping back over those keys types every nested `render`'s second argument\n * with the other components for that resource — excluding the current\n * component when typing a scoped component's own `render`.\n *\n * The parameter must not carry a default: TypeScript contextually types from a\n * parameter's default when it has one, and `{}` would silently degrade every\n * nested render to `any`.\n */\ntype ScopedComponentResourceEntries<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n ComponentsByResource,\n> = {\n [Resource in keyof ComponentsByResource]: LayoutPropsForResource<\n Resources,\n InProps,\n Composables\n > & {\n /**\n * Overrides the layout name used by `context.Root` for this resource.\n * Defaults to the scope's configured name, then the capitalized resource.\n */\n name?: string;\n /**\n * Components scoped to this resource. Each becomes a component on this\n * resource's render context, on `context.<Resource>`, and on the component\n * returned by `asHOF()`.\n */\n components?: {\n [Name in keyof ComponentsByResource[Resource]]: JustScopedComponent<\n ComponentsByResource[Resource][Name]\n > & {\n /** Props accepted by this component, validated at its call site. */\n props?: InPropsObject;\n /**\n * Renders this component. Receives the scoped component's props plus\n * this component's own props, and the other components for this\n * resource (excluding itself).\n */\n render: (\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource & string\n > &\n Show<\n ResolveProps<\n ScopedComponentOwnProps<ComponentsByResource[Resource][Name]>\n >\n >,\n components: Omit<\n ResolvedScopedComponentsMap<ComponentsByResource[Resource]>,\n Name\n >,\n ) => JSX.Element;\n };\n };\n /** Renders this resource's content inside the shared render function. */\n render: (\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource & string\n >,\n components: ResolvedScopedComponentsMap<ComponentsByResource[Resource]>,\n ) => JSX.Element;\n };\n} & Record<\n Exclude<\n keyof ComponentsByResource,\n SelectedLayoutResources<Resources, Arguments>\n >,\n never\n>;\n\n/**\n * Props of a resource-bound component. `resource` is supplied by the binding,\n * so it is removed from the call site.\n */\ntype ScopedBoundResourceComponentProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n Resource extends string,\n> = Show<\n Omit<\n ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >,\n 'resource'\n >\n>;\n\ntype ScopedBoundResourceComponent<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n ComponentsByResource,\n Resource extends string,\n> = BaseComponent<\n string,\n ScopedBoundResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >\n> &\n ResolvedScopedComponentsMap<\n Resource extends keyof ComponentsByResource\n ? ComponentsByResource[Resource]\n : {}\n > & {\n (\n props: ScopedBoundResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >,\n ): JSX.Element;\n /**\n * Type-only property containing the bound resource. This property is\n * `undefined` at runtime.\n */\n readonly resource: Resource;\n };\n\ntype ScopedResourceComponent<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n ComponentsByResource,\n> = BaseComponent<\n string,\n ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n SelectedLayoutResources<Resources, Arguments>\n >\n> & {\n /**\n * The `resource` prop drives the generic, so it is inferred from the call\n * site. Explicit type arguments are never needed.\n */\n <const Resource extends SelectedLayoutResources<Resources, Arguments>>(\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >,\n ): JSX.Element;\n /**\n * Returns a factory that binds the component to one resource. The bound\n * component accepts every prop except `resource`, which the binding supplies.\n *\n * Each resource is bound once and cached, so the returned component type is\n * stable across renders.\n *\n * @example\n * const createDirectory = Directory.asHOF()\n * const UsersDirectory = createDirectory('users')\n *\n * <UsersDirectory title='Users' />\n *\n * @returns A factory producing a component bound to the given resource.\n */\n asHOF(): <\n const Resource extends SelectedLayoutResources<Resources, Arguments>,\n >(\n resource: Resource,\n ) => ScopedBoundResourceComponent<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n ComponentsByResource,\n Resource\n >;\n};\n\ntype ScopedCreateComponent<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n LayoutCustomProps extends InPropsObject,\n> = <\n // Declared first and deliberately without a default: TypeScript\n // contextually types from a parameter's default when one exists, so a\n // default here would type every nested render as `any`. Inferred via a\n // reverse mapped type from each entry's `components` object.\n const ComponentsByResource,\n const ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n > = {},\n ComponentCustomProps extends InPropsObject = {},\n>(options: {\n props?: {\n /** Props from the resource layout definition to expose to the component. */\n include?: ComponentIncludeProps;\n /** Additional props accepted by the component. */\n custom?: ComponentCustomProps;\n };\n /**\n * Per-resource content, keyed by resource. Each entry holds that resource's\n * create-time layout options, its scoped `components`, and its `render`.\n */\n resources?: ScopedComponentResourceEntries<\n Resources,\n InProps,\n Composables,\n Arguments,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n ComponentsByResource\n >;\n /**\n * Renders the scoped component. `children` and `resource` are always\n * available. The context contains `Root`, the layout for the current\n * resource, plus a capitalized component per defined resource.\n */\n render: (\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n SelectedLayoutResources<Resources, Arguments>\n >,\n context: ScopedResourceComponentRenderContext<\n ComponentsByResource,\n LayoutCustomProps\n >,\n ) => JSX.Element;\n}) => ScopedResourceComponent<\n Resources,\n InProps,\n Composables,\n Arguments,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n ComponentsByResource\n>;\n\ntype ScopedCreateResourceLayoutFn<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n CustomProps extends InPropsObject,\n> = ScopedCreateResourceLayoutFnImpl<\n Resources,\n InProps,\n Composables,\n Arguments,\n CustomProps\n> & {\n /**\n * Creates a component shared by the target resources. Included layout props\n * become component props, and `children` is always available as an optional\n * prop in both the render callback and at the call site.\n *\n * Each key of `resources` holds that resource's create-time layout options\n * alongside its `render`. The render context exposes `Root` — the layout for\n * the current resource, built from those options — and one capitalized\n * component per key present in `resources`.\n *\n * Each entry may also declare `components` — components scoped to that\n * resource, available to the entry's own `render`, on `context.<Resource>`,\n * and on the component returned by `asHOF()`.\n *\n * @example\n * const Directory = createDirectoryLayout.createComponent({\n * props: { include: { title: true, actions: 'optional' } },\n * resources: {\n * users: {\n * title: 'Users',\n * components: {\n * Toolbar: { render: ({ title }) => <nav>{title}</nav> },\n * },\n * render: ({ resource }, components) => (\n * <>\n * <components.Toolbar />\n * <span>{resource}</span>\n * </>\n * ),\n * },\n * admins: {\n * title: 'Admins',\n * render: ({ resource }) => <span>{resource}</span>,\n * },\n * },\n * render: ({ actions, children, resource }, context) => (\n * <context.Root actions={actions}>\n * {children}\n * {resource === 'users' ? <context.Users /> : <context.Admins />}\n * <context.Users.Toolbar />\n * </context.Root>\n * ),\n * })\n *\n * <Directory resource='users' title='Users' />\n *\n * @param options The props configuration, per-resource entries, and the\n * shared component render function.\n * @returns A component scoped to the selected resources.\n */\n createComponent: ScopedCreateComponent<\n Resources,\n InProps,\n Composables,\n Arguments,\n CustomProps\n >;\n forResource: ScopedCreateLayoutForResource<\n Resources,\n InProps,\n Composables,\n Arguments,\n CustomProps\n >;\n /**\n * Type-only property containing the target resource union. This property is\n * `undefined` at runtime and exists solely for extracting the scoped type.\n *\n * @example\n * type AccountResource = typeof createAccountLayout.resources;\n */\n readonly resources: SelectedLayoutResources<Resources, Arguments>;\n} & ([keyof Composables] extends [never]\n ? {}\n : {\n makeComposable: ScopedCreateResourceLayoutMakeComposableFn<\n Resources,\n InProps,\n Composables,\n Arguments\n >;\n });\n\nexport type CreateResourceLayoutForResourcesFn<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents = {},\n IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables> = {},\n CustomProps extends InPropsObject = {},\n> = {\n /**\n * Creates a layout factory scoped to the listed resources.\n *\n * Layout names must be supplied when a layout is created.\n *\n * @example\n * createResourceLayout.forResources('users', 'admins')\n *\n * @param resources Resources available from the returned layout factory.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends readonly [\n LayoutResourceKey<Resources>,\n ...Array<LayoutResourceKey<Resources>>,\n ],\n >(\n ...resources: ResourceKeys\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n ResourceKeys,\n CustomProps\n >;\n\n /**\n * Creates a layout factory scoped to a resource list without default names.\n *\n * @example\n * createResourceLayout.forResources({ resources: ['users', 'admins'] })\n *\n * @param options The resources to expose without configured default names.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n >(options: {\n resources: ResourceKeys;\n name?: never;\n }): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n readonly [{ resources: ResourceKeys }],\n CustomProps\n >;\n\n /**\n * Creates a scoped layout factory with optional default names per resource.\n *\n * Each map key is limited to the resources selected in `resources`. Values\n * can be strings or callbacks receiving that resource's capitalized name.\n *\n * @example\n * createResourceLayout.forResources({\n * resources: ['users', 'admins'],\n * name: {\n * users: resource => `${resource}Page`,\n * admins: 'AdminDirectory',\n * },\n * })\n *\n * @param options The selected resources and their optional default names.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n const CallbackName extends string,\n const Names,\n >(\n options: {\n resources: ResourceKeys;\n name: SelectedResourceLayoutNames<\n LayoutResourceKey<Resources>,\n NoInfer<ResourceKeys[number]>,\n CallbackName\n > &\n AtLeastOneResourceLayoutNameKey<NoInfer<ResourceKeys[number]>> &\n Record<\n string,\n NonNullable<\n ResourceLayoutNames<\n LayoutResourceKey<Resources>,\n CallbackName\n >[LayoutResourceKey<Resources>]\n >\n >;\n } & {\n name: Names & Record<Exclude<keyof Names, ResourceKeys[number]>, never>;\n },\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n MappedResourceLayoutArguments<Resources, ResourceKeys, Names, CallbackName>,\n CustomProps\n >;\n\n /**\n * Creates a scoped layout factory with one default-name callback shared by\n * every selected resource. The callback receives a capitalized resource\n * whose `toLowerCase()` result retains the corresponding literal type.\n *\n * @example\n * createResourceLayout.forResources({\n * resources: ['users', 'admins'],\n * name: resource => `${resource}Page`,\n * })\n *\n * @param options The selected resources and shared default-name callback.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n const Name extends string,\n >(\n options: {\n resources: ReadonlyArray<LayoutResourceKey<Resources>>;\n name: (resource: CapitalizedResource<ResourceKeys[number]>) => Name;\n } & { resources: ResourceKeys },\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n SharedResourceLayoutArguments<Resources, ResourceKeys, Name>,\n CustomProps\n >;\n\n /**\n * Creates a scoped layout factory from a resource-keyed configuration.\n * Only configured resources are available from the returned factory.\n *\n * @example\n * createResourceLayout.forResources({\n * users: { name: resource => `${resource}Page` },\n * admins: { name: 'AdminDirectory' },\n * })\n *\n * @param options Resource-keyed layout defaults.\n * @returns A layout factory scoped to the configured resources.\n */\n <\n const CallbackName extends string,\n const Selection extends ResourceLayoutSelection<Resources, CallbackName>,\n >(\n options: Selection &\n AtLeastOneResourceLayoutSelection<Resources, CallbackName> &\n Partial<\n Record<Exclude<'resources', LayoutResourceKey<Resources>>, never>\n > &\n Record<Exclude<keyof Selection, LayoutResourceKey<Resources>>, never>,\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n SelectedResourceLayoutArguments<Selection>,\n CustomProps\n >;\n};\n\n/**\n * Names a scoped component cannot use. Scoped components are attached to\n * function objects, so they collide with the component's own statics and with\n * non-writable `Function.prototype` properties, where `Object.assign` throws.\n */\nconst reservedScopedComponentNames = new Set([\n 'apply',\n 'arguments',\n 'bind',\n 'call',\n 'caller',\n 'displayName',\n 'length',\n 'name',\n 'props',\n 'prototype',\n 'resource',\n]);\n\ntype CreateForResourcesOptions<\n Resources extends ReadonlyArray<ResourceDefinition>,\n> = {\n createLayoutForResource: (\n defaultName: string | undefined,\n resource: LayoutResourceKey<Resources>,\n ) => unknown;\n createMakeComposableLayout?: () => (\n options: Record<string, unknown>,\n ) => unknown;\n createResourceLayout: (options: Record<string, unknown>) => unknown;\n getComponentPropDefinitions: (\n resource: LayoutResourceKey<Resources>,\n ) => Record<string, AnyBuiltPropDefinition>;\n};\n\nexport function createForResources<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>,\n CustomProps extends InPropsObject,\n>({\n createLayoutForResource,\n createMakeComposableLayout,\n createResourceLayout,\n getComponentPropDefinitions,\n}: CreateForResourcesOptions<Resources>) {\n return ((...resourcesOrOptions: Array<unknown>) => {\n const firstArgument = resourcesOrOptions[0];\n let resourceOptions: Array<{\n resource: LayoutResourceKey<Resources>;\n name?:\n | string\n | ((\n resource: CapitalizedResource<LayoutResourceKey<Resources>>,\n ) => string);\n }>;\n\n if (typeof firstArgument === 'string') {\n resourceOptions = resourcesOrOptions.map((resource) => ({\n resource: resource as LayoutResourceKey<Resources>,\n }));\n } else if (\n firstArgument !== null &&\n typeof firstArgument === 'object' &&\n 'resources' in firstArgument &&\n Array.isArray(firstArgument.resources)\n ) {\n const { name, resources } = firstArgument as {\n name?: ResourcesLayoutName<LayoutResourceKey<Resources>>;\n resources: Array<LayoutResourceKey<Resources>>;\n };\n resourceOptions = resources.map((resource) => ({\n name: typeof name === 'function' ? name : name?.[resource],\n resource,\n }));\n } else {\n resourceOptions = Object.entries(firstArgument ?? {}).map(\n ([resource, options]) => ({\n ...(options as {\n name?:\n | string\n | ((\n resource: CapitalizedResource<LayoutResourceKey<Resources>>,\n ) => string);\n }),\n resource: resource as LayoutResourceKey<Resources>,\n }),\n );\n }\n\n const defaultNames = new Map(\n resourceOptions.map(({ name, resource }) => [\n resource,\n typeof name === 'function'\n ? name(\n capitalize(resource) as CapitalizedResource<\n LayoutResourceKey<Resources>\n >,\n )\n : name,\n ]),\n );\n\n function scopedCreateResourceLayout(options: Record<string, unknown>) {\n const resource = options.resource as LayoutResourceKey<Resources>;\n\n return createResourceLayout({\n ...options,\n name: options.name ?? defaultNames.get(resource),\n });\n }\n\n function scopedForResource(options: {\n name?: string;\n resource: LayoutResourceKey<Resources>;\n }) {\n return createLayoutForResource(\n options.name ?? defaultNames.get(options.resource),\n options.resource,\n );\n }\n\n type ScopedComponentRenderFn = (\n props: Record<string, unknown>,\n components: Record<string, (props?: never) => JSX.Element>,\n ) => JSX.Element;\n\n type ScopedResourceScopedComponentDefinition = {\n props?: Record<string, AnyBuiltPropDefinition>;\n render: ScopedComponentRenderFn;\n };\n\n type ScopedComponentEntry = {\n [option: string]: unknown;\n name?: string;\n components?: Record<string, ScopedResourceScopedComponentDefinition>;\n render: ScopedComponentRenderFn;\n };\n\n function createComponent(componentOptions: {\n props?: {\n include?: Record<string, true | 'optional'>;\n custom?: Record<string, AnyBuiltPropDefinition>;\n };\n resources?: Record<string, ScopedComponentEntry>;\n render: (\n props: Record<string, unknown>,\n context: Record<string, (props: never) => JSX.Element>,\n ) => JSX.Element;\n }) {\n const include = componentOptions.props?.include ?? {};\n const custom = componentOptions.props?.custom ?? {};\n const selectedResources = new Set(\n resourceOptions.map(({ resource }) => resource),\n );\n const componentPropsContext = createContext<\n Record<string, unknown> | undefined\n >(undefined);\n const definedEntries = new Map<\n LayoutResourceKey<Resources>,\n ScopedComponentEntry\n >();\n\n for (const [key, entry] of Object.entries(\n componentOptions.resources ?? {},\n )) {\n const resource = key as LayoutResourceKey<Resources>;\n\n if (!selectedResources.has(resource)) {\n throw new Error(\n `Resource \"${key}\" is not available in this scoped component`,\n );\n }\n\n definedEntries.set(resource, entry);\n }\n\n /** Resolved scoped components, per resource. */\n const resourceScopedComponents = new Map<\n LayoutResourceKey<Resources>,\n Record<string, (props?: never) => JSX.Element>\n >();\n const contextResources = new Map<string, LayoutResourceKey<Resources>>();\n const renderContext: Record<string, (props: never) => JSX.Element> =\n Object.fromEntries(\n [...definedEntries].map(([resource, entry]) => {\n const contextKey = capitalize(resource);\n\n if (contextKey === 'Root') {\n throw new Error(\n `Resource \"${resource}\" maps to the reserved render context key \"Root\"`,\n );\n }\n\n const existingResource = contextResources.get(contextKey);\n\n if (existingResource !== undefined) {\n throw new Error(\n `Resources \"${existingResource}\" and \"${resource}\" both map to render context key \"${contextKey}\"`,\n );\n }\n\n contextResources.set(contextKey, resource);\n\n /**\n * Built once per resource so every scoped component keeps a stable\n * identity, and shared by the resource render, the render context,\n * and any component bound through `asHOF()`.\n */\n const scopedComponents: Record<\n string,\n (props?: never) => JSX.Element\n > = {};\n\n for (const [name, definition] of Object.entries(\n entry.components ?? {},\n )) {\n if (reservedScopedComponentNames.has(name)) {\n throw new Error(\n `Scoped component \"${name}\" for resource \"${resource}\" uses a reserved name`,\n );\n }\n\n const ownPropDefinitions = definition.props ?? {};\n\n scopedComponents[name] = function ScopedComponent(\n ownProps?: Record<string, unknown>,\n ) {\n const componentProps = useContext(componentPropsContext);\n\n if (componentProps === undefined) {\n throw new Error(\n `Scoped component \"${name}\" must be rendered inside its scoped component`,\n );\n }\n\n const resolvedOwnProps = ownProps ?? {};\n\n validateProps(ownPropDefinitions, resolvedOwnProps);\n\n return definition.render(\n { ...componentProps, ...resolvedOwnProps, resource },\n scopedComponents,\n );\n } as (props?: never) => JSX.Element;\n }\n\n resourceScopedComponents.set(resource, scopedComponents);\n\n function ResourceRender() {\n const componentProps = useContext(componentPropsContext);\n\n if (componentProps === undefined) {\n throw new Error(\n `Render context component \"${contextKey}\" must be rendered inside its scoped component`,\n );\n }\n\n return entry.render(\n { ...componentProps, resource },\n scopedComponents,\n );\n }\n\n return [contextKey, Object.assign(ResourceRender, scopedComponents)];\n }),\n );\n\n /**\n * Layouts are created once per resource and cached. Creating one during\n * render would hand React a new component type on every pass, remounting\n * the whole subtree.\n */\n const roots = new Map<\n LayoutResourceKey<Resources>,\n (props: Record<string, unknown>) => JSX.Element\n >();\n\n function getRoot(resource: LayoutResourceKey<Resources>) {\n let root = roots.get(resource);\n\n if (root === undefined) {\n const entry = definedEntries.get(resource);\n\n if (entry === undefined) {\n // Without an entry there are no create-time layout options, so a\n // layout with required props would fail validation deep inside\n // its own render. Fail here instead, naming the fix.\n throw new Error(\n `Render context component \"Root\" requires a \"resources.${resource}\" entry to build the layout for resource \"${resource}\"`,\n );\n }\n\n const { render: _render, ...layoutOptions } = entry;\n\n root = scopedCreateResourceLayout({\n ...layoutOptions,\n name:\n layoutOptions.name ??\n defaultNames.get(resource) ??\n capitalize(resource),\n resource,\n }) as (props: Record<string, unknown>) => JSX.Element;\n roots.set(resource, root);\n }\n\n return root;\n }\n\n function Root(rootProps: Record<string, unknown>) {\n const componentProps = useContext(componentPropsContext);\n\n if (componentProps === undefined) {\n throw new Error(\n 'Render context component \"Root\" must be rendered inside its scoped component',\n );\n }\n\n return createElement(\n getRoot(componentProps.resource as LayoutResourceKey<Resources>),\n rootProps,\n );\n }\n\n renderContext.Root = Root;\n\n function Component(componentProps: Record<string, unknown>) {\n const componentResource =\n componentProps.resource as LayoutResourceKey<Resources>;\n\n if (!selectedResources.has(componentResource)) {\n throw new Error(\n `Resource \"${componentResource}\" is not available in this scoped component`,\n );\n }\n\n const availableDefinitions =\n getComponentPropDefinitions(componentResource);\n const definitionsToValidate: Record<string, AnyBuiltPropDefinition> =\n {};\n\n for (const [key, inclusion] of Object.entries(include)) {\n const definition = availableDefinitions[key];\n\n if (!definition) {\n continue;\n }\n\n const propKey =\n 'type' in definition && definition.type === 'JSX.Element'\n ? capitalize(key)\n : key;\n\n if (inclusion === true || propKey in componentProps) {\n definitionsToValidate[propKey] = definition;\n }\n }\n\n for (const [key, definition] of Object.entries(custom)) {\n if (key === 'children' || key === 'resource') {\n continue;\n }\n\n const propKey =\n 'type' in definition && definition.type === 'JSX.Element'\n ? capitalize(key)\n : key;\n definitionsToValidate[propKey] = definition;\n }\n\n validateProps(definitionsToValidate, componentProps);\n\n return createElement(\n componentPropsContext.Provider,\n { value: componentProps },\n componentOptions.render(componentProps, renderContext),\n );\n }\n\n /**\n * Bound components are created once per resource and cached. Returning a\n * fresh component from the factory would hand React a new component type\n * whenever the caller rebinds, remounting the subtree.\n */\n const boundComponents = new Map<\n LayoutResourceKey<Resources>,\n (props: Record<string, unknown>) => JSX.Element\n >();\n\n function bindResource(resource: LayoutResourceKey<Resources>) {\n if (!selectedResources.has(resource)) {\n throw new Error(\n `Resource \"${resource}\" is not available in this scoped component`,\n );\n }\n\n let boundComponent = boundComponents.get(resource);\n\n if (boundComponent === undefined) {\n boundComponent = Object.assign(\n (boundProps: Record<string, unknown>) =>\n createElement(Component, { ...boundProps, resource }),\n {\n displayName: `ScopedResourceComponent(${resource})`,\n props: undefined,\n resource: undefined,\n },\n resourceScopedComponents.get(resource) ?? {},\n );\n boundComponents.set(resource, boundComponent);\n }\n\n return boundComponent;\n }\n\n function asHOF() {\n return bindResource;\n }\n\n return Object.assign(Component, {\n asHOF,\n displayName: 'ScopedResourceComponent',\n props: undefined,\n });\n }\n\n const scopedExtras: {\n createComponent: typeof createComponent;\n forResource: typeof scopedForResource;\n makeComposable?: (options: Record<string, unknown>) => unknown;\n resources: undefined;\n } = {\n createComponent,\n forResource: scopedForResource,\n resources: undefined,\n };\n\n if (createMakeComposableLayout) {\n const makeComposableLayout = createMakeComposableLayout();\n\n scopedExtras.makeComposable = (options) => {\n const resource = options.resource as LayoutResourceKey<Resources>;\n\n return makeComposableLayout({\n ...options,\n name: options.name ?? defaultNames.get(resource),\n });\n };\n }\n\n return Object.assign(scopedCreateResourceLayout, scopedExtras);\n }) as unknown as CreateResourceLayoutForResourcesFn<\n Resources,\n InProps,\n Composables,\n IncludeProps,\n CustomProps\n >;\n}\n"],"mappings":";;;;;;;;;;AA+gCA,MAAM,+BAA+B,IAAI,IAAI;CAC3C;CACA;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"for-resources.cjs","names":["capitalize"],"sources":["../../src/create-config/for-resources.ts"],"sourcesContent":["import {\n createContext,\n createElement,\n type JSX,\n type ReactNode,\n useContext,\n} from 'react';\nimport type {\n ComposableComponents,\n ComposableResourceLayout,\n} from '@jfdevelops/react-layout-composables';\nimport {\n type AnyBuiltPropDefinition,\n type ResolveProps,\n type ResolvedBuiltPropShape,\n validateProps,\n} from '@jfdevelops/react-layout-validator';\nimport type {\n IncludedProps,\n InPropsDefinition,\n InPropsObject,\n MergedLayoutInProps,\n ResolvedIncludedPropsAsDefined,\n} from '../props';\nimport type { LayoutResourceKey, ResourceDefinition } from '../resource';\nimport { capitalize } from '../utils/capitalize';\nimport type { BaseComponent, Show } from '../utils';\nimport type {\n LayoutIncludeProps,\n LayoutPropsForResource,\n ResourceLayoutComponent,\n} from './define-layout';\nimport type {\n CreatedLayoutForResource,\n CreateLayoutForResourceOptions,\n CreateResourceLayoutOptionsBase,\n SetDefaultPropForResourceFn,\n} from './for-resource';\n\ntype CapitalizedResource<Resource extends string> = Resource extends Resource\n ? {\n toLowerCase: () => Lowercase<Capitalize<Resource>>;\n } & Capitalize<Resource>\n : never;\n\ntype ResourceLayoutName<\n Resource extends string,\n Name extends string = string,\n> = Name | ((resource: CapitalizedResource<Resource>) => Name);\n\ntype ResourceLayoutNames<\n Resource extends string,\n CallbackName extends string = string,\n> = {\n [TargetResource in Resource]?:\n | string\n | ((resource: CapitalizedResource<TargetResource>) => CallbackName);\n};\n\ntype AtLeastOneResourceLayoutNameKey<Resource extends string> = {\n [TargetResource in Resource]: Record<TargetResource, unknown> &\n Partial<Record<Exclude<Resource, TargetResource>, unknown>>;\n}[Resource];\n\ntype SelectedResourceLayoutNames<\n Resource extends string,\n SelectedResource extends Resource,\n CallbackName extends string,\n> = {\n [TargetResource in Resource as TargetResource extends SelectedResource\n ? TargetResource\n : never]?:\n | string\n | ((resource: CapitalizedResource<TargetResource>) => CallbackName);\n};\n\ntype ResourcesLayoutName<Resource extends string> =\n | Exclude<ResourceLayoutName<Resource>, string>\n | ResourceLayoutNames<Resource>;\n\ntype ResourceLayoutSelection<\n Resources extends ReadonlyArray<ResourceDefinition>,\n CallbackName extends string = string,\n> = {\n [Resource in LayoutResourceKey<Resources>]?: {\n name?: string | ((resource: CapitalizedResource<Resource>) => CallbackName);\n };\n};\n\ntype AtLeastOneResourceLayoutSelection<\n Resources extends ReadonlyArray<ResourceDefinition>,\n CallbackName extends string,\n> = {\n [Resource in LayoutResourceKey<Resources>]: Required<\n Pick<ResourceLayoutSelection<Resources, CallbackName>, Resource>\n > &\n Omit<ResourceLayoutSelection<Resources, CallbackName>, Resource>;\n}[LayoutResourceKey<Resources>];\n\ntype SelectedLayoutResources<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Arguments extends ReadonlyArray<unknown>,\n> =\n Arguments extends ReadonlyArray<LayoutResourceKey<Resources>>\n ? Arguments[number]\n : Arguments[0] extends {\n resources: ReadonlyArray<infer Resource>;\n }\n ? Resource & LayoutResourceKey<Resources>\n : keyof Arguments[0] & LayoutResourceKey<Resources>;\n\ntype ResolveResourceLayoutName<Name> = Name extends (\n ...args: never[]\n) => infer Result\n ? Result & string\n : Name extends string\n ? Name\n : string;\n\ntype NormalizeCapitalizedResourceName<\n Name extends string,\n Resource extends string,\n> = Name extends Name\n ? NormalizeCapitalizedResourceNameMatch<Name, Resource> extends infer Match\n ? [Match] extends [never]\n ? Name\n : Match\n : never\n : never;\n\ntype NormalizeCapitalizedResourceNameMatch<\n Name extends string,\n Resource extends string,\n> = Resource extends Resource\n ? Name extends `${CapitalizedResource<Resource>}${infer Suffix}`\n ? `${Capitalize<Resource>}${Suffix}`\n : never\n : never;\n\ntype SelectedResourceLayoutName<Arguments, Resource extends string> =\n Arguments extends ReadonlyArray<string>\n ? string\n : Arguments extends readonly [infer Options]\n ? Options extends {\n resources: ReadonlyArray<string>;\n name?: infer Name;\n }\n ? Name extends (...args: never[]) => unknown\n ? ResolveResourceLayoutName<Name>\n : Name extends Record<Resource, infer ResourceName>\n ? ResolveResourceLayoutName<ResourceName>\n : string\n : Options extends Record<Resource, infer ResourceOptions>\n ? ResourceOptions extends { name?: infer Name }\n ? ResolveResourceLayoutName<Name>\n : string\n : string\n : string;\n\ntype NormalizeResourceLayoutNames<Names, CallbackName extends string> = {\n [Resource in keyof Names]: Names[Resource] extends (\n ...args: never[]\n ) => unknown\n ? (\n resource: CapitalizedResource<Resource & string>,\n ) => NormalizeCapitalizedResourceName<CallbackName, Resource & string>\n : Names[Resource];\n};\n\ntype NormalizeResourceLayoutSelection<Selection> = {\n [Resource in keyof Selection]: Selection[Resource] extends {\n name: infer Name;\n }\n ? {\n name: Name extends (...args: never[]) => unknown\n ? (\n resource: CapitalizedResource<Resource & string>,\n ) => NormalizeCapitalizedResourceName<\n ResolveResourceLayoutName<Name>,\n Resource & string\n >\n : Name;\n }\n : Selection[Resource];\n};\n\ntype SharedResourceLayoutArguments<\n Resources extends ReadonlyArray<ResourceDefinition>,\n ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n Name extends string,\n> = readonly [\n {\n resources: ResourceKeys;\n name: (\n resource: CapitalizedResource<ResourceKeys[number]>,\n ) => NormalizeCapitalizedResourceName<Name, ResourceKeys[number]>;\n },\n];\n\ntype MappedResourceLayoutArguments<\n Resources extends ReadonlyArray<ResourceDefinition>,\n ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n Names,\n CallbackName extends string,\n> = readonly [\n {\n resources: ResourceKeys;\n name: NormalizeResourceLayoutNames<Names, CallbackName>;\n },\n];\n\ntype SelectedResourceLayoutArguments<Selection> = readonly [\n NormalizeResourceLayoutSelection<Selection>,\n];\n\ntype HasResourceLayoutName<Arguments, Resource extends string> =\n Arguments extends ReadonlyArray<string>\n ? false\n : Arguments extends readonly [infer Options]\n ? Options extends {\n resources: ReadonlyArray<string>;\n name: infer Name;\n }\n ? Name extends (...args: never[]) => unknown\n ? true\n : Name extends Record<Resource, unknown>\n ? true\n : false\n : Options extends Record<Resource, infer ResourceOptions>\n ? 'name' extends keyof ResourceOptions\n ? true\n : false\n : false\n : false;\n\ntype ScopedCreateResourceLayoutOptions<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n Name extends string,\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Props extends InPropsObject,\n> = LayoutPropsForResource<Resources, InProps, Composables> & {\n resource: Resource;\n props?: Props;\n} & (HasResourceLayoutName<Arguments, Resource> extends true\n ? { name?: Name }\n : { name: Name });\n\ntype ScopedCreateResourceLayoutFnImpl<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n CustomProps extends InPropsObject,\n> = <\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Name extends string = SelectedResourceLayoutName<Arguments, Resource>,\n Props extends InPropsObject = {},\n>(\n options: ScopedCreateResourceLayoutOptions<\n Resources,\n InProps,\n Composables,\n Arguments,\n Name,\n Resource,\n Props\n >,\n) => ResourceLayoutComponent<Name, CustomProps, Composables, Resource>;\n\ntype ScopedCreateLayoutForResource<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n CustomProps extends InPropsObject,\n> = <\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Name extends string = SelectedResourceLayoutName<Arguments, Resource>,\n>(\n options: CreateLayoutForResourceOptions<Resources, Name, Resource>,\n) => CreatedLayoutForResource<\n Resources,\n InProps,\n Composables,\n Name,\n Resource,\n CustomProps\n> & {\n setDefaults: SetDefaultPropForResourceFn<\n Resources,\n InProps,\n Composables,\n Name,\n Resource,\n CustomProps\n >;\n};\n\ntype ScopedCreateResourceLayoutMakeComposableFn<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n> = <\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Name extends string = SelectedResourceLayoutName<Arguments, Resource>,\n Props extends InPropsObject = {},\n>(\n options: Omit<\n CreateResourceLayoutOptionsBase<Resources, Name, Resource>,\n 'name'\n > &\n Partial<LayoutPropsForResource<Resources, InProps, Composables>> & {\n props?: Props;\n } & (HasResourceLayoutName<Arguments, Resource> extends true\n ? { name?: Name }\n : { name: Name }),\n) => ComposableResourceLayout<Composables, Name, any, any, any>;\n\ntype ScopedComponentAvailableProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n> = MergedLayoutInProps<Resources, InProps, Composables> & LayoutCustomProps;\n\ntype ScopedResourceComponentProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n Resource extends string,\n> = Show<\n Omit<\n ResolvedIncludedPropsAsDefined<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >,\n ComponentIncludeProps\n > &\n ResolvedBuiltPropShape<ComponentCustomProps>,\n 'children' | 'resource'\n > & {\n children?: ReactNode;\n resource: Resource;\n }\n>;\n\n/**\n * Fields reverse-inferred from each scoped component declaration. Only `props`\n * belongs here — putting `render` in the reverse map makes TypeScript infer it\n * as `unknown` (function types don't reverse-map cleanly). `render` is supplied\n * by the constraint intersection instead, like the playground's `transform`.\n */\ntype ScopedComponentShape = {\n props?: InPropsObject;\n};\n\n/**\n * Homomorphic pick of reverse-mapped scoped-component fields. Paired with a\n * mapped type over the components object, this lets each entry's inferred\n * `props` flow into sibling render signatures.\n */\ntype JustScopedComponent<T> = {\n [Key in keyof T & keyof ScopedComponentShape]: T[Key];\n};\n\n/**\n * Resources with no `components` reverse-infer as `unknown`. Treat that as an\n * empty map so sibling/context access stays closed.\n */\ntype NormalizeScopedComponentsMap<Components> = unknown extends Components\n ? {}\n : Components extends Record<string, unknown>\n ? Components\n : {};\n\n/** Extracts the prop definitions declared on a scoped component. */\ntype ScopedComponentOwnProps<Definition> = Definition extends {\n props: infer Props;\n}\n ? Props extends InPropsObject\n ? Props\n : {}\n : {};\n\n/**\n * A scoped component's call signature. Components that declare no props are\n * callable with no arguments.\n */\ntype ScopedComponentSignature<Props> = {} extends Props\n ? (props?: Props) => JSX.Element\n : (props: Props) => JSX.Element;\n\n/**\n * The sibling / context components for one resource, keyed by their declared\n * names with call-site prop types.\n */\ntype ResolvedScopedComponentsMap<Components> = {\n [Name in keyof NormalizeScopedComponentsMap<Components>]: ScopedComponentSignature<\n Show<\n ResolvedBuiltPropShape<\n ScopedComponentOwnProps<NormalizeScopedComponentsMap<Components>[Name]>\n >\n >\n >;\n};\n\ntype ScopedResourceComponentRenderContext<\n ComponentsByResource,\n LayoutCustomProps extends InPropsObject,\n> = {\n /**\n * The resource layout for the component's current `resource`, created\n * internally from that resource's entry options. Accepts the layout's\n * custom props.\n */\n Root: (props: Show<ResolveProps<LayoutCustomProps>>) => JSX.Element;\n} & {\n [Resource in keyof ComponentsByResource as Capitalize<\n Resource & string\n >]-?: (() => JSX.Element) &\n ResolvedScopedComponentsMap<ComponentsByResource[Resource]>;\n};\n\n/**\n * Reverse-mapped `resources` constraint.\n *\n * `ComponentsByResource` is inferred from each entry's `components` object.\n * Mapping back over those keys types every nested `render`'s second argument\n * with the other components for that resource — excluding the current\n * component when typing a scoped component's own `render`.\n *\n * The parameter must not carry a default: TypeScript contextually types from a\n * parameter's default when it has one, and `{}` would silently degrade every\n * nested render to `any`.\n */\ntype ScopedComponentResourceEntries<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n ComponentsByResource,\n> = {\n [Resource in keyof ComponentsByResource]: LayoutPropsForResource<\n Resources,\n InProps,\n Composables\n > & {\n /**\n * Overrides the layout name used by `context.Root` for this resource.\n * Defaults to the scope's configured name, then the capitalized resource.\n */\n name?: string;\n /**\n * Components scoped to this resource. Each becomes a component on this\n * resource's render context, on `context.<Resource>`, and on the component\n * returned by `asHOF()`.\n */\n components?: {\n [Name in keyof ComponentsByResource[Resource]]: JustScopedComponent<\n ComponentsByResource[Resource][Name]\n > & {\n /** Props accepted by this component, validated at its call site. */\n props?: InPropsObject;\n /**\n * Renders this component. Receives the scoped component's props plus\n * this component's own props, and the other components for this\n * resource (excluding itself).\n */\n render: (\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource & string\n > &\n Show<\n ResolvedBuiltPropShape<\n ScopedComponentOwnProps<ComponentsByResource[Resource][Name]>\n >\n >,\n components: Omit<\n ResolvedScopedComponentsMap<ComponentsByResource[Resource]>,\n Name\n >,\n ) => JSX.Element;\n };\n };\n /** Renders this resource's content inside the shared render function. */\n render: (\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource & string\n >,\n components: ResolvedScopedComponentsMap<ComponentsByResource[Resource]>,\n ) => JSX.Element;\n };\n} & Record<\n Exclude<\n keyof ComponentsByResource,\n SelectedLayoutResources<Resources, Arguments>\n >,\n never\n>;\n\n/**\n * Props of a resource-bound component. `resource` is supplied by the binding,\n * so it is removed from the call site.\n */\ntype ScopedBoundResourceComponentProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n Resource extends string,\n> = Show<\n Omit<\n ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >,\n 'resource'\n >\n>;\n\ntype ScopedBoundResourceComponent<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n ComponentsByResource,\n Resource extends string,\n> = BaseComponent<\n string,\n ScopedBoundResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >\n> &\n ResolvedScopedComponentsMap<\n Resource extends keyof ComponentsByResource\n ? ComponentsByResource[Resource]\n : {}\n > & {\n (\n props: ScopedBoundResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >,\n ): JSX.Element;\n /**\n * Type-only property containing the bound resource. This property is\n * `undefined` at runtime.\n */\n readonly resource: Resource;\n };\n\ntype ScopedResourceComponent<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n ComponentsByResource,\n> = BaseComponent<\n string,\n ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n SelectedLayoutResources<Resources, Arguments>\n >\n> & {\n /**\n * The `resource` prop drives the generic, so it is inferred from the call\n * site. Explicit type arguments are never needed.\n */\n <const Resource extends SelectedLayoutResources<Resources, Arguments>>(\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >,\n ): JSX.Element;\n /**\n * Returns a factory that binds the component to one resource. The bound\n * component accepts every prop except `resource`, which the binding supplies.\n *\n * Each resource is bound once and cached, so the returned component type is\n * stable across renders.\n *\n * @example\n * const createDirectory = Directory.asHOF()\n * const UsersDirectory = createDirectory('users')\n *\n * <UsersDirectory title='Users' />\n *\n * @returns A factory producing a component bound to the given resource.\n */\n asHOF(): <\n const Resource extends SelectedLayoutResources<Resources, Arguments>,\n >(\n resource: Resource,\n ) => ScopedBoundResourceComponent<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n ComponentsByResource,\n Resource\n >;\n};\n\ntype ScopedCreateComponent<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n LayoutCustomProps extends InPropsObject,\n> = <\n // Declared first and deliberately without a default: TypeScript\n // contextually types from a parameter's default when one exists, so a\n // default here would type every nested render as `any`. Inferred via a\n // reverse mapped type from each entry's `components` object.\n const ComponentsByResource,\n const ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n > = {},\n ComponentCustomProps extends InPropsObject = {},\n>(options: {\n props?: {\n /** Props from the resource layout definition to expose to the component. */\n include?: ComponentIncludeProps;\n /** Additional props accepted by the component. */\n custom?: ComponentCustomProps;\n };\n /**\n * Per-resource content, keyed by resource. Each entry holds that resource's\n * create-time layout options, its scoped `components`, and its `render`.\n */\n resources?: ScopedComponentResourceEntries<\n Resources,\n InProps,\n Composables,\n Arguments,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n ComponentsByResource\n >;\n /**\n * Renders the scoped component. `children` and `resource` are always\n * available. The context contains `Root`, the layout for the current\n * resource, plus a capitalized component per defined resource.\n */\n render: (\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n SelectedLayoutResources<Resources, Arguments>\n >,\n context: ScopedResourceComponentRenderContext<\n ComponentsByResource,\n LayoutCustomProps\n >,\n ) => JSX.Element;\n}) => ScopedResourceComponent<\n Resources,\n InProps,\n Composables,\n Arguments,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n ComponentsByResource\n>;\n\ntype ScopedCreateResourceLayoutFn<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n CustomProps extends InPropsObject,\n> = ScopedCreateResourceLayoutFnImpl<\n Resources,\n InProps,\n Composables,\n Arguments,\n CustomProps\n> & {\n /**\n * Creates a component shared by the target resources. Included layout props\n * become component props, and `children` is always available as an optional\n * prop in both the render callback and at the call site.\n *\n * Each key of `resources` holds that resource's create-time layout options\n * alongside its `render`. The render context exposes `Root` — the layout for\n * the current resource, built from those options — and one capitalized\n * component per key present in `resources`.\n *\n * Each entry may also declare `components` — components scoped to that\n * resource, available to the entry's own `render`, on `context.<Resource>`,\n * and on the component returned by `asHOF()`.\n *\n * @example\n * const Directory = createDirectoryLayout.createComponent({\n * props: { include: { title: true, actions: 'optional' } },\n * resources: {\n * users: {\n * title: 'Users',\n * components: {\n * Toolbar: { render: ({ title }) => <nav>{title}</nav> },\n * },\n * render: ({ resource }, components) => (\n * <>\n * <components.Toolbar />\n * <span>{resource}</span>\n * </>\n * ),\n * },\n * admins: {\n * title: 'Admins',\n * render: ({ resource }) => <span>{resource}</span>,\n * },\n * },\n * render: ({ actions, children, resource }, context) => (\n * <context.Root actions={actions}>\n * {children}\n * {resource === 'users' ? <context.Users /> : <context.Admins />}\n * <context.Users.Toolbar />\n * </context.Root>\n * ),\n * })\n *\n * <Directory resource='users' title='Users' />\n *\n * @param options The props configuration, per-resource entries, and the\n * shared component render function.\n * @returns A component scoped to the selected resources.\n */\n createComponent: ScopedCreateComponent<\n Resources,\n InProps,\n Composables,\n Arguments,\n CustomProps\n >;\n forResource: ScopedCreateLayoutForResource<\n Resources,\n InProps,\n Composables,\n Arguments,\n CustomProps\n >;\n /**\n * Type-only property containing the target resource union. This property is\n * `undefined` at runtime and exists solely for extracting the scoped type.\n *\n * @example\n * type AccountResource = typeof createAccountLayout.resources;\n */\n readonly resources: SelectedLayoutResources<Resources, Arguments>;\n} & ([keyof Composables] extends [never]\n ? {}\n : {\n makeComposable: ScopedCreateResourceLayoutMakeComposableFn<\n Resources,\n InProps,\n Composables,\n Arguments\n >;\n });\n\nexport type CreateResourceLayoutForResourcesFn<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents = {},\n IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables> = {},\n CustomProps extends InPropsObject = {},\n> = {\n /**\n * Creates a layout factory scoped to the listed resources.\n *\n * Layout names must be supplied when a layout is created.\n *\n * @example\n * createResourceLayout.forResources('users', 'admins')\n *\n * @param resources Resources available from the returned layout factory.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends readonly [\n LayoutResourceKey<Resources>,\n ...Array<LayoutResourceKey<Resources>>,\n ],\n >(\n ...resources: ResourceKeys\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n ResourceKeys,\n CustomProps\n >;\n\n /**\n * Creates a layout factory scoped to a resource list without default names.\n *\n * @example\n * createResourceLayout.forResources({ resources: ['users', 'admins'] })\n *\n * @param options The resources to expose without configured default names.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n >(options: {\n resources: ResourceKeys;\n name?: never;\n }): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n readonly [{ resources: ResourceKeys }],\n CustomProps\n >;\n\n /**\n * Creates a scoped layout factory with optional default names per resource.\n *\n * Each map key is limited to the resources selected in `resources`. Values\n * can be strings or callbacks receiving that resource's capitalized name.\n *\n * @example\n * createResourceLayout.forResources({\n * resources: ['users', 'admins'],\n * name: {\n * users: resource => `${resource}Page`,\n * admins: 'AdminDirectory',\n * },\n * })\n *\n * @param options The selected resources and their optional default names.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n const CallbackName extends string,\n const Names,\n >(\n options: {\n resources: ResourceKeys;\n name: SelectedResourceLayoutNames<\n LayoutResourceKey<Resources>,\n NoInfer<ResourceKeys[number]>,\n CallbackName\n > &\n AtLeastOneResourceLayoutNameKey<NoInfer<ResourceKeys[number]>> &\n Record<\n string,\n NonNullable<\n ResourceLayoutNames<\n LayoutResourceKey<Resources>,\n CallbackName\n >[LayoutResourceKey<Resources>]\n >\n >;\n } & {\n name: Names & Record<Exclude<keyof Names, ResourceKeys[number]>, never>;\n },\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n MappedResourceLayoutArguments<Resources, ResourceKeys, Names, CallbackName>,\n CustomProps\n >;\n\n /**\n * Creates a scoped layout factory with one default-name callback shared by\n * every selected resource. The callback receives a capitalized resource\n * whose `toLowerCase()` result retains the corresponding literal type.\n *\n * @example\n * createResourceLayout.forResources({\n * resources: ['users', 'admins'],\n * name: resource => `${resource}Page`,\n * })\n *\n * @param options The selected resources and shared default-name callback.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n const Name extends string,\n >(\n options: {\n resources: ReadonlyArray<LayoutResourceKey<Resources>>;\n name: (resource: CapitalizedResource<ResourceKeys[number]>) => Name;\n } & { resources: ResourceKeys },\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n SharedResourceLayoutArguments<Resources, ResourceKeys, Name>,\n CustomProps\n >;\n\n /**\n * Creates a scoped layout factory from a resource-keyed configuration.\n * Only configured resources are available from the returned factory.\n *\n * @example\n * createResourceLayout.forResources({\n * users: { name: resource => `${resource}Page` },\n * admins: { name: 'AdminDirectory' },\n * })\n *\n * @param options Resource-keyed layout defaults.\n * @returns A layout factory scoped to the configured resources.\n */\n <\n const CallbackName extends string,\n const Selection extends ResourceLayoutSelection<Resources, CallbackName>,\n >(\n options: Selection &\n AtLeastOneResourceLayoutSelection<Resources, CallbackName> &\n Partial<\n Record<Exclude<'resources', LayoutResourceKey<Resources>>, never>\n > &\n Record<Exclude<keyof Selection, LayoutResourceKey<Resources>>, never>,\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n SelectedResourceLayoutArguments<Selection>,\n CustomProps\n >;\n};\n\n/**\n * Names a scoped component cannot use. Scoped components are attached to\n * function objects, so they collide with the component's own statics and with\n * non-writable `Function.prototype` properties. `__proto__` is reserved so\n * assignment cannot hit the prototype setter on a normal object.\n */\nconst reservedScopedComponentNames = new Set([\n '__proto__',\n 'apply',\n 'arguments',\n 'bind',\n 'call',\n 'caller',\n 'displayName',\n 'length',\n 'name',\n 'props',\n 'prototype',\n 'resource',\n]);\n\ntype CreateForResourcesOptions<\n Resources extends ReadonlyArray<ResourceDefinition>,\n> = {\n createLayoutForResource: (\n defaultName: string | undefined,\n resource: LayoutResourceKey<Resources>,\n ) => unknown;\n createMakeComposableLayout?: () => (\n options: Record<string, unknown>,\n ) => unknown;\n createResourceLayout: (options: Record<string, unknown>) => unknown;\n getComponentPropDefinitions: (\n resource: LayoutResourceKey<Resources>,\n ) => Record<string, AnyBuiltPropDefinition>;\n};\n\nexport function createForResources<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>,\n CustomProps extends InPropsObject,\n>({\n createLayoutForResource,\n createMakeComposableLayout,\n createResourceLayout,\n getComponentPropDefinitions,\n}: CreateForResourcesOptions<Resources>) {\n return ((...resourcesOrOptions: Array<unknown>) => {\n const firstArgument = resourcesOrOptions[0];\n let resourceOptions: Array<{\n resource: LayoutResourceKey<Resources>;\n name?:\n | string\n | ((\n resource: CapitalizedResource<LayoutResourceKey<Resources>>,\n ) => string);\n }>;\n\n if (typeof firstArgument === 'string') {\n resourceOptions = resourcesOrOptions.map((resource) => ({\n resource: resource as LayoutResourceKey<Resources>,\n }));\n } else if (\n firstArgument !== null &&\n typeof firstArgument === 'object' &&\n 'resources' in firstArgument &&\n Array.isArray(firstArgument.resources)\n ) {\n const { name, resources } = firstArgument as {\n name?: ResourcesLayoutName<LayoutResourceKey<Resources>>;\n resources: Array<LayoutResourceKey<Resources>>;\n };\n resourceOptions = resources.map((resource) => ({\n name: typeof name === 'function' ? name : name?.[resource],\n resource,\n }));\n } else {\n resourceOptions = Object.entries(firstArgument ?? {}).map(\n ([resource, options]) => ({\n ...(options as {\n name?:\n | string\n | ((\n resource: CapitalizedResource<LayoutResourceKey<Resources>>,\n ) => string);\n }),\n resource: resource as LayoutResourceKey<Resources>,\n }),\n );\n }\n\n const defaultNames = new Map(\n resourceOptions.map(({ name, resource }) => [\n resource,\n typeof name === 'function'\n ? name(\n capitalize(resource) as CapitalizedResource<\n LayoutResourceKey<Resources>\n >,\n )\n : name,\n ]),\n );\n\n function scopedCreateResourceLayout(options: Record<string, unknown>) {\n const resource = options.resource as LayoutResourceKey<Resources>;\n\n return createResourceLayout({\n ...options,\n name: options.name ?? defaultNames.get(resource),\n });\n }\n\n function scopedForResource(options: {\n name?: string;\n resource: LayoutResourceKey<Resources>;\n }) {\n return createLayoutForResource(\n options.name ?? defaultNames.get(options.resource),\n options.resource,\n );\n }\n\n type ScopedComponentRenderFn = (\n props: Record<string, unknown>,\n components: Record<string, (props?: never) => JSX.Element>,\n ) => JSX.Element;\n\n type ScopedResourceScopedComponentDefinition = {\n props?: Record<string, AnyBuiltPropDefinition>;\n render: ScopedComponentRenderFn;\n };\n\n type ScopedComponentEntry = {\n [option: string]: unknown;\n name?: string;\n components?: Record<string, ScopedResourceScopedComponentDefinition>;\n render: ScopedComponentRenderFn;\n };\n\n function createComponent(componentOptions: {\n props?: {\n include?: Record<string, true | 'optional'>;\n custom?: Record<string, AnyBuiltPropDefinition>;\n };\n resources?: Record<string, ScopedComponentEntry>;\n render: (\n props: Record<string, unknown>,\n context: Record<string, (props: never) => JSX.Element>,\n ) => JSX.Element;\n }) {\n const include = componentOptions.props?.include ?? {};\n const custom = componentOptions.props?.custom ?? {};\n const selectedResources = new Set(\n resourceOptions.map(({ resource }) => resource),\n );\n const componentPropsContext = createContext<\n Record<string, unknown> | undefined\n >(undefined);\n const definedEntries = new Map<\n LayoutResourceKey<Resources>,\n ScopedComponentEntry\n >();\n\n for (const [key, entry] of Object.entries(\n componentOptions.resources ?? {},\n )) {\n const resource = key as LayoutResourceKey<Resources>;\n\n if (!selectedResources.has(resource)) {\n throw new Error(\n `Resource \"${key}\" is not available in this scoped component`,\n );\n }\n\n definedEntries.set(resource, entry);\n }\n\n /** Resolved scoped components, per resource. */\n const resourceScopedComponents = new Map<\n LayoutResourceKey<Resources>,\n Record<string, (props?: never) => JSX.Element>\n >();\n const contextResources = new Map<string, LayoutResourceKey<Resources>>();\n const renderContext: Record<string, (props: never) => JSX.Element> =\n Object.fromEntries(\n [...definedEntries].map(([resource, entry]) => {\n const contextKey = capitalize(resource);\n\n if (contextKey === 'Root') {\n throw new Error(\n `Resource \"${resource}\" maps to the reserved render context key \"Root\"`,\n );\n }\n\n const existingResource = contextResources.get(contextKey);\n\n if (existingResource !== undefined) {\n throw new Error(\n `Resources \"${existingResource}\" and \"${resource}\" both map to render context key \"${contextKey}\"`,\n );\n }\n\n contextResources.set(contextKey, resource);\n\n /**\n * Built once per resource so every scoped component keeps a stable\n * identity, and shared by the resource render, the render context,\n * and any component bound through `asHOF()`.\n */\n const scopedComponents: Record<\n string,\n (props?: never) => JSX.Element\n > = {};\n\n for (const [name, definition] of Object.entries(\n entry.components ?? {},\n )) {\n if (reservedScopedComponentNames.has(name)) {\n throw new Error(\n `Scoped component \"${name}\" for resource \"${resource}\" uses a reserved name`,\n );\n }\n\n const ownPropDefinitions = definition.props ?? {};\n\n function ScopedComponent(ownProps?: Record<string, unknown>) {\n const componentProps = useContext(componentPropsContext);\n\n if (componentProps === undefined) {\n throw new Error(\n `Scoped component \"${name}\" must be rendered inside its scoped component`,\n );\n }\n\n const resolvedOwnProps = ownProps ?? {};\n\n validateProps(ownPropDefinitions, resolvedOwnProps);\n\n return definition.render(\n { ...componentProps, ...resolvedOwnProps, resource },\n scopedComponents,\n );\n }\n\n scopedComponents[name] = ScopedComponent as (\n props?: never,\n ) => JSX.Element;\n }\n\n resourceScopedComponents.set(resource, scopedComponents);\n\n function ResourceRender() {\n const componentProps = useContext(componentPropsContext);\n\n if (componentProps === undefined) {\n throw new Error(\n `Render context component \"${contextKey}\" must be rendered inside its scoped component`,\n );\n }\n\n return entry.render(\n { ...componentProps, resource },\n scopedComponents,\n );\n }\n\n return [contextKey, Object.assign(ResourceRender, scopedComponents)];\n }),\n );\n\n /**\n * Layouts are created once per resource and cached. Creating one during\n * render would hand React a new component type on every pass, remounting\n * the whole subtree.\n */\n const roots = new Map<\n LayoutResourceKey<Resources>,\n (props: Record<string, unknown>) => JSX.Element\n >();\n\n function getRoot(resource: LayoutResourceKey<Resources>) {\n let root = roots.get(resource);\n\n if (root === undefined) {\n const entry = definedEntries.get(resource);\n\n if (entry === undefined) {\n // Without an entry there are no create-time layout options, so a\n // layout with required props would fail validation deep inside\n // its own render. Fail here instead, naming the fix.\n throw new Error(\n `Render context component \"Root\" requires a \"resources.${resource}\" entry to build the layout for resource \"${resource}\"`,\n );\n }\n\n const { render: _render, ...layoutOptions } = entry;\n\n root = scopedCreateResourceLayout({\n ...layoutOptions,\n name:\n layoutOptions.name ??\n defaultNames.get(resource) ??\n capitalize(resource),\n resource,\n }) as (props: Record<string, unknown>) => JSX.Element;\n roots.set(resource, root);\n }\n\n return root;\n }\n\n function Root(rootProps: Record<string, unknown>) {\n const componentProps = useContext(componentPropsContext);\n\n if (componentProps === undefined) {\n throw new Error(\n 'Render context component \"Root\" must be rendered inside its scoped component',\n );\n }\n\n return createElement(\n getRoot(componentProps.resource as LayoutResourceKey<Resources>),\n rootProps,\n );\n }\n\n renderContext.Root = Root;\n\n function Component(componentProps: Record<string, unknown>) {\n const componentResource =\n componentProps.resource as LayoutResourceKey<Resources>;\n\n if (!selectedResources.has(componentResource)) {\n throw new Error(\n `Resource \"${componentResource}\" is not available in this scoped component`,\n );\n }\n\n const availableDefinitions =\n getComponentPropDefinitions(componentResource);\n const definitionsToValidate: Record<string, AnyBuiltPropDefinition> =\n {};\n\n for (const [key, inclusion] of Object.entries(include)) {\n const definition = availableDefinitions[key];\n\n if (!definition) {\n continue;\n }\n\n // Keep declared keys as-is — do not capitalize JSX.Element props.\n if (inclusion === true || key in componentProps) {\n definitionsToValidate[key] = definition;\n }\n }\n\n for (const [key, definition] of Object.entries(custom)) {\n if (key === 'children' || key === 'resource') {\n continue;\n }\n\n definitionsToValidate[key] = definition;\n }\n\n validateProps(definitionsToValidate, componentProps);\n\n return createElement(\n componentPropsContext.Provider,\n { value: componentProps },\n componentOptions.render(componentProps, renderContext),\n );\n }\n\n /**\n * Bound components are created once per resource and cached. Returning a\n * fresh component from the factory would hand React a new component type\n * whenever the caller rebinds, remounting the subtree.\n */\n const boundComponents = new Map<\n LayoutResourceKey<Resources>,\n (props: Record<string, unknown>) => JSX.Element\n >();\n\n function bindResource(resource: LayoutResourceKey<Resources>) {\n if (!selectedResources.has(resource)) {\n throw new Error(\n `Resource \"${resource}\" is not available in this scoped component`,\n );\n }\n\n let boundComponent = boundComponents.get(resource);\n\n if (boundComponent === undefined) {\n boundComponent = Object.assign(\n (boundProps: Record<string, unknown>) =>\n createElement(Component, { ...boundProps, resource }),\n {\n displayName: `ScopedResourceComponent(${resource})`,\n props: undefined,\n resource: undefined,\n },\n resourceScopedComponents.get(resource) ?? {},\n );\n boundComponents.set(resource, boundComponent);\n }\n\n return boundComponent;\n }\n\n function asHOF() {\n return bindResource;\n }\n\n return Object.assign(Component, {\n asHOF,\n displayName: 'ScopedResourceComponent',\n props: undefined,\n });\n }\n\n const scopedExtras: {\n createComponent: typeof createComponent;\n forResource: typeof scopedForResource;\n makeComposable?: (options: Record<string, unknown>) => unknown;\n resources: undefined;\n } = {\n createComponent,\n forResource: scopedForResource,\n resources: undefined,\n };\n\n if (createMakeComposableLayout) {\n const makeComposableLayout = createMakeComposableLayout();\n\n scopedExtras.makeComposable = (options) => {\n const resource = options.resource as LayoutResourceKey<Resources>;\n\n return makeComposableLayout({\n ...options,\n name: options.name ?? defaultNames.get(resource),\n });\n };\n }\n\n return Object.assign(scopedCreateResourceLayout, scopedExtras);\n }) as unknown as CreateResourceLayoutForResourcesFn<\n Resources,\n InProps,\n Composables,\n IncludeProps,\n CustomProps\n >;\n}\n"],"mappings":";;;;;;;;;;;AAihCA,MAAM,+BAA+B,IAAI,IAAI;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAkBD,SAAgB,mBAMd,EACA,yBACA,4BACA,sBACA,+BACuC;CACvC,SAAS,GAAG,uBAAuC;EACjD,MAAM,gBAAgB,mBAAmB;EACzC,IAAI;EASJ,IAAI,OAAO,kBAAkB,UAC3B,kBAAkB,mBAAmB,KAAK,cAAc,EAC5C,SACZ,EAAE;OACG,IACL,kBAAkB,QAClB,OAAO,kBAAkB,YACzB,eAAe,i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IAAI,CAAC,kBAAkB,IAAI,QAAQ,GACjC,MAAM,IAAI,MACR,aAAa,SAAS,4CACxB;IAGF,IAAI,iBAAiB,gBAAgB,IAAI,QAAQ;IAEjD,IAAI,mBAAmB,QAAW;KAChC,iBAAiB,OAAO,QACrB,wCACe,WAAW;MAAE,GAAG;MAAY;KAAS,CAAC,GACtD;MACE,aAAa,2BAA2B,SAAS;MACjD,OAAO;MACP,UAAU;KACZ,GACA,yBAAyB,IAAI,QAAQ,KAAK,CAAC,CAC7C;KACA,gBAAgB,IAAI,UAAU,cAAc;IAC9C;IAEA,OAAO;GACT;GAEA,SAAS,QAAQ;IACf,OAAO;GACT;GAEA,OAAO,OAAO,OAAO,WAAW;IAC9B;IACA,aAAa;IACb,OAAO;GACT,CAAC;EACH;EAEA,MAAM,eAKF;GACF;GACA,aAAa;GACb,WAAW;EACb;EAEA,IAAI,4BAA4B;GAC9B,MAAM,uBAAuB,2BAA2B;GAExD,aAAa,kBAAkB,YAAY;IACzC,MAAM,WAAW,QAAQ;IAEzB,OAAO,qBAAqB;KAC1B,GAAG;KACH,MAAM,QAAQ,QAAQ,aAAa,IAAI,QAAQ;IACjD,CAAC;GACH;EACF;EAEA,OAAO,OAAO,OAAO,4BAA4B,YAAY;CAC/D;AAOF"}
@@ -1,11 +1,11 @@
1
1
  import { BaseComponent, Show } from "../utils.cjs";
2
2
  import { LayoutResourceKey, ResourceDefinition } from "../resource.cjs";
3
- import { InPropsDefinition, InPropsObject, IncludedProps, MergedLayoutInProps, ResolvedIncludedProps } from "../props.cjs";
3
+ import { InPropsDefinition, InPropsObject, IncludedProps, MergedLayoutInProps, ResolvedIncludedPropsAsDefined } from "../props.cjs";
4
4
  import { CreateLayoutForResourceOptions, CreateResourceLayoutOptionsBase, CreatedLayoutForResource, SetDefaultPropForResourceFn } from "./for-resource.cjs";
5
5
  import { LayoutIncludeProps, LayoutPropsForResource, ResourceLayoutComponent } from "./define-layout.cjs";
6
6
  import { ComposableComponents, ComposableResourceLayout } from "@jfdevelops/react-layout-composables";
7
7
  import { JSX, ReactNode } from "react";
8
- import { ResolveProps } from "@jfdevelops/react-layout-validator";
8
+ import { ResolveProps, ResolvedBuiltPropShape } from "@jfdevelops/react-layout-validator";
9
9
 
10
10
  //#region src/create-config/for-resources.d.ts
11
11
  type CapitalizedResource<Resource extends string> = Resource extends Resource ? {
@@ -69,23 +69,23 @@ type ScopedCreateResourceLayoutMakeComposableFn<Resources extends ReadonlyArray<
69
69
  name: Name;
70
70
  })) => ComposableResourceLayout<Composables, Name, any, any, any>;
71
71
  type ScopedComponentAvailableProps<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject> = MergedLayoutInProps<Resources, InProps, Composables> & LayoutCustomProps;
72
- 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<ResolvedIncludedProps<ScopedComponentAvailableProps<Resources, InProps, Composables, LayoutCustomProps>, ComponentIncludeProps> & ResolveProps<ComponentCustomProps>, 'children' | 'resource'> & {
72
+ 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'> & {
73
73
  children?: ReactNode;
74
74
  resource: Resource;
75
75
  }>;
76
76
  /**
77
- * Shape of a scoped component definition. Used with a reverse mapped type so
78
- * TypeScript can infer each component's full declaration (including `props`)
79
- * while still constraining known fields.
77
+ * Fields reverse-inferred from each scoped component declaration. Only `props`
78
+ * belongs here putting `render` in the reverse map makes TypeScript infer it
79
+ * as `unknown` (function types don't reverse-map cleanly). `render` is supplied
80
+ * by the constraint intersection instead, like the playground's `transform`.
80
81
  */
81
82
  type ScopedComponentShape = {
82
83
  props?: InPropsObject;
83
- render?: unknown;
84
84
  };
85
85
  /**
86
- * Homomorphic pick of known scoped-component fields. Paired with a reverse
87
- * mapped type over the components object, this lets each entry's inferred type
88
- * flow into sibling render signatures (see TypeScript's reverse mapped types).
86
+ * Homomorphic pick of reverse-mapped scoped-component fields. Paired with a
87
+ * mapped type over the components object, this lets each entry's inferred
88
+ * `props` flow into sibling render signatures.
89
89
  */
90
90
  type JustScopedComponent<T> = { [Key in keyof T & keyof ScopedComponentShape]: T[Key] };
91
91
  /**
@@ -106,7 +106,7 @@ type ScopedComponentSignature<Props> = {} extends Props ? (props?: Props) => JSX
106
106
  * The sibling / context components for one resource, keyed by their declared
107
107
  * names with call-site prop types.
108
108
  */
109
- type ResolvedScopedComponentsMap<Components> = { [Name in keyof NormalizeScopedComponentsMap<Components>]: ScopedComponentSignature<Show<ResolveProps<ScopedComponentOwnProps<NormalizeScopedComponentsMap<Components>[Name]>>>> };
109
+ type ResolvedScopedComponentsMap<Components> = { [Name in keyof NormalizeScopedComponentsMap<Components>]: ScopedComponentSignature<Show<ResolvedBuiltPropShape<ScopedComponentOwnProps<NormalizeScopedComponentsMap<Components>[Name]>>>> };
110
110
  type ScopedResourceComponentRenderContext<ComponentsByResource, LayoutCustomProps extends InPropsObject> = {
111
111
  /**
112
112
  * The resource layout for the component's current `resource`, created
@@ -145,7 +145,7 @@ type ScopedComponentResourceEntries<Resources extends ReadonlyArray<ResourceDefi
145
145
  * this component's own props, and the other components for this
146
146
  * resource (excluding itself).
147
147
  */
148
- render: (props: ScopedResourceComponentProps<Resources, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource & string> & Show<ResolveProps<ScopedComponentOwnProps<ComponentsByResource[Resource][Name]>>>, components: Omit<ResolvedScopedComponentsMap<ComponentsByResource[Resource]>, Name>) => JSX.Element;
148
+ render: (props: ScopedResourceComponentProps<Resources, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource & string> & Show<ResolvedBuiltPropShape<ScopedComponentOwnProps<ComponentsByResource[Resource][Name]>>>, components: Omit<ResolvedScopedComponentsMap<ComponentsByResource[Resource]>, Name>) => JSX.Element;
149
149
  } }; /** Renders this resource's content inside the shared render function. */
150
150
  render: (props: ScopedResourceComponentProps<Resources, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource & string>, components: ResolvedScopedComponentsMap<ComponentsByResource[Resource]>) => JSX.Element;
151
151
  } } & Record<Exclude<keyof ComponentsByResource, SelectedLayoutResources<Resources, Arguments>>, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"for-resources.d.cts","names":[],"sources":["../../src/create-config/for-resources.ts"],"mappings":";;;;;;;;;;KAsCK,mBAAA,4BAA+C,QAAA,SAAiB,QAAA;EAE/D,WAAA,QAAmB,SAAA,CAAU,UAAA,CAAW,QAAA;AAAA,IACtC,UAAA,CAAW,QAAA;AAAA,KAQd,mBAAA,uFAIgB,QAAA,eAEb,QAAA,EAAU,mBAAA,CAAoB,cAAA,MAAoB,YAAA;AAAA,KAGrD,+BAAA,iDACgB,QAAA,GAAW,MAAA,CAAO,cAAA,aACnC,OAAA,CAAQ,MAAA,CAAO,OAAA,CAAQ,QAAA,EAAU,cAAA,eACnC,QAAA;AAAA,KAEG,2BAAA,mDAEsB,QAAA,sDAGN,QAAA,IAAY,cAAA,SAAuB,gBAAA,GAClD,cAAA,uBAGE,QAAA,EAAU,mBAAA,CAAoB,cAAA,MAAoB,YAAA;AAAA,KAOrD,uBAAA,mBACe,aAAA,CAAc,kBAAA,0DAG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AA;IAC3D,SAAA,EAAW,YAAA;EAAA,IAChB,4BAAA,CACD,SAAA,EACA,OAAA,EACA,WAAA,EACA,6BAAA,CAA8B,SAAA,EAAW,YAAA,EAAc,IAAA,GACvD,WAAA;EA9zBiB;;;;;;;;;;;;;EAAA,4DAg1BO,uBAAA,CAAwB,SAAA,EAAW,YAAA,GAE3D,OAAA,EAAS,SAAA,GACP,iCAAA,CAAkC,SAAA,EAAW,YAAA,IAC7C,OAAA,CACE,MAAA,CAAO,OAAA,cAAqB,iBAAA,CAAkB,SAAA,cAEhD,MAAA,CAAO,OAAA,OAAc,SAAA,EAAW,iBAAA,CAAkB,SAAA,aACnD,4BAAA,CACD,SAAA,EACA,OAAA,EACA,WAAA,EACA,+BAAA,CAAgC,SAAA,GAChC,WAAA;AAAA"}
@@ -1,10 +1,10 @@
1
1
  import { BaseComponent, Show } from "../utils.mjs";
2
2
  import { LayoutResourceKey, ResourceDefinition } from "../resource.mjs";
3
- import { InPropsDefinition, InPropsObject, IncludedProps, MergedLayoutInProps, ResolvedIncludedProps } from "../props.mjs";
3
+ import { InPropsDefinition, InPropsObject, IncludedProps, MergedLayoutInProps, ResolvedIncludedPropsAsDefined } from "../props.mjs";
4
4
  import { CreateLayoutForResourceOptions, CreateResourceLayoutOptionsBase, CreatedLayoutForResource, SetDefaultPropForResourceFn } from "./for-resource.mjs";
5
5
  import { LayoutIncludeProps, LayoutPropsForResource, ResourceLayoutComponent } from "./define-layout.mjs";
6
6
  import { ComposableComponents, ComposableResourceLayout } from "@jfdevelops/react-layout-composables";
7
- import { ResolveProps } from "@jfdevelops/react-layout-validator";
7
+ import { ResolveProps, ResolvedBuiltPropShape } from "@jfdevelops/react-layout-validator";
8
8
  import { JSX, ReactNode } from "react";
9
9
 
10
10
  //#region src/create-config/for-resources.d.ts
@@ -69,23 +69,23 @@ type ScopedCreateResourceLayoutMakeComposableFn<Resources extends ReadonlyArray<
69
69
  name: Name;
70
70
  })) => ComposableResourceLayout<Composables, Name, any, any, any>;
71
71
  type ScopedComponentAvailableProps<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, LayoutCustomProps extends InPropsObject> = MergedLayoutInProps<Resources, InProps, Composables> & LayoutCustomProps;
72
- 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<ResolvedIncludedProps<ScopedComponentAvailableProps<Resources, InProps, Composables, LayoutCustomProps>, ComponentIncludeProps> & ResolveProps<ComponentCustomProps>, 'children' | 'resource'> & {
72
+ 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'> & {
73
73
  children?: ReactNode;
74
74
  resource: Resource;
75
75
  }>;
76
76
  /**
77
- * Shape of a scoped component definition. Used with a reverse mapped type so
78
- * TypeScript can infer each component's full declaration (including `props`)
79
- * while still constraining known fields.
77
+ * Fields reverse-inferred from each scoped component declaration. Only `props`
78
+ * belongs here putting `render` in the reverse map makes TypeScript infer it
79
+ * as `unknown` (function types don't reverse-map cleanly). `render` is supplied
80
+ * by the constraint intersection instead, like the playground's `transform`.
80
81
  */
81
82
  type ScopedComponentShape = {
82
83
  props?: InPropsObject;
83
- render?: unknown;
84
84
  };
85
85
  /**
86
- * Homomorphic pick of known scoped-component fields. Paired with a reverse
87
- * mapped type over the components object, this lets each entry's inferred type
88
- * flow into sibling render signatures (see TypeScript's reverse mapped types).
86
+ * Homomorphic pick of reverse-mapped scoped-component fields. Paired with a
87
+ * mapped type over the components object, this lets each entry's inferred
88
+ * `props` flow into sibling render signatures.
89
89
  */
90
90
  type JustScopedComponent<T> = { [Key in keyof T & keyof ScopedComponentShape]: T[Key] };
91
91
  /**
@@ -106,7 +106,7 @@ type ScopedComponentSignature<Props> = {} extends Props ? (props?: Props) => JSX
106
106
  * The sibling / context components for one resource, keyed by their declared
107
107
  * names with call-site prop types.
108
108
  */
109
- type ResolvedScopedComponentsMap<Components> = { [Name in keyof NormalizeScopedComponentsMap<Components>]: ScopedComponentSignature<Show<ResolveProps<ScopedComponentOwnProps<NormalizeScopedComponentsMap<Components>[Name]>>>> };
109
+ type ResolvedScopedComponentsMap<Components> = { [Name in keyof NormalizeScopedComponentsMap<Components>]: ScopedComponentSignature<Show<ResolvedBuiltPropShape<ScopedComponentOwnProps<NormalizeScopedComponentsMap<Components>[Name]>>>> };
110
110
  type ScopedResourceComponentRenderContext<ComponentsByResource, LayoutCustomProps extends InPropsObject> = {
111
111
  /**
112
112
  * The resource layout for the component's current `resource`, created
@@ -145,7 +145,7 @@ type ScopedComponentResourceEntries<Resources extends ReadonlyArray<ResourceDefi
145
145
  * this component's own props, and the other components for this
146
146
  * resource (excluding itself).
147
147
  */
148
- render: (props: ScopedResourceComponentProps<Resources, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource & string> & Show<ResolveProps<ScopedComponentOwnProps<ComponentsByResource[Resource][Name]>>>, components: Omit<ResolvedScopedComponentsMap<ComponentsByResource[Resource]>, Name>) => JSX.Element;
148
+ render: (props: ScopedResourceComponentProps<Resources, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource & string> & Show<ResolvedBuiltPropShape<ScopedComponentOwnProps<ComponentsByResource[Resource][Name]>>>, components: Omit<ResolvedScopedComponentsMap<ComponentsByResource[Resource]>, Name>) => JSX.Element;
149
149
  } }; /** Renders this resource's content inside the shared render function. */
150
150
  render: (props: ScopedResourceComponentProps<Resources, InProps, Composables, LayoutCustomProps, ComponentIncludeProps, ComponentCustomProps, Resource & string>, components: ResolvedScopedComponentsMap<ComponentsByResource[Resource]>) => JSX.Element;
151
151
  } } & Record<Exclude<keyof ComponentsByResource, SelectedLayoutResources<Resources, Arguments>>, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"for-resources.d.mts","names":[],"sources":["../../src/create-config/for-resources.ts"],"mappings":";;;;;;;;;;KAsCK,mBAAA,4BAA+C,QAAA,SAAiB,QAAA;EAE/D,WAAA,QAAmB,SAAA,CAAU,UAAA,CAAW,QAAA;AAAA,IACtC,UAAA,CAAW,QAAA;AAAA,KAQd,mBAAA,uFAIgB,QAAA,eAEb,QAAA,EAAU,mBAAA,CAAoB,cAAA,MAAoB,YAAA;AAAA,KAGrD,+BAAA,iDACgB,QAAA,GAAW,MAAA,CAAO,cAAA,aACnC,OAAA,CAAQ,MAAA,CAAO,OAAA,CAAQ,QAAA,EAAU,cAAA,eACnC,QAAA;AAAA,KAEG,2BAAA,mDAEsB,QAAA,sDAGN,QAAA,IAAY,cAAA,SAAuB,gBAAA,GAClD,cAAA,uBAGE,QAAA,EAAU,mBAAA,CAAoB,cAAA,MAAoB,YAAA;AAAA,KAOrD,uBAAA,mBACe,aAAA,CAAc,kBAAA,0DAGnB,iBAAA,CAAkB,SAAA;EAC7B,IAAA,cAAkB,QAAA,EAAU,mBAAA,CAAoB,QAAA,MAAc,YAAA;AAAA;AAAA,KAI7D,iCAAA,mBACe,aAAA,CAAc,kBAAA,iDAGnB,iBAAA,CAAkB,SAAA,IAAa,QAAA,CAC1C,IAAA,CAAK,uBAAA,CAAwB,SAAA,EAAW,YAAA,GAAe,QAAA,KAEvD,IAAA,CAAK,uBAAA,CAAwB,SAAA,EAAW,YAAA,GAAe,QAAA,IACzD,iBAAA,CAAkB,SAAA;AA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A,cAEhD,MAAA,CAAO,OAAA,OAAc,SAAA,EAAW,iBAAA,CAAkB,SAAA,aACnD,4BAAA,CACD,SAAA,EACA,OAAA,EACA,WAAA,EACA,+BAAA,CAAgC,SAAA,GAChC,WAAA;AAAA"}
@@ -6,9 +6,11 @@ import { createContext, createElement, useContext } from "react";
6
6
  /**
7
7
  * Names a scoped component cannot use. Scoped components are attached to
8
8
  * function objects, so they collide with the component's own statics and with
9
- * non-writable `Function.prototype` properties, where `Object.assign` throws.
9
+ * non-writable `Function.prototype` properties. `__proto__` is reserved so
10
+ * assignment cannot hit the prototype setter on a normal object.
10
11
  */
11
12
  const reservedScopedComponentNames = new Set([
13
+ "__proto__",
12
14
  "apply",
13
15
  "arguments",
14
16
  "bind",
@@ -76,7 +78,7 @@ function createForResources({ createLayoutForResource, createMakeComposableLayou
76
78
  for (const [name, definition] of Object.entries(entry.components ?? {})) {
77
79
  if (reservedScopedComponentNames.has(name)) throw new Error(`Scoped component "${name}" for resource "${resource}" uses a reserved name`);
78
80
  const ownPropDefinitions = definition.props ?? {};
79
- scopedComponents[name] = function ScopedComponent(ownProps) {
81
+ function ScopedComponent(ownProps) {
80
82
  const componentProps = useContext(componentPropsContext);
81
83
  if (componentProps === void 0) throw new Error(`Scoped component "${name}" must be rendered inside its scoped component`);
82
84
  const resolvedOwnProps = ownProps ?? {};
@@ -86,7 +88,8 @@ function createForResources({ createLayoutForResource, createMakeComposableLayou
86
88
  ...resolvedOwnProps,
87
89
  resource
88
90
  }, scopedComponents);
89
- };
91
+ }
92
+ scopedComponents[name] = ScopedComponent;
90
93
  }
91
94
  resourceScopedComponents.set(resource, scopedComponents);
92
95
  function ResourceRender() {
@@ -134,13 +137,11 @@ function createForResources({ createLayoutForResource, createMakeComposableLayou
134
137
  for (const [key, inclusion] of Object.entries(include)) {
135
138
  const definition = availableDefinitions[key];
136
139
  if (!definition) continue;
137
- const propKey = "type" in definition && definition.type === "JSX.Element" ? capitalize(key) : key;
138
- if (inclusion === true || propKey in componentProps) definitionsToValidate[propKey] = definition;
140
+ if (inclusion === true || key in componentProps) definitionsToValidate[key] = definition;
139
141
  }
140
142
  for (const [key, definition] of Object.entries(custom)) {
141
143
  if (key === "children" || key === "resource") continue;
142
- const propKey = "type" in definition && definition.type === "JSX.Element" ? capitalize(key) : key;
143
- definitionsToValidate[propKey] = definition;
144
+ definitionsToValidate[key] = definition;
144
145
  }
145
146
  validateProps(definitionsToValidate, componentProps);
146
147
  return createElement(componentPropsContext.Provider, { value: componentProps }, componentOptions.render(componentProps, renderContext));
@@ -1 +1 @@
1
- {"version":3,"file":"for-resources.mjs","names":[],"sources":["../../src/create-config/for-resources.ts"],"sourcesContent":["import {\n createContext,\n createElement,\n type JSX,\n type ReactNode,\n useContext,\n} from 'react';\nimport type {\n ComposableComponents,\n ComposableResourceLayout,\n} from '@jfdevelops/react-layout-composables';\nimport {\n type AnyBuiltPropDefinition,\n type ResolveProps,\n validateProps,\n} from '@jfdevelops/react-layout-validator';\nimport type {\n IncludedProps,\n InPropsDefinition,\n InPropsObject,\n MergedLayoutInProps,\n ResolvedIncludedProps,\n} from '../props';\nimport type { LayoutResourceKey, ResourceDefinition } from '../resource';\nimport { capitalize } from '../utils/capitalize';\nimport type { BaseComponent, Show } from '../utils';\nimport type {\n LayoutIncludeProps,\n LayoutPropsForResource,\n ResourceLayoutComponent,\n} from './define-layout';\nimport type {\n CreatedLayoutForResource,\n CreateLayoutForResourceOptions,\n CreateResourceLayoutOptionsBase,\n SetDefaultPropForResourceFn,\n} from './for-resource';\n\ntype CapitalizedResource<Resource extends string> = Resource extends Resource\n ? {\n toLowerCase: () => Lowercase<Capitalize<Resource>>;\n } & Capitalize<Resource>\n : never;\n\ntype ResourceLayoutName<\n Resource extends string,\n Name extends string = string,\n> = Name | ((resource: CapitalizedResource<Resource>) => Name);\n\ntype ResourceLayoutNames<\n Resource extends string,\n CallbackName extends string = string,\n> = {\n [TargetResource in Resource]?:\n | string\n | ((resource: CapitalizedResource<TargetResource>) => CallbackName);\n};\n\ntype AtLeastOneResourceLayoutNameKey<Resource extends string> = {\n [TargetResource in Resource]: Record<TargetResource, unknown> &\n Partial<Record<Exclude<Resource, TargetResource>, unknown>>;\n}[Resource];\n\ntype SelectedResourceLayoutNames<\n Resource extends string,\n SelectedResource extends Resource,\n CallbackName extends string,\n> = {\n [TargetResource in Resource as TargetResource extends SelectedResource\n ? TargetResource\n : never]?:\n | string\n | ((resource: CapitalizedResource<TargetResource>) => CallbackName);\n};\n\ntype ResourcesLayoutName<Resource extends string> =\n | Exclude<ResourceLayoutName<Resource>, string>\n | ResourceLayoutNames<Resource>;\n\ntype ResourceLayoutSelection<\n Resources extends ReadonlyArray<ResourceDefinition>,\n CallbackName extends string = string,\n> = {\n [Resource in LayoutResourceKey<Resources>]?: {\n name?: string | ((resource: CapitalizedResource<Resource>) => CallbackName);\n };\n};\n\ntype AtLeastOneResourceLayoutSelection<\n Resources extends ReadonlyArray<ResourceDefinition>,\n CallbackName extends string,\n> = {\n [Resource in LayoutResourceKey<Resources>]: Required<\n Pick<ResourceLayoutSelection<Resources, CallbackName>, Resource>\n > &\n Omit<ResourceLayoutSelection<Resources, CallbackName>, Resource>;\n}[LayoutResourceKey<Resources>];\n\ntype SelectedLayoutResources<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Arguments extends ReadonlyArray<unknown>,\n> =\n Arguments extends ReadonlyArray<LayoutResourceKey<Resources>>\n ? Arguments[number]\n : Arguments[0] extends {\n resources: ReadonlyArray<infer Resource>;\n }\n ? Resource & LayoutResourceKey<Resources>\n : keyof Arguments[0] & LayoutResourceKey<Resources>;\n\ntype ResolveResourceLayoutName<Name> = Name extends (\n ...args: never[]\n) => infer Result\n ? Result & string\n : Name extends string\n ? Name\n : string;\n\ntype NormalizeCapitalizedResourceName<\n Name extends string,\n Resource extends string,\n> = Name extends Name\n ? NormalizeCapitalizedResourceNameMatch<Name, Resource> extends infer Match\n ? [Match] extends [never]\n ? Name\n : Match\n : never\n : never;\n\ntype NormalizeCapitalizedResourceNameMatch<\n Name extends string,\n Resource extends string,\n> = Resource extends Resource\n ? Name extends `${CapitalizedResource<Resource>}${infer Suffix}`\n ? `${Capitalize<Resource>}${Suffix}`\n : never\n : never;\n\ntype SelectedResourceLayoutName<Arguments, Resource extends string> =\n Arguments extends ReadonlyArray<string>\n ? string\n : Arguments extends readonly [infer Options]\n ? Options extends {\n resources: ReadonlyArray<string>;\n name?: infer Name;\n }\n ? Name extends (...args: never[]) => unknown\n ? ResolveResourceLayoutName<Name>\n : Name extends Record<Resource, infer ResourceName>\n ? ResolveResourceLayoutName<ResourceName>\n : string\n : Options extends Record<Resource, infer ResourceOptions>\n ? ResourceOptions extends { name?: infer Name }\n ? ResolveResourceLayoutName<Name>\n : string\n : string\n : string;\n\ntype NormalizeResourceLayoutNames<Names, CallbackName extends string> = {\n [Resource in keyof Names]: Names[Resource] extends (\n ...args: never[]\n ) => unknown\n ? (\n resource: CapitalizedResource<Resource & string>,\n ) => NormalizeCapitalizedResourceName<CallbackName, Resource & string>\n : Names[Resource];\n};\n\ntype NormalizeResourceLayoutSelection<Selection> = {\n [Resource in keyof Selection]: Selection[Resource] extends {\n name: infer Name;\n }\n ? {\n name: Name extends (...args: never[]) => unknown\n ? (\n resource: CapitalizedResource<Resource & string>,\n ) => NormalizeCapitalizedResourceName<\n ResolveResourceLayoutName<Name>,\n Resource & string\n >\n : Name;\n }\n : Selection[Resource];\n};\n\ntype SharedResourceLayoutArguments<\n Resources extends ReadonlyArray<ResourceDefinition>,\n ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n Name extends string,\n> = readonly [\n {\n resources: ResourceKeys;\n name: (\n resource: CapitalizedResource<ResourceKeys[number]>,\n ) => NormalizeCapitalizedResourceName<Name, ResourceKeys[number]>;\n },\n];\n\ntype MappedResourceLayoutArguments<\n Resources extends ReadonlyArray<ResourceDefinition>,\n ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n Names,\n CallbackName extends string,\n> = readonly [\n {\n resources: ResourceKeys;\n name: NormalizeResourceLayoutNames<Names, CallbackName>;\n },\n];\n\ntype SelectedResourceLayoutArguments<Selection> = readonly [\n NormalizeResourceLayoutSelection<Selection>,\n];\n\ntype HasResourceLayoutName<Arguments, Resource extends string> =\n Arguments extends ReadonlyArray<string>\n ? false\n : Arguments extends readonly [infer Options]\n ? Options extends {\n resources: ReadonlyArray<string>;\n name: infer Name;\n }\n ? Name extends (...args: never[]) => unknown\n ? true\n : Name extends Record<Resource, unknown>\n ? true\n : false\n : Options extends Record<Resource, infer ResourceOptions>\n ? 'name' extends keyof ResourceOptions\n ? true\n : false\n : false\n : false;\n\ntype ScopedCreateResourceLayoutOptions<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n Name extends string,\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Props extends InPropsObject,\n> = LayoutPropsForResource<Resources, InProps, Composables> & {\n resource: Resource;\n props?: Props;\n} & (HasResourceLayoutName<Arguments, Resource> extends true\n ? { name?: Name }\n : { name: Name });\n\ntype ScopedCreateResourceLayoutFnImpl<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n CustomProps extends InPropsObject,\n> = <\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Name extends string = SelectedResourceLayoutName<Arguments, Resource>,\n Props extends InPropsObject = {},\n>(\n options: ScopedCreateResourceLayoutOptions<\n Resources,\n InProps,\n Composables,\n Arguments,\n Name,\n Resource,\n Props\n >,\n) => ResourceLayoutComponent<Name, CustomProps, Composables, Resource>;\n\ntype ScopedCreateLayoutForResource<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n CustomProps extends InPropsObject,\n> = <\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Name extends string = SelectedResourceLayoutName<Arguments, Resource>,\n>(\n options: CreateLayoutForResourceOptions<Resources, Name, Resource>,\n) => CreatedLayoutForResource<\n Resources,\n InProps,\n Composables,\n Name,\n Resource,\n CustomProps\n> & {\n setDefaults: SetDefaultPropForResourceFn<\n Resources,\n InProps,\n Composables,\n Name,\n Resource,\n CustomProps\n >;\n};\n\ntype ScopedCreateResourceLayoutMakeComposableFn<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n> = <\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Name extends string = SelectedResourceLayoutName<Arguments, Resource>,\n Props extends InPropsObject = {},\n>(\n options: Omit<\n CreateResourceLayoutOptionsBase<Resources, Name, Resource>,\n 'name'\n > &\n Partial<LayoutPropsForResource<Resources, InProps, Composables>> & {\n props?: Props;\n } & (HasResourceLayoutName<Arguments, Resource> extends true\n ? { name?: Name }\n : { name: Name }),\n) => ComposableResourceLayout<Composables, Name, any, any, any>;\n\ntype ScopedComponentAvailableProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n> = MergedLayoutInProps<Resources, InProps, Composables> & LayoutCustomProps;\n\ntype ScopedResourceComponentProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n Resource extends string,\n> = Show<\n Omit<\n ResolvedIncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >,\n ComponentIncludeProps\n > &\n ResolveProps<ComponentCustomProps>,\n 'children' | 'resource'\n > & {\n children?: ReactNode;\n resource: Resource;\n }\n>;\n\n/**\n * Shape of a scoped component definition. Used with a reverse mapped type so\n * TypeScript can infer each component's full declaration (including `props`)\n * while still constraining known fields.\n */\ntype ScopedComponentShape = {\n props?: InPropsObject;\n render?: unknown;\n};\n\n/**\n * Homomorphic pick of known scoped-component fields. Paired with a reverse\n * mapped type over the components object, this lets each entry's inferred type\n * flow into sibling render signatures (see TypeScript's reverse mapped types).\n */\ntype JustScopedComponent<T> = {\n [Key in keyof T & keyof ScopedComponentShape]: T[Key];\n};\n\n/**\n * Resources with no `components` reverse-infer as `unknown`. Treat that as an\n * empty map so sibling/context access stays closed.\n */\ntype NormalizeScopedComponentsMap<Components> = unknown extends Components\n ? {}\n : Components extends Record<string, unknown>\n ? Components\n : {};\n\n/** Extracts the prop definitions declared on a scoped component. */\ntype ScopedComponentOwnProps<Definition> = Definition extends {\n props: infer Props;\n}\n ? Props extends InPropsObject\n ? Props\n : {}\n : {};\n\n/**\n * A scoped component's call signature. Components that declare no props are\n * callable with no arguments.\n */\ntype ScopedComponentSignature<Props> = {} extends Props\n ? (props?: Props) => JSX.Element\n : (props: Props) => JSX.Element;\n\n/**\n * The sibling / context components for one resource, keyed by their declared\n * names with call-site prop types.\n */\ntype ResolvedScopedComponentsMap<Components> = {\n [Name in keyof NormalizeScopedComponentsMap<Components>]: ScopedComponentSignature<\n Show<\n ResolveProps<\n ScopedComponentOwnProps<NormalizeScopedComponentsMap<Components>[Name]>\n >\n >\n >;\n};\n\ntype ScopedResourceComponentRenderContext<\n ComponentsByResource,\n LayoutCustomProps extends InPropsObject,\n> = {\n /**\n * The resource layout for the component's current `resource`, created\n * internally from that resource's entry options. Accepts the layout's\n * custom props.\n */\n Root: (props: Show<ResolveProps<LayoutCustomProps>>) => JSX.Element;\n} & {\n [Resource in keyof ComponentsByResource as Capitalize<\n Resource & string\n >]-?: (() => JSX.Element) &\n ResolvedScopedComponentsMap<ComponentsByResource[Resource]>;\n};\n\n/**\n * Reverse-mapped `resources` constraint.\n *\n * `ComponentsByResource` is inferred from each entry's `components` object.\n * Mapping back over those keys types every nested `render`'s second argument\n * with the other components for that resource — excluding the current\n * component when typing a scoped component's own `render`.\n *\n * The parameter must not carry a default: TypeScript contextually types from a\n * parameter's default when it has one, and `{}` would silently degrade every\n * nested render to `any`.\n */\ntype ScopedComponentResourceEntries<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n ComponentsByResource,\n> = {\n [Resource in keyof ComponentsByResource]: LayoutPropsForResource<\n Resources,\n InProps,\n Composables\n > & {\n /**\n * Overrides the layout name used by `context.Root` for this resource.\n * Defaults to the scope's configured name, then the capitalized resource.\n */\n name?: string;\n /**\n * Components scoped to this resource. Each becomes a component on this\n * resource's render context, on `context.<Resource>`, and on the component\n * returned by `asHOF()`.\n */\n components?: {\n [Name in keyof ComponentsByResource[Resource]]: JustScopedComponent<\n ComponentsByResource[Resource][Name]\n > & {\n /** Props accepted by this component, validated at its call site. */\n props?: InPropsObject;\n /**\n * Renders this component. Receives the scoped component's props plus\n * this component's own props, and the other components for this\n * resource (excluding itself).\n */\n render: (\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource & string\n > &\n Show<\n ResolveProps<\n ScopedComponentOwnProps<ComponentsByResource[Resource][Name]>\n >\n >,\n components: Omit<\n ResolvedScopedComponentsMap<ComponentsByResource[Resource]>,\n Name\n >,\n ) => JSX.Element;\n };\n };\n /** Renders this resource's content inside the shared render function. */\n render: (\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource & string\n >,\n components: ResolvedScopedComponentsMap<ComponentsByResource[Resource]>,\n ) => JSX.Element;\n };\n} & Record<\n Exclude<\n keyof ComponentsByResource,\n SelectedLayoutResources<Resources, Arguments>\n >,\n never\n>;\n\n/**\n * Props of a resource-bound component. `resource` is supplied by the binding,\n * so it is removed from the call site.\n */\ntype ScopedBoundResourceComponentProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n Resource extends string,\n> = Show<\n Omit<\n ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >,\n 'resource'\n >\n>;\n\ntype ScopedBoundResourceComponent<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n ComponentsByResource,\n Resource extends string,\n> = BaseComponent<\n string,\n ScopedBoundResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >\n> &\n ResolvedScopedComponentsMap<\n Resource extends keyof ComponentsByResource\n ? ComponentsByResource[Resource]\n : {}\n > & {\n (\n props: ScopedBoundResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >,\n ): JSX.Element;\n /**\n * Type-only property containing the bound resource. This property is\n * `undefined` at runtime.\n */\n readonly resource: Resource;\n };\n\ntype ScopedResourceComponent<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n ComponentsByResource,\n> = BaseComponent<\n string,\n ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n SelectedLayoutResources<Resources, Arguments>\n >\n> & {\n /**\n * The `resource` prop drives the generic, so it is inferred from the call\n * site. Explicit type arguments are never needed.\n */\n <const Resource extends SelectedLayoutResources<Resources, Arguments>>(\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >,\n ): JSX.Element;\n /**\n * Returns a factory that binds the component to one resource. The bound\n * component accepts every prop except `resource`, which the binding supplies.\n *\n * Each resource is bound once and cached, so the returned component type is\n * stable across renders.\n *\n * @example\n * const createDirectory = Directory.asHOF()\n * const UsersDirectory = createDirectory('users')\n *\n * <UsersDirectory title='Users' />\n *\n * @returns A factory producing a component bound to the given resource.\n */\n asHOF(): <\n const Resource extends SelectedLayoutResources<Resources, Arguments>,\n >(\n resource: Resource,\n ) => ScopedBoundResourceComponent<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n ComponentsByResource,\n Resource\n >;\n};\n\ntype ScopedCreateComponent<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n LayoutCustomProps extends InPropsObject,\n> = <\n // Declared first and deliberately without a default: TypeScript\n // contextually types from a parameter's default when one exists, so a\n // default here would type every nested render as `any`. Inferred via a\n // reverse mapped type from each entry's `components` object.\n const ComponentsByResource,\n const ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n > = {},\n ComponentCustomProps extends InPropsObject = {},\n>(options: {\n props?: {\n /** Props from the resource layout definition to expose to the component. */\n include?: ComponentIncludeProps;\n /** Additional props accepted by the component. */\n custom?: ComponentCustomProps;\n };\n /**\n * Per-resource content, keyed by resource. Each entry holds that resource's\n * create-time layout options, its scoped `components`, and its `render`.\n */\n resources?: ScopedComponentResourceEntries<\n Resources,\n InProps,\n Composables,\n Arguments,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n ComponentsByResource\n >;\n /**\n * Renders the scoped component. `children` and `resource` are always\n * available. The context contains `Root`, the layout for the current\n * resource, plus a capitalized component per defined resource.\n */\n render: (\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n SelectedLayoutResources<Resources, Arguments>\n >,\n context: ScopedResourceComponentRenderContext<\n ComponentsByResource,\n LayoutCustomProps\n >,\n ) => JSX.Element;\n}) => ScopedResourceComponent<\n Resources,\n InProps,\n Composables,\n Arguments,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n ComponentsByResource\n>;\n\ntype ScopedCreateResourceLayoutFn<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n CustomProps extends InPropsObject,\n> = ScopedCreateResourceLayoutFnImpl<\n Resources,\n InProps,\n Composables,\n Arguments,\n CustomProps\n> & {\n /**\n * Creates a component shared by the target resources. Included layout props\n * become component props, and `children` is always available as an optional\n * prop in both the render callback and at the call site.\n *\n * Each key of `resources` holds that resource's create-time layout options\n * alongside its `render`. The render context exposes `Root` — the layout for\n * the current resource, built from those options — and one capitalized\n * component per key present in `resources`.\n *\n * Each entry may also declare `components` — components scoped to that\n * resource, available to the entry's own `render`, on `context.<Resource>`,\n * and on the component returned by `asHOF()`.\n *\n * @example\n * const Directory = createDirectoryLayout.createComponent({\n * props: { include: { title: true, actions: 'optional' } },\n * resources: {\n * users: {\n * title: 'Users',\n * components: {\n * Toolbar: { render: ({ title }) => <nav>{title}</nav> },\n * },\n * render: ({ resource }, components) => (\n * <>\n * <components.Toolbar />\n * <span>{resource}</span>\n * </>\n * ),\n * },\n * admins: {\n * title: 'Admins',\n * render: ({ resource }) => <span>{resource}</span>,\n * },\n * },\n * render: ({ actions, children, resource }, context) => (\n * <context.Root actions={actions}>\n * {children}\n * {resource === 'users' ? <context.Users /> : <context.Admins />}\n * <context.Users.Toolbar />\n * </context.Root>\n * ),\n * })\n *\n * <Directory resource='users' title='Users' />\n *\n * @param options The props configuration, per-resource entries, and the\n * shared component render function.\n * @returns A component scoped to the selected resources.\n */\n createComponent: ScopedCreateComponent<\n Resources,\n InProps,\n Composables,\n Arguments,\n CustomProps\n >;\n forResource: ScopedCreateLayoutForResource<\n Resources,\n InProps,\n Composables,\n Arguments,\n CustomProps\n >;\n /**\n * Type-only property containing the target resource union. This property is\n * `undefined` at runtime and exists solely for extracting the scoped type.\n *\n * @example\n * type AccountResource = typeof createAccountLayout.resources;\n */\n readonly resources: SelectedLayoutResources<Resources, Arguments>;\n} & ([keyof Composables] extends [never]\n ? {}\n : {\n makeComposable: ScopedCreateResourceLayoutMakeComposableFn<\n Resources,\n InProps,\n Composables,\n Arguments\n >;\n });\n\nexport type CreateResourceLayoutForResourcesFn<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents = {},\n IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables> = {},\n CustomProps extends InPropsObject = {},\n> = {\n /**\n * Creates a layout factory scoped to the listed resources.\n *\n * Layout names must be supplied when a layout is created.\n *\n * @example\n * createResourceLayout.forResources('users', 'admins')\n *\n * @param resources Resources available from the returned layout factory.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends readonly [\n LayoutResourceKey<Resources>,\n ...Array<LayoutResourceKey<Resources>>,\n ],\n >(\n ...resources: ResourceKeys\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n ResourceKeys,\n CustomProps\n >;\n\n /**\n * Creates a layout factory scoped to a resource list without default names.\n *\n * @example\n * createResourceLayout.forResources({ resources: ['users', 'admins'] })\n *\n * @param options The resources to expose without configured default names.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n >(options: {\n resources: ResourceKeys;\n name?: never;\n }): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n readonly [{ resources: ResourceKeys }],\n CustomProps\n >;\n\n /**\n * Creates a scoped layout factory with optional default names per resource.\n *\n * Each map key is limited to the resources selected in `resources`. Values\n * can be strings or callbacks receiving that resource's capitalized name.\n *\n * @example\n * createResourceLayout.forResources({\n * resources: ['users', 'admins'],\n * name: {\n * users: resource => `${resource}Page`,\n * admins: 'AdminDirectory',\n * },\n * })\n *\n * @param options The selected resources and their optional default names.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n const CallbackName extends string,\n const Names,\n >(\n options: {\n resources: ResourceKeys;\n name: SelectedResourceLayoutNames<\n LayoutResourceKey<Resources>,\n NoInfer<ResourceKeys[number]>,\n CallbackName\n > &\n AtLeastOneResourceLayoutNameKey<NoInfer<ResourceKeys[number]>> &\n Record<\n string,\n NonNullable<\n ResourceLayoutNames<\n LayoutResourceKey<Resources>,\n CallbackName\n >[LayoutResourceKey<Resources>]\n >\n >;\n } & {\n name: Names & Record<Exclude<keyof Names, ResourceKeys[number]>, never>;\n },\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n MappedResourceLayoutArguments<Resources, ResourceKeys, Names, CallbackName>,\n CustomProps\n >;\n\n /**\n * Creates a scoped layout factory with one default-name callback shared by\n * every selected resource. The callback receives a capitalized resource\n * whose `toLowerCase()` result retains the corresponding literal type.\n *\n * @example\n * createResourceLayout.forResources({\n * resources: ['users', 'admins'],\n * name: resource => `${resource}Page`,\n * })\n *\n * @param options The selected resources and shared default-name callback.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n const Name extends string,\n >(\n options: {\n resources: ReadonlyArray<LayoutResourceKey<Resources>>;\n name: (resource: CapitalizedResource<ResourceKeys[number]>) => Name;\n } & { resources: ResourceKeys },\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n SharedResourceLayoutArguments<Resources, ResourceKeys, Name>,\n CustomProps\n >;\n\n /**\n * Creates a scoped layout factory from a resource-keyed configuration.\n * Only configured resources are available from the returned factory.\n *\n * @example\n * createResourceLayout.forResources({\n * users: { name: resource => `${resource}Page` },\n * admins: { name: 'AdminDirectory' },\n * })\n *\n * @param options Resource-keyed layout defaults.\n * @returns A layout factory scoped to the configured resources.\n */\n <\n const CallbackName extends string,\n const Selection extends ResourceLayoutSelection<Resources, CallbackName>,\n >(\n options: Selection &\n AtLeastOneResourceLayoutSelection<Resources, CallbackName> &\n Partial<\n Record<Exclude<'resources', LayoutResourceKey<Resources>>, never>\n > &\n Record<Exclude<keyof Selection, LayoutResourceKey<Resources>>, never>,\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n SelectedResourceLayoutArguments<Selection>,\n CustomProps\n >;\n};\n\n/**\n * Names a scoped component cannot use. Scoped components are attached to\n * function objects, so they collide with the component's own statics and with\n * non-writable `Function.prototype` properties, where `Object.assign` throws.\n */\nconst reservedScopedComponentNames = new Set([\n 'apply',\n 'arguments',\n 'bind',\n 'call',\n 'caller',\n 'displayName',\n 'length',\n 'name',\n 'props',\n 'prototype',\n 'resource',\n]);\n\ntype CreateForResourcesOptions<\n Resources extends ReadonlyArray<ResourceDefinition>,\n> = {\n createLayoutForResource: (\n defaultName: string | undefined,\n resource: LayoutResourceKey<Resources>,\n ) => unknown;\n createMakeComposableLayout?: () => (\n options: Record<string, unknown>,\n ) => unknown;\n createResourceLayout: (options: Record<string, unknown>) => unknown;\n getComponentPropDefinitions: (\n resource: LayoutResourceKey<Resources>,\n ) => Record<string, AnyBuiltPropDefinition>;\n};\n\nexport function createForResources<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>,\n CustomProps extends InPropsObject,\n>({\n createLayoutForResource,\n createMakeComposableLayout,\n createResourceLayout,\n getComponentPropDefinitions,\n}: CreateForResourcesOptions<Resources>) {\n return ((...resourcesOrOptions: Array<unknown>) => {\n const firstArgument = resourcesOrOptions[0];\n let resourceOptions: Array<{\n resource: LayoutResourceKey<Resources>;\n name?:\n | string\n | ((\n resource: CapitalizedResource<LayoutResourceKey<Resources>>,\n ) => string);\n }>;\n\n if (typeof firstArgument === 'string') {\n resourceOptions = resourcesOrOptions.map((resource) => ({\n resource: resource as LayoutResourceKey<Resources>,\n }));\n } else if (\n firstArgument !== null &&\n typeof firstArgument === 'object' &&\n 'resources' in firstArgument &&\n Array.isArray(firstArgument.resources)\n ) {\n const { name, resources } = firstArgument as {\n name?: ResourcesLayoutName<LayoutResourceKey<Resources>>;\n resources: Array<LayoutResourceKey<Resources>>;\n };\n resourceOptions = resources.map((resource) => ({\n name: typeof name === 'function' ? name : name?.[resource],\n resource,\n }));\n } else {\n resourceOptions = Object.entries(firstArgument ?? {}).map(\n ([resource, options]) => ({\n ...(options as {\n name?:\n | string\n | ((\n resource: CapitalizedResource<LayoutResourceKey<Resources>>,\n ) => string);\n }),\n resource: resource as LayoutResourceKey<Resources>,\n }),\n );\n }\n\n const defaultNames = new Map(\n resourceOptions.map(({ name, resource }) => [\n resource,\n typeof name === 'function'\n ? name(\n capitalize(resource) as CapitalizedResource<\n LayoutResourceKey<Resources>\n >,\n )\n : name,\n ]),\n );\n\n function scopedCreateResourceLayout(options: Record<string, unknown>) {\n const resource = options.resource as LayoutResourceKey<Resources>;\n\n return createResourceLayout({\n ...options,\n name: options.name ?? defaultNames.get(resource),\n });\n }\n\n function scopedForResource(options: {\n name?: string;\n resource: LayoutResourceKey<Resources>;\n }) {\n return createLayoutForResource(\n options.name ?? defaultNames.get(options.resource),\n options.resource,\n );\n }\n\n type ScopedComponentRenderFn = (\n props: Record<string, unknown>,\n components: Record<string, (props?: never) => JSX.Element>,\n ) => JSX.Element;\n\n type ScopedResourceScopedComponentDefinition = {\n props?: Record<string, AnyBuiltPropDefinition>;\n render: ScopedComponentRenderFn;\n };\n\n type ScopedComponentEntry = {\n [option: string]: unknown;\n name?: string;\n components?: Record<string, ScopedResourceScopedComponentDefinition>;\n render: ScopedComponentRenderFn;\n };\n\n function createComponent(componentOptions: {\n props?: {\n include?: Record<string, true | 'optional'>;\n custom?: Record<string, AnyBuiltPropDefinition>;\n };\n resources?: Record<string, ScopedComponentEntry>;\n render: (\n props: Record<string, unknown>,\n context: Record<string, (props: never) => JSX.Element>,\n ) => JSX.Element;\n }) {\n const include = componentOptions.props?.include ?? {};\n const custom = componentOptions.props?.custom ?? {};\n const selectedResources = new Set(\n resourceOptions.map(({ resource }) => resource),\n );\n const componentPropsContext = createContext<\n Record<string, unknown> | undefined\n >(undefined);\n const definedEntries = new Map<\n LayoutResourceKey<Resources>,\n ScopedComponentEntry\n >();\n\n for (const [key, entry] of Object.entries(\n componentOptions.resources ?? {},\n )) {\n const resource = key as LayoutResourceKey<Resources>;\n\n if (!selectedResources.has(resource)) {\n throw new Error(\n `Resource \"${key}\" is not available in this scoped component`,\n );\n }\n\n definedEntries.set(resource, entry);\n }\n\n /** Resolved scoped components, per resource. */\n const resourceScopedComponents = new Map<\n LayoutResourceKey<Resources>,\n Record<string, (props?: never) => JSX.Element>\n >();\n const contextResources = new Map<string, LayoutResourceKey<Resources>>();\n const renderContext: Record<string, (props: never) => JSX.Element> =\n Object.fromEntries(\n [...definedEntries].map(([resource, entry]) => {\n const contextKey = capitalize(resource);\n\n if (contextKey === 'Root') {\n throw new Error(\n `Resource \"${resource}\" maps to the reserved render context key \"Root\"`,\n );\n }\n\n const existingResource = contextResources.get(contextKey);\n\n if (existingResource !== undefined) {\n throw new Error(\n `Resources \"${existingResource}\" and \"${resource}\" both map to render context key \"${contextKey}\"`,\n );\n }\n\n contextResources.set(contextKey, resource);\n\n /**\n * Built once per resource so every scoped component keeps a stable\n * identity, and shared by the resource render, the render context,\n * and any component bound through `asHOF()`.\n */\n const scopedComponents: Record<\n string,\n (props?: never) => JSX.Element\n > = {};\n\n for (const [name, definition] of Object.entries(\n entry.components ?? {},\n )) {\n if (reservedScopedComponentNames.has(name)) {\n throw new Error(\n `Scoped component \"${name}\" for resource \"${resource}\" uses a reserved name`,\n );\n }\n\n const ownPropDefinitions = definition.props ?? {};\n\n scopedComponents[name] = function ScopedComponent(\n ownProps?: Record<string, unknown>,\n ) {\n const componentProps = useContext(componentPropsContext);\n\n if (componentProps === undefined) {\n throw new Error(\n `Scoped component \"${name}\" must be rendered inside its scoped component`,\n );\n }\n\n const resolvedOwnProps = ownProps ?? {};\n\n validateProps(ownPropDefinitions, resolvedOwnProps);\n\n return definition.render(\n { ...componentProps, ...resolvedOwnProps, resource },\n scopedComponents,\n );\n } as (props?: never) => JSX.Element;\n }\n\n resourceScopedComponents.set(resource, scopedComponents);\n\n function ResourceRender() {\n const componentProps = useContext(componentPropsContext);\n\n if (componentProps === undefined) {\n throw new Error(\n `Render context component \"${contextKey}\" must be rendered inside its scoped component`,\n );\n }\n\n return entry.render(\n { ...componentProps, resource },\n scopedComponents,\n );\n }\n\n return [contextKey, Object.assign(ResourceRender, scopedComponents)];\n }),\n );\n\n /**\n * Layouts are created once per resource and cached. Creating one during\n * render would hand React a new component type on every pass, remounting\n * the whole subtree.\n */\n const roots = new Map<\n LayoutResourceKey<Resources>,\n (props: Record<string, unknown>) => JSX.Element\n >();\n\n function getRoot(resource: LayoutResourceKey<Resources>) {\n let root = roots.get(resource);\n\n if (root === undefined) {\n const entry = definedEntries.get(resource);\n\n if (entry === undefined) {\n // Without an entry there are no create-time layout options, so a\n // layout with required props would fail validation deep inside\n // its own render. Fail here instead, naming the fix.\n throw new Error(\n `Render context component \"Root\" requires a \"resources.${resource}\" entry to build the layout for resource \"${resource}\"`,\n );\n }\n\n const { render: _render, ...layoutOptions } = entry;\n\n root = scopedCreateResourceLayout({\n ...layoutOptions,\n name:\n layoutOptions.name ??\n defaultNames.get(resource) ??\n capitalize(resource),\n resource,\n }) as (props: Record<string, unknown>) => JSX.Element;\n roots.set(resource, root);\n }\n\n return root;\n }\n\n function Root(rootProps: Record<string, unknown>) {\n const componentProps = useContext(componentPropsContext);\n\n if (componentProps === undefined) {\n throw new Error(\n 'Render context component \"Root\" must be rendered inside its scoped component',\n );\n }\n\n return createElement(\n getRoot(componentProps.resource as LayoutResourceKey<Resources>),\n rootProps,\n );\n }\n\n renderContext.Root = Root;\n\n function Component(componentProps: Record<string, unknown>) {\n const componentResource =\n componentProps.resource as LayoutResourceKey<Resources>;\n\n if (!selectedResources.has(componentResource)) {\n throw new Error(\n `Resource \"${componentResource}\" is not available in this scoped component`,\n );\n }\n\n const availableDefinitions =\n getComponentPropDefinitions(componentResource);\n const definitionsToValidate: Record<string, AnyBuiltPropDefinition> =\n {};\n\n for (const [key, inclusion] of Object.entries(include)) {\n const definition = availableDefinitions[key];\n\n if (!definition) {\n continue;\n }\n\n const propKey =\n 'type' in definition && definition.type === 'JSX.Element'\n ? capitalize(key)\n : key;\n\n if (inclusion === true || propKey in componentProps) {\n definitionsToValidate[propKey] = definition;\n }\n }\n\n for (const [key, definition] of Object.entries(custom)) {\n if (key === 'children' || key === 'resource') {\n continue;\n }\n\n const propKey =\n 'type' in definition && definition.type === 'JSX.Element'\n ? capitalize(key)\n : key;\n definitionsToValidate[propKey] = definition;\n }\n\n validateProps(definitionsToValidate, componentProps);\n\n return createElement(\n componentPropsContext.Provider,\n { value: componentProps },\n componentOptions.render(componentProps, renderContext),\n );\n }\n\n /**\n * Bound components are created once per resource and cached. Returning a\n * fresh component from the factory would hand React a new component type\n * whenever the caller rebinds, remounting the subtree.\n */\n const boundComponents = new Map<\n LayoutResourceKey<Resources>,\n (props: Record<string, unknown>) => JSX.Element\n >();\n\n function bindResource(resource: LayoutResourceKey<Resources>) {\n if (!selectedResources.has(resource)) {\n throw new Error(\n `Resource \"${resource}\" is not available in this scoped component`,\n );\n }\n\n let boundComponent = boundComponents.get(resource);\n\n if (boundComponent === undefined) {\n boundComponent = Object.assign(\n (boundProps: Record<string, unknown>) =>\n createElement(Component, { ...boundProps, resource }),\n {\n displayName: `ScopedResourceComponent(${resource})`,\n props: undefined,\n resource: undefined,\n },\n resourceScopedComponents.get(resource) ?? {},\n );\n boundComponents.set(resource, boundComponent);\n }\n\n return boundComponent;\n }\n\n function asHOF() {\n return bindResource;\n }\n\n return Object.assign(Component, {\n asHOF,\n displayName: 'ScopedResourceComponent',\n props: undefined,\n });\n }\n\n const scopedExtras: {\n createComponent: typeof createComponent;\n forResource: typeof scopedForResource;\n makeComposable?: (options: Record<string, unknown>) => unknown;\n resources: undefined;\n } = {\n createComponent,\n forResource: scopedForResource,\n resources: undefined,\n };\n\n if (createMakeComposableLayout) {\n const makeComposableLayout = createMakeComposableLayout();\n\n scopedExtras.makeComposable = (options) => {\n const resource = options.resource as LayoutResourceKey<Resources>;\n\n return makeComposableLayout({\n ...options,\n name: options.name ?? defaultNames.get(resource),\n });\n };\n }\n\n return Object.assign(scopedCreateResourceLayout, scopedExtras);\n }) as unknown as CreateResourceLayoutForResourcesFn<\n Resources,\n InProps,\n Composables,\n IncludeProps,\n CustomProps\n >;\n}\n"],"mappings":";;;;;;;;;;AA+gCA,MAAM,+BAA+B,IAAI,IAAI;CAC3C;CACA;CACA;C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"}
1
+ {"version":3,"file":"for-resources.mjs","names":[],"sources":["../../src/create-config/for-resources.ts"],"sourcesContent":["import {\n createContext,\n createElement,\n type JSX,\n type ReactNode,\n useContext,\n} from 'react';\nimport type {\n ComposableComponents,\n ComposableResourceLayout,\n} from '@jfdevelops/react-layout-composables';\nimport {\n type AnyBuiltPropDefinition,\n type ResolveProps,\n type ResolvedBuiltPropShape,\n validateProps,\n} from '@jfdevelops/react-layout-validator';\nimport type {\n IncludedProps,\n InPropsDefinition,\n InPropsObject,\n MergedLayoutInProps,\n ResolvedIncludedPropsAsDefined,\n} from '../props';\nimport type { LayoutResourceKey, ResourceDefinition } from '../resource';\nimport { capitalize } from '../utils/capitalize';\nimport type { BaseComponent, Show } from '../utils';\nimport type {\n LayoutIncludeProps,\n LayoutPropsForResource,\n ResourceLayoutComponent,\n} from './define-layout';\nimport type {\n CreatedLayoutForResource,\n CreateLayoutForResourceOptions,\n CreateResourceLayoutOptionsBase,\n SetDefaultPropForResourceFn,\n} from './for-resource';\n\ntype CapitalizedResource<Resource extends string> = Resource extends Resource\n ? {\n toLowerCase: () => Lowercase<Capitalize<Resource>>;\n } & Capitalize<Resource>\n : never;\n\ntype ResourceLayoutName<\n Resource extends string,\n Name extends string = string,\n> = Name | ((resource: CapitalizedResource<Resource>) => Name);\n\ntype ResourceLayoutNames<\n Resource extends string,\n CallbackName extends string = string,\n> = {\n [TargetResource in Resource]?:\n | string\n | ((resource: CapitalizedResource<TargetResource>) => CallbackName);\n};\n\ntype AtLeastOneResourceLayoutNameKey<Resource extends string> = {\n [TargetResource in Resource]: Record<TargetResource, unknown> &\n Partial<Record<Exclude<Resource, TargetResource>, unknown>>;\n}[Resource];\n\ntype SelectedResourceLayoutNames<\n Resource extends string,\n SelectedResource extends Resource,\n CallbackName extends string,\n> = {\n [TargetResource in Resource as TargetResource extends SelectedResource\n ? TargetResource\n : never]?:\n | string\n | ((resource: CapitalizedResource<TargetResource>) => CallbackName);\n};\n\ntype ResourcesLayoutName<Resource extends string> =\n | Exclude<ResourceLayoutName<Resource>, string>\n | ResourceLayoutNames<Resource>;\n\ntype ResourceLayoutSelection<\n Resources extends ReadonlyArray<ResourceDefinition>,\n CallbackName extends string = string,\n> = {\n [Resource in LayoutResourceKey<Resources>]?: {\n name?: string | ((resource: CapitalizedResource<Resource>) => CallbackName);\n };\n};\n\ntype AtLeastOneResourceLayoutSelection<\n Resources extends ReadonlyArray<ResourceDefinition>,\n CallbackName extends string,\n> = {\n [Resource in LayoutResourceKey<Resources>]: Required<\n Pick<ResourceLayoutSelection<Resources, CallbackName>, Resource>\n > &\n Omit<ResourceLayoutSelection<Resources, CallbackName>, Resource>;\n}[LayoutResourceKey<Resources>];\n\ntype SelectedLayoutResources<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Arguments extends ReadonlyArray<unknown>,\n> =\n Arguments extends ReadonlyArray<LayoutResourceKey<Resources>>\n ? Arguments[number]\n : Arguments[0] extends {\n resources: ReadonlyArray<infer Resource>;\n }\n ? Resource & LayoutResourceKey<Resources>\n : keyof Arguments[0] & LayoutResourceKey<Resources>;\n\ntype ResolveResourceLayoutName<Name> = Name extends (\n ...args: never[]\n) => infer Result\n ? Result & string\n : Name extends string\n ? Name\n : string;\n\ntype NormalizeCapitalizedResourceName<\n Name extends string,\n Resource extends string,\n> = Name extends Name\n ? NormalizeCapitalizedResourceNameMatch<Name, Resource> extends infer Match\n ? [Match] extends [never]\n ? Name\n : Match\n : never\n : never;\n\ntype NormalizeCapitalizedResourceNameMatch<\n Name extends string,\n Resource extends string,\n> = Resource extends Resource\n ? Name extends `${CapitalizedResource<Resource>}${infer Suffix}`\n ? `${Capitalize<Resource>}${Suffix}`\n : never\n : never;\n\ntype SelectedResourceLayoutName<Arguments, Resource extends string> =\n Arguments extends ReadonlyArray<string>\n ? string\n : Arguments extends readonly [infer Options]\n ? Options extends {\n resources: ReadonlyArray<string>;\n name?: infer Name;\n }\n ? Name extends (...args: never[]) => unknown\n ? ResolveResourceLayoutName<Name>\n : Name extends Record<Resource, infer ResourceName>\n ? ResolveResourceLayoutName<ResourceName>\n : string\n : Options extends Record<Resource, infer ResourceOptions>\n ? ResourceOptions extends { name?: infer Name }\n ? ResolveResourceLayoutName<Name>\n : string\n : string\n : string;\n\ntype NormalizeResourceLayoutNames<Names, CallbackName extends string> = {\n [Resource in keyof Names]: Names[Resource] extends (\n ...args: never[]\n ) => unknown\n ? (\n resource: CapitalizedResource<Resource & string>,\n ) => NormalizeCapitalizedResourceName<CallbackName, Resource & string>\n : Names[Resource];\n};\n\ntype NormalizeResourceLayoutSelection<Selection> = {\n [Resource in keyof Selection]: Selection[Resource] extends {\n name: infer Name;\n }\n ? {\n name: Name extends (...args: never[]) => unknown\n ? (\n resource: CapitalizedResource<Resource & string>,\n ) => NormalizeCapitalizedResourceName<\n ResolveResourceLayoutName<Name>,\n Resource & string\n >\n : Name;\n }\n : Selection[Resource];\n};\n\ntype SharedResourceLayoutArguments<\n Resources extends ReadonlyArray<ResourceDefinition>,\n ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n Name extends string,\n> = readonly [\n {\n resources: ResourceKeys;\n name: (\n resource: CapitalizedResource<ResourceKeys[number]>,\n ) => NormalizeCapitalizedResourceName<Name, ResourceKeys[number]>;\n },\n];\n\ntype MappedResourceLayoutArguments<\n Resources extends ReadonlyArray<ResourceDefinition>,\n ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n Names,\n CallbackName extends string,\n> = readonly [\n {\n resources: ResourceKeys;\n name: NormalizeResourceLayoutNames<Names, CallbackName>;\n },\n];\n\ntype SelectedResourceLayoutArguments<Selection> = readonly [\n NormalizeResourceLayoutSelection<Selection>,\n];\n\ntype HasResourceLayoutName<Arguments, Resource extends string> =\n Arguments extends ReadonlyArray<string>\n ? false\n : Arguments extends readonly [infer Options]\n ? Options extends {\n resources: ReadonlyArray<string>;\n name: infer Name;\n }\n ? Name extends (...args: never[]) => unknown\n ? true\n : Name extends Record<Resource, unknown>\n ? true\n : false\n : Options extends Record<Resource, infer ResourceOptions>\n ? 'name' extends keyof ResourceOptions\n ? true\n : false\n : false\n : false;\n\ntype ScopedCreateResourceLayoutOptions<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n Name extends string,\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Props extends InPropsObject,\n> = LayoutPropsForResource<Resources, InProps, Composables> & {\n resource: Resource;\n props?: Props;\n} & (HasResourceLayoutName<Arguments, Resource> extends true\n ? { name?: Name }\n : { name: Name });\n\ntype ScopedCreateResourceLayoutFnImpl<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n CustomProps extends InPropsObject,\n> = <\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Name extends string = SelectedResourceLayoutName<Arguments, Resource>,\n Props extends InPropsObject = {},\n>(\n options: ScopedCreateResourceLayoutOptions<\n Resources,\n InProps,\n Composables,\n Arguments,\n Name,\n Resource,\n Props\n >,\n) => ResourceLayoutComponent<Name, CustomProps, Composables, Resource>;\n\ntype ScopedCreateLayoutForResource<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n CustomProps extends InPropsObject,\n> = <\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Name extends string = SelectedResourceLayoutName<Arguments, Resource>,\n>(\n options: CreateLayoutForResourceOptions<Resources, Name, Resource>,\n) => CreatedLayoutForResource<\n Resources,\n InProps,\n Composables,\n Name,\n Resource,\n CustomProps\n> & {\n setDefaults: SetDefaultPropForResourceFn<\n Resources,\n InProps,\n Composables,\n Name,\n Resource,\n CustomProps\n >;\n};\n\ntype ScopedCreateResourceLayoutMakeComposableFn<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n> = <\n Resource extends SelectedLayoutResources<Resources, Arguments>,\n Name extends string = SelectedResourceLayoutName<Arguments, Resource>,\n Props extends InPropsObject = {},\n>(\n options: Omit<\n CreateResourceLayoutOptionsBase<Resources, Name, Resource>,\n 'name'\n > &\n Partial<LayoutPropsForResource<Resources, InProps, Composables>> & {\n props?: Props;\n } & (HasResourceLayoutName<Arguments, Resource> extends true\n ? { name?: Name }\n : { name: Name }),\n) => ComposableResourceLayout<Composables, Name, any, any, any>;\n\ntype ScopedComponentAvailableProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n> = MergedLayoutInProps<Resources, InProps, Composables> & LayoutCustomProps;\n\ntype ScopedResourceComponentProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n Resource extends string,\n> = Show<\n Omit<\n ResolvedIncludedPropsAsDefined<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >,\n ComponentIncludeProps\n > &\n ResolvedBuiltPropShape<ComponentCustomProps>,\n 'children' | 'resource'\n > & {\n children?: ReactNode;\n resource: Resource;\n }\n>;\n\n/**\n * Fields reverse-inferred from each scoped component declaration. Only `props`\n * belongs here — putting `render` in the reverse map makes TypeScript infer it\n * as `unknown` (function types don't reverse-map cleanly). `render` is supplied\n * by the constraint intersection instead, like the playground's `transform`.\n */\ntype ScopedComponentShape = {\n props?: InPropsObject;\n};\n\n/**\n * Homomorphic pick of reverse-mapped scoped-component fields. Paired with a\n * mapped type over the components object, this lets each entry's inferred\n * `props` flow into sibling render signatures.\n */\ntype JustScopedComponent<T> = {\n [Key in keyof T & keyof ScopedComponentShape]: T[Key];\n};\n\n/**\n * Resources with no `components` reverse-infer as `unknown`. Treat that as an\n * empty map so sibling/context access stays closed.\n */\ntype NormalizeScopedComponentsMap<Components> = unknown extends Components\n ? {}\n : Components extends Record<string, unknown>\n ? Components\n : {};\n\n/** Extracts the prop definitions declared on a scoped component. */\ntype ScopedComponentOwnProps<Definition> = Definition extends {\n props: infer Props;\n}\n ? Props extends InPropsObject\n ? Props\n : {}\n : {};\n\n/**\n * A scoped component's call signature. Components that declare no props are\n * callable with no arguments.\n */\ntype ScopedComponentSignature<Props> = {} extends Props\n ? (props?: Props) => JSX.Element\n : (props: Props) => JSX.Element;\n\n/**\n * The sibling / context components for one resource, keyed by their declared\n * names with call-site prop types.\n */\ntype ResolvedScopedComponentsMap<Components> = {\n [Name in keyof NormalizeScopedComponentsMap<Components>]: ScopedComponentSignature<\n Show<\n ResolvedBuiltPropShape<\n ScopedComponentOwnProps<NormalizeScopedComponentsMap<Components>[Name]>\n >\n >\n >;\n};\n\ntype ScopedResourceComponentRenderContext<\n ComponentsByResource,\n LayoutCustomProps extends InPropsObject,\n> = {\n /**\n * The resource layout for the component's current `resource`, created\n * internally from that resource's entry options. Accepts the layout's\n * custom props.\n */\n Root: (props: Show<ResolveProps<LayoutCustomProps>>) => JSX.Element;\n} & {\n [Resource in keyof ComponentsByResource as Capitalize<\n Resource & string\n >]-?: (() => JSX.Element) &\n ResolvedScopedComponentsMap<ComponentsByResource[Resource]>;\n};\n\n/**\n * Reverse-mapped `resources` constraint.\n *\n * `ComponentsByResource` is inferred from each entry's `components` object.\n * Mapping back over those keys types every nested `render`'s second argument\n * with the other components for that resource — excluding the current\n * component when typing a scoped component's own `render`.\n *\n * The parameter must not carry a default: TypeScript contextually types from a\n * parameter's default when it has one, and `{}` would silently degrade every\n * nested render to `any`.\n */\ntype ScopedComponentResourceEntries<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n ComponentsByResource,\n> = {\n [Resource in keyof ComponentsByResource]: LayoutPropsForResource<\n Resources,\n InProps,\n Composables\n > & {\n /**\n * Overrides the layout name used by `context.Root` for this resource.\n * Defaults to the scope's configured name, then the capitalized resource.\n */\n name?: string;\n /**\n * Components scoped to this resource. Each becomes a component on this\n * resource's render context, on `context.<Resource>`, and on the component\n * returned by `asHOF()`.\n */\n components?: {\n [Name in keyof ComponentsByResource[Resource]]: JustScopedComponent<\n ComponentsByResource[Resource][Name]\n > & {\n /** Props accepted by this component, validated at its call site. */\n props?: InPropsObject;\n /**\n * Renders this component. Receives the scoped component's props plus\n * this component's own props, and the other components for this\n * resource (excluding itself).\n */\n render: (\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource & string\n > &\n Show<\n ResolvedBuiltPropShape<\n ScopedComponentOwnProps<ComponentsByResource[Resource][Name]>\n >\n >,\n components: Omit<\n ResolvedScopedComponentsMap<ComponentsByResource[Resource]>,\n Name\n >,\n ) => JSX.Element;\n };\n };\n /** Renders this resource's content inside the shared render function. */\n render: (\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource & string\n >,\n components: ResolvedScopedComponentsMap<ComponentsByResource[Resource]>,\n ) => JSX.Element;\n };\n} & Record<\n Exclude<\n keyof ComponentsByResource,\n SelectedLayoutResources<Resources, Arguments>\n >,\n never\n>;\n\n/**\n * Props of a resource-bound component. `resource` is supplied by the binding,\n * so it is removed from the call site.\n */\ntype ScopedBoundResourceComponentProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n Resource extends string,\n> = Show<\n Omit<\n ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >,\n 'resource'\n >\n>;\n\ntype ScopedBoundResourceComponent<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n ComponentsByResource,\n Resource extends string,\n> = BaseComponent<\n string,\n ScopedBoundResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >\n> &\n ResolvedScopedComponentsMap<\n Resource extends keyof ComponentsByResource\n ? ComponentsByResource[Resource]\n : {}\n > & {\n (\n props: ScopedBoundResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >,\n ): JSX.Element;\n /**\n * Type-only property containing the bound resource. This property is\n * `undefined` at runtime.\n */\n readonly resource: Resource;\n };\n\ntype ScopedResourceComponent<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n LayoutCustomProps extends InPropsObject,\n ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n >,\n ComponentCustomProps extends InPropsObject,\n ComponentsByResource,\n> = BaseComponent<\n string,\n ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n SelectedLayoutResources<Resources, Arguments>\n >\n> & {\n /**\n * The `resource` prop drives the generic, so it is inferred from the call\n * site. Explicit type arguments are never needed.\n */\n <const Resource extends SelectedLayoutResources<Resources, Arguments>>(\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n Resource\n >,\n ): JSX.Element;\n /**\n * Returns a factory that binds the component to one resource. The bound\n * component accepts every prop except `resource`, which the binding supplies.\n *\n * Each resource is bound once and cached, so the returned component type is\n * stable across renders.\n *\n * @example\n * const createDirectory = Directory.asHOF()\n * const UsersDirectory = createDirectory('users')\n *\n * <UsersDirectory title='Users' />\n *\n * @returns A factory producing a component bound to the given resource.\n */\n asHOF(): <\n const Resource extends SelectedLayoutResources<Resources, Arguments>,\n >(\n resource: Resource,\n ) => ScopedBoundResourceComponent<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n ComponentsByResource,\n Resource\n >;\n};\n\ntype ScopedCreateComponent<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n LayoutCustomProps extends InPropsObject,\n> = <\n // Declared first and deliberately without a default: TypeScript\n // contextually types from a parameter's default when one exists, so a\n // default here would type every nested render as `any`. Inferred via a\n // reverse mapped type from each entry's `components` object.\n const ComponentsByResource,\n const ComponentIncludeProps extends IncludedProps<\n ScopedComponentAvailableProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps\n >\n > = {},\n ComponentCustomProps extends InPropsObject = {},\n>(options: {\n props?: {\n /** Props from the resource layout definition to expose to the component. */\n include?: ComponentIncludeProps;\n /** Additional props accepted by the component. */\n custom?: ComponentCustomProps;\n };\n /**\n * Per-resource content, keyed by resource. Each entry holds that resource's\n * create-time layout options, its scoped `components`, and its `render`.\n */\n resources?: ScopedComponentResourceEntries<\n Resources,\n InProps,\n Composables,\n Arguments,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n ComponentsByResource\n >;\n /**\n * Renders the scoped component. `children` and `resource` are always\n * available. The context contains `Root`, the layout for the current\n * resource, plus a capitalized component per defined resource.\n */\n render: (\n props: ScopedResourceComponentProps<\n Resources,\n InProps,\n Composables,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n SelectedLayoutResources<Resources, Arguments>\n >,\n context: ScopedResourceComponentRenderContext<\n ComponentsByResource,\n LayoutCustomProps\n >,\n ) => JSX.Element;\n}) => ScopedResourceComponent<\n Resources,\n InProps,\n Composables,\n Arguments,\n LayoutCustomProps,\n ComponentIncludeProps,\n ComponentCustomProps,\n ComponentsByResource\n>;\n\ntype ScopedCreateResourceLayoutFn<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n Arguments extends ReadonlyArray<unknown>,\n CustomProps extends InPropsObject,\n> = ScopedCreateResourceLayoutFnImpl<\n Resources,\n InProps,\n Composables,\n Arguments,\n CustomProps\n> & {\n /**\n * Creates a component shared by the target resources. Included layout props\n * become component props, and `children` is always available as an optional\n * prop in both the render callback and at the call site.\n *\n * Each key of `resources` holds that resource's create-time layout options\n * alongside its `render`. The render context exposes `Root` — the layout for\n * the current resource, built from those options — and one capitalized\n * component per key present in `resources`.\n *\n * Each entry may also declare `components` — components scoped to that\n * resource, available to the entry's own `render`, on `context.<Resource>`,\n * and on the component returned by `asHOF()`.\n *\n * @example\n * const Directory = createDirectoryLayout.createComponent({\n * props: { include: { title: true, actions: 'optional' } },\n * resources: {\n * users: {\n * title: 'Users',\n * components: {\n * Toolbar: { render: ({ title }) => <nav>{title}</nav> },\n * },\n * render: ({ resource }, components) => (\n * <>\n * <components.Toolbar />\n * <span>{resource}</span>\n * </>\n * ),\n * },\n * admins: {\n * title: 'Admins',\n * render: ({ resource }) => <span>{resource}</span>,\n * },\n * },\n * render: ({ actions, children, resource }, context) => (\n * <context.Root actions={actions}>\n * {children}\n * {resource === 'users' ? <context.Users /> : <context.Admins />}\n * <context.Users.Toolbar />\n * </context.Root>\n * ),\n * })\n *\n * <Directory resource='users' title='Users' />\n *\n * @param options The props configuration, per-resource entries, and the\n * shared component render function.\n * @returns A component scoped to the selected resources.\n */\n createComponent: ScopedCreateComponent<\n Resources,\n InProps,\n Composables,\n Arguments,\n CustomProps\n >;\n forResource: ScopedCreateLayoutForResource<\n Resources,\n InProps,\n Composables,\n Arguments,\n CustomProps\n >;\n /**\n * Type-only property containing the target resource union. This property is\n * `undefined` at runtime and exists solely for extracting the scoped type.\n *\n * @example\n * type AccountResource = typeof createAccountLayout.resources;\n */\n readonly resources: SelectedLayoutResources<Resources, Arguments>;\n} & ([keyof Composables] extends [never]\n ? {}\n : {\n makeComposable: ScopedCreateResourceLayoutMakeComposableFn<\n Resources,\n InProps,\n Composables,\n Arguments\n >;\n });\n\nexport type CreateResourceLayoutForResourcesFn<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents = {},\n IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables> = {},\n CustomProps extends InPropsObject = {},\n> = {\n /**\n * Creates a layout factory scoped to the listed resources.\n *\n * Layout names must be supplied when a layout is created.\n *\n * @example\n * createResourceLayout.forResources('users', 'admins')\n *\n * @param resources Resources available from the returned layout factory.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends readonly [\n LayoutResourceKey<Resources>,\n ...Array<LayoutResourceKey<Resources>>,\n ],\n >(\n ...resources: ResourceKeys\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n ResourceKeys,\n CustomProps\n >;\n\n /**\n * Creates a layout factory scoped to a resource list without default names.\n *\n * @example\n * createResourceLayout.forResources({ resources: ['users', 'admins'] })\n *\n * @param options The resources to expose without configured default names.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n >(options: {\n resources: ResourceKeys;\n name?: never;\n }): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n readonly [{ resources: ResourceKeys }],\n CustomProps\n >;\n\n /**\n * Creates a scoped layout factory with optional default names per resource.\n *\n * Each map key is limited to the resources selected in `resources`. Values\n * can be strings or callbacks receiving that resource's capitalized name.\n *\n * @example\n * createResourceLayout.forResources({\n * resources: ['users', 'admins'],\n * name: {\n * users: resource => `${resource}Page`,\n * admins: 'AdminDirectory',\n * },\n * })\n *\n * @param options The selected resources and their optional default names.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n const CallbackName extends string,\n const Names,\n >(\n options: {\n resources: ResourceKeys;\n name: SelectedResourceLayoutNames<\n LayoutResourceKey<Resources>,\n NoInfer<ResourceKeys[number]>,\n CallbackName\n > &\n AtLeastOneResourceLayoutNameKey<NoInfer<ResourceKeys[number]>> &\n Record<\n string,\n NonNullable<\n ResourceLayoutNames<\n LayoutResourceKey<Resources>,\n CallbackName\n >[LayoutResourceKey<Resources>]\n >\n >;\n } & {\n name: Names & Record<Exclude<keyof Names, ResourceKeys[number]>, never>;\n },\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n MappedResourceLayoutArguments<Resources, ResourceKeys, Names, CallbackName>,\n CustomProps\n >;\n\n /**\n * Creates a scoped layout factory with one default-name callback shared by\n * every selected resource. The callback receives a capitalized resource\n * whose `toLowerCase()` result retains the corresponding literal type.\n *\n * @example\n * createResourceLayout.forResources({\n * resources: ['users', 'admins'],\n * name: resource => `${resource}Page`,\n * })\n *\n * @param options The selected resources and shared default-name callback.\n * @returns A layout factory scoped to the selected resources.\n */\n <\n const ResourceKeys extends ReadonlyArray<LayoutResourceKey<Resources>>,\n const Name extends string,\n >(\n options: {\n resources: ReadonlyArray<LayoutResourceKey<Resources>>;\n name: (resource: CapitalizedResource<ResourceKeys[number]>) => Name;\n } & { resources: ResourceKeys },\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n SharedResourceLayoutArguments<Resources, ResourceKeys, Name>,\n CustomProps\n >;\n\n /**\n * Creates a scoped layout factory from a resource-keyed configuration.\n * Only configured resources are available from the returned factory.\n *\n * @example\n * createResourceLayout.forResources({\n * users: { name: resource => `${resource}Page` },\n * admins: { name: 'AdminDirectory' },\n * })\n *\n * @param options Resource-keyed layout defaults.\n * @returns A layout factory scoped to the configured resources.\n */\n <\n const CallbackName extends string,\n const Selection extends ResourceLayoutSelection<Resources, CallbackName>,\n >(\n options: Selection &\n AtLeastOneResourceLayoutSelection<Resources, CallbackName> &\n Partial<\n Record<Exclude<'resources', LayoutResourceKey<Resources>>, never>\n > &\n Record<Exclude<keyof Selection, LayoutResourceKey<Resources>>, never>,\n ): ScopedCreateResourceLayoutFn<\n Resources,\n InProps,\n Composables,\n SelectedResourceLayoutArguments<Selection>,\n CustomProps\n >;\n};\n\n/**\n * Names a scoped component cannot use. Scoped components are attached to\n * function objects, so they collide with the component's own statics and with\n * non-writable `Function.prototype` properties. `__proto__` is reserved so\n * assignment cannot hit the prototype setter on a normal object.\n */\nconst reservedScopedComponentNames = new Set([\n '__proto__',\n 'apply',\n 'arguments',\n 'bind',\n 'call',\n 'caller',\n 'displayName',\n 'length',\n 'name',\n 'props',\n 'prototype',\n 'resource',\n]);\n\ntype CreateForResourcesOptions<\n Resources extends ReadonlyArray<ResourceDefinition>,\n> = {\n createLayoutForResource: (\n defaultName: string | undefined,\n resource: LayoutResourceKey<Resources>,\n ) => unknown;\n createMakeComposableLayout?: () => (\n options: Record<string, unknown>,\n ) => unknown;\n createResourceLayout: (options: Record<string, unknown>) => unknown;\n getComponentPropDefinitions: (\n resource: LayoutResourceKey<Resources>,\n ) => Record<string, AnyBuiltPropDefinition>;\n};\n\nexport function createForResources<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Composables extends ComposableComponents,\n IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>,\n CustomProps extends InPropsObject,\n>({\n createLayoutForResource,\n createMakeComposableLayout,\n createResourceLayout,\n getComponentPropDefinitions,\n}: CreateForResourcesOptions<Resources>) {\n return ((...resourcesOrOptions: Array<unknown>) => {\n const firstArgument = resourcesOrOptions[0];\n let resourceOptions: Array<{\n resource: LayoutResourceKey<Resources>;\n name?:\n | string\n | ((\n resource: CapitalizedResource<LayoutResourceKey<Resources>>,\n ) => string);\n }>;\n\n if (typeof firstArgument === 'string') {\n resourceOptions = resourcesOrOptions.map((resource) => ({\n resource: resource as LayoutResourceKey<Resources>,\n }));\n } else if (\n firstArgument !== null &&\n typeof firstArgument === 'object' &&\n 'resources' in firstArgument &&\n Array.isArray(firstArgument.resources)\n ) {\n const { name, resources } = firstArgument as {\n name?: ResourcesLayoutName<LayoutResourceKey<Resources>>;\n resources: Array<LayoutResourceKey<Resources>>;\n };\n resourceOptions = resources.map((resource) => ({\n name: typeof name === 'function' ? name : name?.[resource],\n resource,\n }));\n } else {\n resourceOptions = Object.entries(firstArgument ?? {}).map(\n ([resource, options]) => ({\n ...(options as {\n name?:\n | string\n | ((\n resource: CapitalizedResource<LayoutResourceKey<Resources>>,\n ) => string);\n }),\n resource: resource as LayoutResourceKey<Resources>,\n }),\n );\n }\n\n const defaultNames = new Map(\n resourceOptions.map(({ name, resource }) => [\n resource,\n typeof name === 'function'\n ? name(\n capitalize(resource) as CapitalizedResource<\n LayoutResourceKey<Resources>\n >,\n )\n : name,\n ]),\n );\n\n function scopedCreateResourceLayout(options: Record<string, unknown>) {\n const resource = options.resource as LayoutResourceKey<Resources>;\n\n return createResourceLayout({\n ...options,\n name: options.name ?? defaultNames.get(resource),\n });\n }\n\n function scopedForResource(options: {\n name?: string;\n resource: LayoutResourceKey<Resources>;\n }) {\n return createLayoutForResource(\n options.name ?? defaultNames.get(options.resource),\n options.resource,\n );\n }\n\n type ScopedComponentRenderFn = (\n props: Record<string, unknown>,\n components: Record<string, (props?: never) => JSX.Element>,\n ) => JSX.Element;\n\n type ScopedResourceScopedComponentDefinition = {\n props?: Record<string, AnyBuiltPropDefinition>;\n render: ScopedComponentRenderFn;\n };\n\n type ScopedComponentEntry = {\n [option: string]: unknown;\n name?: string;\n components?: Record<string, ScopedResourceScopedComponentDefinition>;\n render: ScopedComponentRenderFn;\n };\n\n function createComponent(componentOptions: {\n props?: {\n include?: Record<string, true | 'optional'>;\n custom?: Record<string, AnyBuiltPropDefinition>;\n };\n resources?: Record<string, ScopedComponentEntry>;\n render: (\n props: Record<string, unknown>,\n context: Record<string, (props: never) => JSX.Element>,\n ) => JSX.Element;\n }) {\n const include = componentOptions.props?.include ?? {};\n const custom = componentOptions.props?.custom ?? {};\n const selectedResources = new Set(\n resourceOptions.map(({ resource }) => resource),\n );\n const componentPropsContext = createContext<\n Record<string, unknown> | undefined\n >(undefined);\n const definedEntries = new Map<\n LayoutResourceKey<Resources>,\n ScopedComponentEntry\n >();\n\n for (const [key, entry] of Object.entries(\n componentOptions.resources ?? {},\n )) {\n const resource = key as LayoutResourceKey<Resources>;\n\n if (!selectedResources.has(resource)) {\n throw new Error(\n `Resource \"${key}\" is not available in this scoped component`,\n );\n }\n\n definedEntries.set(resource, entry);\n }\n\n /** Resolved scoped components, per resource. */\n const resourceScopedComponents = new Map<\n LayoutResourceKey<Resources>,\n Record<string, (props?: never) => JSX.Element>\n >();\n const contextResources = new Map<string, LayoutResourceKey<Resources>>();\n const renderContext: Record<string, (props: never) => JSX.Element> =\n Object.fromEntries(\n [...definedEntries].map(([resource, entry]) => {\n const contextKey = capitalize(resource);\n\n if (contextKey === 'Root') {\n throw new Error(\n `Resource \"${resource}\" maps to the reserved render context key \"Root\"`,\n );\n }\n\n const existingResource = contextResources.get(contextKey);\n\n if (existingResource !== undefined) {\n throw new Error(\n `Resources \"${existingResource}\" and \"${resource}\" both map to render context key \"${contextKey}\"`,\n );\n }\n\n contextResources.set(contextKey, resource);\n\n /**\n * Built once per resource so every scoped component keeps a stable\n * identity, and shared by the resource render, the render context,\n * and any component bound through `asHOF()`.\n */\n const scopedComponents: Record<\n string,\n (props?: never) => JSX.Element\n > = {};\n\n for (const [name, definition] of Object.entries(\n entry.components ?? {},\n )) {\n if (reservedScopedComponentNames.has(name)) {\n throw new Error(\n `Scoped component \"${name}\" for resource \"${resource}\" uses a reserved name`,\n );\n }\n\n const ownPropDefinitions = definition.props ?? {};\n\n function ScopedComponent(ownProps?: Record<string, unknown>) {\n const componentProps = useContext(componentPropsContext);\n\n if (componentProps === undefined) {\n throw new Error(\n `Scoped component \"${name}\" must be rendered inside its scoped component`,\n );\n }\n\n const resolvedOwnProps = ownProps ?? {};\n\n validateProps(ownPropDefinitions, resolvedOwnProps);\n\n return definition.render(\n { ...componentProps, ...resolvedOwnProps, resource },\n scopedComponents,\n );\n }\n\n scopedComponents[name] = ScopedComponent as (\n props?: never,\n ) => JSX.Element;\n }\n\n resourceScopedComponents.set(resource, scopedComponents);\n\n function ResourceRender() {\n const componentProps = useContext(componentPropsContext);\n\n if (componentProps === undefined) {\n throw new Error(\n `Render context component \"${contextKey}\" must be rendered inside its scoped component`,\n );\n }\n\n return entry.render(\n { ...componentProps, resource },\n scopedComponents,\n );\n }\n\n return [contextKey, Object.assign(ResourceRender, scopedComponents)];\n }),\n );\n\n /**\n * Layouts are created once per resource and cached. Creating one during\n * render would hand React a new component type on every pass, remounting\n * the whole subtree.\n */\n const roots = new Map<\n LayoutResourceKey<Resources>,\n (props: Record<string, unknown>) => JSX.Element\n >();\n\n function getRoot(resource: LayoutResourceKey<Resources>) {\n let root = roots.get(resource);\n\n if (root === undefined) {\n const entry = definedEntries.get(resource);\n\n if (entry === undefined) {\n // Without an entry there are no create-time layout options, so a\n // layout with required props would fail validation deep inside\n // its own render. Fail here instead, naming the fix.\n throw new Error(\n `Render context component \"Root\" requires a \"resources.${resource}\" entry to build the layout for resource \"${resource}\"`,\n );\n }\n\n const { render: _render, ...layoutOptions } = entry;\n\n root = scopedCreateResourceLayout({\n ...layoutOptions,\n name:\n layoutOptions.name ??\n defaultNames.get(resource) ??\n capitalize(resource),\n resource,\n }) as (props: Record<string, unknown>) => JSX.Element;\n roots.set(resource, root);\n }\n\n return root;\n }\n\n function Root(rootProps: Record<string, unknown>) {\n const componentProps = useContext(componentPropsContext);\n\n if (componentProps === undefined) {\n throw new Error(\n 'Render context component \"Root\" must be rendered inside its scoped component',\n );\n }\n\n return createElement(\n getRoot(componentProps.resource as LayoutResourceKey<Resources>),\n rootProps,\n );\n }\n\n renderContext.Root = Root;\n\n function Component(componentProps: Record<string, unknown>) {\n const componentResource =\n componentProps.resource as LayoutResourceKey<Resources>;\n\n if (!selectedResources.has(componentResource)) {\n throw new Error(\n `Resource \"${componentResource}\" is not available in this scoped component`,\n );\n }\n\n const availableDefinitions =\n getComponentPropDefinitions(componentResource);\n const definitionsToValidate: Record<string, AnyBuiltPropDefinition> =\n {};\n\n for (const [key, inclusion] of Object.entries(include)) {\n const definition = availableDefinitions[key];\n\n if (!definition) {\n continue;\n }\n\n // Keep declared keys as-is — do not capitalize JSX.Element props.\n if (inclusion === true || key in componentProps) {\n definitionsToValidate[key] = definition;\n }\n }\n\n for (const [key, definition] of Object.entries(custom)) {\n if (key === 'children' || key === 'resource') {\n continue;\n }\n\n definitionsToValidate[key] = definition;\n }\n\n validateProps(definitionsToValidate, componentProps);\n\n return createElement(\n componentPropsContext.Provider,\n { value: componentProps },\n componentOptions.render(componentProps, renderContext),\n );\n }\n\n /**\n * Bound components are created once per resource and cached. Returning a\n * fresh component from the factory would hand React a new component type\n * whenever the caller rebinds, remounting the subtree.\n */\n const boundComponents = new Map<\n LayoutResourceKey<Resources>,\n (props: Record<string, unknown>) => JSX.Element\n >();\n\n function bindResource(resource: LayoutResourceKey<Resources>) {\n if (!selectedResources.has(resource)) {\n throw new Error(\n `Resource \"${resource}\" is not available in this scoped component`,\n );\n }\n\n let boundComponent = boundComponents.get(resource);\n\n if (boundComponent === undefined) {\n boundComponent = Object.assign(\n (boundProps: Record<string, unknown>) =>\n createElement(Component, { ...boundProps, resource }),\n {\n displayName: `ScopedResourceComponent(${resource})`,\n props: undefined,\n resource: undefined,\n },\n resourceScopedComponents.get(resource) ?? {},\n );\n boundComponents.set(resource, boundComponent);\n }\n\n return boundComponent;\n }\n\n function asHOF() {\n return bindResource;\n }\n\n return Object.assign(Component, {\n asHOF,\n displayName: 'ScopedResourceComponent',\n props: undefined,\n });\n }\n\n const scopedExtras: {\n createComponent: typeof createComponent;\n forResource: typeof scopedForResource;\n makeComposable?: (options: Record<string, unknown>) => unknown;\n resources: undefined;\n } = {\n createComponent,\n forResource: scopedForResource,\n resources: undefined,\n };\n\n if (createMakeComposableLayout) {\n const makeComposableLayout = createMakeComposableLayout();\n\n scopedExtras.makeComposable = (options) => {\n const resource = options.resource as LayoutResourceKey<Resources>;\n\n return makeComposableLayout({\n ...options,\n name: options.name ?? defaultNames.get(resource),\n });\n };\n }\n\n return Object.assign(scopedCreateResourceLayout, scopedExtras);\n }) as unknown as CreateResourceLayoutForResourcesFn<\n Resources,\n InProps,\n Composables,\n IncludeProps,\n CustomProps\n >;\n}\n"],"mappings":";;;;;;;;;;;AAihCA,MAAM,+BAA+B,IAAI,IAAI;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAkBD,SAAgB,mBAMd,EACA,yBACA,4BACA,sBACA,+BACuC;CACvC,SAAS,GAAG,uBAAuC;EACjD,MAAM,gBAAgB,mBAAmB;EACzC,IAAI;EASJ,IAAI,OAAO,kBAAkB,UAC3B,kBAAkB,mBAAmB,KAAK,cAAc,EAC5C,SACZ,EAAE;OACG,IACL,kBAAkB,QAClB,OAAO,kBAAkB,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AG1B;GAEF,SAAS,aAAa,UAAwC;IAC5D,IAAI,CAAC,kBAAkB,IAAI,QAAQ,GACjC,MAAM,IAAI,MACR,aAAa,SAAS,4CACxB;IAGF,IAAI,iBAAiB,gBAAgB,IAAI,QAAQ;IAEjD,IAAI,mBAAmB,QAAW;KAChC,iBAAiB,OAAO,QACrB,eACC,cAAc,WAAW;MAAE,GAAG;MAAY;KAAS,CAAC,GACtD;MACE,aAAa,2BAA2B,SAAS;MACjD,OAAO;MACP,UAAU;KACZ,GACA,yBAAyB,IAAI,QAAQ,KAAK,CAAC,CAC7C;KACA,gBAAgB,IAAI,UAAU,cAAc;IAC9C;IAEA,OAAO;GACT;GAEA,SAAS,QAAQ;IACf,OAAO;GACT;GAEA,OAAO,OAAO,OAAO,WAAW;IAC9B;IACA,aAAa;IACb,OAAO;GACT,CAAC;EACH;EAEA,MAAM,eAKF;GACF;GACA,aAAa;GACb,WAAW;EACb;EAEA,IAAI,4BAA4B;GAC9B,MAAM,uBAAuB,2BAA2B;GAExD,aAAa,kBAAkB,YAAY;IACzC,MAAM,WAAW,QAAQ;IAEzB,OAAO,qBAAqB;KAC1B,GAAG;KACH,MAAM,QAAQ,QAAQ,aAAa,IAAI,QAAQ;IACjD,CAAC;GACH;EACF;EAEA,OAAO,OAAO,OAAO,4BAA4B,YAAY;CAC/D;AAOF"}
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BaseComponent, MergeIntersection, Show, UnionToIntersection, pick } from "./utils.cjs";
2
2
  import { LayoutResourceKey, NormalizeResource, NormalizeResources, ResourceDefinition, ResourceEnum, ResourceLayoutComponentProps, ResourceTree, normalizeResource, normalizeResources, toResourceEnum } from "./resource.cjs";
3
- import { InPropsDefinition, InPropsFunction, InPropsObject, InPropsOptions, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, ResolvedIncludedProps } from "./props.cjs";
3
+ import { InPropsDefinition, InPropsFunction, InPropsObject, InPropsOptions, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, ResolvedIncludedProps, ResolvedIncludedPropsAsDefined } from "./props.cjs";
4
4
  import { defineResourceLayout } from "./create-config/define-layout.cjs";
5
5
  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";
6
- import { AnyBuiltPropDefinition, ExtractDefinitionValue, ResolveLayoutProps, ResolveProps, createPrimitivePropBuilder, createProp, isPropDefinitionShape, resolvePropDefinitionValues, validateProps } from "@jfdevelops/react-layout-validator";
7
- export { type AnyBuiltPropDefinition, type AnyComposableComponent, type BaseComponent, type ComposableComponent, type ComposableComponentCallable, type ComposableComponents, type ComposableNameContext, type ComposablePresetComponent, type ComposablePresetComponentCallProps, type ComposablePresetMeta, type ComposablePresetProps, type ComposableResourceLayout, type CreateLayoutComposable, type DefinedComposableComponentRecord, type ExtractDefinitionValue, type InPropsDefinition, type InPropsFunction, type InPropsObject, type InPropsOptions, type IncludedProps, type InferredInProps, LayoutComposablePresetProvider, type LayoutComposablesFactory, type LayoutRenderProps, type LayoutResourceKey, type MakeComposable, type MakeComposableOptions, type MergeIntersection, type MergePresetProps, type MergedLayoutInProps, type NormalizeResource, type NormalizeResources, type PresetPropsFromComposable, type RequiredPresetLayoutProps, type RequiredPresetRenderProps, type ResolveLayoutComposables, type ResolveLayoutProps, type ResolveProps, type ResolvedIncludedProps, type ResourceDefinition, type ResourceEnum, type ResourceLayoutComponentProps, type ResourceTree, type Show, type UnionToIntersection, collectComposablePresetEntries, createComposableComponent, createLayoutComposableFactory, createPrimitivePropBuilder, createProp, defineComposableComponent, defineResourceLayout, isPropDefinitionShape, makeComposable, normalizeResource, normalizeResources, pick, resolveComposablePresetProps, resolveLayoutComposables, resolvePropDefinitionValues, toResourceEnum, validateProps };
6
+ import { AnyBuiltPropDefinition, ExtractDefinitionValue, ResolveLayoutProps, ResolveLayoutPropsAsDefined, ResolveProps, ResolvedBuiltPropShape, createPrimitivePropBuilder, createProp, isPropDefinitionShape, resolvePropDefinitionValues, validateProps } from "@jfdevelops/react-layout-validator";
7
+ export { type AnyBuiltPropDefinition, type AnyComposableComponent, type BaseComponent, type ComposableComponent, type ComposableComponentCallable, type ComposableComponents, type ComposableNameContext, type ComposablePresetComponent, type ComposablePresetComponentCallProps, type ComposablePresetMeta, type ComposablePresetProps, type ComposableResourceLayout, type CreateLayoutComposable, type DefinedComposableComponentRecord, type ExtractDefinitionValue, type InPropsDefinition, type InPropsFunction, type InPropsObject, type InPropsOptions, type IncludedProps, type InferredInProps, LayoutComposablePresetProvider, type LayoutComposablesFactory, type LayoutRenderProps, type LayoutResourceKey, type MakeComposable, type MakeComposableOptions, type MergeIntersection, type MergePresetProps, type MergedLayoutInProps, type NormalizeResource, type NormalizeResources, type PresetPropsFromComposable, type RequiredPresetLayoutProps, type RequiredPresetRenderProps, type ResolveLayoutComposables, type ResolveLayoutProps, type ResolveLayoutPropsAsDefined, type ResolveProps, type ResolvedBuiltPropShape, type ResolvedIncludedProps, type ResolvedIncludedPropsAsDefined, type ResourceDefinition, type ResourceEnum, type ResourceLayoutComponentProps, type ResourceTree, type Show, type UnionToIntersection, collectComposablePresetEntries, createComposableComponent, createLayoutComposableFactory, createPrimitivePropBuilder, createProp, defineComposableComponent, defineResourceLayout, isPropDefinitionShape, makeComposable, normalizeResource, normalizeResources, pick, resolveComposablePresetProps, resolveLayoutComposables, resolvePropDefinitionValues, toResourceEnum, validateProps };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BaseComponent, MergeIntersection, Show, UnionToIntersection, pick } from "./utils.mjs";
2
2
  import { LayoutResourceKey, NormalizeResource, NormalizeResources, ResourceDefinition, ResourceEnum, ResourceLayoutComponentProps, ResourceTree, normalizeResource, normalizeResources, toResourceEnum } from "./resource.mjs";
3
- import { InPropsDefinition, InPropsFunction, InPropsObject, InPropsOptions, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, ResolvedIncludedProps } from "./props.mjs";
3
+ import { InPropsDefinition, InPropsFunction, InPropsObject, InPropsOptions, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, ResolvedIncludedProps, ResolvedIncludedPropsAsDefined } from "./props.mjs";
4
4
  import { defineResourceLayout } from "./create-config/define-layout.mjs";
5
5
  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";
6
- import { AnyBuiltPropDefinition, ExtractDefinitionValue, ResolveLayoutProps, ResolveProps, createPrimitivePropBuilder, createProp, isPropDefinitionShape, resolvePropDefinitionValues, validateProps } from "@jfdevelops/react-layout-validator";
7
- export { type AnyBuiltPropDefinition, type AnyComposableComponent, type BaseComponent, type ComposableComponent, type ComposableComponentCallable, type ComposableComponents, type ComposableNameContext, type ComposablePresetComponent, type ComposablePresetComponentCallProps, type ComposablePresetMeta, type ComposablePresetProps, type ComposableResourceLayout, type CreateLayoutComposable, type DefinedComposableComponentRecord, type ExtractDefinitionValue, type InPropsDefinition, type InPropsFunction, type InPropsObject, type InPropsOptions, type IncludedProps, type InferredInProps, LayoutComposablePresetProvider, type LayoutComposablesFactory, type LayoutRenderProps, type LayoutResourceKey, type MakeComposable, type MakeComposableOptions, type MergeIntersection, type MergePresetProps, type MergedLayoutInProps, type NormalizeResource, type NormalizeResources, type PresetPropsFromComposable, type RequiredPresetLayoutProps, type RequiredPresetRenderProps, type ResolveLayoutComposables, type ResolveLayoutProps, type ResolveProps, type ResolvedIncludedProps, type ResourceDefinition, type ResourceEnum, type ResourceLayoutComponentProps, type ResourceTree, type Show, type UnionToIntersection, collectComposablePresetEntries, createComposableComponent, createLayoutComposableFactory, createPrimitivePropBuilder, createProp, defineComposableComponent, defineResourceLayout, isPropDefinitionShape, makeComposable, normalizeResource, normalizeResources, pick, resolveComposablePresetProps, resolveLayoutComposables, resolvePropDefinitionValues, toResourceEnum, validateProps };
6
+ import { AnyBuiltPropDefinition, ExtractDefinitionValue, ResolveLayoutProps, ResolveLayoutPropsAsDefined, ResolveProps, ResolvedBuiltPropShape, createPrimitivePropBuilder, createProp, isPropDefinitionShape, resolvePropDefinitionValues, validateProps } from "@jfdevelops/react-layout-validator";
7
+ export { type AnyBuiltPropDefinition, type AnyComposableComponent, type BaseComponent, type ComposableComponent, type ComposableComponentCallable, type ComposableComponents, type ComposableNameContext, type ComposablePresetComponent, type ComposablePresetComponentCallProps, type ComposablePresetMeta, type ComposablePresetProps, type ComposableResourceLayout, type CreateLayoutComposable, type DefinedComposableComponentRecord, type ExtractDefinitionValue, type InPropsDefinition, type InPropsFunction, type InPropsObject, type InPropsOptions, type IncludedProps, type InferredInProps, LayoutComposablePresetProvider, type LayoutComposablesFactory, type LayoutRenderProps, type LayoutResourceKey, type MakeComposable, type MakeComposableOptions, type MergeIntersection, type MergePresetProps, type MergedLayoutInProps, type NormalizeResource, type NormalizeResources, type PresetPropsFromComposable, type RequiredPresetLayoutProps, type RequiredPresetRenderProps, type ResolveLayoutComposables, type ResolveLayoutProps, type ResolveLayoutPropsAsDefined, type ResolveProps, type ResolvedBuiltPropShape, type ResolvedIncludedProps, type ResolvedIncludedPropsAsDefined, type ResourceDefinition, type ResourceEnum, type ResourceLayoutComponentProps, type ResourceTree, type Show, type UnionToIntersection, collectComposablePresetEntries, createComposableComponent, createLayoutComposableFactory, createPrimitivePropBuilder, createProp, defineComposableComponent, defineResourceLayout, isPropDefinitionShape, makeComposable, normalizeResource, normalizeResources, pick, resolveComposablePresetProps, resolveLayoutComposables, resolvePropDefinitionValues, toResourceEnum, validateProps };
package/dist/props.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Show } from "./utils.cjs";
2
2
  import { ResourceDefinition, ResourceEnum } from "./resource.cjs";
3
3
  import { ComposableComponents, InPropsObject, MergePresetProps } from "@jfdevelops/react-layout-composables";
4
- import { EnumWrappedProp, LiteralWrappedProp, ResolveLayoutProps, ResolveProps } from "@jfdevelops/react-layout-validator";
4
+ import { EnumWrappedProp, LiteralWrappedProp, ResolveLayoutProps, ResolveLayoutPropsAsDefined, ResolveProps } from "@jfdevelops/react-layout-validator";
5
5
 
6
6
  //#region src/props.d.ts
7
7
  type InPropsOptions<Resources extends ReadonlyArray<ResourceDefinition>, Name extends string> = {
@@ -19,7 +19,12 @@ type IncludedProps<T extends object> = { [K in keyof T & string]?: true | 'optio
19
19
  type RequiredIncludedPropKeys<IncludeProps extends object> = { [Key in keyof IncludeProps]: IncludeProps[Key] extends true ? Key : never }[keyof IncludeProps];
20
20
  type OptionalIncludedPropKeys<IncludeProps extends object> = { [Key in keyof IncludeProps]: IncludeProps[Key] extends 'optional' ? Key : never }[keyof IncludeProps];
21
21
  type ResolvedIncludedProps<Props extends InPropsObject, IncludeProps extends IncludedProps<Props>> = ResolveLayoutProps<Pick<Props, RequiredIncludedPropKeys<IncludeProps> & keyof Props>> & Partial<ResolveLayoutProps<Pick<Props, OptionalIncludedPropKeys<IncludeProps> & keyof Props>>>;
22
+ /**
23
+ * Like {@link ResolvedIncludedProps}, but keeps included prop keys exactly as
24
+ * declared (no `JSX.Element` capitalization).
25
+ */
26
+ type ResolvedIncludedPropsAsDefined<Props extends InPropsObject, IncludeProps extends IncludedProps<Props>> = ResolveLayoutPropsAsDefined<Pick<Props, RequiredIncludedPropKeys<IncludeProps> & keyof Props>> & Partial<ResolveLayoutPropsAsDefined<Pick<Props, OptionalIncludedPropKeys<IncludeProps> & keyof Props>>>;
22
27
  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>>;
23
28
  //#endregion
24
- export { InPropsDefinition, InPropsFunction, type InPropsObject, InPropsOptions, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, ResolvedIncludedProps };
29
+ export { InPropsDefinition, InPropsFunction, type InPropsObject, InPropsOptions, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, ResolvedIncludedProps, ResolvedIncludedPropsAsDefined };
25
30
  //# sourceMappingURL=props.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.cts","names":[],"sources":["../src/props.ts"],"mappings":";;;;;;KAYY,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,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,aAAA,CACnB,mBAAA,CAAoB,SAAA,EAAW,OAAA,EAAS,WAAA,6BAEtB,aAAA,SAClB,IAAA,CACF,YAAA,CAAa,WAAA,IACX,qBAAA,CACE,mBAAA,CAAoB,SAAA,EAAW,OAAA,EAAS,WAAA,GACxC,YAAA"}
package/dist/props.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Show } from "./utils.mjs";
2
2
  import { ResourceDefinition, ResourceEnum } from "./resource.mjs";
3
3
  import { ComposableComponents, InPropsObject, MergePresetProps } from "@jfdevelops/react-layout-composables";
4
- import { EnumWrappedProp, LiteralWrappedProp, ResolveLayoutProps, ResolveProps } from "@jfdevelops/react-layout-validator";
4
+ import { EnumWrappedProp, LiteralWrappedProp, ResolveLayoutProps, ResolveLayoutPropsAsDefined, ResolveProps } from "@jfdevelops/react-layout-validator";
5
5
 
6
6
  //#region src/props.d.ts
7
7
  type InPropsOptions<Resources extends ReadonlyArray<ResourceDefinition>, Name extends string> = {
@@ -19,7 +19,12 @@ type IncludedProps<T extends object> = { [K in keyof T & string]?: true | 'optio
19
19
  type RequiredIncludedPropKeys<IncludeProps extends object> = { [Key in keyof IncludeProps]: IncludeProps[Key] extends true ? Key : never }[keyof IncludeProps];
20
20
  type OptionalIncludedPropKeys<IncludeProps extends object> = { [Key in keyof IncludeProps]: IncludeProps[Key] extends 'optional' ? Key : never }[keyof IncludeProps];
21
21
  type ResolvedIncludedProps<Props extends InPropsObject, IncludeProps extends IncludedProps<Props>> = ResolveLayoutProps<Pick<Props, RequiredIncludedPropKeys<IncludeProps> & keyof Props>> & Partial<ResolveLayoutProps<Pick<Props, OptionalIncludedPropKeys<IncludeProps> & keyof Props>>>;
22
+ /**
23
+ * Like {@link ResolvedIncludedProps}, but keeps included prop keys exactly as
24
+ * declared (no `JSX.Element` capitalization).
25
+ */
26
+ type ResolvedIncludedPropsAsDefined<Props extends InPropsObject, IncludeProps extends IncludedProps<Props>> = ResolveLayoutPropsAsDefined<Pick<Props, RequiredIncludedPropKeys<IncludeProps> & keyof Props>> & Partial<ResolveLayoutPropsAsDefined<Pick<Props, OptionalIncludedPropKeys<IncludeProps> & keyof Props>>>;
22
27
  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>>;
23
28
  //#endregion
24
- export { InPropsDefinition, InPropsFunction, type InPropsObject, InPropsOptions, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, ResolvedIncludedProps };
29
+ export { InPropsDefinition, InPropsFunction, type InPropsObject, InPropsOptions, IncludedProps, InferredInProps, LayoutRenderProps, MergedLayoutInProps, ResolvedIncludedProps, ResolvedIncludedPropsAsDefined };
25
30
  //# sourceMappingURL=props.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.mts","names":[],"sources":["../src/props.ts"],"mappings":";;;;;;KAYY,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,CA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AS,WAAA,GACxC,YAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jfdevelops/react-layout",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "A React library for creating layout components.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,8 +26,8 @@
26
26
  "node": "^20.19.0 || >=22.12.0"
27
27
  },
28
28
  "dependencies": {
29
- "@jfdevelops/react-layout-validator": "0.2.3",
30
- "@jfdevelops/react-layout-composables": "0.2.3"
29
+ "@jfdevelops/react-layout-composables": "0.2.3",
30
+ "@jfdevelops/react-layout-validator": "0.2.3"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": ">=18",