@jfdevelops/react-layout 0.2.0 → 0.3.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/define-layout.cjs +144 -0
- package/dist/create-config/define-layout.cjs.map +1 -0
- package/dist/create-config/define-layout.d.cts +106 -0
- package/dist/create-config/define-layout.d.cts.map +1 -0
- package/dist/create-config/define-layout.d.mts +106 -0
- package/dist/create-config/define-layout.d.mts.map +1 -0
- package/dist/create-config/define-layout.mjs +144 -0
- package/dist/create-config/define-layout.mjs.map +1 -0
- package/dist/create-config/get-component.cjs +52 -0
- package/dist/create-config/get-component.cjs.map +1 -0
- package/dist/create-config/get-component.d.cts +62 -0
- package/dist/create-config/get-component.d.cts.map +1 -0
- package/dist/create-config/get-component.d.mts +62 -0
- package/dist/create-config/get-component.d.mts.map +1 -0
- package/dist/create-config/get-component.mjs +51 -0
- package/dist/create-config/get-component.mjs.map +1 -0
- package/dist/create-config/index.d.cts +3 -0
- package/dist/create-config/index.d.mts +3 -0
- package/dist/create-config/types.d.cts +42 -0
- package/dist/create-config/types.d.cts.map +1 -0
- package/dist/create-config/types.d.mts +42 -0
- package/dist/create-config/types.d.mts.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/props.d.cts +2 -2
- package/dist/props.d.cts.map +1 -1
- package/dist/props.d.mts +2 -2
- package/dist/props.d.mts.map +1 -1
- package/dist/resource.cjs.map +1 -1
- package/dist/resource.d.cts +22 -2
- package/dist/resource.d.cts.map +1 -1
- package/dist/resource.d.mts +22 -2
- package/dist/resource.d.mts.map +1 -1
- package/dist/resource.mjs.map +1 -1
- package/dist/utils.cjs +5 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +2 -1
- package/dist/utils.d.cts.map +1 -1
- package/dist/utils.d.mts +2 -1
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs +5 -1
- package/dist/utils.mjs.map +1 -1
- package/dist/validators/validate-props.cjs +3 -1
- package/dist/validators/validate-props.cjs.map +1 -1
- package/dist/validators/validate-props.mjs +3 -1
- package/dist/validators/validate-props.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/create-config.cjs +0 -101
- package/dist/create-config.cjs.map +0 -1
- package/dist/create-config.d.cts +0 -67
- package/dist/create-config.d.cts.map +0 -1
- package/dist/create-config.d.mts +0 -67
- package/dist/create-config.d.mts.map +0 -1
- package/dist/create-config.mjs +0 -101
- package/dist/create-config.mjs.map +0 -1
package/dist/resource.d.cts
CHANGED
|
@@ -38,10 +38,30 @@ type ResourceDefinitionValue<Resource extends ResourceDefinition> = Resource ext
|
|
|
38
38
|
* Top-level resource names declared in a `resources` array. Preserves string
|
|
39
39
|
* literal unions for const resource definitions (unlike `keyof` on the
|
|
40
40
|
* normalized resource tree, which tends to widen to `string` in hovers).
|
|
41
|
-
|
|
41
|
+
*/
|
|
42
42
|
type LayoutResourceKey<Resources extends ReadonlyArray<ResourceDefinition>> = ResourceDefinitionValue<Resources[number]>;
|
|
43
|
+
type ResourceDefinitionForKey<Resources extends ReadonlyArray<ResourceDefinition>, Key extends string> = Extract<Resources[number], Key | {
|
|
44
|
+
value: Key;
|
|
45
|
+
}>;
|
|
46
|
+
/** `subResources` array declared on a layout resource. */
|
|
47
|
+
type SubResourceDefinitionsFor<Resources extends ReadonlyArray<ResourceDefinition>, Resource extends LayoutResourceKey<Resources>> = ResourceDefinitionForKey<Resources, Resource> extends {
|
|
48
|
+
subResources: infer SubResources extends ReadonlyArray<ResourceDefinition>;
|
|
49
|
+
} ? SubResources : readonly [];
|
|
50
|
+
type CanNestSubResourceParam<MaxDepth extends number, DepthAcc extends readonly unknown[]> = [...DepthAcc, unknown]['length'] extends MaxDepth ? false : true;
|
|
51
|
+
/**
|
|
52
|
+
* `subResource` route param: a slug at the current depth, or `{ resource, subResource }`
|
|
53
|
+
* when that slug has nested `subResources` in the layout tree and `MaxDepth` allows it.
|
|
54
|
+
*/
|
|
55
|
+
type RecursiveSubResourceParam<Resources extends ReadonlyArray<ResourceDefinition>, SubDefs extends ReadonlyArray<ResourceDefinition>, MaxDepth extends number = 6, DepthAcc extends readonly unknown[] = readonly []> = LayoutResourceKey<SubDefs> extends infer Key ? Key extends LayoutResourceKey<SubDefs> ? CanNestSubResourceParam<MaxDepth, DepthAcc> extends true ? ResourceDefinitionForKey<SubDefs, Key> extends {
|
|
56
|
+
subResources: infer Nested extends ReadonlyArray<ResourceDefinition>;
|
|
57
|
+
} ? [LayoutResourceKey<Nested>] extends [never] ? Key : Key | {
|
|
58
|
+
resource: Key;
|
|
59
|
+
subResource: RecursiveSubResourceParam<Resources, Nested, MaxDepth, readonly [...DepthAcc, unknown]>;
|
|
60
|
+
} : Key : Key : never : never;
|
|
61
|
+
/** Recursive `subResource` values for a layout resource (full tree depth). */
|
|
62
|
+
type SubResourceParamForResource<Resources extends ReadonlyArray<ResourceDefinition>, Resource extends LayoutResourceKey<Resources>> = [SubResourceDefinitionsFor<Resources, Resource>] extends [readonly []] ? never : RecursiveSubResourceParam<Resources, SubResourceDefinitionsFor<Resources, Resource>>;
|
|
43
63
|
type ResourceEnum<Resources extends ReadonlyArray<ResourceDefinition>> = NonEmptyReadonlyArray<LayoutResourceKey<Resources>>;
|
|
44
64
|
declare function toResourceEnum<Resources extends ReadonlyArray<ResourceDefinition>>(resources: NormalizeResources<Resources>): ResourceEnum<Resources>;
|
|
45
65
|
//#endregion
|
|
46
|
-
export { LayoutResourceKey, NormalizeResource, NormalizeResources, ResourceDefinition, ResourceEnum, ResourceLayoutComponentProps, ResourceTree, normalizeResource, normalizeResources, toResourceEnum };
|
|
66
|
+
export { LayoutResourceKey, NormalizeResource, NormalizeResources, ResourceDefinition, ResourceDefinitionForKey, ResourceEnum, ResourceLayoutComponentProps, ResourceTree, SubResourceDefinitionsFor, SubResourceParamForResource, normalizeResource, normalizeResources, toResourceEnum };
|
|
47
67
|
//# sourceMappingURL=resource.d.cts.map
|
package/dist/resource.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.cts","names":[],"sources":["../src/resource.ts"],"mappings":";;;;;KAIY,kBAAA;EAGN,KAAA;EACA,YAAA,EAAc,aAAa,CACzB,kBAAA;IALI;;;;;IAWF,cAAA;EAAA;AAAA;AAAA,KAKE,YAAA,GAAe,MAAM;EAG7B,YAAA,EAAc,YAAA;AAAA;AAAA,KAIN,iBAAA,kBAAmC,kBAAA,IAC7C,QAAA,4BAEc,QAAA;EACN,YAAA;AAAA,MAGJ,QAAA;EACI,KAAA;EACA,YAAA,6BACE,aAAA,CAAc,kBAAA;AAAA,cAGR,KAAA;EACN,YAAA,EAAc,kBAAA,CAAmB,YAAA;AAAA;AAAA,KAKjC,kBAAA,mBACQ,aAAA,CAAc,kBAAA,KAC9B,iBAAA,CACF,mBAAA,CAAoB,iBAAA,CAAkB,SAAA;AAAA,KAE5B,4BAAA;EACV,QAAA,EAAU,SAAS;AAAA;AAAA,iBAiCL,iBAAA,CAAkB,QAAA,EAAU,kBAAA,GAAqB,YAAY;AAAA,iBAI7D,kBAAA,mBACI,aAAA,CAAc,kBAAA,GAChC,SAAA,EAAW,SAAA,GAAY,kBAAA,CAAmB,SAAA;AAAA,KAIvC,uBAAA,kBAAyC,kBAAA,IAC5C,QAAA,kBACI,QAAA,GACA,QAAA;EAAmB,KAAA;AAAA,IACjB,KAAA;;;;;;KAQI,iBAAA,mBACQ,aAAA,CAAc,kBAAA,KAC9B,uBAAA,CAAwB,SAAA;AAAA,KAEhB,YAAA,mBAA+B,aAAA,CAAc,kBAAA,KACvD,qBAAA,CAAsB,iBAAA,CAAkB,SAAA;AAAA,iBAC1B,cAAA,mBACI,aAAA,CAAc,kBAAA,GAChC,SAAA,EAAW,kBAAA,CAAmB,SAAA,IAOJ,YAAA,CAAa,SAAA"}
|
|
1
|
+
{"version":3,"file":"resource.d.cts","names":[],"sources":["../src/resource.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AA,mBAChB,aAAA,CAAc,kBAAA,qFAG5B,iBAAA,CAAkB,OAAA,sBAClB,GAAA,SAAY,iBAAA,CAAkB,OAAA,IAC5B,uBAAA,CAAwB,QAAA,EAAU,QAAA,iBAChC,wBAAA,CAAyB,OAAA,EAAS,GAAA;EAChC,YAAA,uBAAmC,aAAA,CAAc,kBAAA;AAAA,KAEhD,iBAAA,CAAkB,MAAA,qBACjB,GAAA,GAEI,GAAA;EAEE,QAAA,EAAU,GAAA;EACV,WAAA,EAAa,yBAAA,CACX,SAAA,EACA,MAAA,EACA,QAAA,eACa,QAAA;AAAA,IAGvB,GAAA,GACF,GAAA;;KAKI,2BAAA,mBACQ,aAAA,CAAc,kBAAA,oBACf,iBAAA,CAAkB,SAAA,MAChC,yBAAA,CAA0B,SAAA,EAAW,QAAA,mCAEtC,yBAAA,CACE,SAAA,EACA,yBAAA,CAA0B,SAAA,EAAW,QAAA;AAAA,KAW/B,YAAA,mBAA+B,aAAA,CAAc,kBAAA,KACvD,qBAAA,CAAsB,iBAAA,CAAkB,SAAA;AAAA,iBAC1B,cAAA,mBACI,aAAA,CAAc,kBAAA,GAChC,SAAA,EAAW,kBAAA,CAAmB,SAAA,IAOJ,YAAA,CAAa,SAAA"}
|
package/dist/resource.d.mts
CHANGED
|
@@ -38,10 +38,30 @@ type ResourceDefinitionValue<Resource extends ResourceDefinition> = Resource ext
|
|
|
38
38
|
* Top-level resource names declared in a `resources` array. Preserves string
|
|
39
39
|
* literal unions for const resource definitions (unlike `keyof` on the
|
|
40
40
|
* normalized resource tree, which tends to widen to `string` in hovers).
|
|
41
|
-
|
|
41
|
+
*/
|
|
42
42
|
type LayoutResourceKey<Resources extends ReadonlyArray<ResourceDefinition>> = ResourceDefinitionValue<Resources[number]>;
|
|
43
|
+
type ResourceDefinitionForKey<Resources extends ReadonlyArray<ResourceDefinition>, Key extends string> = Extract<Resources[number], Key | {
|
|
44
|
+
value: Key;
|
|
45
|
+
}>;
|
|
46
|
+
/** `subResources` array declared on a layout resource. */
|
|
47
|
+
type SubResourceDefinitionsFor<Resources extends ReadonlyArray<ResourceDefinition>, Resource extends LayoutResourceKey<Resources>> = ResourceDefinitionForKey<Resources, Resource> extends {
|
|
48
|
+
subResources: infer SubResources extends ReadonlyArray<ResourceDefinition>;
|
|
49
|
+
} ? SubResources : readonly [];
|
|
50
|
+
type CanNestSubResourceParam<MaxDepth extends number, DepthAcc extends readonly unknown[]> = [...DepthAcc, unknown]['length'] extends MaxDepth ? false : true;
|
|
51
|
+
/**
|
|
52
|
+
* `subResource` route param: a slug at the current depth, or `{ resource, subResource }`
|
|
53
|
+
* when that slug has nested `subResources` in the layout tree and `MaxDepth` allows it.
|
|
54
|
+
*/
|
|
55
|
+
type RecursiveSubResourceParam<Resources extends ReadonlyArray<ResourceDefinition>, SubDefs extends ReadonlyArray<ResourceDefinition>, MaxDepth extends number = 6, DepthAcc extends readonly unknown[] = readonly []> = LayoutResourceKey<SubDefs> extends infer Key ? Key extends LayoutResourceKey<SubDefs> ? CanNestSubResourceParam<MaxDepth, DepthAcc> extends true ? ResourceDefinitionForKey<SubDefs, Key> extends {
|
|
56
|
+
subResources: infer Nested extends ReadonlyArray<ResourceDefinition>;
|
|
57
|
+
} ? [LayoutResourceKey<Nested>] extends [never] ? Key : Key | {
|
|
58
|
+
resource: Key;
|
|
59
|
+
subResource: RecursiveSubResourceParam<Resources, Nested, MaxDepth, readonly [...DepthAcc, unknown]>;
|
|
60
|
+
} : Key : Key : never : never;
|
|
61
|
+
/** Recursive `subResource` values for a layout resource (full tree depth). */
|
|
62
|
+
type SubResourceParamForResource<Resources extends ReadonlyArray<ResourceDefinition>, Resource extends LayoutResourceKey<Resources>> = [SubResourceDefinitionsFor<Resources, Resource>] extends [readonly []] ? never : RecursiveSubResourceParam<Resources, SubResourceDefinitionsFor<Resources, Resource>>;
|
|
43
63
|
type ResourceEnum<Resources extends ReadonlyArray<ResourceDefinition>> = NonEmptyReadonlyArray<LayoutResourceKey<Resources>>;
|
|
44
64
|
declare function toResourceEnum<Resources extends ReadonlyArray<ResourceDefinition>>(resources: NormalizeResources<Resources>): ResourceEnum<Resources>;
|
|
45
65
|
//#endregion
|
|
46
|
-
export { LayoutResourceKey, NormalizeResource, NormalizeResources, ResourceDefinition, ResourceEnum, ResourceLayoutComponentProps, ResourceTree, normalizeResource, normalizeResources, toResourceEnum };
|
|
66
|
+
export { LayoutResourceKey, NormalizeResource, NormalizeResources, ResourceDefinition, ResourceDefinitionForKey, ResourceEnum, ResourceLayoutComponentProps, ResourceTree, SubResourceDefinitionsFor, SubResourceParamForResource, normalizeResource, normalizeResources, toResourceEnum };
|
|
47
67
|
//# sourceMappingURL=resource.d.mts.map
|
package/dist/resource.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.mts","names":[],"sources":["../src/resource.ts"],"mappings":";;;;;KAIY,kBAAA;EAGN,KAAA;EACA,YAAA,EAAc,aAAa,CACzB,kBAAA;IALI;;;;;IAWF,cAAA;EAAA;AAAA;AAAA,KAKE,YAAA,GAAe,MAAM;EAG7B,YAAA,EAAc,YAAA;AAAA;AAAA,KAIN,iBAAA,kBAAmC,kBAAA,IAC7C,QAAA,4BAEc,QAAA;EACN,YAAA;AAAA,MAGJ,QAAA;EACI,KAAA;EACA,YAAA,6BACE,aAAA,CAAc,kBAAA;AAAA,cAGR,KAAA;EACN,YAAA,EAAc,kBAAA,CAAmB,YAAA;AAAA;AAAA,KAKjC,kBAAA,mBACQ,aAAA,CAAc,kBAAA,KAC9B,iBAAA,CACF,mBAAA,CAAoB,iBAAA,CAAkB,SAAA;AAAA,KAE5B,4BAAA;EACV,QAAA,EAAU,SAAS;AAAA;AAAA,iBAiCL,iBAAA,CAAkB,QAAA,EAAU,kBAAA,GAAqB,YAAY;AAAA,iBAI7D,kBAAA,mBACI,aAAA,CAAc,kBAAA,GAChC,SAAA,EAAW,SAAA,GAAY,kBAAA,CAAmB,SAAA;AAAA,KAIvC,uBAAA,kB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{"version":3,"file":"resource.mjs","names":[],"sources":["../src/resource.ts"],"sourcesContent":["import { ReactNode } from 'react';\nimport { NonEmptyReadonlyArray } from './validators';\nimport { MergeIntersection, UnionToIntersection } from './utils';\n\nexport type ResourceDefinition =\n | string\n | {\n value: string;\n subResources: ReadonlyArray<\n ResourceDefinition & {\n /**\n * Whether to allow any string as a sub resource.\n *\n * @default false\n */\n allowAnyString?: boolean;\n }\n >;\n };\n\nexport type ResourceTree = Record<\n string,\n {\n subResources: ResourceTree;\n }\n>;\n\nexport type NormalizeResource<Resource extends ResourceDefinition> =\n Resource extends string\n ? {\n [Key in Resource]: {\n subResources: {};\n };\n }\n : Resource extends {\n value: infer Value extends string;\n subResources: infer SubResources extends\n ReadonlyArray<ResourceDefinition>;\n }\n ? {\n [Key in Value]: {\n subResources: NormalizeResources<SubResources>;\n };\n }\n : never;\n\nexport type NormalizeResources<\n Resources extends ReadonlyArray<ResourceDefinition>,\n> = MergeIntersection<\n UnionToIntersection<NormalizeResource<Resources[number]>>\n>;\nexport type ResourceLayoutComponentProps = {\n children: ReactNode;\n};\n\nfunction normalizeResourceTree(resource: ResourceDefinition): ResourceTree {\n if (typeof resource === 'string') {\n return {\n [resource]: {\n subResources: {},\n },\n };\n }\n\n const { value, subResources } = resource;\n\n return {\n [value]: {\n subResources: normalizeResourcesTree(subResources),\n },\n };\n}\n\nfunction normalizeResourcesTree(\n resources: ReadonlyArray<ResourceDefinition>,\n): ResourceTree {\n const normalizedResources: ResourceTree = {};\n\n for (const resource of resources) {\n Object.assign(normalizedResources, normalizeResourceTree(resource));\n }\n\n return normalizedResources;\n}\n\nexport function normalizeResource(resource: ResourceDefinition): ResourceTree {\n return normalizeResourceTree(resource);\n}\n\nexport function normalizeResources<\n Resources extends ReadonlyArray<ResourceDefinition>,\n>(resources: Resources): NormalizeResources<Resources> {\n return normalizeResourcesTree(resources) as NormalizeResources<Resources>;\n}\n\ntype ResourceDefinitionValue<Resource extends ResourceDefinition> =\n Resource extends string\n ? Resource\n : Resource extends { value: infer Value extends string }\n ? Value\n
|
|
1
|
+
{"version":3,"file":"resource.mjs","names":[],"sources":["../src/resource.ts"],"sourcesContent":["import { ReactNode } from 'react';\nimport { NonEmptyReadonlyArray } from './validators';\nimport { MergeIntersection, UnionToIntersection } from './utils';\n\nexport type ResourceDefinition =\n | string\n | {\n value: string;\n subResources: ReadonlyArray<\n ResourceDefinition & {\n /**\n * Whether to allow any string as a sub resource.\n *\n * @default false\n */\n allowAnyString?: boolean;\n }\n >;\n };\n\nexport type ResourceTree = Record<\n string,\n {\n subResources: ResourceTree;\n }\n>;\n\nexport type NormalizeResource<Resource extends ResourceDefinition> =\n Resource extends string\n ? {\n [Key in Resource]: {\n subResources: {};\n };\n }\n : Resource extends {\n value: infer Value extends string;\n subResources: infer SubResources extends\n ReadonlyArray<ResourceDefinition>;\n }\n ? {\n [Key in Value]: {\n subResources: NormalizeResources<SubResources>;\n };\n }\n : never;\n\nexport type NormalizeResources<\n Resources extends ReadonlyArray<ResourceDefinition>,\n> = MergeIntersection<\n UnionToIntersection<NormalizeResource<Resources[number]>>\n>;\nexport type ResourceLayoutComponentProps = {\n children: ReactNode;\n};\n\nfunction normalizeResourceTree(resource: ResourceDefinition): ResourceTree {\n if (typeof resource === 'string') {\n return {\n [resource]: {\n subResources: {},\n },\n };\n }\n\n const { value, subResources } = resource;\n\n return {\n [value]: {\n subResources: normalizeResourcesTree(subResources),\n },\n };\n}\n\nfunction normalizeResourcesTree(\n resources: ReadonlyArray<ResourceDefinition>,\n): ResourceTree {\n const normalizedResources: ResourceTree = {};\n\n for (const resource of resources) {\n Object.assign(normalizedResources, normalizeResourceTree(resource));\n }\n\n return normalizedResources;\n}\n\nexport function normalizeResource(resource: ResourceDefinition): ResourceTree {\n return normalizeResourceTree(resource);\n}\n\nexport function normalizeResources<\n Resources extends ReadonlyArray<ResourceDefinition>,\n>(resources: Resources): NormalizeResources<Resources> {\n return normalizeResourcesTree(resources) as NormalizeResources<Resources>;\n}\n\ntype ResourceDefinitionValue<Resource extends ResourceDefinition> =\n Resource extends string\n ? Resource\n : Resource extends { value: infer Value extends string }\n ? Value\n : never;\n\n /**\n * Top-level resource names declared in a `resources` array. Preserves string\n * literal unions for const resource definitions (unlike `keyof` on the\n * normalized resource tree, which tends to widen to `string` in hovers).\n */\nexport type LayoutResourceKey<\n Resources extends ReadonlyArray<ResourceDefinition>,\n> = ResourceDefinitionValue<Resources[number]>;\n\nexport type ResourceDefinitionForKey<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Key extends string,\n> = Extract<Resources[number], Key | { value: Key }>;\n\n/** `subResources` array declared on a layout resource. */\nexport type SubResourceDefinitionsFor<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Resource extends LayoutResourceKey<Resources>,\n> = ResourceDefinitionForKey<Resources, Resource> extends {\n subResources: infer SubResources extends ReadonlyArray<ResourceDefinition>;\n}\n ? SubResources\n : readonly [];\n\ntype CanNestSubResourceParam<\n MaxDepth extends number,\n DepthAcc extends readonly unknown[],\n> = [...DepthAcc, unknown]['length'] extends MaxDepth ? false : true;\n\n/**\n * `subResource` route param: a slug at the current depth, or `{ resource, subResource }`\n * when that slug has nested `subResources` in the layout tree and `MaxDepth` allows it.\n */\nexport type RecursiveSubResourceParam<\n Resources extends ReadonlyArray<ResourceDefinition>,\n SubDefs extends ReadonlyArray<ResourceDefinition>,\n MaxDepth extends number = 6,\n DepthAcc extends readonly unknown[] = readonly [],\n> = LayoutResourceKey<SubDefs> extends infer Key\n ? Key extends LayoutResourceKey<SubDefs>\n ? CanNestSubResourceParam<MaxDepth, DepthAcc> extends true\n ? ResourceDefinitionForKey<SubDefs, Key> extends {\n subResources: infer Nested extends ReadonlyArray<ResourceDefinition>;\n }\n ? [LayoutResourceKey<Nested>] extends [never]\n ? Key\n :\n | Key\n | {\n resource: Key;\n subResource: RecursiveSubResourceParam<\n Resources,\n Nested,\n MaxDepth,\n readonly [...DepthAcc, unknown]\n >;\n }\n : Key\n : Key\n : never\n : never;\n\n/** Recursive `subResource` values for a layout resource (full tree depth). */\nexport type SubResourceParamForResource<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Resource extends LayoutResourceKey<Resources>,\n> = [SubResourceDefinitionsFor<Resources, Resource>] extends [readonly []]\n ? never\n : RecursiveSubResourceParam<\n Resources,\n SubResourceDefinitionsFor<Resources, Resource>\n >;\n\nexport type GetSubResourceKeys<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Resource extends LayoutResourceKey<Resources>,\n> = ResourceDefinitionForKey<Resources, Resource> extends {\n subResources: infer SubResources extends ReadonlyArray<ResourceDefinition>;\n}\n ? LayoutResourceKey<SubResources>\n : never;\nexport type ResourceEnum<Resources extends ReadonlyArray<ResourceDefinition>> =\n NonEmptyReadonlyArray<LayoutResourceKey<Resources>>;\nexport function toResourceEnum<\n Resources extends ReadonlyArray<ResourceDefinition>,\n>(resources: NormalizeResources<Resources>) {\n const keys = Object.keys(resources);\n\n if (keys.length === 0) {\n throw new Error('No resources provided');\n }\n\n return keys as unknown as ResourceEnum<Resources>;\n}\n"],"mappings":";AAuDA,SAAS,sBAAsB,UAA4C;CACzE,IAAI,OAAO,aAAa,UACtB,OAAO,GACJ,WAAW,EACV,cAAc,CAAC,EACjB,EACF;CAGF,MAAM,EAAE,OAAO,iBAAiB;CAEhC,OAAO,GACJ,QAAQ,EACP,cAAc,uBAAuB,YAAY,EACnD,EACF;AACF;AAEA,SAAS,uBACP,WACc;CACd,MAAM,sBAAoC,CAAC;CAE3C,KAAK,MAAM,YAAY,WACrB,OAAO,OAAO,qBAAqB,sBAAsB,QAAQ,CAAC;CAGpE,OAAO;AACT;AAEA,SAAgB,kBAAkB,UAA4C;CAC5E,OAAO,sBAAsB,QAAQ;AACvC;AAEA,SAAgB,mBAEd,WAAqD;CACrD,OAAO,uBAAuB,SAAS;AACzC;AA4FA,SAAgB,eAEd,WAA0C;CAC1C,MAAM,OAAO,OAAO,KAAK,SAAS;CAElC,IAAI,KAAK,WAAW,GAClB,MAAM,IAAI,MAAM,uBAAuB;CAGzC,OAAO;AACT"}
|
package/dist/utils.cjs
CHANGED
|
@@ -18,8 +18,13 @@ function pick(obj, keys) {
|
|
|
18
18
|
return acc;
|
|
19
19
|
}, {});
|
|
20
20
|
}
|
|
21
|
+
function functionalUpdate(value, updater) {
|
|
22
|
+
if (typeof updater === "function") return updater(value);
|
|
23
|
+
return updater;
|
|
24
|
+
}
|
|
21
25
|
|
|
22
26
|
//#endregion
|
|
27
|
+
exports.functionalUpdate = functionalUpdate;
|
|
23
28
|
exports.pick = pick;
|
|
24
29
|
exports.resolvePropDefinitionValues = resolvePropDefinitionValues;
|
|
25
30
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["export type Show<T> = T extends (...args: infer A) => infer R\n ? (...args: A) => R\n : { [K in keyof T]: T[K] } & {};\nexport type MergeIntersection<T> = {\n [Key in keyof T]: T[Key];\n};\n\nexport type UnionToIntersection<Union> = (\n Union extends unknown ? (value: Union) => void : never\n) extends (value: infer Intersection) => void\n ? Intersection\n : never;\n\nexport interface BaseComponent<Name extends string, Props = {}> {\n /**\n * The name of the component. Useful for debugging and error messages.\n */\n displayName: Name;\n /**\n * A type only property to get the type of the props. At runtime,\n * this is `undefined`.\n */\n props: Props;\n}\n\ntype ValueBackedDefinition = {\n _baseProp?: {\n value?: unknown;\n };\n};\n\nexport function isPropDefinitionShape(value: unknown): value is {\n visibility: unknown;\n} {\n return typeof value === 'function' && value !== null && 'visibility' in value;\n}\n\nexport function resolvePropDefinitionValues(input: Record<string, unknown>) {\n const out: Record<string, unknown> = {};\n\n for (const key of Object.keys(input)) {\n const value = input[key];\n out[key] = isPropDefinitionShape(value)\n ? (value as ValueBackedDefinition)._baseProp?.value\n : value;\n }\n\n return out;\n}\n\nexport function pick<T extends object, K extends keyof T>(obj: T, keys: K[]) {\n if (keys.length === 0) {\n return {} as Pick<T, K>;\n }\n\n return keys.reduce(\n (acc, key) => {\n if (key in obj) acc[key] = obj[key];\n\n return acc;\n },\n {} as Pick<T, K>,\n );\n}\n"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["export type Show<T> = T extends (...args: infer A) => infer R\n ? (...args: A) => R\n : { [K in keyof T]: T[K] } & {};\nexport type MergeIntersection<T> = {\n [Key in keyof T]: T[Key];\n};\nexport type IsUnion<T, U = T> = T extends unknown\n ? [U] extends [T]\n ? false\n : true\n : never;\nexport type UnionToIntersection<Union> = (\n Union extends unknown ? (value: Union) => void : never\n) extends (value: infer Intersection) => void\n ? Intersection\n : never;\nexport type Updater<T> = T | ((prev: T) => T);\n\nexport interface BaseComponent<Name extends string, Props = {}> {\n /**\n * The name of the component. Useful for debugging and error messages.\n */\n displayName: Name;\n /**\n * A type only property to get the type of the props. At runtime,\n * this is `undefined`.\n */\n props: Props;\n}\n\ntype ValueBackedDefinition = {\n _baseProp?: {\n value?: unknown;\n };\n};\n\nexport function isPropDefinitionShape(value: unknown): value is {\n visibility: unknown;\n} {\n return typeof value === 'function' && value !== null && 'visibility' in value;\n}\n\nexport function resolvePropDefinitionValues(input: Record<string, unknown>) {\n const out: Record<string, unknown> = {};\n\n for (const key of Object.keys(input)) {\n const value = input[key];\n out[key] = isPropDefinitionShape(value)\n ? (value as ValueBackedDefinition)._baseProp?.value\n : value;\n }\n\n return out;\n}\n\nexport function pick<T extends object, K extends keyof T>(obj: T, keys: K[]) {\n if (keys.length === 0) {\n return {} as Pick<T, K>;\n }\n\n return keys.reduce(\n (acc, key) => {\n if (key in obj) acc[key] = obj[key];\n\n return acc;\n },\n {} as Pick<T, K>,\n );\n}\n\nexport function functionalUpdate<T>(value: T, updater: Updater<T>){\n if (typeof updater === 'function') {\n return (updater as (prev: T) => T)(value);\n }\n\n return updater;\n}\n"],"mappings":";;AAoCA,SAAgB,sBAAsB,OAEpC;CACA,OAAO,OAAO,UAAU,cAAc,UAAU,QAAQ,gBAAgB;AAC1E;AAEA,SAAgB,4BAA4B,OAAgC;CAC1E,MAAM,MAA+B,CAAC;CAEtC,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EACpC,MAAM,QAAQ,MAAM;EACpB,IAAI,OAAO,sBAAsB,KAAK,IACjC,MAAgC,WAAW,QAC5C;CACN;CAEA,OAAO;AACT;AAEA,SAAgB,KAA0C,KAAQ,MAAW;CAC3E,IAAI,KAAK,WAAW,GAClB,OAAO,CAAC;CAGV,OAAO,KAAK,QACT,KAAK,QAAQ;EACZ,IAAI,OAAO,KAAK,IAAI,OAAO,IAAI;EAE/B,OAAO;CACT,GACA,CAAC,CACH;AACF;AAEA,SAAgB,iBAAoB,OAAU,SAAoB;CAChE,IAAI,OAAO,YAAY,YACrB,OAAQ,QAA2B,KAAK;CAG1C,OAAO;AACT"}
|
package/dist/utils.d.cts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
type Show<T> = T extends ((...args: infer A) => infer R) ? (...args: A) => R : { [K in keyof T]: T[K] } & {};
|
|
3
3
|
type MergeIntersection<T> = { [Key in keyof T]: T[Key] };
|
|
4
4
|
type UnionToIntersection<Union> = (Union extends unknown ? (value: Union) => void : never) extends ((value: infer Intersection) => void) ? Intersection : never;
|
|
5
|
+
type Updater<T> = T | ((prev: T) => T);
|
|
5
6
|
interface BaseComponent<Name extends string, Props = {}> {
|
|
6
7
|
/**
|
|
7
8
|
* The name of the component. Useful for debugging and error messages.
|
|
@@ -15,5 +16,5 @@ interface BaseComponent<Name extends string, Props = {}> {
|
|
|
15
16
|
}
|
|
16
17
|
declare function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
|
|
17
18
|
//#endregion
|
|
18
|
-
export { BaseComponent, MergeIntersection, Show, UnionToIntersection, pick };
|
|
19
|
+
export { BaseComponent, MergeIntersection, Show, UnionToIntersection, Updater, pick };
|
|
19
20
|
//# sourceMappingURL=utils.d.cts.map
|
package/dist/utils.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.cts","names":[],"sources":["../src/utils.ts"],"mappings":";KAAY,IAAA,MAAU,CAAA,cAAc,IAAA,6BAC5B,IAAA,EAAM,CAAA,KAAM,CAAA,iBACF,CAAA,GAAI,CAAA,CAAE,CAAA;AAAA,KACZ,iBAAA,sBACI,CAAA,GAAI,CAAA,CAAE,GAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"utils.d.cts","names":[],"sources":["../src/utils.ts"],"mappings":";KAAY,IAAA,MAAU,CAAA,cAAc,IAAA,6BAC5B,IAAA,EAAM,CAAA,KAAM,CAAA,iBACF,CAAA,GAAI,CAAA,CAAE,CAAA;AAAA,KACZ,iBAAA,sBACI,CAAA,GAAI,CAAA,CAAE,GAAA;AAAA,KAOV,mBAAA,WACV,KAAA,oBAAyB,KAAA,EAAO,KAAK,6BAC5B,KAAA,iCACP,YAAA;AAAA,KAEQ,OAAA,MAAa,CAAA,KAAM,IAAA,EAAM,CAAA,KAAM,CAAA;AAAA,UAE1B,aAAA;EAhBQ;;;EAoBvB,WAAA,EAAa,IAAA;EAtBqB;;;;EA2BlC,KAAA,EAAO,KAAK;AAAA;AAAA,iBA4BE,IAAA,mCAAuC,CAAA,EAAG,GAAA,EAAK,CAAA,EAAG,IAAA,EAAM,CAAA,KAAG,IAAA,CAAA,CAAA,EAAA,CAAA"}
|
package/dist/utils.d.mts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
type Show<T> = T extends ((...args: infer A) => infer R) ? (...args: A) => R : { [K in keyof T]: T[K] } & {};
|
|
3
3
|
type MergeIntersection<T> = { [Key in keyof T]: T[Key] };
|
|
4
4
|
type UnionToIntersection<Union> = (Union extends unknown ? (value: Union) => void : never) extends ((value: infer Intersection) => void) ? Intersection : never;
|
|
5
|
+
type Updater<T> = T | ((prev: T) => T);
|
|
5
6
|
interface BaseComponent<Name extends string, Props = {}> {
|
|
6
7
|
/**
|
|
7
8
|
* The name of the component. Useful for debugging and error messages.
|
|
@@ -15,5 +16,5 @@ interface BaseComponent<Name extends string, Props = {}> {
|
|
|
15
16
|
}
|
|
16
17
|
declare function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
|
|
17
18
|
//#endregion
|
|
18
|
-
export { BaseComponent, MergeIntersection, Show, UnionToIntersection, pick };
|
|
19
|
+
export { BaseComponent, MergeIntersection, Show, UnionToIntersection, Updater, pick };
|
|
19
20
|
//# sourceMappingURL=utils.d.mts.map
|
package/dist/utils.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.mts","names":[],"sources":["../src/utils.ts"],"mappings":";KAAY,IAAA,MAAU,CAAA,cAAc,IAAA,6BAC5B,IAAA,EAAM,CAAA,KAAM,CAAA,iBACF,CAAA,GAAI,CAAA,CAAE,CAAA;AAAA,KACZ,iBAAA,sBACI,CAAA,GAAI,CAAA,CAAE,GAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"utils.d.mts","names":[],"sources":["../src/utils.ts"],"mappings":";KAAY,IAAA,MAAU,CAAA,cAAc,IAAA,6BAC5B,IAAA,EAAM,CAAA,KAAM,CAAA,iBACF,CAAA,GAAI,CAAA,CAAE,CAAA;AAAA,KACZ,iBAAA,sBACI,CAAA,GAAI,CAAA,CAAE,GAAA;AAAA,KAOV,mBAAA,WACV,KAAA,oBAAyB,KAAA,EAAO,KAAK,6BAC5B,KAAA,iCACP,YAAA;AAAA,KAEQ,OAAA,MAAa,CAAA,KAAM,IAAA,EAAM,CAAA,KAAM,CAAA;AAAA,UAE1B,aAAA;EAhBQ;;;EAoBvB,WAAA,EAAa,IAAA;EAtBqB;;;;EA2BlC,KAAA,EAAO,KAAK;AAAA;AAAA,iBA4BE,IAAA,mCAAuC,CAAA,EAAG,GAAA,EAAK,CAAA,EAAG,IAAA,EAAM,CAAA,KAAG,IAAA,CAAA,CAAA,EAAA,CAAA"}
|
package/dist/utils.mjs
CHANGED
|
@@ -17,7 +17,11 @@ function pick(obj, keys) {
|
|
|
17
17
|
return acc;
|
|
18
18
|
}, {});
|
|
19
19
|
}
|
|
20
|
+
function functionalUpdate(value, updater) {
|
|
21
|
+
if (typeof updater === "function") return updater(value);
|
|
22
|
+
return updater;
|
|
23
|
+
}
|
|
20
24
|
|
|
21
25
|
//#endregion
|
|
22
|
-
export { pick, resolvePropDefinitionValues };
|
|
26
|
+
export { functionalUpdate, pick, resolvePropDefinitionValues };
|
|
23
27
|
//# sourceMappingURL=utils.mjs.map
|
package/dist/utils.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["export type Show<T> = T extends (...args: infer A) => infer R\n ? (...args: A) => R\n : { [K in keyof T]: T[K] } & {};\nexport type MergeIntersection<T> = {\n [Key in keyof T]: T[Key];\n};\n\nexport type UnionToIntersection<Union> = (\n Union extends unknown ? (value: Union) => void : never\n) extends (value: infer Intersection) => void\n ? Intersection\n : never;\n\nexport interface BaseComponent<Name extends string, Props = {}> {\n /**\n * The name of the component. Useful for debugging and error messages.\n */\n displayName: Name;\n /**\n * A type only property to get the type of the props. At runtime,\n * this is `undefined`.\n */\n props: Props;\n}\n\ntype ValueBackedDefinition = {\n _baseProp?: {\n value?: unknown;\n };\n};\n\nexport function isPropDefinitionShape(value: unknown): value is {\n visibility: unknown;\n} {\n return typeof value === 'function' && value !== null && 'visibility' in value;\n}\n\nexport function resolvePropDefinitionValues(input: Record<string, unknown>) {\n const out: Record<string, unknown> = {};\n\n for (const key of Object.keys(input)) {\n const value = input[key];\n out[key] = isPropDefinitionShape(value)\n ? (value as ValueBackedDefinition)._baseProp?.value\n : value;\n }\n\n return out;\n}\n\nexport function pick<T extends object, K extends keyof T>(obj: T, keys: K[]) {\n if (keys.length === 0) {\n return {} as Pick<T, K>;\n }\n\n return keys.reduce(\n (acc, key) => {\n if (key in obj) acc[key] = obj[key];\n\n return acc;\n },\n {} as Pick<T, K>,\n );\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["export type Show<T> = T extends (...args: infer A) => infer R\n ? (...args: A) => R\n : { [K in keyof T]: T[K] } & {};\nexport type MergeIntersection<T> = {\n [Key in keyof T]: T[Key];\n};\nexport type IsUnion<T, U = T> = T extends unknown\n ? [U] extends [T]\n ? false\n : true\n : never;\nexport type UnionToIntersection<Union> = (\n Union extends unknown ? (value: Union) => void : never\n) extends (value: infer Intersection) => void\n ? Intersection\n : never;\nexport type Updater<T> = T | ((prev: T) => T);\n\nexport interface BaseComponent<Name extends string, Props = {}> {\n /**\n * The name of the component. Useful for debugging and error messages.\n */\n displayName: Name;\n /**\n * A type only property to get the type of the props. At runtime,\n * this is `undefined`.\n */\n props: Props;\n}\n\ntype ValueBackedDefinition = {\n _baseProp?: {\n value?: unknown;\n };\n};\n\nexport function isPropDefinitionShape(value: unknown): value is {\n visibility: unknown;\n} {\n return typeof value === 'function' && value !== null && 'visibility' in value;\n}\n\nexport function resolvePropDefinitionValues(input: Record<string, unknown>) {\n const out: Record<string, unknown> = {};\n\n for (const key of Object.keys(input)) {\n const value = input[key];\n out[key] = isPropDefinitionShape(value)\n ? (value as ValueBackedDefinition)._baseProp?.value\n : value;\n }\n\n return out;\n}\n\nexport function pick<T extends object, K extends keyof T>(obj: T, keys: K[]) {\n if (keys.length === 0) {\n return {} as Pick<T, K>;\n }\n\n return keys.reduce(\n (acc, key) => {\n if (key in obj) acc[key] = obj[key];\n\n return acc;\n },\n {} as Pick<T, K>,\n );\n}\n\nexport function functionalUpdate<T>(value: T, updater: Updater<T>){\n if (typeof updater === 'function') {\n return (updater as (prev: T) => T)(value);\n }\n\n return updater;\n}\n"],"mappings":";AAoCA,SAAgB,sBAAsB,OAEpC;CACA,OAAO,OAAO,UAAU,cAAc,UAAU,QAAQ,gBAAgB;AAC1E;AAEA,SAAgB,4BAA4B,OAAgC;CAC1E,MAAM,MAA+B,CAAC;CAEtC,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EACpC,MAAM,QAAQ,MAAM;EACpB,IAAI,OAAO,sBAAsB,KAAK,IACjC,MAAgC,WAAW,QAC5C;CACN;CAEA,OAAO;AACT;AAEA,SAAgB,KAA0C,KAAQ,MAAW;CAC3E,IAAI,KAAK,WAAW,GAClB,OAAO,CAAC;CAGV,OAAO,KAAK,QACT,KAAK,QAAQ;EACZ,IAAI,OAAO,KAAK,IAAI,OAAO,IAAI;EAE/B,OAAO;CACT,GACA,CAAC,CACH;AACF;AAEA,SAAgB,iBAAoB,OAAU,SAAoB;CAChE,IAAI,OAAO,YAAY,YACrB,OAAQ,QAA2B,KAAK;CAG1C,OAAO;AACT"}
|
|
@@ -10,7 +10,9 @@ function validateProps(shape, props) {
|
|
|
10
10
|
const prop = shape[key];
|
|
11
11
|
if (prop.visibility === "required" && !(key in props)) throw new MissingRequiredPropError(key);
|
|
12
12
|
if (prop.visibility === "optional" && !(key in props)) continue;
|
|
13
|
-
|
|
13
|
+
const value = props[key];
|
|
14
|
+
if ("type" in prop && prop.type === "JSX.Element" && typeof value === "function") continue;
|
|
15
|
+
prop(value);
|
|
14
16
|
}
|
|
15
17
|
return props;
|
|
16
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-props.cjs","names":[],"sources":["../../src/validators/validate-props.ts"],"sourcesContent":["import type { AnyBuiltPropDefinition } from './types';\n\nexport class MissingRequiredPropError extends Error {\n constructor(key: string) {\n super(`Property \"${key}\" is required but not provided.`);\n }\n}\n\nexport function validateProps<T extends object>(\n shape: Record<string, AnyBuiltPropDefinition>,\n props: T,\n) {\n for (const key in shape) {\n const prop = shape[key];\n\n if (prop.visibility === 'required' && !(key in props)) {\n throw new MissingRequiredPropError(key);\n }\n\n if (prop.visibility === 'optional' && !(key in props)) {\n continue;\n }\n\n
|
|
1
|
+
{"version":3,"file":"validate-props.cjs","names":[],"sources":["../../src/validators/validate-props.ts"],"sourcesContent":["import type { AnyBuiltPropDefinition } from './types';\n\nexport class MissingRequiredPropError extends Error {\n constructor(key: string) {\n super(`Property \"${key}\" is required but not provided.`);\n }\n}\n\nexport function validateProps<T extends object>(\n shape: Record<string, AnyBuiltPropDefinition>,\n props: T,\n) {\n for (const key in shape) {\n const prop = shape[key];\n\n if (prop.visibility === 'required' && !(key in props)) {\n throw new MissingRequiredPropError(key);\n }\n\n if (prop.visibility === 'optional' && !(key in props)) {\n continue;\n }\n\n const value = (props as Record<string, unknown>)[key];\n\n if (\n 'type' in prop &&\n prop.type === 'JSX.Element' &&\n typeof value === 'function'\n ) {\n continue;\n }\n\n prop(value);\n }\n\n return props;\n}\n"],"mappings":";;AAEA,IAAa,2BAAb,cAA8C,MAAM;CAClD,YAAY,KAAa;EACvB,MAAM,aAAa,IAAI,gCAAgC;CACzD;AACF;AAEA,SAAgB,cACd,OACA,OACA;CACA,KAAK,MAAM,OAAO,OAAO;EACvB,MAAM,OAAO,MAAM;EAEnB,IAAI,KAAK,eAAe,cAAc,EAAE,OAAO,QAC7C,MAAM,IAAI,yBAAyB,GAAG;EAGxC,IAAI,KAAK,eAAe,cAAc,EAAE,OAAO,QAC7C;EAGF,MAAM,QAAS,MAAkC;EAEjD,IACE,UAAU,QACV,KAAK,SAAS,iBACd,OAAO,UAAU,YAEjB;EAGF,KAAK,KAAK;CACZ;CAEA,OAAO;AACT"}
|
|
@@ -9,7 +9,9 @@ function validateProps(shape, props) {
|
|
|
9
9
|
const prop = shape[key];
|
|
10
10
|
if (prop.visibility === "required" && !(key in props)) throw new MissingRequiredPropError(key);
|
|
11
11
|
if (prop.visibility === "optional" && !(key in props)) continue;
|
|
12
|
-
|
|
12
|
+
const value = props[key];
|
|
13
|
+
if ("type" in prop && prop.type === "JSX.Element" && typeof value === "function") continue;
|
|
14
|
+
prop(value);
|
|
13
15
|
}
|
|
14
16
|
return props;
|
|
15
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-props.mjs","names":[],"sources":["../../src/validators/validate-props.ts"],"sourcesContent":["import type { AnyBuiltPropDefinition } from './types';\n\nexport class MissingRequiredPropError extends Error {\n constructor(key: string) {\n super(`Property \"${key}\" is required but not provided.`);\n }\n}\n\nexport function validateProps<T extends object>(\n shape: Record<string, AnyBuiltPropDefinition>,\n props: T,\n) {\n for (const key in shape) {\n const prop = shape[key];\n\n if (prop.visibility === 'required' && !(key in props)) {\n throw new MissingRequiredPropError(key);\n }\n\n if (prop.visibility === 'optional' && !(key in props)) {\n continue;\n }\n\n
|
|
1
|
+
{"version":3,"file":"validate-props.mjs","names":[],"sources":["../../src/validators/validate-props.ts"],"sourcesContent":["import type { AnyBuiltPropDefinition } from './types';\n\nexport class MissingRequiredPropError extends Error {\n constructor(key: string) {\n super(`Property \"${key}\" is required but not provided.`);\n }\n}\n\nexport function validateProps<T extends object>(\n shape: Record<string, AnyBuiltPropDefinition>,\n props: T,\n) {\n for (const key in shape) {\n const prop = shape[key];\n\n if (prop.visibility === 'required' && !(key in props)) {\n throw new MissingRequiredPropError(key);\n }\n\n if (prop.visibility === 'optional' && !(key in props)) {\n continue;\n }\n\n const value = (props as Record<string, unknown>)[key];\n\n if (\n 'type' in prop &&\n prop.type === 'JSX.Element' &&\n typeof value === 'function'\n ) {\n continue;\n }\n\n prop(value);\n }\n\n return props;\n}\n"],"mappings":";AAEA,IAAa,2BAAb,cAA8C,MAAM;CAClD,YAAY,KAAa;EACvB,MAAM,aAAa,IAAI,gCAAgC;CACzD;AACF;AAEA,SAAgB,cACd,OACA,OACA;CACA,KAAK,MAAM,OAAO,OAAO;EACvB,MAAM,OAAO,MAAM;EAEnB,IAAI,KAAK,eAAe,cAAc,EAAE,OAAO,QAC7C,MAAM,IAAI,yBAAyB,GAAG;EAGxC,IAAI,KAAK,eAAe,cAAc,EAAE,OAAO,QAC7C;EAGF,MAAM,QAAS,MAAkC;EAEjD,IACE,UAAU,QACV,KAAK,SAAS,iBACd,OAAO,UAAU,YAEjB;EAGF,KAAK,KAAK;CACZ;CAEA,OAAO;AACT"}
|
package/package.json
CHANGED
package/dist/create-config.cjs
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
const require_utils = require('./utils.cjs');
|
|
2
|
-
const require_composable = require('./composable.cjs');
|
|
3
|
-
const require_builders = require('./validators/builders.cjs');
|
|
4
|
-
const require_validate_props = require('./validators/validate-props.cjs');
|
|
5
|
-
const require_resource = require('./resource.cjs');
|
|
6
|
-
const require_capitalize = require('./utils/capitalize.cjs');
|
|
7
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
-
|
|
9
|
-
//#region src/create-config.tsx
|
|
10
|
-
function isBuiltPropDefinition(value) {
|
|
11
|
-
return typeof value === "function" && value !== null && "visibility" in value;
|
|
12
|
-
}
|
|
13
|
-
function isSplitLayoutInPropDefinition(value) {
|
|
14
|
-
return value !== null && typeof value === "object" && "render" in value && value.render !== void 0;
|
|
15
|
-
}
|
|
16
|
-
function splitLayoutInProps(inProps) {
|
|
17
|
-
const resolvedInProps = {};
|
|
18
|
-
const splitInProps = {};
|
|
19
|
-
for (const [key, value] of Object.entries(inProps)) {
|
|
20
|
-
if (isBuiltPropDefinition(value)) {
|
|
21
|
-
resolvedInProps[key] = value;
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
if (isSplitLayoutInPropDefinition(value)) {
|
|
25
|
-
splitInProps[key] = value.render;
|
|
26
|
-
if (value.props && typeof value.props === "object") Object.assign(resolvedInProps, value.props);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
resolvedInProps,
|
|
31
|
-
splitInProps
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function defineResourceLayout(options) {
|
|
35
|
-
const { options: inProps, resources, layout } = options;
|
|
36
|
-
const normalizedResources = require_resource.normalizeResources(resources);
|
|
37
|
-
const resourcesEnum = require_builders.createPrimitivePropBuilder("string").enum(require_resource.toResourceEnum(normalizedResources));
|
|
38
|
-
const definedResourceLayout = (layoutOptions) => {
|
|
39
|
-
const { name, props: instancePropDefinitions, ...layoutOptionProps } = layoutOptions;
|
|
40
|
-
const createComposableLayout = require_composable.makeComposable();
|
|
41
|
-
const nameProp = require_builders.createProp.string().literal(name);
|
|
42
|
-
const { resolvedInProps, splitInProps } = splitLayoutInProps({
|
|
43
|
-
...typeof inProps === "function" ? inProps({
|
|
44
|
-
resource: resourcesEnum,
|
|
45
|
-
name: nameProp
|
|
46
|
-
}) : inProps,
|
|
47
|
-
...instancePropDefinitions,
|
|
48
|
-
...layoutOptionProps
|
|
49
|
-
});
|
|
50
|
-
const { composables, render, props: layoutProps } = layout;
|
|
51
|
-
const customLayoutProps = layoutProps?.custom;
|
|
52
|
-
const includeLayoutProps = layoutProps?.include;
|
|
53
|
-
const resolvedLayoutProps = {
|
|
54
|
-
...require_utils.pick(resolvedInProps, Object.keys(includeLayoutProps ?? {})),
|
|
55
|
-
...customLayoutProps
|
|
56
|
-
};
|
|
57
|
-
const layoutContext = {
|
|
58
|
-
resource: layoutOptions.resource,
|
|
59
|
-
name,
|
|
60
|
-
capitalize: require_capitalize.capitalize
|
|
61
|
-
};
|
|
62
|
-
const resolvedComposables = composables ? require_composable.resolveLayoutComposables(composables, layoutContext) : void 0;
|
|
63
|
-
const mergedRenderContext = {
|
|
64
|
-
composables: resolvedComposables,
|
|
65
|
-
resource: layoutContext.resource,
|
|
66
|
-
name: layoutContext.name,
|
|
67
|
-
inProps: splitInProps
|
|
68
|
-
};
|
|
69
|
-
function Component(props) {
|
|
70
|
-
const validatedProps = require_validate_props.validateProps(resolvedLayoutProps, props);
|
|
71
|
-
const includedPropKeys = Object.keys(includeLayoutProps ?? {});
|
|
72
|
-
const includedPropDefinitions = require_utils.pick(resolvedInProps, includedPropKeys);
|
|
73
|
-
const validatedIncludedProps = require_validate_props.validateProps(includedPropDefinitions, {
|
|
74
|
-
...require_utils.resolvePropDefinitionValues(includedPropDefinitions),
|
|
75
|
-
...require_utils.pick(splitInProps, includedPropKeys),
|
|
76
|
-
...require_utils.pick(layoutOptionProps, includedPropKeys)
|
|
77
|
-
});
|
|
78
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: render({
|
|
79
|
-
...validatedProps,
|
|
80
|
-
...validatedIncludedProps
|
|
81
|
-
}, mergedRenderContext) });
|
|
82
|
-
}
|
|
83
|
-
function createComposition(compositionOptions) {
|
|
84
|
-
if (!compositionOptions.components) return {};
|
|
85
|
-
return { makeComposable: createComposableLayout(compositionOptions) };
|
|
86
|
-
}
|
|
87
|
-
return Object.assign(Component, {
|
|
88
|
-
displayName: name,
|
|
89
|
-
props: void 0,
|
|
90
|
-
...createComposition({
|
|
91
|
-
components: resolvedComposables,
|
|
92
|
-
name
|
|
93
|
-
})
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
return definedResourceLayout;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
//#endregion
|
|
100
|
-
exports.defineResourceLayout = defineResourceLayout;
|
|
101
|
-
//# sourceMappingURL=create-config.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-config.cjs","names":["normalizeResources","createPrimitivePropBuilder","toResourceEnum","makeComposable","createProp","pick","resolveLayoutComposables","validateProps","resolvePropDefinitionValues"],"sources":["../src/create-config.tsx"],"sourcesContent":["import type { JSX } from 'react';\nimport {\n type ComposableComponents,\n type ComposableNameContext,\n type CreateLayoutComposable,\n MakeComposable,\n makeComposable,\n MakeComposableOptions,\n resolveLayoutComposables,\n} from './composable';\nimport {\n type AnyBuiltPropDefinition,\n createPrimitivePropBuilder,\n createProp,\n type ResolveLayoutProps,\n type ResolveProps,\n validateProps,\n} from './validators';\nimport {\n IncludedProps,\n InferredInProps,\n InPropsDefinition,\n InPropsObject,\n LayoutRenderProps,\n} from './props';\nimport {\n normalizeResources,\n toResourceEnum,\n type LayoutResourceKey,\n type NormalizeResources,\n type ResourceDefinition,\n} from './resource';\nimport {\n BaseComponent,\n pick,\n resolvePropDefinitionValues,\n Show,\n} from './utils';\nimport { capitalize } from './utils/capitalize';\n\ntype LayoutProps<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n IncludeProps extends IncludedProps<InferredInProps<Resources, Options>> = {},\n CustomProps extends InPropsObject = {},\n> = {\n /**\n * Props to include in the layout.\n */\n include?: IncludeProps;\n /**\n * Custom props that the layout will receive.\n */\n custom?: CustomProps;\n};\n\ntype LayoutRenderContext<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Composables extends ComposableComponents,\n> = {\n composables: LayoutRenderComposables<Composables>;\n inProps: Record<string, unknown>;\n resource: LayoutResourceKey<Resources>;\n name: string;\n};\ntype LayoutRenderComposables<Composables extends ComposableComponents> = [\n keyof Composables,\n] extends [never]\n ? undefined\n : Composables;\n\ntype SplitLayoutInPropDefinition<\n Props extends InPropsObject = {},\n Content = unknown,\n> = {\n props?: Props;\n render: ((props: ResolveProps<Props>) => Content) | Content;\n};\n\nfunction isBuiltPropDefinition(\n value: unknown,\n): value is AnyBuiltPropDefinition {\n return typeof value === 'function' && value !== null && 'visibility' in value;\n}\n\nfunction isSplitLayoutInPropDefinition(\n value: unknown,\n): value is SplitLayoutInPropDefinition {\n return (\n value !== null &&\n typeof value === 'object' &&\n 'render' in value &&\n (value as { render?: unknown }).render !== undefined\n );\n}\n\nfunction splitLayoutInProps(inProps: Record<string, unknown>) {\n const resolvedInProps: Record<string, AnyBuiltPropDefinition> = {};\n const splitInProps: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(inProps)) {\n if (isBuiltPropDefinition(value)) {\n resolvedInProps[key] = value;\n continue;\n }\n\n if (isSplitLayoutInPropDefinition(value)) {\n splitInProps[key] = value.render;\n\n if (value.props && typeof value.props === 'object') {\n Object.assign(resolvedInProps, value.props);\n }\n }\n }\n\n return {\n resolvedInProps,\n splitInProps,\n };\n}\n\ntype CreateViewMapOptions<\n Resources extends ReadonlyArray<ResourceDefinition>,\n Options extends InPropsDefinition<Resources>,\n IncludeProps extends IncludedProps<InferredInProps<Resources, Options>> = {},\n CustomProps extends InPropsObject = {},\n Composables extends ComposableComponents = {},\n> = {\n /**\n * An array of valid resource names to support.\n */\n resources: Resources;\n /**\n * The options that are passed into the created resource layout.\n */\n options: Options;\n layout: {\n /**\n * The props to pass to the layout.\n */\n props?: LayoutProps<Resources, Options, IncludeProps, CustomProps>;\n /**\n * Components used to compose the layout. Invoked per layout instance with\n * a scoped `create` that resolves composable `name` callbacks using the\n * layout's `resource` and `name`.\n */\n composables?: (\n create: CreateLayoutComposable<LayoutResourceKey<Resources>>,\n ) => Composables;\n /**\n * The render function for the layout.\n */\n render: (\n props: LayoutRenderProps<Resources, Options, IncludeProps, CustomProps>,\n context: LayoutRenderContext<Resources, Composables>,\n ) => JSX.Element;\n };\n};\n\ntype ResourceLayoutComposition<\n Name extends string,\n Composables extends ComposableComponents,\n> = [keyof Composables] extends [never]\n ? {}\n : {\n makeComposable: MakeComposable<Composables, Name>;\n };\ntype ResourceLayoutComponent<\n Name extends string,\n Props extends InPropsObject = {},\n Composables extends ComposableComponents = {},\n> = ResourceLayoutComposition<Name, Composables> &\n BaseComponent<Name, ResolveProps<Props>> & {\n (props: Show<ResolveProps<Props>>): JSX.Element;\n };\n\ntype DefinedResourceLayoutOptions<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n Name extends string,\n Resource extends LayoutResourceKey<Resources>,\n Props extends InPropsObject = {},\n> = ResolveLayoutProps<InferredInProps<Resources, InProps>> & {\n name: Name;\n resource: Resource;\n props?: Props;\n};\ntype DefinedResourceLayout<\n Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n IncludeProps extends IncludedProps<InferredInProps<Resources, InProps>> = {},\n CustomProps extends InPropsObject = {},\n Composables extends ComposableComponents = {},\n> = <\n Name extends string,\n Resource extends LayoutResourceKey<Resources>,\n Props extends InPropsObject = {},\n>(\n options: DefinedResourceLayoutOptions<\n Resources,\n InProps,\n Name,\n Resource,\n Props\n >,\n) => ResourceLayoutComponent<Name, CustomProps, Composables>;\n\nexport function defineResourceLayout<\n const Resources extends ReadonlyArray<ResourceDefinition>,\n InProps extends InPropsDefinition<Resources>,\n IncludeProps extends IncludedProps<InferredInProps<Resources, InProps>> = {},\n CustomProps extends InPropsObject = {},\n Composables extends ComposableComponents = {},\n>(\n options: CreateViewMapOptions<\n Resources,\n InProps,\n IncludeProps,\n CustomProps,\n Composables\n >,\n) {\n const { options: inProps, resources, layout } = options;\n const normalizedResources = normalizeResources(resources);\n const resourcesEnum = createPrimitivePropBuilder('string').enum(\n toResourceEnum(normalizedResources),\n );\n const definedResourceLayout: DefinedResourceLayout<\n Resources,\n InProps,\n IncludeProps,\n CustomProps,\n Composables\n > = (layoutOptions) => {\n const {\n name,\n props: instancePropDefinitions,\n ...layoutOptionProps\n } = layoutOptions;\n const createComposableLayout =\n makeComposable<\n LayoutRenderProps<Resources, InProps, IncludeProps, CustomProps>\n >();\n const nameProp = createProp.string().literal(name);\n const rawResolvedOptions =\n typeof inProps === 'function'\n ? inProps({\n resource: resourcesEnum,\n name: nameProp,\n })\n : inProps;\n const { resolvedInProps, splitInProps } = splitLayoutInProps({\n ...(rawResolvedOptions as Record<string, unknown>),\n ...(instancePropDefinitions as Record<string, unknown> | undefined),\n ...layoutOptionProps,\n });\n const { composables, render, props: layoutProps } = layout;\n const customLayoutProps = layoutProps?.custom;\n const includeLayoutProps = layoutProps?.include;\n const resolvedIncludedProps = pick(\n resolvedInProps,\n Object.keys(includeLayoutProps ?? {}),\n );\n const resolvedLayoutProps = {\n ...resolvedIncludedProps,\n ...customLayoutProps,\n };\n const layoutContext: ComposableNameContext<\n LayoutResourceKey<Resources>,\n typeof name\n > = {\n resource: layoutOptions.resource,\n name,\n capitalize,\n };\n const resolvedComposables = composables\n ? resolveLayoutComposables(composables, layoutContext)\n : undefined;\n const mergedRenderContext = {\n composables: resolvedComposables as LayoutRenderComposables<Composables>,\n resource: layoutContext.resource,\n name: layoutContext.name,\n inProps: splitInProps,\n } as LayoutRenderContext<Resources, Composables>;\n\n function Component(props: Show<ResolveProps<CustomProps>>) {\n const validatedProps = validateProps(resolvedLayoutProps, props);\n const includedPropKeys = Object.keys(includeLayoutProps ?? {});\n const includedPropDefinitions = pick(\n resolvedInProps,\n includedPropKeys,\n ) as Record<string, unknown>;\n const includedPropValues = {\n ...resolvePropDefinitionValues(includedPropDefinitions),\n ...pick(\n splitInProps,\n includedPropKeys as (keyof typeof splitInProps)[],\n ),\n ...pick(\n layoutOptionProps,\n includedPropKeys as (keyof typeof layoutOptionProps)[],\n ),\n };\n const validatedIncludedProps = validateProps(\n includedPropDefinitions as Record<string, AnyBuiltPropDefinition>,\n includedPropValues,\n );\n const layoutRenderProps = {\n ...validatedProps,\n ...validatedIncludedProps,\n } as unknown as LayoutRenderProps<\n Resources,\n InProps,\n IncludeProps,\n CustomProps\n >;\n\n return <>{render(layoutRenderProps, mergedRenderContext)}</>;\n }\n\n function createComposition<LayoutName extends string>(\n compositionOptions: MakeComposableOptions<Composables, LayoutName>,\n ) {\n if (!compositionOptions.components) {\n return {} as ResourceLayoutComposition<LayoutName, Composables>;\n }\n\n return {\n makeComposable: createComposableLayout(compositionOptions),\n };\n }\n\n return Object.assign(Component, {\n displayName: name,\n props: undefined as unknown as ResolveProps<CustomProps>,\n ...createComposition({\n components: resolvedComposables as Composables | undefined,\n name,\n }),\n });\n };\n\n return definedResourceLayout;\n}\n"],"mappings":";;;;;;;;;AA+EA,SAAS,sBACP,OACiC;CACjC,OAAO,OAAO,UAAU,cAAc,UAAU,QAAQ,gBAAgB;AAC1E;AAEA,SAAS,8BACP,OACsC;CACtC,OACE,UAAU,QACV,OAAO,UAAU,YACjB,YAAY,SACX,MAA+B,WAAW;AAE/C;AAEA,SA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M,cAAc;GACpB,SAAS;EACX;EAEA,SAAS,UAAU,OAAwC;GACzD,MAAM,iBAAiBC,qCAAc,qBAAqB,KAAK;GAC/D,MAAM,mBAAmB,OAAO,KAAK,sBAAsB,CAAC,CAAC;GAC7D,MAAM,0BAA0BF,mBAC9B,iBACA,gBACF;GAYA,MAAM,yBAAyBE,qCAC7B,yBACA;IAZA,GAAGC,0CAA4B,uBAAuB;IACtD,GAAGH,mBACD,cACA,gBACF;IACA,GAAGA,mBACD,mBACA,gBACF;GAIiB,CACnB;GAWA,OAAO,mFAAG,OAAO;IATf,GAAG;IACH,GAAG;GAQ4B,GAAG,mBAAmB,EAAI;EAC7D;EAEA,SAAS,kBACP,oBACA;GACA,IAAI,CAAC,mBAAmB,YACtB,OAAO,CAAC;GAGV,OAAO,EACL,gBAAgB,uBAAuB,kBAAkB,EAC3D;EACF;EAEA,OAAO,OAAO,OAAO,WAAW;GAC9B,aAAa;GACb,OAAO;GACP,GAAG,kBAAkB;IACnB,YAAY;IACZ;GACF,CAAC;EACH,CAAC;CACH;CAEA,OAAO;AACT"}
|
package/dist/create-config.d.cts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { ResolveLayoutProps, ResolveProps } from "./validators/types.cjs";
|
|
2
|
-
import { BaseComponent, Show } from "./utils.cjs";
|
|
3
|
-
import { LayoutResourceKey, ResourceDefinition } from "./resource.cjs";
|
|
4
|
-
import { InPropsDefinition, InPropsObject, IncludedProps, InferredInProps, LayoutRenderProps } from "./props.cjs";
|
|
5
|
-
import { ComposableComponents, CreateLayoutComposable, MakeComposable } from "./composable.cjs";
|
|
6
|
-
import { JSX } from "react";
|
|
7
|
-
|
|
8
|
-
//#region src/create-config.d.ts
|
|
9
|
-
type LayoutProps<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, IncludeProps extends IncludedProps<InferredInProps<Resources, Options>> = {}, CustomProps extends InPropsObject = {}> = {
|
|
10
|
-
/**
|
|
11
|
-
* Props to include in the layout.
|
|
12
|
-
*/
|
|
13
|
-
include?: IncludeProps;
|
|
14
|
-
/**
|
|
15
|
-
* Custom props that the layout will receive.
|
|
16
|
-
*/
|
|
17
|
-
custom?: CustomProps;
|
|
18
|
-
};
|
|
19
|
-
type LayoutRenderContext<Resources extends ReadonlyArray<ResourceDefinition>, Composables extends ComposableComponents> = {
|
|
20
|
-
composables: LayoutRenderComposables<Composables>;
|
|
21
|
-
inProps: Record<string, unknown>;
|
|
22
|
-
resource: LayoutResourceKey<Resources>;
|
|
23
|
-
name: string;
|
|
24
|
-
};
|
|
25
|
-
type LayoutRenderComposables<Composables extends ComposableComponents> = [keyof Composables] extends [never] ? undefined : Composables;
|
|
26
|
-
type CreateViewMapOptions<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, IncludeProps extends IncludedProps<InferredInProps<Resources, Options>> = {}, CustomProps extends InPropsObject = {}, Composables extends ComposableComponents = {}> = {
|
|
27
|
-
/**
|
|
28
|
-
* An array of valid resource names to support.
|
|
29
|
-
*/
|
|
30
|
-
resources: Resources;
|
|
31
|
-
/**
|
|
32
|
-
* The options that are passed into the created resource layout.
|
|
33
|
-
*/
|
|
34
|
-
options: Options;
|
|
35
|
-
layout: {
|
|
36
|
-
/**
|
|
37
|
-
* The props to pass to the layout.
|
|
38
|
-
*/
|
|
39
|
-
props?: LayoutProps<Resources, Options, IncludeProps, CustomProps>;
|
|
40
|
-
/**
|
|
41
|
-
* Components used to compose the layout. Invoked per layout instance with
|
|
42
|
-
* a scoped `create` that resolves composable `name` callbacks using the
|
|
43
|
-
* layout's `resource` and `name`.
|
|
44
|
-
*/
|
|
45
|
-
composables?: (create: CreateLayoutComposable<LayoutResourceKey<Resources>>) => Composables;
|
|
46
|
-
/**
|
|
47
|
-
* The render function for the layout.
|
|
48
|
-
*/
|
|
49
|
-
render: (props: LayoutRenderProps<Resources, Options, IncludeProps, CustomProps>, context: LayoutRenderContext<Resources, Composables>) => JSX.Element;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
type ResourceLayoutComposition<Name extends string, Composables extends ComposableComponents> = [keyof Composables] extends [never] ? {} : {
|
|
53
|
-
makeComposable: MakeComposable<Composables, Name>;
|
|
54
|
-
};
|
|
55
|
-
type ResourceLayoutComponent<Name extends string, Props extends InPropsObject = {}, Composables extends ComposableComponents = {}> = ResourceLayoutComposition<Name, Composables> & BaseComponent<Name, ResolveProps<Props>> & {
|
|
56
|
-
(props: Show<ResolveProps<Props>>): JSX.Element;
|
|
57
|
-
};
|
|
58
|
-
type DefinedResourceLayoutOptions<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Name extends string, Resource extends LayoutResourceKey<Resources>, Props extends InPropsObject = {}> = ResolveLayoutProps<InferredInProps<Resources, InProps>> & {
|
|
59
|
-
name: Name;
|
|
60
|
-
resource: Resource;
|
|
61
|
-
props?: Props;
|
|
62
|
-
};
|
|
63
|
-
type DefinedResourceLayout<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, IncludeProps extends IncludedProps<InferredInProps<Resources, InProps>> = {}, CustomProps extends InPropsObject = {}, Composables extends ComposableComponents = {}> = <Name extends string, Resource extends LayoutResourceKey<Resources>, Props extends InPropsObject = {}>(options: DefinedResourceLayoutOptions<Resources, InProps, Name, Resource, Props>) => ResourceLayoutComponent<Name, CustomProps, Composables>;
|
|
64
|
-
declare function defineResourceLayout<const Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, IncludeProps extends IncludedProps<InferredInProps<Resources, InProps>> = {}, CustomProps extends InPropsObject = {}, Composables extends ComposableComponents = {}>(options: CreateViewMapOptions<Resources, InProps, IncludeProps, CustomProps, Composables>): DefinedResourceLayout<Resources, InProps, IncludeProps, CustomProps, Composables>;
|
|
65
|
-
//#endregion
|
|
66
|
-
export { defineResourceLayout };
|
|
67
|
-
//# sourceMappingURL=create-config.d.cts.map
|
|
@@ -1 +0,0 @@
|
|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,uBAAA,oCAEW,aAAA,2BACM,oBAAA,SAClB,yBAAA,CAA0B,IAAA,EAAM,WAAA,IAClC,aAAA,CAAc,IAAA,EAAM,YAAA,CAAa,KAAA;EAAA,CAC9B,KAAA,EAAO,IAAA,CAAK,YAAA,CAAa,KAAA,KAAU,GAAA,CAAI,OAAA;AAAA;AAAA,KAGvC,4BAAA,mBACe,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,yCAEjB,iBAAA,CAAkB,SAAA,iBACrB,aAAA,SACZ,kBAAA,CAAmB,eAAA,CAAgB,SAAA,EAAW,OAAA;EAChD,IAAA,EAAM,IAAA;EACN,QAAA,EAAU,QAAA;EACV,KAAA,GAAQ,KAAA;AAAA;AAAA,KAEL,qBAAA,mBACe,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,wBACb,aAAA,CAAc,eAAA,CAAgB,SAAA,EAAW,OAAA,6BAC1C,aAAA,2BACA,oBAAA,gDAGH,iBAAA,CAAkB,SAAA,iBACrB,aAAA,OAEd,OAAA,EAAS,4BAAA,CACP,SAAA,EACA,OAAA,EACA,IAAA,EACA,QAAA,EACA,KAAA,MAEC,uBAAA,CAAwB,IAAA,EAAM,WAAA,EAAa,WAAA;AAAA,iBAEhC,oBAAA,yBACU,aAAA,CAAc,kBAAA,mBACtB,iBAAA,CAAkB,SAAA,wBACb,aAAA,CAAc,eAAA,CAAgB,SAAA,EAAW,OAAA,6BAC1C,aAAA,2BACA,oBAAA,OAEpB,OAAA,EAAS,oBAAA,CACP,SAAA,EACA,OAAA,EACA,YAAA,EACA,WAAA,EACA,WAAA,IACD,qBAAA,CAAA,SAAA,EAAA,OAAA,EAAA,YAAA,EAAA,WAAA,EAAA,WAAA"}
|
package/dist/create-config.d.mts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { ResolveLayoutProps, ResolveProps } from "./validators/types.mjs";
|
|
2
|
-
import { BaseComponent, Show } from "./utils.mjs";
|
|
3
|
-
import { LayoutResourceKey, ResourceDefinition } from "./resource.mjs";
|
|
4
|
-
import { InPropsDefinition, InPropsObject, IncludedProps, InferredInProps, LayoutRenderProps } from "./props.mjs";
|
|
5
|
-
import { ComposableComponents, CreateLayoutComposable, MakeComposable } from "./composable.mjs";
|
|
6
|
-
import { JSX } from "react";
|
|
7
|
-
|
|
8
|
-
//#region src/create-config.d.ts
|
|
9
|
-
type LayoutProps<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, IncludeProps extends IncludedProps<InferredInProps<Resources, Options>> = {}, CustomProps extends InPropsObject = {}> = {
|
|
10
|
-
/**
|
|
11
|
-
* Props to include in the layout.
|
|
12
|
-
*/
|
|
13
|
-
include?: IncludeProps;
|
|
14
|
-
/**
|
|
15
|
-
* Custom props that the layout will receive.
|
|
16
|
-
*/
|
|
17
|
-
custom?: CustomProps;
|
|
18
|
-
};
|
|
19
|
-
type LayoutRenderContext<Resources extends ReadonlyArray<ResourceDefinition>, Composables extends ComposableComponents> = {
|
|
20
|
-
composables: LayoutRenderComposables<Composables>;
|
|
21
|
-
inProps: Record<string, unknown>;
|
|
22
|
-
resource: LayoutResourceKey<Resources>;
|
|
23
|
-
name: string;
|
|
24
|
-
};
|
|
25
|
-
type LayoutRenderComposables<Composables extends ComposableComponents> = [keyof Composables] extends [never] ? undefined : Composables;
|
|
26
|
-
type CreateViewMapOptions<Resources extends ReadonlyArray<ResourceDefinition>, Options extends InPropsDefinition<Resources>, IncludeProps extends IncludedProps<InferredInProps<Resources, Options>> = {}, CustomProps extends InPropsObject = {}, Composables extends ComposableComponents = {}> = {
|
|
27
|
-
/**
|
|
28
|
-
* An array of valid resource names to support.
|
|
29
|
-
*/
|
|
30
|
-
resources: Resources;
|
|
31
|
-
/**
|
|
32
|
-
* The options that are passed into the created resource layout.
|
|
33
|
-
*/
|
|
34
|
-
options: Options;
|
|
35
|
-
layout: {
|
|
36
|
-
/**
|
|
37
|
-
* The props to pass to the layout.
|
|
38
|
-
*/
|
|
39
|
-
props?: LayoutProps<Resources, Options, IncludeProps, CustomProps>;
|
|
40
|
-
/**
|
|
41
|
-
* Components used to compose the layout. Invoked per layout instance with
|
|
42
|
-
* a scoped `create` that resolves composable `name` callbacks using the
|
|
43
|
-
* layout's `resource` and `name`.
|
|
44
|
-
*/
|
|
45
|
-
composables?: (create: CreateLayoutComposable<LayoutResourceKey<Resources>>) => Composables;
|
|
46
|
-
/**
|
|
47
|
-
* The render function for the layout.
|
|
48
|
-
*/
|
|
49
|
-
render: (props: LayoutRenderProps<Resources, Options, IncludeProps, CustomProps>, context: LayoutRenderContext<Resources, Composables>) => JSX.Element;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
type ResourceLayoutComposition<Name extends string, Composables extends ComposableComponents> = [keyof Composables] extends [never] ? {} : {
|
|
53
|
-
makeComposable: MakeComposable<Composables, Name>;
|
|
54
|
-
};
|
|
55
|
-
type ResourceLayoutComponent<Name extends string, Props extends InPropsObject = {}, Composables extends ComposableComponents = {}> = ResourceLayoutComposition<Name, Composables> & BaseComponent<Name, ResolveProps<Props>> & {
|
|
56
|
-
(props: Show<ResolveProps<Props>>): JSX.Element;
|
|
57
|
-
};
|
|
58
|
-
type DefinedResourceLayoutOptions<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, Name extends string, Resource extends LayoutResourceKey<Resources>, Props extends InPropsObject = {}> = ResolveLayoutProps<InferredInProps<Resources, InProps>> & {
|
|
59
|
-
name: Name;
|
|
60
|
-
resource: Resource;
|
|
61
|
-
props?: Props;
|
|
62
|
-
};
|
|
63
|
-
type DefinedResourceLayout<Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, IncludeProps extends IncludedProps<InferredInProps<Resources, InProps>> = {}, CustomProps extends InPropsObject = {}, Composables extends ComposableComponents = {}> = <Name extends string, Resource extends LayoutResourceKey<Resources>, Props extends InPropsObject = {}>(options: DefinedResourceLayoutOptions<Resources, InProps, Name, Resource, Props>) => ResourceLayoutComponent<Name, CustomProps, Composables>;
|
|
64
|
-
declare function defineResourceLayout<const Resources extends ReadonlyArray<ResourceDefinition>, InProps extends InPropsDefinition<Resources>, IncludeProps extends IncludedProps<InferredInProps<Resources, InProps>> = {}, CustomProps extends InPropsObject = {}, Composables extends ComposableComponents = {}>(options: CreateViewMapOptions<Resources, InProps, IncludeProps, CustomProps, Composables>): DefinedResourceLayout<Resources, InProps, IncludeProps, CustomProps, Composables>;
|
|
65
|
-
//#endregion
|
|
66
|
-
export { defineResourceLayout };
|
|
67
|
-
//# sourceMappingURL=create-config.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-config.d.mts","names":[],"sources":["../src/create-config.tsx"],"mappings":";;;;;;;;KAwCK,WAAA,mBACe,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,wBACb,aAAA,CAAc,eAAA,CAAgB,SAAA,EAAW,OAAA,6BAC1C,aAAA;;;AAPL;EAYf,OAAA,GAAU,YAAA;EATI;;;EAad,MAAA,GAAS,WAAA;AAAA;AAAA,KAGN,mBAAA,mBACe,aAAA,CAAc,kBAAA,uBACZ,oBAAA;EAEpB,WAAA,EAAa,uBAAA,CAAwB,WAAA;EACrC,OAAA,EAAS,MAAA;EACT,QAAA,EAAU,iBAAA,CAAkB,SAAA;EAC5B,IAAA;AAAA;AAAA,KAEG,uBAAA,qBAA4C,oBAAA,WACzC,WAAA,gCAGJ,WAAA;AAAA,KAoDC,oBAAA,mBACe,aAAA,CAAc,kBAAA,mBAChB,iBAAA,CAAkB,SAAA,wBACb,aAAA,CAAc,eAAA,CAAgB,SAAA,EAAW,OAAA,6BAC1C,aAAA,2BACA,oBAAA;EArFF;;;EA0FlB,SAAA,EAAW,SAAA;EAzFuB;;;EA6FlC,OAAA,EAAS,OAAA;EACT,MAAA;IA7F8D;;;IAiG5D,KAAA,GAAQ,WAAA,CAAY,SAAA,EAAW,OAAA,EAAS,YAAA,EAAc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