@jfdevelops/react-layout 1.5.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/create-config/create-defined-resource-layout.cjs +28 -0
- package/dist/create-config/create-defined-resource-layout.cjs.map +1 -1
- package/dist/create-config/create-defined-resource-layout.d.cts +6 -10
- package/dist/create-config/create-defined-resource-layout.d.cts.map +1 -1
- package/dist/create-config/create-defined-resource-layout.d.mts +6 -10
- package/dist/create-config/create-defined-resource-layout.d.mts.map +1 -1
- package/dist/create-config/create-defined-resource-layout.mjs +28 -0
- package/dist/create-config/create-defined-resource-layout.mjs.map +1 -1
- package/dist/create-config/define-layout.cjs +1 -1
- package/dist/create-config/define-layout.cjs.map +1 -1
- package/dist/create-config/define-layout.d.cts +10 -22
- package/dist/create-config/define-layout.d.cts.map +1 -1
- package/dist/create-config/define-layout.d.mts +10 -22
- package/dist/create-config/define-layout.d.mts.map +1 -1
- package/dist/create-config/define-layout.mjs +1 -1
- package/dist/create-config/define-layout.mjs.map +1 -1
- package/dist/create-config/for-resource.cjs.map +1 -1
- package/dist/create-config/for-resource.d.cts +10 -7
- package/dist/create-config/for-resource.d.cts.map +1 -1
- package/dist/create-config/for-resource.d.mts +10 -7
- package/dist/create-config/for-resource.d.mts.map +1 -1
- package/dist/create-config/for-resource.mjs.map +1 -1
- package/dist/create-config/for-resources/resource-selection.d.cts +4 -2
- package/dist/create-config/for-resources/resource-selection.d.cts.map +1 -1
- package/dist/create-config/for-resources/resource-selection.d.mts +4 -2
- package/dist/create-config/for-resources/resource-selection.d.mts.map +1 -1
- package/dist/create-config/for-resources/scoped-layout.d.cts +16 -24
- package/dist/create-config/for-resources/scoped-layout.d.cts.map +1 -1
- package/dist/create-config/for-resources/scoped-layout.d.mts +16 -24
- package/dist/create-config/for-resources/scoped-layout.d.mts.map +1 -1
- package/dist/create-config/layout-name.cjs +170 -8
- package/dist/create-config/layout-name.cjs.map +1 -1
- package/dist/create-config/layout-name.d.cts +219 -23
- package/dist/create-config/layout-name.d.cts.map +1 -1
- package/dist/create-config/layout-name.d.mts +219 -23
- package/dist/create-config/layout-name.d.mts.map +1 -1
- package/dist/create-config/layout-name.mjs +171 -8
- package/dist/create-config/layout-name.mjs.map +1 -1
- package/dist/errors/invalid-part-type.cjs +21 -0
- package/dist/errors/invalid-part-type.cjs.map +1 -0
- package/dist/errors/invalid-part-type.d.cts +110 -0
- package/dist/errors/invalid-part-type.d.cts.map +1 -0
- package/dist/errors/invalid-part-type.d.mts +110 -0
- package/dist/errors/invalid-part-type.d.mts.map +1 -0
- package/dist/errors/invalid-part-type.mjs +21 -0
- package/dist/errors/invalid-part-type.mjs.map +1 -0
- package/dist/errors/invalid-part.cjs +23 -0
- package/dist/errors/invalid-part.cjs.map +1 -0
- package/dist/errors/invalid-part.d.cts +107 -0
- package/dist/errors/invalid-part.d.cts.map +1 -0
- package/dist/errors/invalid-part.d.mts +107 -0
- package/dist/errors/invalid-part.d.mts.map +1 -0
- package/dist/errors/invalid-part.mjs +23 -0
- package/dist/errors/invalid-part.mjs.map +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.cts +4 -2
- package/dist/index.d.mts +4 -2
- package/dist/index.mjs +3 -1
- package/package.json +3 -3
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { LayoutResourceKey, ResourceDefinition } from "../../resource.cjs";
|
|
2
2
|
import { InPropsDefinition, InPropsObject, MergedLayoutInProps, ResolvedIncludedComponentProps } from "../../props.cjs";
|
|
3
|
+
import { LayoutNameInput } from "../layout-name.cjs";
|
|
3
4
|
import { CreateLayoutForResourceOptions, CreateResourceLayoutOptionsBase, CreatedLayoutForResource, SetDefaultPropForResourceFn } from "../for-resource.cjs";
|
|
4
|
-
import { AtLeastOneResourceLayoutNameKey, AtLeastOneResourceLayoutSelection, CapitalizedResource,
|
|
5
|
+
import { AtLeastOneResourceLayoutNameKey, AtLeastOneResourceLayoutSelection, CapitalizedResource, MappedResourceLayoutArguments, ResourceLayoutNames, ResourceLayoutSelection, SelectedLayoutResources, SelectedResourceLayoutArguments, SelectedResourceLayoutName, SelectedResourceLayoutNames, SharedResourceLayoutArguments } from "./resource-selection.cjs";
|
|
5
6
|
import { ScopedCreateComponent, ScopedCreateResourceComponents } from "./create-component.cjs";
|
|
6
7
|
import { LayoutIncludeProps, LayoutPropsForResource, ResourceLayoutComponent, ResourceLayoutResult } from "../define-layout.cjs";
|
|
7
8
|
import { ComposableComponents, ComposableResourceLayout } from "@jfdevelops/react-layout-composables";
|
|
@@ -10,25 +11,16 @@ import { ComposableComponents, ComposableResourceLayout } from "@jfdevelops/reac
|
|
|
10
11
|
type ScopedCreateResourceLayoutOptions<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, Name extends string, Resource extends SelectedLayoutResources<Resources, Arguments>, Props extends InPropsObject> = LayoutPropsForResource<Resources, InProps, Composables, IncludeProps> & {
|
|
11
12
|
resource: Resource;
|
|
12
13
|
props?: Props;
|
|
13
|
-
} & (HasResourceLayoutName<Arguments, Resource> extends true ? {
|
|
14
14
|
name?: Name;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
type ScopedCreateResourceLayoutFnImpl<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, CustomProps extends InPropsObject, DefaultNamespace extends boolean = false, States = {}> = <Resource extends SelectedLayoutResources<Resources, Arguments>, Name extends string = SelectedResourceLayoutName<Arguments, Resource>, Props extends InPropsObject = {}, Namespace extends boolean = DefaultNamespace>(options: ScopedCreateResourceLayoutOptions<Resources, InProps, Composables, IncludeProps, Arguments, Name, Resource, Props> & {
|
|
15
|
+
};
|
|
16
|
+
type ScopedCreateResourceLayoutFnImpl<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, CustomProps extends InPropsObject, DefaultNamespace extends boolean = false, States = {}, DefaultNaming extends LayoutNameInput<any, any> | undefined = undefined> = <Resource extends SelectedLayoutResources<Resources, Arguments>, Name extends string = SelectedResourceLayoutName<Arguments, Resource, DefaultNaming>, Props extends InPropsObject = {}, Namespace extends boolean = DefaultNamespace>(options: ScopedCreateResourceLayoutOptions<Resources, InProps, Composables, IncludeProps, Arguments, Name, Resource, Props> & {
|
|
19
17
|
namespace?: Namespace;
|
|
20
18
|
}) => ResourceLayoutResult<ResourceLayoutComponent<Name, CustomProps, Composables, Resource, ResolvedIncludedComponentProps<MergedLayoutInProps<Resources, InProps, Composables>, IncludeProps>, States, Resources, InProps>, Namespace>;
|
|
21
|
-
type ScopedCreateLayoutForResource<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, CustomProps extends InPropsObject, DefaultNamespace extends boolean = false, States = {}> = <Resource extends SelectedLayoutResources<Resources, Arguments>, Name extends string = SelectedResourceLayoutName<Arguments, Resource>>(options: CreateLayoutForResourceOptions<Resources, Name, Resource>) => CreatedLayoutForResource<Resources, InProps, Composables, IncludeProps, Name, Resource, CustomProps, {}, DefaultNamespace, States> & {
|
|
19
|
+
type ScopedCreateLayoutForResource<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, CustomProps extends InPropsObject, DefaultNamespace extends boolean = false, States = {}, DefaultNaming extends LayoutNameInput<any, any> | undefined = undefined> = <Resource extends SelectedLayoutResources<Resources, Arguments>, Name extends string = SelectedResourceLayoutName<Arguments, Resource, DefaultNaming>>(options: CreateLayoutForResourceOptions<Resources, Name, Resource>) => CreatedLayoutForResource<Resources, InProps, Composables, IncludeProps, Name, Resource, CustomProps, {}, DefaultNamespace, States> & {
|
|
22
20
|
setDefaults: SetDefaultPropForResourceFn<Resources, InProps, Composables, IncludeProps, Name, Resource, CustomProps, DefaultNamespace, States>;
|
|
23
21
|
};
|
|
24
|
-
type ScopedCreateResourceLayoutMakeComposableFn<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown
|
|
25
|
-
|
|
26
|
-
} & (HasResourceLayoutName<Arguments, Resource> extends true ? {
|
|
27
|
-
name?: Name;
|
|
28
|
-
} : {
|
|
29
|
-
name: Name;
|
|
30
|
-
})) => ComposableResourceLayout<Composables, Name, any, any, any>;
|
|
31
|
-
type ScopedCreateResourceLayoutFn<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, CustomProps extends InPropsObject, DefaultNamespace extends boolean = false, States = {}> = ScopedCreateResourceLayoutFnImpl<Resources, InProps, Composables, IncludeProps, Arguments, CustomProps, DefaultNamespace, States> & {
|
|
22
|
+
type ScopedCreateResourceLayoutMakeComposableFn<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, DefaultNaming extends LayoutNameInput<any, any> | undefined = undefined> = <Resource extends SelectedLayoutResources<Resources, Arguments>, Name extends string = SelectedResourceLayoutName<Arguments, Resource, DefaultNaming>, Props extends InPropsObject = {}>(options: CreateResourceLayoutOptionsBase<Resources, Name, Resource, Props, Name> & Partial<LayoutPropsForResource<Resources, InProps, Composables, IncludeProps>>) => ComposableResourceLayout<Composables, Name, any, any, any>;
|
|
23
|
+
type ScopedCreateResourceLayoutFn<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, CustomProps extends InPropsObject, DefaultNamespace extends boolean = false, States = {}, DefaultNaming extends LayoutNameInput<any, any> | undefined = undefined> = ScopedCreateResourceLayoutFnImpl<Resources, InProps, Composables, IncludeProps, Arguments, CustomProps, DefaultNamespace, States, DefaultNaming> & {
|
|
32
24
|
/**
|
|
33
25
|
* Creates a component shared by the target resources. Included layout props
|
|
34
26
|
* become component props, and `children` is always available as an optional
|
|
@@ -84,7 +76,7 @@ type ScopedCreateResourceLayoutFn<Resources extends ReadonlyArray<ResourceDefini
|
|
|
84
76
|
*/
|
|
85
77
|
createComponent: ScopedCreateComponent<Resources, InProps, Composables, Arguments, CustomProps>; /** Builds one reusable entry for the selected resources. */
|
|
86
78
|
createResourceComponents: ScopedCreateResourceComponents<Resources, InProps, Composables, Arguments, CustomProps, {}, {}>;
|
|
87
|
-
forResource: ScopedCreateLayoutForResource<Resources, InProps, Composables, IncludeProps, Arguments, CustomProps, DefaultNamespace, States>;
|
|
79
|
+
forResource: ScopedCreateLayoutForResource<Resources, InProps, Composables, IncludeProps, Arguments, CustomProps, DefaultNamespace, States, DefaultNaming>;
|
|
88
80
|
/**
|
|
89
81
|
* Type-only property containing the target resource union. This property is
|
|
90
82
|
* `undefined` at runtime and exists solely for extracting the scoped type.
|
|
@@ -94,13 +86,13 @@ type ScopedCreateResourceLayoutFn<Resources extends ReadonlyArray<ResourceDefini
|
|
|
94
86
|
*/
|
|
95
87
|
readonly resources: SelectedLayoutResources<Resources, Arguments>;
|
|
96
88
|
} & ([keyof Composables] extends [never] ? {} : {
|
|
97
|
-
makeComposable: ScopedCreateResourceLayoutMakeComposableFn<Resources, InProps, Composables, IncludeProps, Arguments>;
|
|
89
|
+
makeComposable: ScopedCreateResourceLayoutMakeComposableFn<Resources, InProps, Composables, IncludeProps, Arguments, DefaultNaming>;
|
|
98
90
|
});
|
|
99
|
-
type CreateResourceLayoutForResourcesFn<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents = {}, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables> = {}, CustomProps extends InPropsObject = {}, DefaultNamespace extends boolean = false, States = {}> = {
|
|
91
|
+
type CreateResourceLayoutForResourcesFn<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents = {}, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables> = {}, CustomProps extends InPropsObject = {}, DefaultNamespace extends boolean = false, States = {}, DefaultNaming extends LayoutNameInput<any, any> | undefined = undefined> = {
|
|
100
92
|
/**
|
|
101
93
|
* Creates a layout factory scoped to the listed resources.
|
|
102
94
|
*
|
|
103
|
-
* Layout names
|
|
95
|
+
* Layout names inherit the naming default or derive from the resource.
|
|
104
96
|
*
|
|
105
97
|
* @example
|
|
106
98
|
* createResourceLayout.forResources('users', 'admins')
|
|
@@ -108,7 +100,7 @@ type CreateResourceLayoutForResourcesFn<Resources extends ReadonlyArray<Resource
|
|
|
108
100
|
* @param resources Resources available from the returned layout factory.
|
|
109
101
|
* @returns A layout factory scoped to the selected resources.
|
|
110
102
|
*/
|
|
111
|
-
<const ResourceKeys extends readonly [LayoutResourceKey<Resources>, ...Array<LayoutResourceKey<Resources>>]>(...resources: ResourceKeys): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, ResourceKeys, CustomProps, DefaultNamespace, States>;
|
|
103
|
+
<const ResourceKeys extends readonly [LayoutResourceKey<Resources>, ...Array<LayoutResourceKey<Resources>>]>(...resources: ResourceKeys): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, ResourceKeys, CustomProps, DefaultNamespace, States, DefaultNaming>;
|
|
112
104
|
/**
|
|
113
105
|
* Creates a layout factory scoped to a resource list without default names.
|
|
114
106
|
*
|
|
@@ -123,7 +115,7 @@ type CreateResourceLayoutForResourcesFn<Resources extends ReadonlyArray<Resource
|
|
|
123
115
|
name?: never;
|
|
124
116
|
}): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, readonly [{
|
|
125
117
|
resources: ResourceKeys;
|
|
126
|
-
}], CustomProps, DefaultNamespace, States>;
|
|
118
|
+
}], CustomProps, DefaultNamespace, States, DefaultNaming>;
|
|
127
119
|
/**
|
|
128
120
|
* Creates a scoped layout factory with optional default names per resource.
|
|
129
121
|
*
|
|
@@ -147,7 +139,7 @@ type CreateResourceLayoutForResourcesFn<Resources extends ReadonlyArray<Resource
|
|
|
147
139
|
name: SelectedResourceLayoutNames<LayoutResourceKey<Resources>, NoInfer<ResourceKeys[number]>, CallbackName> & AtLeastOneResourceLayoutNameKey<NoInfer<ResourceKeys[number]>> & Record<string, NonNullable<ResourceLayoutNames<LayoutResourceKey<Resources>, CallbackName>[LayoutResourceKey<Resources>]>>;
|
|
148
140
|
} & {
|
|
149
141
|
name: Names & Record<Exclude<keyof Names, ResourceKeys[number]>, never>;
|
|
150
|
-
}): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, MappedResourceLayoutArguments<Resources, ResourceKeys, Names, CallbackName>, CustomProps, DefaultNamespace, States>;
|
|
142
|
+
}): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, MappedResourceLayoutArguments<Resources, ResourceKeys, Names, CallbackName>, CustomProps, DefaultNamespace, States, DefaultNaming>;
|
|
151
143
|
/**
|
|
152
144
|
* Creates a scoped layout factory with one default-name callback shared by
|
|
153
145
|
* every selected resource. The callback receives a capitalized resource
|
|
@@ -167,7 +159,7 @@ type CreateResourceLayoutForResourcesFn<Resources extends ReadonlyArray<Resource
|
|
|
167
159
|
name: (resource: CapitalizedResource<ResourceKeys[number]>) => Name;
|
|
168
160
|
} & {
|
|
169
161
|
resources: ResourceKeys;
|
|
170
|
-
}): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, SharedResourceLayoutArguments<Resources, ResourceKeys, Name>, CustomProps, DefaultNamespace, States>;
|
|
162
|
+
}): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, SharedResourceLayoutArguments<Resources, ResourceKeys, Name>, CustomProps, DefaultNamespace, States, DefaultNaming>;
|
|
171
163
|
/**
|
|
172
164
|
* Creates a scoped layout factory from a resource-keyed configuration.
|
|
173
165
|
* Only configured resources are available from the returned factory.
|
|
@@ -181,7 +173,7 @@ type CreateResourceLayoutForResourcesFn<Resources extends ReadonlyArray<Resource
|
|
|
181
173
|
* @param options Resource-keyed layout defaults.
|
|
182
174
|
* @returns A layout factory scoped to the configured resources.
|
|
183
175
|
*/
|
|
184
|
-
<const CallbackName extends string, const Selection extends ResourceLayoutSelection<Resources, CallbackName>>(options: Selection & AtLeastOneResourceLayoutSelection<Resources, CallbackName> & Partial<Record<Exclude<'resources', LayoutResourceKey<Resources>>, never>> & Record<Exclude<keyof Selection, LayoutResourceKey<Resources>>, never>): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, SelectedResourceLayoutArguments<Selection>, CustomProps, DefaultNamespace, States>;
|
|
176
|
+
<const CallbackName extends string, const Selection extends ResourceLayoutSelection<Resources, CallbackName>>(options: Selection & AtLeastOneResourceLayoutSelection<Resources, CallbackName> & Partial<Record<Exclude<'resources', LayoutResourceKey<Resources>>, never>> & Record<Exclude<keyof Selection, LayoutResourceKey<Resources>>, never>): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, SelectedResourceLayoutArguments<Selection>, CustomProps, DefaultNamespace, States, DefaultNaming>;
|
|
185
177
|
};
|
|
186
178
|
//#endregion
|
|
187
179
|
export { CreateResourceLayoutForResourcesFn };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scoped-layout.d.cts","names":[],"sources":["../../../src/create-config/for-resources/scoped-layout.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"scoped-layout.d.cts","names":[],"sources":["../../../src/create-config/for-resources/scoped-layout.ts"],"mappings":";;;;;;;;;;KA0CY,iCAAA,mBACQ,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,uBACd,oBAAA,uBACC,kBAAA,CAAmB,SAAA,EAAW,OAAA,EAAS,WAAA,qBAC1C,aAAA,iDAED,uBAAA,CAAwB,SAAA,EAAW,SAAA,iBACtC,aAAA,IACZ,sBAAA,CAAuB,SAAA,EAAW,OAAA,EAAS,WAAA,EAAa,YAAA;EAC1D,QAAA,EAAU,QAAA;EACV,KAAA,GAAQ,KAAA;EACR,IAAA,GAAO,IAAA;AAAA;AAAA,KAGG,gCAAA,mBACQ,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,uBACd,oBAAA,uBACC,kBAAA,CAAmB,SAAA,EAAW,OAAA,EAAS,WAAA,qBAC1C,aAAA,+BACE,aAAA,+EAGE,eAAA,wDAEL,uBAAA,CAAwB,SAAA,EAAW,SAAA,yBAC9B,0BAAA,CACpB,SAAA,EAAW,QAAA,EAAU,aAAA,iBAET,aAAA,mCACc,gBAAA,EAE5B,OAAA,EAAS,iCAAA,CACP,SAAA,EACA,OAAA,EACA,WAAA,EACA,YAAA,EACA,SAAA,EACA,IAAA,EACA,QAAA,EACA,KAAA;EACI,SAAA,GAAY,SAAA;AAAA,MACf,oBAAA,CAAqB,uBAAA,CACxB,IAAA,EACA,WAAA,EACA,WAAA,EACA,QAAA,EACA,8BAAA,CACE,mBAAA,CAAoB,SAAA,EAAW,OAAA,EAAS,WAAA,GACxC,YAAA,GAGF,MAAA,EACA,SAAA,EACA,OAAA,GACC,SAAA;AAAA,KAES,6BAAA,mBACQ,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,uBACd,oBAAA,uBACC,kBAAA,CAAm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AA,EACA,OAAA,EACA,WAAA,EACA,YAAA,EACA,+BAAA,CAAgC,SAAA,GAChC,WAAA,EACA,gBAAA,EACA,MAAA,EACA,aAAA;AAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { LayoutResourceKey, ResourceDefinition } from "../../resource.mjs";
|
|
2
2
|
import { InPropsDefinition, InPropsObject, MergedLayoutInProps, ResolvedIncludedComponentProps } from "../../props.mjs";
|
|
3
|
+
import { LayoutNameInput } from "../layout-name.mjs";
|
|
3
4
|
import { CreateLayoutForResourceOptions, CreateResourceLayoutOptionsBase, CreatedLayoutForResource, SetDefaultPropForResourceFn } from "../for-resource.mjs";
|
|
4
|
-
import { AtLeastOneResourceLayoutNameKey, AtLeastOneResourceLayoutSelection, CapitalizedResource,
|
|
5
|
+
import { AtLeastOneResourceLayoutNameKey, AtLeastOneResourceLayoutSelection, CapitalizedResource, MappedResourceLayoutArguments, ResourceLayoutNames, ResourceLayoutSelection, SelectedLayoutResources, SelectedResourceLayoutArguments, SelectedResourceLayoutName, SelectedResourceLayoutNames, SharedResourceLayoutArguments } from "./resource-selection.mjs";
|
|
5
6
|
import { ScopedCreateComponent, ScopedCreateResourceComponents } from "./create-component.mjs";
|
|
6
7
|
import { LayoutIncludeProps, LayoutPropsForResource, ResourceLayoutComponent, ResourceLayoutResult } from "../define-layout.mjs";
|
|
7
8
|
import { ComposableComponents, ComposableResourceLayout } from "@jfdevelops/react-layout-composables";
|
|
@@ -10,25 +11,16 @@ import { ComposableComponents, ComposableResourceLayout } from "@jfdevelops/reac
|
|
|
10
11
|
type ScopedCreateResourceLayoutOptions<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, Name extends string, Resource extends SelectedLayoutResources<Resources, Arguments>, Props extends InPropsObject> = LayoutPropsForResource<Resources, InProps, Composables, IncludeProps> & {
|
|
11
12
|
resource: Resource;
|
|
12
13
|
props?: Props;
|
|
13
|
-
} & (HasResourceLayoutName<Arguments, Resource> extends true ? {
|
|
14
14
|
name?: Name;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
type ScopedCreateResourceLayoutFnImpl<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, CustomProps extends InPropsObject, DefaultNamespace extends boolean = false, States = {}> = <Resource extends SelectedLayoutResources<Resources, Arguments>, Name extends string = SelectedResourceLayoutName<Arguments, Resource>, Props extends InPropsObject = {}, Namespace extends boolean = DefaultNamespace>(options: ScopedCreateResourceLayoutOptions<Resources, InProps, Composables, IncludeProps, Arguments, Name, Resource, Props> & {
|
|
15
|
+
};
|
|
16
|
+
type ScopedCreateResourceLayoutFnImpl<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, CustomProps extends InPropsObject, DefaultNamespace extends boolean = false, States = {}, DefaultNaming extends LayoutNameInput<any, any> | undefined = undefined> = <Resource extends SelectedLayoutResources<Resources, Arguments>, Name extends string = SelectedResourceLayoutName<Arguments, Resource, DefaultNaming>, Props extends InPropsObject = {}, Namespace extends boolean = DefaultNamespace>(options: ScopedCreateResourceLayoutOptions<Resources, InProps, Composables, IncludeProps, Arguments, Name, Resource, Props> & {
|
|
19
17
|
namespace?: Namespace;
|
|
20
18
|
}) => ResourceLayoutResult<ResourceLayoutComponent<Name, CustomProps, Composables, Resource, ResolvedIncludedComponentProps<MergedLayoutInProps<Resources, InProps, Composables>, IncludeProps>, States, Resources, InProps>, Namespace>;
|
|
21
|
-
type ScopedCreateLayoutForResource<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, CustomProps extends InPropsObject, DefaultNamespace extends boolean = false, States = {}> = <Resource extends SelectedLayoutResources<Resources, Arguments>, Name extends string = SelectedResourceLayoutName<Arguments, Resource>>(options: CreateLayoutForResourceOptions<Resources, Name, Resource>) => CreatedLayoutForResource<Resources, InProps, Composables, IncludeProps, Name, Resource, CustomProps, {}, DefaultNamespace, States> & {
|
|
19
|
+
type ScopedCreateLayoutForResource<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, CustomProps extends InPropsObject, DefaultNamespace extends boolean = false, States = {}, DefaultNaming extends LayoutNameInput<any, any> | undefined = undefined> = <Resource extends SelectedLayoutResources<Resources, Arguments>, Name extends string = SelectedResourceLayoutName<Arguments, Resource, DefaultNaming>>(options: CreateLayoutForResourceOptions<Resources, Name, Resource>) => CreatedLayoutForResource<Resources, InProps, Composables, IncludeProps, Name, Resource, CustomProps, {}, DefaultNamespace, States> & {
|
|
22
20
|
setDefaults: SetDefaultPropForResourceFn<Resources, InProps, Composables, IncludeProps, Name, Resource, CustomProps, DefaultNamespace, States>;
|
|
23
21
|
};
|
|
24
|
-
type ScopedCreateResourceLayoutMakeComposableFn<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown
|
|
25
|
-
|
|
26
|
-
} & (HasResourceLayoutName<Arguments, Resource> extends true ? {
|
|
27
|
-
name?: Name;
|
|
28
|
-
} : {
|
|
29
|
-
name: Name;
|
|
30
|
-
})) => ComposableResourceLayout<Composables, Name, any, any, any>;
|
|
31
|
-
type ScopedCreateResourceLayoutFn<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, CustomProps extends InPropsObject, DefaultNamespace extends boolean = false, States = {}> = ScopedCreateResourceLayoutFnImpl<Resources, InProps, Composables, IncludeProps, Arguments, CustomProps, DefaultNamespace, States> & {
|
|
22
|
+
type ScopedCreateResourceLayoutMakeComposableFn<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, DefaultNaming extends LayoutNameInput<any, any> | undefined = undefined> = <Resource extends SelectedLayoutResources<Resources, Arguments>, Name extends string = SelectedResourceLayoutName<Arguments, Resource, DefaultNaming>, Props extends InPropsObject = {}>(options: CreateResourceLayoutOptionsBase<Resources, Name, Resource, Props, Name> & Partial<LayoutPropsForResource<Resources, InProps, Composables, IncludeProps>>) => ComposableResourceLayout<Composables, Name, any, any, any>;
|
|
23
|
+
type ScopedCreateResourceLayoutFn<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables>, Arguments extends ReadonlyArray<unknown>, CustomProps extends InPropsObject, DefaultNamespace extends boolean = false, States = {}, DefaultNaming extends LayoutNameInput<any, any> | undefined = undefined> = ScopedCreateResourceLayoutFnImpl<Resources, InProps, Composables, IncludeProps, Arguments, CustomProps, DefaultNamespace, States, DefaultNaming> & {
|
|
32
24
|
/**
|
|
33
25
|
* Creates a component shared by the target resources. Included layout props
|
|
34
26
|
* become component props, and `children` is always available as an optional
|
|
@@ -84,7 +76,7 @@ type ScopedCreateResourceLayoutFn<Resources extends ReadonlyArray<ResourceDefini
|
|
|
84
76
|
*/
|
|
85
77
|
createComponent: ScopedCreateComponent<Resources, InProps, Composables, Arguments, CustomProps>; /** Builds one reusable entry for the selected resources. */
|
|
86
78
|
createResourceComponents: ScopedCreateResourceComponents<Resources, InProps, Composables, Arguments, CustomProps, {}, {}>;
|
|
87
|
-
forResource: ScopedCreateLayoutForResource<Resources, InProps, Composables, IncludeProps, Arguments, CustomProps, DefaultNamespace, States>;
|
|
79
|
+
forResource: ScopedCreateLayoutForResource<Resources, InProps, Composables, IncludeProps, Arguments, CustomProps, DefaultNamespace, States, DefaultNaming>;
|
|
88
80
|
/**
|
|
89
81
|
* Type-only property containing the target resource union. This property is
|
|
90
82
|
* `undefined` at runtime and exists solely for extracting the scoped type.
|
|
@@ -94,13 +86,13 @@ type ScopedCreateResourceLayoutFn<Resources extends ReadonlyArray<ResourceDefini
|
|
|
94
86
|
*/
|
|
95
87
|
readonly resources: SelectedLayoutResources<Resources, Arguments>;
|
|
96
88
|
} & ([keyof Composables] extends [never] ? {} : {
|
|
97
|
-
makeComposable: ScopedCreateResourceLayoutMakeComposableFn<Resources, InProps, Composables, IncludeProps, Arguments>;
|
|
89
|
+
makeComposable: ScopedCreateResourceLayoutMakeComposableFn<Resources, InProps, Composables, IncludeProps, Arguments, DefaultNaming>;
|
|
98
90
|
});
|
|
99
|
-
type CreateResourceLayoutForResourcesFn<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents = {}, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables> = {}, CustomProps extends InPropsObject = {}, DefaultNamespace extends boolean = false, States = {}> = {
|
|
91
|
+
type CreateResourceLayoutForResourcesFn<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Composables extends ComposableComponents = {}, IncludeProps extends LayoutIncludeProps<Resources, InProps, Composables> = {}, CustomProps extends InPropsObject = {}, DefaultNamespace extends boolean = false, States = {}, DefaultNaming extends LayoutNameInput<any, any> | undefined = undefined> = {
|
|
100
92
|
/**
|
|
101
93
|
* Creates a layout factory scoped to the listed resources.
|
|
102
94
|
*
|
|
103
|
-
* Layout names
|
|
95
|
+
* Layout names inherit the naming default or derive from the resource.
|
|
104
96
|
*
|
|
105
97
|
* @example
|
|
106
98
|
* createResourceLayout.forResources('users', 'admins')
|
|
@@ -108,7 +100,7 @@ type CreateResourceLayoutForResourcesFn<Resources extends ReadonlyArray<Resource
|
|
|
108
100
|
* @param resources Resources available from the returned layout factory.
|
|
109
101
|
* @returns A layout factory scoped to the selected resources.
|
|
110
102
|
*/
|
|
111
|
-
<const ResourceKeys extends readonly [LayoutResourceKey<Resources>, ...Array<LayoutResourceKey<Resources>>]>(...resources: ResourceKeys): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, ResourceKeys, CustomProps, DefaultNamespace, States>;
|
|
103
|
+
<const ResourceKeys extends readonly [LayoutResourceKey<Resources>, ...Array<LayoutResourceKey<Resources>>]>(...resources: ResourceKeys): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, ResourceKeys, CustomProps, DefaultNamespace, States, DefaultNaming>;
|
|
112
104
|
/**
|
|
113
105
|
* Creates a layout factory scoped to a resource list without default names.
|
|
114
106
|
*
|
|
@@ -123,7 +115,7 @@ type CreateResourceLayoutForResourcesFn<Resources extends ReadonlyArray<Resource
|
|
|
123
115
|
name?: never;
|
|
124
116
|
}): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, readonly [{
|
|
125
117
|
resources: ResourceKeys;
|
|
126
|
-
}], CustomProps, DefaultNamespace, States>;
|
|
118
|
+
}], CustomProps, DefaultNamespace, States, DefaultNaming>;
|
|
127
119
|
/**
|
|
128
120
|
* Creates a scoped layout factory with optional default names per resource.
|
|
129
121
|
*
|
|
@@ -147,7 +139,7 @@ type CreateResourceLayoutForResourcesFn<Resources extends ReadonlyArray<Resource
|
|
|
147
139
|
name: SelectedResourceLayoutNames<LayoutResourceKey<Resources>, NoInfer<ResourceKeys[number]>, CallbackName> & AtLeastOneResourceLayoutNameKey<NoInfer<ResourceKeys[number]>> & Record<string, NonNullable<ResourceLayoutNames<LayoutResourceKey<Resources>, CallbackName>[LayoutResourceKey<Resources>]>>;
|
|
148
140
|
} & {
|
|
149
141
|
name: Names & Record<Exclude<keyof Names, ResourceKeys[number]>, never>;
|
|
150
|
-
}): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, MappedResourceLayoutArguments<Resources, ResourceKeys, Names, CallbackName>, CustomProps, DefaultNamespace, States>;
|
|
142
|
+
}): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, MappedResourceLayoutArguments<Resources, ResourceKeys, Names, CallbackName>, CustomProps, DefaultNamespace, States, DefaultNaming>;
|
|
151
143
|
/**
|
|
152
144
|
* Creates a scoped layout factory with one default-name callback shared by
|
|
153
145
|
* every selected resource. The callback receives a capitalized resource
|
|
@@ -167,7 +159,7 @@ type CreateResourceLayoutForResourcesFn<Resources extends ReadonlyArray<Resource
|
|
|
167
159
|
name: (resource: CapitalizedResource<ResourceKeys[number]>) => Name;
|
|
168
160
|
} & {
|
|
169
161
|
resources: ResourceKeys;
|
|
170
|
-
}): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, SharedResourceLayoutArguments<Resources, ResourceKeys, Name>, CustomProps, DefaultNamespace, States>;
|
|
162
|
+
}): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, SharedResourceLayoutArguments<Resources, ResourceKeys, Name>, CustomProps, DefaultNamespace, States, DefaultNaming>;
|
|
171
163
|
/**
|
|
172
164
|
* Creates a scoped layout factory from a resource-keyed configuration.
|
|
173
165
|
* Only configured resources are available from the returned factory.
|
|
@@ -181,7 +173,7 @@ type CreateResourceLayoutForResourcesFn<Resources extends ReadonlyArray<Resource
|
|
|
181
173
|
* @param options Resource-keyed layout defaults.
|
|
182
174
|
* @returns A layout factory scoped to the configured resources.
|
|
183
175
|
*/
|
|
184
|
-
<const CallbackName extends string, const Selection extends ResourceLayoutSelection<Resources, CallbackName>>(options: Selection & AtLeastOneResourceLayoutSelection<Resources, CallbackName> & Partial<Record<Exclude<'resources', LayoutResourceKey<Resources>>, never>> & Record<Exclude<keyof Selection, LayoutResourceKey<Resources>>, never>): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, SelectedResourceLayoutArguments<Selection>, CustomProps, DefaultNamespace, States>;
|
|
176
|
+
<const CallbackName extends string, const Selection extends ResourceLayoutSelection<Resources, CallbackName>>(options: Selection & AtLeastOneResourceLayoutSelection<Resources, CallbackName> & Partial<Record<Exclude<'resources', LayoutResourceKey<Resources>>, never>> & Record<Exclude<keyof Selection, LayoutResourceKey<Resources>>, never>): ScopedCreateResourceLayoutFn<Resources, InProps, Composables, IncludeProps, SelectedResourceLayoutArguments<Selection>, CustomProps, DefaultNamespace, States, DefaultNaming>;
|
|
185
177
|
};
|
|
186
178
|
//#endregion
|
|
187
179
|
export { CreateResourceLayoutForResourcesFn };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scoped-layout.d.mts","names":[],"sources":["../../../src/create-config/for-resources/scoped-layout.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"scoped-layout.d.mts","names":[],"sources":["../../../src/create-config/for-resources/scoped-layout.ts"],"mappings":";;;;;;;;;;KA0CY,iCAAA,mBACQ,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,uBACd,oBAAA,uBACC,kBAAA,CAAmB,SAAA,EAAW,OAAA,EAAS,WAAA,qBAC1C,aAAA,iDAED,uBAAA,CAAwB,SAAA,EAAW,SAAA,iBACtC,aAAA,IACZ,sBAAA,CAAuB,SAAA,EAAW,OAAA,EAAS,WAAA,EAAa,YAAA;EAC1D,QAAA,EAAU,QAAA;EACV,KAAA,GAAQ,KAAA;EACR,IAAA,GAAO,IAAA;AAAA;AAAA,KAGG,gCAAA,mBACQ,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,uBACd,oBAAA,uBACC,kBAAA,CAAmB,SAAA,EAAW,OAAA,EAAS,WAAA,qBAC1C,aAAA,+BACE,aAAA,+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A,CAAc,iBAAA,CAAkB,SAAA;IAC3C,IAAA,GAAO,QAAA,EAAU,mBAAA,CAAoB,YAAA,cAA0B,IAAA;EAAA;IAC3D,SAAA,EAAW,YAAA;EAAA,IAChB,4BAAA,CACD,SAAA,EACA,OAAA,EACA,WAAA,EACA,YAAA,EACA,6BAAA,CAA8B,SAAA,EAAW,YAAA,EAAc,IAAA,GACvD,WAAA,EACA,gBAAA,EACA,MAAA,EACA,aAAA;EAjWA;;;;;;;;;;;;;EAAA,4DAmXwB,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,YAAA,EACA,+BAAA,CAAgC,SAAA,GAChC,WAAA,EACA,gBAAA,EACA,MAAA,EACA,aAAA;AAAA"}
|
|
@@ -1,20 +1,182 @@
|
|
|
1
|
+
const require_invalid_part = require('../errors/invalid-part.cjs');
|
|
2
|
+
const require_invalid_part_type = require('../errors/invalid-part-type.cjs');
|
|
3
|
+
const require_layout_configuration_error = require('../errors/layout-configuration-error.cjs');
|
|
1
4
|
|
|
2
5
|
//#region src/create-config/layout-name.ts
|
|
3
6
|
const layoutNamePattern = Symbol("layoutNamePattern");
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
const defaultPartDefinitions = {
|
|
8
|
+
prefix: "string",
|
|
9
|
+
beforeSuffix: "string",
|
|
10
|
+
append: "string"
|
|
11
|
+
};
|
|
12
|
+
function validatePartValues(definitions, values) {
|
|
13
|
+
if (values === void 0) return {};
|
|
14
|
+
if (values === null || typeof values !== "object" || Array.isArray(values)) throw new require_layout_configuration_error.LayoutConfigurationError("Naming part values must be an object.");
|
|
15
|
+
const supplied = [];
|
|
16
|
+
for (const part of Reflect.ownKeys(values)) {
|
|
17
|
+
if (typeof part !== "string" || !Object.hasOwn(definitions, part)) throw new require_invalid_part.InvalidPartError({
|
|
18
|
+
part: String(part),
|
|
19
|
+
validParts: Object.keys(definitions)
|
|
20
|
+
});
|
|
21
|
+
const value = Reflect.get(values, part);
|
|
22
|
+
if (value === void 0) continue;
|
|
23
|
+
const expectedType = definitions[part];
|
|
24
|
+
if (expectedType === "string" && typeof value === "string" || expectedType === "number" && typeof value === "number") supplied.push([part, value]);
|
|
25
|
+
else throw new require_invalid_part_type.InvalidPartTypeError({
|
|
26
|
+
part,
|
|
27
|
+
expectedType,
|
|
28
|
+
receivedType: value === null ? "null" : Array.isArray(value) ? "array" : typeof value
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return Object.fromEntries(supplied);
|
|
32
|
+
}
|
|
33
|
+
function createNamingFactory(definitions, definition) {
|
|
34
|
+
const pattern = typeof definition === "function" ? definition : definition.pattern;
|
|
35
|
+
const strict = typeof definition === "function" || definition.strict !== false;
|
|
36
|
+
const defaults = Object.fromEntries(Object.keys(definitions).map((key) => [key, ""]));
|
|
6
37
|
function name(parts) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
38
|
+
if (strict && typeof parts !== "function") validatePartValues(definitions, parts);
|
|
39
|
+
const resolver = ((context) => {
|
|
40
|
+
const values = typeof parts === "function" ? parts(context) : parts;
|
|
41
|
+
const supplied = strict ? validatePartValues(definitions, values) : Object.fromEntries(Object.entries(values ?? {}).filter(([, value]) => value !== void 0));
|
|
42
|
+
return pattern(context, {
|
|
43
|
+
...defaults,
|
|
44
|
+
...supplied
|
|
45
|
+
});
|
|
46
|
+
});
|
|
13
47
|
Object.defineProperty(resolver, layoutNamePattern, { value: {} });
|
|
14
48
|
return resolver;
|
|
15
49
|
}
|
|
16
50
|
return name;
|
|
17
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Defines a reusable layout naming convention that preserves resource-specific
|
|
54
|
+
* literal names in TypeScript. Define the pattern once, then supply optional
|
|
55
|
+
* part values wherever the convention is used.
|
|
56
|
+
*
|
|
57
|
+
* Omit `name` entirely when the generated name, such as `UsersLayout`, is enough.
|
|
58
|
+
* Use this helper when several layouts share a naming rule or need variations
|
|
59
|
+
* while retaining exact component `displayName` types.
|
|
60
|
+
*
|
|
61
|
+
* Choose the form that matches the values your convention needs:
|
|
62
|
+
*
|
|
63
|
+
* - `defineLayoutName(pattern)` provides the string parts `prefix`,
|
|
64
|
+
* `beforeSuffix`, and `append` for common naming variations.
|
|
65
|
+
* - `defineLayoutName.defineParts(...names).namingFn(pattern)` provides custom
|
|
66
|
+
* string parts when domain-specific names make the pattern clearer.
|
|
67
|
+
* - `defineLayoutName.defineParts(schema).namingFn(pattern)` declares each
|
|
68
|
+
* part as `'string'` or `'number'` when supplied values need different types.
|
|
69
|
+
*
|
|
70
|
+
* The pattern controls where parts appear; their names do not impose an order.
|
|
71
|
+
* Part values are optional and omitted values render as empty text. Supply an
|
|
72
|
+
* object for fixed values, or a callback when values depend on the resource.
|
|
73
|
+
* Numeric placeholders can also be empty text inside the pattern. Narrow them
|
|
74
|
+
* with `typeof value === 'number'` before using number-only methods.
|
|
75
|
+
* Supplied keys and value kinds are also validated at runtime. Unknown parts
|
|
76
|
+
* throw InvalidPartError; incorrect value kinds throw InvalidPartTypeError.
|
|
77
|
+
* Each returned naming resolver can be passed to a factory, definition, or
|
|
78
|
+
* component creation call through its `name` option.
|
|
79
|
+
*
|
|
80
|
+
* Strict checking defaults to true. Use `{ pattern, strict: false }` here or
|
|
81
|
+
* in namingFn to accept unchecked part keys and values in both TypeScript
|
|
82
|
+
* and runtime calls. Unchecked conventions return string names.
|
|
83
|
+
*
|
|
84
|
+
* @param definition - A pattern callback, or an object containing the pattern
|
|
85
|
+
* and optional strict-checking policy.
|
|
86
|
+
* @returns A function accepting optional part values or a context callback.
|
|
87
|
+
* Calling it with no arguments leaves every declared part empty.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* Use the default string parts for a shared convention with occasional variants.
|
|
91
|
+
* ```tsx
|
|
92
|
+
* const layoutName = defineLayoutName(({ resource, capitalize }, parts) =>
|
|
93
|
+
* `${parts.prefix}${capitalize(resource)}${parts.beforeSuffix}Layout${parts.append}`,
|
|
94
|
+
* );
|
|
95
|
+
* const factory = createDefinedResourceLayout({
|
|
96
|
+
* resources: ['users'],
|
|
97
|
+
* name: layoutName(),
|
|
98
|
+
* });
|
|
99
|
+
* const { createResourceLayout } = factory.defineResourceLayout({
|
|
100
|
+
* render: () => <div />,
|
|
101
|
+
* });
|
|
102
|
+
* const Users = createResourceLayout({ resource: 'users' });
|
|
103
|
+
* // Users.displayName is typed as 'UsersLayout'.
|
|
104
|
+
* const AdminUsers = createResourceLayout({
|
|
105
|
+
* resource: 'users',
|
|
106
|
+
* name: layoutName({ prefix: 'Admin', beforeSuffix: 'Detail' }),
|
|
107
|
+
* });
|
|
108
|
+
* // AdminUsers.displayName is typed as 'AdminUsersDetailLayout'.
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* Declare custom string parts when their names describe your application's
|
|
113
|
+
* conventions more clearly than prefix, beforeSuffix, and append.
|
|
114
|
+
* ```ts
|
|
115
|
+
* const pageName = defineLayoutName
|
|
116
|
+
* .defineParts('section', 'variant')
|
|
117
|
+
* .namingFn(({ resource, capitalize }, parts) =>
|
|
118
|
+
* `${parts.section}${capitalize(resource)}${parts.variant}Page`,
|
|
119
|
+
* );
|
|
120
|
+
* const adminPage = pageName({ section: 'Admin', variant: 'Detail' });
|
|
121
|
+
* // Used for 'users', this produces 'AdminUsersDetailPage'.
|
|
122
|
+
* const resourcePage = pageName(({ resource }) => ({
|
|
123
|
+
* section: resource === 'users' ? 'Admin' : 'Public',
|
|
124
|
+
* }));
|
|
125
|
+
* // Used for 'users', this produces 'AdminUsersPage'.
|
|
126
|
+
* // Other resources receive the 'Public' section instead.
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* Use a schema when a part should accept a number instead of a string.
|
|
131
|
+
* Supplied keys are suggested by the editor and checked against the schema.
|
|
132
|
+
* ```ts
|
|
133
|
+
* const versionedName = defineLayoutName
|
|
134
|
+
* .defineParts({ section: 'string', version: 'number' })
|
|
135
|
+
* .namingFn(({ resource, capitalize }, parts) =>
|
|
136
|
+
* `${parts.section}${capitalize(resource)}V${parts.version}`,
|
|
137
|
+
* );
|
|
138
|
+
* const adminV2 = versionedName({ section: 'Admin', version: 2 });
|
|
139
|
+
* // Used for 'users', this produces 'AdminUsersV2'.
|
|
140
|
+
* // versionedName({ version: '2' }) is rejected: version must be a number.
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* Guard optional numeric values before formatting them with number methods.
|
|
145
|
+
* Plain interpolation, as above, already handles empty values.
|
|
146
|
+
* ```ts
|
|
147
|
+
* const formattedName = defineLayoutName
|
|
148
|
+
* .defineParts({ version: 'number' })
|
|
149
|
+
* .namingFn(({ resource, capitalize }, parts) => {
|
|
150
|
+
* const version = typeof parts.version === 'number'
|
|
151
|
+
* ? parts.version.toFixed(0)
|
|
152
|
+
* : '';
|
|
153
|
+
* return `${capitalize(resource)}V${version}`;
|
|
154
|
+
* });
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* Opt out of part checking when a convention intentionally accepts external
|
|
159
|
+
* keys and mixed value types. The resulting displayName is typed as string.
|
|
160
|
+
* ```ts
|
|
161
|
+
* const externalName = defineLayoutName
|
|
162
|
+
* .defineParts({ version: 'number' })
|
|
163
|
+
* .namingFn({
|
|
164
|
+
* pattern: ({ resource }, parts) => `${resource}${parts.version}${parts.extra}`,
|
|
165
|
+
* strict: false,
|
|
166
|
+
* });
|
|
167
|
+
* const legacy = externalName({ version: 'legacy', extra: true });
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
function defineLayoutName(definition) {
|
|
171
|
+
return createNamingFactory(defaultPartDefinitions, definition);
|
|
172
|
+
}
|
|
173
|
+
function defineParts(...input) {
|
|
174
|
+
const definitions = typeof input[0] === "object" ? input[0] : Object.fromEntries(input.map((key) => [key, "string"]));
|
|
175
|
+
return { namingFn(definition) {
|
|
176
|
+
return createNamingFactory(definitions, definition);
|
|
177
|
+
} };
|
|
178
|
+
}
|
|
179
|
+
defineLayoutName.defineParts = defineParts;
|
|
18
180
|
|
|
19
181
|
//#endregion
|
|
20
182
|
exports.defineLayoutName = defineLayoutName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-name.cjs","names":[],"sources":["../../src/create-config/layout-name.ts"],"sourcesContent":["import { capitalize } from '../utils/capitalize';\n/** Literal placeholders allow a naming convention to retain resource-specific names. */\ndeclare const resourceNameToken: unique symbol;\ntype ResourceToken = string & { readonly [resourceNameToken]: true };\ntype CapitalizedToken = 'LayoutCapitalizedResourceToken';\ntype PatternNameContext = Omit<\n LayoutNameContext<ResourceToken>,\n 'capitalize'\n> & {\n capitalize: <T extends string>(\n value: T\n ) => T extends ResourceToken ? CapitalizedToken : Capitalize<T>;\n};\ntype PrefixToken = '__layout_prefix__';\ntype BeforeToken = '__layout_before_suffix__';\ntype AppendToken = '__layout_append__';\nexport interface LayoutNameContext<\n Resource extends string = string,\n State extends string = string\n> {\n resource: Resource;\n states: readonly State[];\n capitalize: typeof capitalize;\n}\nexport interface LayoutNameParts {\n prefix?: string;\n beforeSuffix?: string;\n append?: string;\n}\ntype PatternParts = {\n prefix: PrefixToken;\n beforeSuffix: BeforeToken;\n append: AppendToken;\n};\ntype Replace<\n S extends string,\n From extends string,\n To extends string\n> = S extends `${infer A}${From}${infer B}`\n ? `${A}${To}${Replace<B, From, To>}`\n : S;\ntype ReplaceResource<\n S extends string,\n Resource extends string\n> = S extends `${ResourceToken}${infer Rest}`\n ? `${Resource}${ReplaceResource<Rest, Resource>}`\n : S extends `${infer First}${infer Rest}`\n ? `${First}${ReplaceResource<Rest, Resource>}`\n : S;\ntype Part<P, K extends keyof LayoutNameParts> = K extends keyof P\n ? Extract<P[K], string>\n : '';\nexport type ResolveNamePattern<\n Pattern extends string,\n Resource extends string,\n Parts = {}\n> = ReplaceResource<\n Replace<\n Replace<\n Replace<\n Replace<Pattern, PrefixToken, Part<Parts, 'prefix'>>,\n BeforeToken,\n Part<Parts, 'beforeSuffix'>\n >,\n AppendToken,\n Part<Parts, 'append'>\n >,\n CapitalizedToken,\n Capitalize<Resource>\n >,\n Resource\n>;\nexport const layoutNamePattern: unique symbol = Symbol('layoutNamePattern');\nexport interface LayoutNameResolver<\n Pattern extends string = string,\n Parts = {}\n> {\n (context: LayoutNameContext): string;\n readonly [layoutNamePattern]: { pattern: Pattern; parts: Parts };\n}\nexport type LayoutNameInput<\n Resource extends string = string,\n States extends string = string,\n Name extends string = string\n> = Name | ((context: LayoutNameContext<Resource, States>) => Name);\nexport type ResolvedLayoutName<\n Naming,\n Resource extends string\n> = Naming extends LayoutNameResolver<infer Pattern, infer Parts>\n ? ResolveNamePattern<Pattern, Resource, Parts>\n : Naming extends (...args: any[]) => infer Result\n ? Extract<Result, string>\n : Naming extends string\n ? Naming\n : string;\n/** Define the stable structure once; supply optional variations at each call site. */\nexport function defineLayoutName<const Pattern extends string>(\n pattern: (context: PatternNameContext, parts: PatternParts) => Pattern\n) {\n function name<const Parts extends LayoutNameParts = {}>(\n parts?: Parts | ((context: PatternNameContext) => Parts)\n ): LayoutNameResolver<Pattern, Parts> {\n const resolver = ((context: LayoutNameContext) =>\n pattern(\n context as unknown as PatternNameContext,\n {\n prefix: '',\n beforeSuffix: '',\n append: '',\n ...(typeof parts === 'function'\n ? parts(context as unknown as PatternNameContext)\n : parts),\n } as PatternParts\n )) as unknown as LayoutNameResolver<Pattern, Parts>;\n Object.defineProperty(resolver, layoutNamePattern, { value: {} });\n return resolver;\n }\n return name;\n}\n"],"mappings":";;AAwEA,MAAa,oBAAmC,OAAO,mBAAmB;;AAwB1E,SAAgB,iBACd,SACA;CACA,SAAS,KACP,OACoC;EACpC,MAAM,aAAa,YACjB,QACE,SACA;GACE,QAAQ;GACR,cAAc;GACd,QAAQ;GACR,GAAI,OAAO,UAAU,aACjB,MAAM,OAAwC,IAC9C;EACN,CACF;EACF,OAAO,eAAe,UAAU,mBAAmB,EAAE,OAAO,CAAC,EAAE,CAAC;EAChE,OAAO;CACT;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"layout-name.cjs","names":["LayoutConfigurationError","InvalidPartError","InvalidPartTypeError"],"sources":["../../src/create-config/layout-name.ts"],"sourcesContent":["import { capitalize } from '../utils/capitalize';\nimport {\n InvalidPartError,\n InvalidPartTypeError,\n LayoutConfigurationError\n} from '../errors';\n/**\n * Each slot has a distinct type identity, so ordinary text cannot become a slot.\n */\ndeclare const layoutNamePlaceholder: unique symbol;\ntype NamePlaceholder<\n Key extends string,\n Value extends string | number = string\n> = Value & {\n readonly [layoutNamePlaceholder]: Key;\n};\ntype PatternNameContext = Omit<\n LayoutNameContext<NamePlaceholder<'resource'>>,\n 'capitalize'\n> & {\n capitalize: <T extends string>(\n value: T\n ) => T extends NamePlaceholder<'resource'>\n ? NamePlaceholder<'capitalizedResource'>\n : Capitalize<T>;\n};\nexport interface LayoutNameContext<\n Resource extends string = string,\n State extends string = string\n> {\n resource: Resource;\n states: readonly State[];\n capitalize: typeof capitalize;\n}\nexport interface LayoutNameParts {\n prefix?: string;\n beforeSuffix?: string;\n append?: string;\n}\n/**\n * Value kinds accepted by a declared naming part.\n */\nexport type LayoutNamePartType = 'string' | 'number';\n\n/**\n * Declares each naming part and the value kind accepted at call sites.\n */\nexport type LayoutNamePartDefinitions = Readonly<\n Record<string, LayoutNamePartType>\n>;\n\n/**\n * Defines the naming pattern and strict-checking policy. Strict defaults to true.\n */\nexport interface LayoutNameOptions<\n Definitions extends LayoutNamePartDefinitions,\n Pattern extends string,\n Strict extends boolean = true\n> {\n /**\n * Combines the naming context and part placeholders into a name.\n */\n pattern: NamingPattern<Definitions, Pattern, Strict>;\n /**\n * Set to false to skip part type checking and runtime validation.\n */\n strict?: Strict;\n}\n\n/**\n * Part values are intentionally unchecked when strict is false.\n */\ntype UncheckedNamingParts<Definitions extends LayoutNamePartDefinitions> =\n {\n [Key in keyof Definitions]?: any;\n } & Record<string, any>;\n\ntype PartValue<Type extends LayoutNamePartType> = Type extends 'number'\n ? number\n : string;\n\n/**\n * Optional values for declared naming parts. Omitted slots render as empty text.\n */\nexport type LayoutNamePartValues<\n Definitions extends LayoutNamePartDefinitions\n> = {\n [Key in keyof Definitions]?: PartValue<Definitions[Key]>;\n};\n\ntype PatternParts<Definitions extends LayoutNamePartDefinitions> = {\n [Key in keyof Definitions & string]: NamePlaceholder<\n `part:${Key}`,\n PartValue<Definitions[Key]> | ''\n >;\n};\ntype PartText<Value> = Value extends string | number ? `${Value}` : '';\ntype Part<Parts, Key extends keyof Parts> = PartText<Parts[Key]>;\ntype ResourcePlaceholderValues<Resource extends string> = {\n resource: Resource;\n capitalizedResource: Capitalize<Resource>;\n};\ntype PlaceholderValues<\n Resource extends string,\n Parts\n> = ResourcePlaceholderValues<Resource> & {\n [Key in keyof Parts & string as `part:${Key}`]: ResolvePattern<\n Part<Parts, Key>,\n ResourcePlaceholderValues<Resource>\n >;\n};\ntype MatchPlaceholder<Pattern extends string, Values> = {\n [Key in keyof Values & string]: Pattern extends\n | NamePlaceholder<Key>\n | `${NamePlaceholder<Key>}`\n | `${NamePlaceholder<Key, number>}`\n ? [Extract<Values[Key], string>, '']\n : Pattern extends `${NamePlaceholder<Key>}${infer Rest}`\n ? [Extract<Values[Key], string>, Rest]\n : Pattern extends `${NamePlaceholder<Key, number>}${infer Rest}`\n ? [Extract<Values[Key], string>, Rest]\n : never;\n}[keyof Values & string];\ntype ResolvePattern<\n Pattern extends string,\n Values,\n Result extends string = ''\n> = [MatchPlaceholder<Pattern, Values>] extends [never]\n ? Pattern extends `${infer First}${infer Rest}`\n ? ResolvePattern<Rest, Values, `${Result}${First}`>\n : `${Result}${Pattern}`\n : MatchPlaceholder<Pattern, Values> extends [\n infer Value extends string,\n infer Rest extends string\n ]\n ? ResolvePattern<Rest, Values, `${Result}${Value}`>\n : never;\nexport type ResolveNamePattern<\n Pattern extends string,\n Resource extends string,\n Parts = {}\n> = ResolvePattern<Pattern, PlaceholderValues<Resource, Parts>>;\nexport const layoutNamePattern: unique symbol = Symbol(\n 'layoutNamePattern'\n);\nexport interface LayoutNameResolver<\n Pattern extends string = string,\n Parts = {}\n> {\n (context: LayoutNameContext): string;\n readonly [layoutNamePattern]: { pattern: Pattern; parts: Parts };\n}\n/**\n * Computes a layout name from its resource and available render states.\n */\nexport type LayoutNameCallback<\n Resource extends string = string,\n States extends string = string,\n Name extends string = string\n> = (context: LayoutNameContext<Resource, States>) => Name;\n\nexport type LayoutNameInput<\n Resource extends string = string,\n States extends string = string,\n Name extends string = string\n> = Name | LayoutNameCallback<Resource, States, Name>;\nexport type ResolvedLayoutName<Naming, Resource extends string> = [\n Naming\n] extends [undefined]\n ? `${Capitalize<Resource>}Layout`\n : Naming extends LayoutNameResolver<infer Pattern, infer Parts>\n ? ResolveNamePattern<Pattern, Resource, Parts>\n : Naming extends (...args: any[]) => infer Result\n ? Extract<Result, string>\n : Naming extends string\n ? Naming\n : `${Capitalize<Resource>}Layout`;\ntype NamingPartsInput<\n Definitions extends LayoutNamePartDefinitions,\n Parts extends LayoutNamePartValues<Definitions>\n> = {\n [Key in keyof (LayoutNamePartValues<Definitions> &\n Parts)]: Key extends keyof Definitions\n ? (LayoutNamePartValues<Definitions> & Parts)[Key]\n : never;\n};\n\ntype NamingPartsCallback<\n Definitions extends LayoutNamePartDefinitions,\n Parts extends LayoutNamePartValues<Definitions>\n> = (context: PatternNameContext) => NamingPartsInput<Definitions, Parts>;\n\ntype ResolvedParts<\n Definitions extends LayoutNamePartDefinitions,\n Parts\n> = {\n [Key in keyof Definitions]: Key extends keyof Parts ? Parts[Key] : '';\n};\n\ntype NamingPattern<\n Definitions extends LayoutNamePartDefinitions,\n Pattern extends string,\n Strict extends boolean = true\n> = (\n context: PatternNameContext,\n parts: [Strict] extends [false]\n ? UncheckedNamingParts<Definitions>\n : PatternParts<Definitions>\n) => Pattern;\n\ntype NamingDefinition<\n Definitions extends LayoutNamePartDefinitions,\n Pattern extends string,\n Strict extends boolean\n> =\n | NamingPattern<Definitions, Pattern, Strict>\n | LayoutNameOptions<Definitions, Pattern, Strict>;\n\n/**\n * Supplies optional part values while preserving their literal types in names.\n */\ninterface CheckedLayoutNameFactory<\n Definitions extends LayoutNamePartDefinitions,\n Pattern extends string\n> {\n /**\n * Supplies values for declared parts without coercing their types.\n * Fixed values are checked immediately; callback results are checked when\n * the layout name is resolved for a resource.\n *\n * @throws {InvalidPartError} A supplied part has not been declared.\n * @throws {InvalidPartTypeError} A supplied value has the wrong kind.\n */\n <const Parts extends LayoutNamePartValues<Definitions> = {}>(\n parts?:\n | NamingPartsInput<Definitions, Parts>\n | NamingPartsCallback<Definitions, Parts>\n ): LayoutNameResolver<Pattern, ResolvedParts<Definitions, Parts>>;\n}\n\ninterface UncheckedLayoutNameFactory<\n Definitions extends LayoutNamePartDefinitions\n> {\n (\n parts?:\n | UncheckedNamingParts<Definitions>\n | ((\n context: PatternNameContext\n ) => UncheckedNamingParts<Definitions>)\n ): LayoutNameResolver<string>;\n}\n\n/**\n * Supplies optional naming parts. Strict conventions preserve literal names;\n * unchecked conventions accept arbitrary keys and values and return string names.\n */\nexport type LayoutNameFactory<\n Definitions extends LayoutNamePartDefinitions,\n Pattern extends string,\n Strict extends boolean = true\n> = [Strict] extends [false]\n ? UncheckedLayoutNameFactory<Definitions>\n : CheckedLayoutNameFactory<Definitions, Pattern>;\n\ninterface DefinedLayoutNameParts<\n Definitions extends LayoutNamePartDefinitions\n> {\n /**\n * Defines the naming pattern and optional strict-checking policy.\n * Strict defaults to true; false accepts unchecked part keys and values.\n */\n namingFn<\n const Pattern extends string,\n const Strict extends boolean = true\n >(\n definition: NamingDefinition<Definitions, Pattern, Strict>\n ): LayoutNameFactory<Definitions, Pattern, Strict>;\n}\n\nconst defaultPartDefinitions = {\n prefix: 'string',\n beforeSuffix: 'string',\n append: 'string'\n} satisfies { [Key in keyof LayoutNameParts]-?: 'string' };\n\nfunction validatePartValues(\n definitions: LayoutNamePartDefinitions,\n values: unknown\n): Record<string, string | number> {\n if (values === undefined) return {};\n if (\n values === null ||\n typeof values !== 'object' ||\n Array.isArray(values)\n ) {\n throw new LayoutConfigurationError(\n 'Naming part values must be an object.'\n );\n }\n\n const supplied: Array<[string, string | number]> = [];\n for (const part of Reflect.ownKeys(values)) {\n if (typeof part !== 'string' || !Object.hasOwn(definitions, part)) {\n throw new InvalidPartError({\n part: String(part),\n validParts: Object.keys(definitions)\n });\n }\n const value: unknown = Reflect.get(values, part);\n if (value === undefined) continue;\n\n const expectedType = definitions[part];\n if (\n (expectedType === 'string' && typeof value === 'string') ||\n (expectedType === 'number' && typeof value === 'number')\n ) {\n supplied.push([part, value]);\n } else {\n throw new InvalidPartTypeError({\n part,\n expectedType,\n receivedType:\n value === null\n ? 'null'\n : Array.isArray(value)\n ? 'array'\n : typeof value\n });\n }\n }\n return Object.fromEntries(supplied);\n}\n\nfunction createNamingFactory<\n Definitions extends LayoutNamePartDefinitions,\n const Pattern extends string,\n Strict extends boolean = true\n>(\n definitions: Definitions,\n definition: NamingDefinition<Definitions, Pattern, Strict>\n): LayoutNameFactory<Definitions, Pattern, Strict> {\n const pattern =\n typeof definition === 'function' ? definition : definition.pattern;\n const strict =\n typeof definition === 'function' || definition.strict !== false;\n const defaults = Object.fromEntries(\n Object.keys(definitions).map((key) => [key, ''])\n );\n function name<\n const Parts extends LayoutNamePartValues<Definitions> = {}\n >(\n parts?:\n | NamingPartsInput<Definitions, Parts>\n | NamingPartsCallback<Definitions, Parts>\n ): LayoutNameResolver<Pattern, ResolvedParts<Definitions, Parts>> {\n if (strict && typeof parts !== 'function')\n validatePartValues(definitions, parts);\n const resolver = ((context: LayoutNameContext) => {\n const values =\n typeof parts === 'function'\n ? parts(context as unknown as PatternNameContext)\n : parts;\n const supplied = strict\n ? validatePartValues(definitions, values)\n : Object.fromEntries(\n Object.entries(values ?? {}).filter(\n ([, value]) => value !== undefined\n )\n );\n return pattern(\n context as unknown as PatternNameContext,\n {\n ...defaults,\n ...supplied\n } as [Strict] extends [false]\n ? UncheckedNamingParts<Definitions>\n : PatternParts<Definitions>\n );\n }) as unknown as LayoutNameResolver<\n Pattern,\n ResolvedParts<Definitions, Parts>\n >;\n Object.defineProperty(resolver, layoutNamePattern, { value: {} });\n return resolver;\n }\n return name as LayoutNameFactory<Definitions, Pattern, Strict>;\n}\n\n/**\n * Defines a reusable layout naming convention that preserves resource-specific\n * literal names in TypeScript. Define the pattern once, then supply optional\n * part values wherever the convention is used.\n *\n * Omit `name` entirely when the generated name, such as `UsersLayout`, is enough.\n * Use this helper when several layouts share a naming rule or need variations\n * while retaining exact component `displayName` types.\n *\n * Choose the form that matches the values your convention needs:\n *\n * - `defineLayoutName(pattern)` provides the string parts `prefix`,\n * `beforeSuffix`, and `append` for common naming variations.\n * - `defineLayoutName.defineParts(...names).namingFn(pattern)` provides custom\n * string parts when domain-specific names make the pattern clearer.\n * - `defineLayoutName.defineParts(schema).namingFn(pattern)` declares each\n * part as `'string'` or `'number'` when supplied values need different types.\n *\n * The pattern controls where parts appear; their names do not impose an order.\n * Part values are optional and omitted values render as empty text. Supply an\n * object for fixed values, or a callback when values depend on the resource.\n * Numeric placeholders can also be empty text inside the pattern. Narrow them\n * with `typeof value === 'number'` before using number-only methods.\n * Supplied keys and value kinds are also validated at runtime. Unknown parts\n * throw InvalidPartError; incorrect value kinds throw InvalidPartTypeError.\n * Each returned naming resolver can be passed to a factory, definition, or\n * component creation call through its `name` option.\n *\n * Strict checking defaults to true. Use `{ pattern, strict: false }` here or\n * in namingFn to accept unchecked part keys and values in both TypeScript\n * and runtime calls. Unchecked conventions return string names.\n *\n * @param definition - A pattern callback, or an object containing the pattern\n * and optional strict-checking policy.\n * @returns A function accepting optional part values or a context callback.\n * Calling it with no arguments leaves every declared part empty.\n *\n * @example\n * Use the default string parts for a shared convention with occasional variants.\n * ```tsx\n * const layoutName = defineLayoutName(({ resource, capitalize }, parts) =>\n * `${parts.prefix}${capitalize(resource)}${parts.beforeSuffix}Layout${parts.append}`,\n * );\n * const factory = createDefinedResourceLayout({\n * resources: ['users'],\n * name: layoutName(),\n * });\n * const { createResourceLayout } = factory.defineResourceLayout({\n * render: () => <div />,\n * });\n * const Users = createResourceLayout({ resource: 'users' });\n * // Users.displayName is typed as 'UsersLayout'.\n * const AdminUsers = createResourceLayout({\n * resource: 'users',\n * name: layoutName({ prefix: 'Admin', beforeSuffix: 'Detail' }),\n * });\n * // AdminUsers.displayName is typed as 'AdminUsersDetailLayout'.\n * ```\n *\n * @example\n * Declare custom string parts when their names describe your application's\n * conventions more clearly than prefix, beforeSuffix, and append.\n * ```ts\n * const pageName = defineLayoutName\n * .defineParts('section', 'variant')\n * .namingFn(({ resource, capitalize }, parts) =>\n * `${parts.section}${capitalize(resource)}${parts.variant}Page`,\n * );\n * const adminPage = pageName({ section: 'Admin', variant: 'Detail' });\n * // Used for 'users', this produces 'AdminUsersDetailPage'.\n * const resourcePage = pageName(({ resource }) => ({\n * section: resource === 'users' ? 'Admin' : 'Public',\n * }));\n * // Used for 'users', this produces 'AdminUsersPage'.\n * // Other resources receive the 'Public' section instead.\n * ```\n *\n * @example\n * Use a schema when a part should accept a number instead of a string.\n * Supplied keys are suggested by the editor and checked against the schema.\n * ```ts\n * const versionedName = defineLayoutName\n * .defineParts({ section: 'string', version: 'number' })\n * .namingFn(({ resource, capitalize }, parts) =>\n * `${parts.section}${capitalize(resource)}V${parts.version}`,\n * );\n * const adminV2 = versionedName({ section: 'Admin', version: 2 });\n * // Used for 'users', this produces 'AdminUsersV2'.\n * // versionedName({ version: '2' }) is rejected: version must be a number.\n * ```\n *\n * @example\n * Guard optional numeric values before formatting them with number methods.\n * Plain interpolation, as above, already handles empty values.\n * ```ts\n * const formattedName = defineLayoutName\n * .defineParts({ version: 'number' })\n * .namingFn(({ resource, capitalize }, parts) => {\n * const version = typeof parts.version === 'number'\n * ? parts.version.toFixed(0)\n * : '';\n * return `${capitalize(resource)}V${version}`;\n * });\n * ```\n *\n * @example\n * Opt out of part checking when a convention intentionally accepts external\n * keys and mixed value types. The resulting displayName is typed as string.\n * ```ts\n * const externalName = defineLayoutName\n * .defineParts({ version: 'number' })\n * .namingFn({\n * pattern: ({ resource }, parts) => `${resource}${parts.version}${parts.extra}`,\n * strict: false,\n * });\n * const legacy = externalName({ version: 'legacy', extra: true });\n * ```\n */\nexport function defineLayoutName<\n const Pattern extends string,\n const Strict extends boolean = true\n>(\n definition: NamingDefinition<\n typeof defaultPartDefinitions,\n Pattern,\n Strict\n >\n): LayoutNameFactory<typeof defaultPartDefinitions, Pattern, Strict> {\n return createNamingFactory(defaultPartDefinitions, definition);\n}\n\n/**\n * Declares string placeholders from their names.\n * Call namingFn on the result to define how those slots form a layout name.\n */\nfunction defineParts<const Keys extends readonly string[]>(\n ...keys: Keys\n): DefinedLayoutNameParts<{ [Key in Keys[number]]: 'string' }>;\n/**\n * Declares placeholders with string or number values from a part schema.\n * Call namingFn on the result to define how those slots form a layout name.\n */\nfunction defineParts<const Definitions extends LayoutNamePartDefinitions>(\n definitions: Definitions\n): DefinedLayoutNameParts<Definitions>;\nfunction defineParts(\n ...input: string[] | [LayoutNamePartDefinitions]\n): DefinedLayoutNameParts<LayoutNamePartDefinitions> {\n const definitions =\n typeof input[0] === 'object'\n ? input[0]\n : Object.fromEntries(input.map((key) => [key, 'string']));\n return {\n namingFn(definition) {\n return createNamingFactory(definitions, definition);\n }\n };\n}\n\ndefineLayoutName.defineParts = defineParts;\n"],"mappings":";;;;;AA8IA,MAAa,oBAAmC,OAC9C,mBACF;AAuIA,MAAM,yBAAyB;CAC7B,QAAQ;C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