@jfdevelops/react-layout 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/create-config/create-defined-resource-layout.cjs.map +1 -1
- package/dist/create-config/create-defined-resource-layout.d.cts +1 -1
- package/dist/create-config/create-defined-resource-layout.d.cts.map +1 -1
- package/dist/create-config/create-defined-resource-layout.d.mts +1 -1
- package/dist/create-config/create-defined-resource-layout.d.mts.map +1 -1
- package/dist/create-config/create-defined-resource-layout.mjs.map +1 -1
- package/dist/create-config/create-reusable.cjs +185 -21
- package/dist/create-config/create-reusable.cjs.map +1 -1
- package/dist/create-config/create-reusable.d.cts +1 -41
- package/dist/create-config/create-reusable.d.mts +1 -41
- package/dist/create-config/create-reusable.mjs +185 -21
- package/dist/create-config/create-reusable.mjs.map +1 -1
- package/dist/create-config/index.d.cts +1 -1
- package/dist/create-config/index.d.mts +1 -1
- package/dist/create-config/merge-layout-props.cjs.map +1 -1
- package/dist/create-config/merge-layout-props.mjs.map +1 -1
- package/dist/create-config/reusable-types.d.cts +131 -0
- package/dist/create-config/reusable-types.d.cts.map +1 -0
- package/dist/create-config/reusable-types.d.mts +131 -0
- package/dist/create-config/reusable-types.d.mts.map +1 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/props.cjs.map +1 -1
- package/dist/props.d.cts +6 -1
- package/dist/props.d.cts.map +1 -1
- package/dist/props.d.mts +6 -1
- package/dist/props.d.mts.map +1 -1
- package/dist/props.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/create-config/create-reusable.d.cts.map +0 -1
- package/dist/create-config/create-reusable.d.mts.map +0 -1
|
@@ -1,41 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { InPropsDefinition, InPropsObject, InferredInProps } from "../props.cjs";
|
|
3
|
-
import { AnyBuiltPropDefinition, ExtractDefinitionValue, ResolvedBuiltPropShape } from "@jfdevelops/react-layout-validator";
|
|
4
|
-
|
|
5
|
-
//#region src/create-config/create-reusable.d.ts
|
|
6
|
-
/** Object definitions can be selected recursively; other definitions are leaves. */
|
|
7
|
-
type ReusableOptionSelection<Props extends InPropsObject> = { [Key in keyof Props]?: Props[Key] extends {
|
|
8
|
-
type: 'object';
|
|
9
|
-
properties: infer Shape extends InPropsObject;
|
|
10
|
-
} ? true | ReusableOptionSelection<Shape> : true };
|
|
11
|
-
type OptionDefinitions<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = InferredInProps<Resources, Options> extends infer Props extends InPropsObject ? Props : never;
|
|
12
|
-
/** Only data sources declared by the factory are available for selection. */
|
|
13
|
-
type ReusableInclude<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = {
|
|
14
|
-
resources?: true;
|
|
15
|
-
} & (keyof OptionDefinitions<Resources, Options> extends never ? {} : {
|
|
16
|
-
options?: true | ReusableOptionSelection<OptionDefinitions<Resources, Options>>;
|
|
17
|
-
});
|
|
18
|
-
type SelectedOptionValue<Definition extends AnyBuiltPropDefinition, Selection> = Selection extends true ? ExtractDefinitionValue<Definition> : Definition extends {
|
|
19
|
-
properties: infer Shape extends InPropsObject;
|
|
20
|
-
} ? SelectedOptionProps<Shape, Selection> : never;
|
|
21
|
-
type SelectedOptionProps<Props extends InPropsObject, Selection> = { [Key in keyof Props & keyof Selection as Props[Key]['visibility'] extends 'required' ? Key : never]: SelectedOptionValue<Props[Key], Selection[Key]> } & { [Key in keyof Props & keyof Selection as Props[Key]['visibility'] extends 'optional' ? Key : never]?: SelectedOptionValue<Props[Key], Selection[Key]> };
|
|
22
|
-
/** Options are flattened one level, so `options: { meta: true }` supplies `meta`. */
|
|
23
|
-
type ReusableProps<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject> = (Include extends {
|
|
24
|
-
resources: true;
|
|
25
|
-
} ? {
|
|
26
|
-
resources: ResourceEnum<Resources>[number][];
|
|
27
|
-
} : {}) & (Include extends {
|
|
28
|
-
options: infer Selection;
|
|
29
|
-
} ? Selection extends true ? ResolvedBuiltPropShape<OptionDefinitions<Resources, Options>> : SelectedOptionProps<OptionDefinitions<Resources, Options>, Selection> : {}) & ResolvedBuiltPropShape<Custom>;
|
|
30
|
-
type ExactSelection<Selection, Allowed> = { [Key in keyof Selection]: Key extends keyof Allowed ? Selection[Key] extends object ? ExactSelection<Selection[Key], Exclude<Allowed[Key], true | undefined>> : Allowed[Key] : never };
|
|
31
|
-
/** Creates a validated ordinary function with the shared configuration's types. */
|
|
32
|
-
type CreateReusable<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = <const Include extends ReusableInclude<Resources, Options> = {}, const Custom extends InPropsObject = {}, Result = unknown>(definition: {
|
|
33
|
-
props?: {
|
|
34
|
-
include?: ReusableInclude<Resources, Options> & Include & ExactSelection<Include, ReusableInclude<Resources, Options>>;
|
|
35
|
-
custom?: Custom;
|
|
36
|
-
};
|
|
37
|
-
fn: (props: ReusableProps<Resources, Options, Include, Custom>) => Result;
|
|
38
|
-
}) => (...args: {} extends ReusableProps<Resources, Options, Include, Custom> ? [props?: ReusableProps<Resources, Options, Include, Custom>] : [props: ReusableProps<Resources, Options, Include, Custom>]) => Result;
|
|
39
|
-
//#endregion
|
|
40
|
-
export { CreateReusable, ReusableInclude, ReusableOptionSelection, ReusableProps };
|
|
41
|
-
//# sourceMappingURL=create-reusable.d.cts.map
|
|
1
|
+
import { CreateReusable, ReusableArguments, ReusableDefinition, ReusableFunction, ReusableInclude, ReusableInput, ReusableOptionSelection, ReusableOverlap, ReusableProps, ReusableResolved, ReusableSelected } from "./reusable-types.cjs";
|
|
@@ -1,41 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { InPropsDefinition, InPropsObject, InferredInProps } from "../props.mjs";
|
|
3
|
-
import { AnyBuiltPropDefinition, ExtractDefinitionValue, ResolvedBuiltPropShape } from "@jfdevelops/react-layout-validator";
|
|
4
|
-
|
|
5
|
-
//#region src/create-config/create-reusable.d.ts
|
|
6
|
-
/** Object definitions can be selected recursively; other definitions are leaves. */
|
|
7
|
-
type ReusableOptionSelection<Props extends InPropsObject> = { [Key in keyof Props]?: Props[Key] extends {
|
|
8
|
-
type: 'object';
|
|
9
|
-
properties: infer Shape extends InPropsObject;
|
|
10
|
-
} ? true | ReusableOptionSelection<Shape> : true };
|
|
11
|
-
type OptionDefinitions<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = InferredInProps<Resources, Options> extends infer Props extends InPropsObject ? Props : never;
|
|
12
|
-
/** Only data sources declared by the factory are available for selection. */
|
|
13
|
-
type ReusableInclude<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = {
|
|
14
|
-
resources?: true;
|
|
15
|
-
} & (keyof OptionDefinitions<Resources, Options> extends never ? {} : {
|
|
16
|
-
options?: true | ReusableOptionSelection<OptionDefinitions<Resources, Options>>;
|
|
17
|
-
});
|
|
18
|
-
type SelectedOptionValue<Definition extends AnyBuiltPropDefinition, Selection> = Selection extends true ? ExtractDefinitionValue<Definition> : Definition extends {
|
|
19
|
-
properties: infer Shape extends InPropsObject;
|
|
20
|
-
} ? SelectedOptionProps<Shape, Selection> : never;
|
|
21
|
-
type SelectedOptionProps<Props extends InPropsObject, Selection> = { [Key in keyof Props & keyof Selection as Props[Key]['visibility'] extends 'required' ? Key : never]: SelectedOptionValue<Props[Key], Selection[Key]> } & { [Key in keyof Props & keyof Selection as Props[Key]['visibility'] extends 'optional' ? Key : never]?: SelectedOptionValue<Props[Key], Selection[Key]> };
|
|
22
|
-
/** Options are flattened one level, so `options: { meta: true }` supplies `meta`. */
|
|
23
|
-
type ReusableProps<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject> = (Include extends {
|
|
24
|
-
resources: true;
|
|
25
|
-
} ? {
|
|
26
|
-
resources: ResourceEnum<Resources>[number][];
|
|
27
|
-
} : {}) & (Include extends {
|
|
28
|
-
options: infer Selection;
|
|
29
|
-
} ? Selection extends true ? ResolvedBuiltPropShape<OptionDefinitions<Resources, Options>> : SelectedOptionProps<OptionDefinitions<Resources, Options>, Selection> : {}) & ResolvedBuiltPropShape<Custom>;
|
|
30
|
-
type ExactSelection<Selection, Allowed> = { [Key in keyof Selection]: Key extends keyof Allowed ? Selection[Key] extends object ? ExactSelection<Selection[Key], Exclude<Allowed[Key], true | undefined>> : Allowed[Key] : never };
|
|
31
|
-
/** Creates a validated ordinary function with the shared configuration's types. */
|
|
32
|
-
type CreateReusable<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = <const Include extends ReusableInclude<Resources, Options> = {}, const Custom extends InPropsObject = {}, Result = unknown>(definition: {
|
|
33
|
-
props?: {
|
|
34
|
-
include?: ReusableInclude<Resources, Options> & Include & ExactSelection<Include, ReusableInclude<Resources, Options>>;
|
|
35
|
-
custom?: Custom;
|
|
36
|
-
};
|
|
37
|
-
fn: (props: ReusableProps<Resources, Options, Include, Custom>) => Result;
|
|
38
|
-
}) => (...args: {} extends ReusableProps<Resources, Options, Include, Custom> ? [props?: ReusableProps<Resources, Options, Include, Custom>] : [props: ReusableProps<Resources, Options, Include, Custom>]) => Result;
|
|
39
|
-
//#endregion
|
|
40
|
-
export { CreateReusable, ReusableInclude, ReusableOptionSelection, ReusableProps };
|
|
41
|
-
//# sourceMappingURL=create-reusable.d.mts.map
|
|
1
|
+
import { CreateReusable, ReusableArguments, ReusableDefinition, ReusableFunction, ReusableInclude, ReusableInput, ReusableOptionSelection, ReusableOverlap, ReusableProps, ReusableResolved, ReusableSelected } from "./reusable-types.mjs";
|
|
@@ -1,44 +1,208 @@
|
|
|
1
1
|
import { LayoutConfigurationError } from "../errors/layout-configuration-error.mjs";
|
|
2
|
+
import { createLayoutResourcesAccessor } from "./define-layout.mjs";
|
|
2
3
|
import { createProp, validateProps } from "@jfdevelops/react-layout-validator";
|
|
3
4
|
|
|
4
5
|
//#region src/create-config/create-reusable.ts
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function objectPlan(children, optional = false, guards = [[]]) {
|
|
7
|
+
return {
|
|
8
|
+
kind: "object",
|
|
9
|
+
children,
|
|
10
|
+
optional,
|
|
11
|
+
guards
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function optionPlan(definitions, selection, from, path = [], optionalPaths = []) {
|
|
15
|
+
const entries = selection === true ? Object.fromEntries(Object.keys(definitions).map((key) => [key, true])) : selection;
|
|
16
|
+
const children = {};
|
|
17
|
+
for (const [key, value] of Object.entries(entries ?? {})) {
|
|
9
18
|
if (!Object.hasOwn(definitions, key)) throw new LayoutConfigurationError(`Unknown reusable option "${key}".`);
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
const definition = definitions[key];
|
|
20
|
+
const location = {
|
|
21
|
+
from,
|
|
22
|
+
path: [...path, key]
|
|
23
|
+
};
|
|
24
|
+
if (typeof value === "function") children[key] = {
|
|
25
|
+
...location,
|
|
26
|
+
from: "options",
|
|
27
|
+
guards: optionalPaths.map((path) => ({
|
|
28
|
+
from: "options",
|
|
29
|
+
path
|
|
30
|
+
})),
|
|
31
|
+
kind: "value",
|
|
32
|
+
source: "option",
|
|
33
|
+
selector: value,
|
|
34
|
+
definition
|
|
35
|
+
};
|
|
36
|
+
else if ("properties" in definition && "type" in definition && definition.type === "object" && (value === true || value && typeof value === "object")) children[key] = {
|
|
37
|
+
...optionPlan(definition.properties, value, from, location.path, definition.visibility === "optional" ? [...optionalPaths, location.path] : optionalPaths),
|
|
38
|
+
optional: definition.visibility === "optional"
|
|
39
|
+
};
|
|
40
|
+
else if (value === true) children[key] = {
|
|
41
|
+
...location,
|
|
42
|
+
guards: optionalPaths.map((path) => ({
|
|
43
|
+
from,
|
|
44
|
+
path
|
|
45
|
+
})),
|
|
46
|
+
kind: "value",
|
|
47
|
+
source: "option",
|
|
48
|
+
definition
|
|
49
|
+
};
|
|
50
|
+
else throw new LayoutConfigurationError(`Invalid reusable selection for "${key}".`);
|
|
51
|
+
}
|
|
52
|
+
const origins = /* @__PURE__ */ new Set();
|
|
53
|
+
function collectOrigins(node) {
|
|
54
|
+
if (node.kind === "value") origins.add(node.from);
|
|
55
|
+
else Object.values(node.children).forEach(collectOrigins);
|
|
56
|
+
}
|
|
57
|
+
Object.values(children).forEach(collectOrigins);
|
|
58
|
+
if (!origins.size) origins.add(from);
|
|
59
|
+
return objectPlan(children, false, [...origins].map((origin) => optionalPaths.map((path) => ({
|
|
60
|
+
from: origin,
|
|
61
|
+
path
|
|
62
|
+
}))));
|
|
63
|
+
}
|
|
64
|
+
function sameSelection(left, right) {
|
|
65
|
+
return left.source === right.source && left.selector === right.selector && left.path.join(".") === right.path.join(".") && (left.source === "option" || left.from === right.from);
|
|
66
|
+
}
|
|
67
|
+
function mergePlans(left, right, overlap, path = []) {
|
|
68
|
+
const children = { ...left.children };
|
|
69
|
+
for (const [key, other] of Object.entries(right.children)) {
|
|
70
|
+
const current = children[key];
|
|
71
|
+
if (!current) {
|
|
72
|
+
children[key] = other;
|
|
12
73
|
continue;
|
|
13
74
|
}
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
75
|
+
if (current.kind === "object" && other.kind === "object") children[key] = mergePlans(current, other, overlap, [...path, key]);
|
|
76
|
+
else if (current.kind === "value" && other.kind === "value" && sameSelection(current, other)) children[key] = other.from === "options" ? other : current;
|
|
77
|
+
else if (overlap) children[key] = overlap === "preferProps" ? current : other;
|
|
78
|
+
else throw new LayoutConfigurationError(`Ambiguous reusable property "${[...path, key].join(".")}". Rename one result or set overlap to "preferProps" or "preferSelect".`);
|
|
17
79
|
}
|
|
18
|
-
return
|
|
80
|
+
return {
|
|
81
|
+
kind: "object",
|
|
82
|
+
children,
|
|
83
|
+
optional: left.optional && right.optional,
|
|
84
|
+
guards: [...left.guards, ...right.guards]
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function withoutSharedCallerValues(left, right) {
|
|
88
|
+
const children = { ...left.children };
|
|
89
|
+
for (const [key, other] of Object.entries(right.children)) {
|
|
90
|
+
const current = children[key];
|
|
91
|
+
if (current?.kind === "object" && other.kind === "object") children[key] = withoutSharedCallerValues(current, other);
|
|
92
|
+
else if (current?.kind === "value" && other.kind === "value" && sameSelection(current, other) && other.from === "options") delete children[key];
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
...left,
|
|
96
|
+
children
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function planDefinitions(plan, from) {
|
|
100
|
+
const definitions = {};
|
|
101
|
+
for (const [key, value] of Object.entries(plan.children)) if (value.kind === "value") {
|
|
102
|
+
if (value.from === from && value.definition) definitions[key] = value.definition;
|
|
103
|
+
} else {
|
|
104
|
+
const nested = planDefinitions(value, from);
|
|
105
|
+
if (Object.keys(nested).length) {
|
|
106
|
+
const definition = createProp.object(nested);
|
|
107
|
+
definitions[key] = value.optional ? definition.optional() : definition;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return definitions;
|
|
111
|
+
}
|
|
112
|
+
function sourceSelection(selection, callbacksOnly) {
|
|
113
|
+
if (typeof selection === "function") return true;
|
|
114
|
+
if (selection === true) return callbacksOnly ? {} : true;
|
|
115
|
+
const source = {};
|
|
116
|
+
for (const [key, value] of Object.entries(selection ?? {})) {
|
|
117
|
+
const nested = sourceSelection(value, callbacksOnly);
|
|
118
|
+
if (nested === true || Object.keys(nested).length) source[key] = nested;
|
|
119
|
+
}
|
|
120
|
+
return source;
|
|
121
|
+
}
|
|
122
|
+
function mergeSelections(left, right) {
|
|
123
|
+
if (left === true || right === true) return true;
|
|
124
|
+
const merged = { ...left };
|
|
125
|
+
for (const [key, value] of Object.entries(right)) merged[key] = Object.hasOwn(left, key) ? mergeSelections(left[key], value) : value;
|
|
126
|
+
return merged;
|
|
127
|
+
}
|
|
128
|
+
function readLocation(location, props, options, resources) {
|
|
129
|
+
let value = location.from === "props" ? props : location.from === "options" ? options : resources;
|
|
130
|
+
for (const key of location.path) value = value?.[key];
|
|
131
|
+
return value;
|
|
132
|
+
}
|
|
133
|
+
function resolvePlan(plan, props, options, resources) {
|
|
134
|
+
const result = {};
|
|
135
|
+
for (const [key, node] of Object.entries(plan.children)) if (node.kind === "object") {
|
|
136
|
+
if (node.guards.some((group) => group.every((location) => readLocation(location, props, options, resources) !== void 0))) result[key] = resolvePlan(node, props, options, resources);
|
|
137
|
+
} else {
|
|
138
|
+
if (node.guards?.some((location) => readLocation(location, props, options, resources) === void 0)) continue;
|
|
139
|
+
const value = readLocation(node, props, options, resources);
|
|
140
|
+
if (node.selector) result[key] = node.selector(value);
|
|
141
|
+
else if (value !== void 0 || node.definition?.visibility !== "optional") result[key] = value;
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
19
144
|
}
|
|
20
145
|
function createReusableBuilder(resources, options) {
|
|
21
146
|
const keys = resources.map((entry) => typeof entry === "string" ? entry : entry.value);
|
|
22
147
|
const resource = createProp.string.enum(keys);
|
|
148
|
+
const resourcesAccessor = createLayoutResourcesAccessor(resources);
|
|
23
149
|
function createReusable(definition) {
|
|
24
150
|
const include = definition.props?.include ?? {};
|
|
25
|
-
|
|
151
|
+
const select = definition.select ?? {};
|
|
152
|
+
if (definition.overlap !== void 0 && definition.overlap !== "preferProps" && definition.overlap !== "preferSelect") throw new LayoutConfigurationError("Unknown reusable overlap policy.");
|
|
26
153
|
const optionDefinitions = typeof options === "function" ? options({
|
|
27
154
|
name: createProp.string.literal("Reusable"),
|
|
28
155
|
resource
|
|
29
156
|
}) : options;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
157
|
+
function compile(selection, from) {
|
|
158
|
+
let plan = objectPlan({});
|
|
159
|
+
for (const [key, value] of Object.entries(selection)) {
|
|
160
|
+
let next;
|
|
161
|
+
if (key === "options") {
|
|
162
|
+
if (value !== true && typeof value !== "function" && (!value || typeof value !== "object" || Array.isArray(value))) throw new LayoutConfigurationError("Invalid reusable options selection.");
|
|
163
|
+
next = typeof value === "function" ? objectPlan({ options: {
|
|
164
|
+
kind: "value",
|
|
165
|
+
source: "option",
|
|
166
|
+
from: "options",
|
|
167
|
+
path: [],
|
|
168
|
+
selector: value
|
|
169
|
+
} }) : optionPlan(optionDefinitions, value, from);
|
|
170
|
+
} else if (key === "resources" && (value === true || typeof value === "function")) next = objectPlan({ resources: {
|
|
171
|
+
kind: "value",
|
|
172
|
+
source: "resource",
|
|
173
|
+
from: value === true && from === "props" ? "props" : "resources",
|
|
174
|
+
path: value === true && from === "props" ? ["resources"] : [],
|
|
175
|
+
selector: typeof value === "function" ? value : void 0,
|
|
176
|
+
definition: value === true && from === "props" ? createProp.array(resource) : void 0
|
|
177
|
+
} });
|
|
178
|
+
else throw new LayoutConfigurationError(`Invalid reusable source "${key}".`);
|
|
179
|
+
plan = mergePlans(plan, next);
|
|
180
|
+
}
|
|
181
|
+
return plan;
|
|
38
182
|
}
|
|
183
|
+
let included = compile(include, "props");
|
|
184
|
+
const custom = objectPlan(Object.fromEntries(Object.entries(definition.props?.custom ?? {}).map(([key, value]) => [key, {
|
|
185
|
+
kind: "value",
|
|
186
|
+
source: "custom",
|
|
187
|
+
from: "props",
|
|
188
|
+
path: [key],
|
|
189
|
+
definition: value
|
|
190
|
+
}])));
|
|
191
|
+
included = mergePlans(included, custom);
|
|
192
|
+
const selected = compile(select, "options");
|
|
193
|
+
const plan = mergePlans(included, selected, definition.overlap);
|
|
194
|
+
const callerDefinitions = planDefinitions(withoutSharedCallerValues(included, selected), "props");
|
|
195
|
+
const effectiveCallerDefinitions = planDefinitions(plan, "props");
|
|
196
|
+
const sources = mergeSelections(sourceSelection(include.options, true), sourceSelection(select.options, false));
|
|
197
|
+
const sourceDefinitions = sources === true ? optionDefinitions : planDefinitions(optionPlan(optionDefinitions, sources, "options"), "options");
|
|
198
|
+
const needsOptions = Object.keys(sourceDefinitions).length > 0;
|
|
199
|
+
if (needsOptions && Object.hasOwn(callerDefinitions, "options")) throw new LayoutConfigurationError("Reusable prop \"options\" is reserved for source values.");
|
|
39
200
|
return function reusable(props = {}) {
|
|
40
|
-
validateProps(
|
|
41
|
-
|
|
201
|
+
validateProps(definition.overlap ? callerDefinitions : effectiveCallerDefinitions, props);
|
|
202
|
+
if (needsOptions && props.options !== void 0 && (props.options === null || typeof props.options !== "object" || Array.isArray(props.options))) throw new LayoutConfigurationError("Reusable source options must be an object.");
|
|
203
|
+
const values = props.options ?? {};
|
|
204
|
+
validateProps(sourceDefinitions, values);
|
|
205
|
+
return definition.fn(resolvePlan(plan, props, values, resourcesAccessor));
|
|
42
206
|
};
|
|
43
207
|
}
|
|
44
208
|
return createReusable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-reusable.mjs","names":[],"sources":["../../src/create-config/create-reusable.ts"],"sourcesContent":["import {\n createProp,\n validateProps,\n type AnyBuiltPropDefinition,\n type ExtractDefinitionValue,\n type ResolvedBuiltPropShape,\n} from '@jfdevelops/react-layout-validator';\nimport type {\n InferredInProps,\n InPropsDefinition,\n InPropsObject,\n} from '../props';\nimport type { ResourceDefinition, ResourceEnum } from '../resource';\nimport { LayoutConfigurationError } from '../errors';\n\n/** Object definitions can be selected recursively; other definitions are leaves. */\nexport type ReusableOptionSelection<Props extends InPropsObject> = {\n [Key in keyof Props]?: Props[Key] extends {\n type: 'object';\n properties: infer Shape extends InPropsObject;\n }\n ? true | ReusableOptionSelection<Shape>\n : true;\n};\n\ntype OptionDefinitions<\n Resources extends readonly ResourceDefinition[],\n Options extends InPropsDefinition<Resources>,\n> = InferredInProps<\n Resources,\n Options\n> extends infer Props extends InPropsObject\n ? Props\n : never;\n\n/** Only data sources declared by the factory are available for selection. */\nexport type ReusableInclude<\n Resources extends readonly ResourceDefinition[],\n Options extends InPropsDefinition<Resources>,\n> = { resources?: true } & (keyof OptionDefinitions<\n Resources,\n Options\n> extends never\n ? {}\n : {\n options?:\n | true\n | ReusableOptionSelection<OptionDefinitions<Resources, Options>>;\n });\n\ntype SelectedOptionValue<\n Definition extends AnyBuiltPropDefinition,\n Selection,\n> = Selection extends true\n ? ExtractDefinitionValue<Definition>\n : Definition extends { properties: infer Shape extends InPropsObject }\n ? SelectedOptionProps<Shape, Selection>\n : never;\n\ntype SelectedOptionProps<Props extends InPropsObject, Selection> = {\n [Key in keyof Props &\n keyof Selection as Props[Key]['visibility'] extends 'required'\n ? Key\n : never]: SelectedOptionValue<Props[Key], Selection[Key]>;\n} & {\n [Key in keyof Props &\n keyof Selection as Props[Key]['visibility'] extends 'optional'\n ? Key\n : never]?: SelectedOptionValue<Props[Key], Selection[Key]>;\n};\n\n/** Options are flattened one level, so `options: { meta: true }` supplies `meta`. */\nexport type ReusableProps<\n Resources extends readonly ResourceDefinition[],\n Options extends InPropsDefinition<Resources>,\n Include,\n Custom extends InPropsObject,\n> = (Include extends { resources: true }\n ? { resources: ResourceEnum<Resources>[number][] }\n : {}) &\n (Include extends { options: infer Selection }\n ? Selection extends true\n ? ResolvedBuiltPropShape<OptionDefinitions<Resources, Options>>\n : SelectedOptionProps<OptionDefinitions<Resources, Options>, Selection>\n : {}) &\n ResolvedBuiltPropShape<Custom>;\n\n// Generic constraints alone accept extra keys on structurally compatible objects.\ntype ExactSelection<Selection, Allowed> = {\n [Key in keyof Selection]: Key extends keyof Allowed\n ? Selection[Key] extends object\n ? ExactSelection<Selection[Key], Exclude<Allowed[Key], true | undefined>>\n : Allowed[Key]\n : never;\n};\n\n/** Creates a validated ordinary function with the shared configuration's types. */\nexport type CreateReusable<\n Resources extends readonly ResourceDefinition[],\n Options extends InPropsDefinition<Resources>,\n> = <\n const Include extends ReusableInclude<Resources, Options> = {},\n const Custom extends InPropsObject = {},\n Result = unknown,\n>(definition: {\n props?: {\n include?: ReusableInclude<Resources, Options> &\n Include &\n ExactSelection<Include, ReusableInclude<Resources, Options>>;\n custom?: Custom;\n };\n fn: (props: ReusableProps<Resources, Options, Include, Custom>) => Result;\n}) => (\n ...args: {} extends ReusableProps<Resources, Options, Include, Custom>\n ? [props?: ReusableProps<Resources, Options, Include, Custom>]\n : [props: ReusableProps<Resources, Options, Include, Custom>]\n) => Result;\n\nfunction selectOptions(\n definitions: InPropsObject,\n selection: Record<string, unknown>,\n) {\n const selected: InPropsObject = {};\n for (const [key, include] of Object.entries(selection)) {\n const definition = definitions[key];\n if (!Object.hasOwn(definitions, key)) {\n throw new LayoutConfigurationError(`Unknown reusable option \"${key}\".`);\n }\n if (include === true) {\n selected[key] = definition;\n continue;\n }\n if (\n !include ||\n typeof include !== 'object' ||\n !('properties' in definition) ||\n !('type' in definition) ||\n definition.type !== 'object'\n ) {\n throw new LayoutConfigurationError(\n `Invalid reusable selection for \"${key}\".`,\n );\n }\n const nested = createProp.object(\n selectOptions(\n definition.properties as InPropsObject,\n include as Record<string, unknown>,\n ),\n );\n selected[key] =\n definition.visibility === 'optional' ? nested.optional() : nested;\n }\n return selected;\n}\n\nexport function createReusableBuilder<\n const Resources extends readonly ResourceDefinition[],\n Options extends InPropsDefinition<Resources>,\n>(resources: Resources, options: Options): CreateReusable<Resources, Options>;\nexport function createReusableBuilder(\n resources: readonly ResourceDefinition[],\n options: InPropsObject | ((...args: any[]) => InPropsObject),\n) {\n const keys = resources.map((entry) =>\n typeof entry === 'string' ? entry : entry.value,\n );\n const resource = createProp.string.enum(keys as [string, ...string[]]);\n\n function createReusable(definition: {\n props?: { include?: Record<string, unknown>; custom?: InPropsObject };\n fn: (props: Record<string, unknown>) => unknown;\n }) {\n const include = definition.props?.include ?? {};\n for (const key of Object.keys(include)) {\n if (key !== 'resources' && key !== 'options') {\n throw new LayoutConfigurationError(`Unknown reusable source \"${key}\".`);\n }\n }\n const optionDefinitions =\n typeof options === 'function'\n ? options({ name: createProp.string.literal('Reusable'), resource })\n : options;\n const selected =\n include.options === true\n ? optionDefinitions\n : include.options\n ? selectOptions(\n optionDefinitions,\n include.options as Record<string, unknown>,\n )\n : {};\n const definitions: InPropsObject = { ...selected };\n if (include.resources) {\n if (Object.hasOwn(definitions, 'resources')) {\n throw new LayoutConfigurationError(\n 'Reusable prop \"resources\" is selected more than once.',\n );\n }\n definitions.resources = createProp.array(resource);\n }\n for (const [key, custom] of Object.entries(\n definition.props?.custom ?? {},\n )) {\n if (Object.hasOwn(definitions, key)) {\n throw new LayoutConfigurationError(\n `Reusable prop \"${key}\" is selected more than once.`,\n );\n }\n definitions[key] = custom;\n }\n\n return function reusable(props: Record<string, unknown> = {}) {\n validateProps(definitions, props);\n return definition.fn(props);\n };\n }\n\n return createReusable as unknown;\n}\n"],"mappings":";;;;AAsHA,SAAS,cACP,aACA,WACA;CACA,MAAM,WAA0B,CAAC;CACjC,KAAK,MAAM,CAAC,KAAK,YAAY,OAAO,QAAQ,SAAS,GAAG;EACtD,MAAM,aAAa,YAAY;EAC/B,IAAI,CAAC,OAAO,OAAO,aAAa,GAAG,GACjC,MAAM,IAAI,yBAAyB,4BAA4B,IAAI,GAAG;EAExE,IAAI,YAAY,MAAM;GACpB,SAAS,OAAO;GAChB;EACF;EACA,IACE,CAAC,WACD,OAAO,YAAY,YACnB,EAAE,gBAAgB,eAClB,EAAE,UAAU,eACZ,WAAW,SAAS,UAEpB,MAAM,IAAI,yBACR,mCAAmC,IAAI,GACzC;EAEF,MAAM,SAAS,WAAW,OACxB,cACE,WAAW,YACX,OACF,CACF;EACA,SAAS,OACP,WAAW,eAAe,aAAa,OAAO,SAAS,IAAI;CAC/D;CACA,OAAO;AACT;AAMA,SAAgB,sBACd,WACA,SACA;CACA,MAAM,OAAO,UAAU,KAAK,UAC1B,OAAO,UAAU,WAAW,QAAQ,MAAM,KAC5C;CACA,MAAM,WAAW,WAAW,OAAO,KAAK,IAA6B;CAErE,SAAS,eAAe,YAGrB;EACD,MAAM,UAAU,WAAW,OAAO,WAAW,CAAC;EAC9C,KAAK,MAAM,OAAO,OAAO,KAAK,OAAO,GACnC,IAAI,QAAQ,eAAe,QAAQ,WACjC,MAAM,IAAI,yBAAyB,4BAA4B,IAAI,GAAG;EAG1E,MAAM,oBACJ,OAAO,YAAY,aACf,QAAQ;GAAE,MAAM,WAAW,OAAO,QAAQ,UAAU;GAAG;EAAS,CAAC,IACjE;EAUN,MAAM,cAA6B,EAAE,GARnC,QAAQ,YAAY,OAChB,oBACA,QAAQ,UACR,cACE,mBACA,QAAQ,OACV,IACA,CAAC,EAC0C;EACjD,IAAI,QAAQ,WAAW;GACrB,IAAI,OAAO,OAAO,aAAa,WAAW,GACxC,MAAM,IAAI,yBACR,yDACF;GAEF,YAAY,YAAY,WAAW,MAAM,QAAQ;EACnD;EACA,KAAK,MAAM,CAAC,KAAK,WAAW,OAAO,QACjC,WAAW,OAAO,UAAU,CAAC,CAC/B,GAAG;GACD,IAAI,OAAO,OAAO,aAAa,GAAG,GAChC,MAAM,IAAI,yBACR,kBAAkB,IAAI,8BACxB;GAEF,YAAY,OAAO;EACrB;EAEA,OAAO,SAAS,SAAS,QAAiC,CAAC,GAAG;GAC5D,cAAc,aAAa,KAAK;GAChC,OAAO,WAAW,GAAG,KAAK;EAC5B;CACF;CAEA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"create-reusable.mjs","names":[],"sources":["../../src/create-config/create-reusable.ts"],"sourcesContent":["import {\n createProp,\n validateProps,\n type AnyBuiltPropDefinition,\n} from '@jfdevelops/react-layout-validator';\nimport type { InPropsDefinition, InPropsObject, PropsContract } from '../props';\nimport type { ResourceDefinition } from '../resource';\nimport { LayoutConfigurationError } from '../errors';\nimport { createLayoutResourcesAccessor } from './define-layout';\nimport type { CreateReusable, ReusableOverlap } from './reusable-types';\nexport type * from './reusable-types';\n\ntype RuntimeSelection = Record<string, unknown>;\ntype PlanLocation = { from: 'props' | 'options' | 'resources'; path: string[] };\ntype ValuePlan = PlanLocation & {\n kind: 'value';\n // Optional ancestors remain tied to the value's original source after merging.\n guards?: PlanLocation[];\n source: 'option' | 'resource' | 'custom';\n selector?: (value: any) => unknown;\n definition?: AnyBuiltPropDefinition;\n};\ntype ObjectPlan = {\n kind: 'object';\n children: Record<string, Plan>;\n optional: boolean;\n guards: PlanLocation[][];\n};\ntype Plan = ValuePlan | ObjectPlan;\n\nfunction objectPlan(\n children: Record<string, Plan>,\n optional = false,\n guards: PlanLocation[][] = [[]],\n): ObjectPlan {\n return { kind: 'object', children, optional, guards };\n}\n\nfunction optionPlan(\n definitions: InPropsObject,\n selection: unknown,\n from: 'props' | 'options',\n path: string[] = [],\n optionalPaths: string[][] = [],\n): ObjectPlan {\n const entries =\n selection === true\n ? Object.fromEntries(Object.keys(definitions).map((key) => [key, true]))\n : (selection as RuntimeSelection);\n const children: Record<string, Plan> = {};\n for (const [key, value] of Object.entries(entries ?? {})) {\n if (!Object.hasOwn(definitions, key))\n throw new LayoutConfigurationError(`Unknown reusable option \"${key}\".`);\n const definition = definitions[key];\n const location: PlanLocation = { from, path: [...path, key] };\n if (typeof value === 'function') {\n children[key] = {\n ...location,\n from: 'options',\n guards: optionalPaths.map((path) => ({ from: 'options', path })),\n kind: 'value',\n source: 'option',\n selector: value as ValuePlan['selector'],\n definition,\n };\n } else if (\n 'properties' in definition &&\n 'type' in definition &&\n definition.type === 'object' &&\n (value === true || (value && typeof value === 'object'))\n ) {\n const nested = optionPlan(\n definition.properties as InPropsObject,\n value,\n from,\n location.path,\n definition.visibility === 'optional'\n ? [...optionalPaths, location.path]\n : optionalPaths,\n );\n children[key] = {\n ...nested,\n optional: definition.visibility === 'optional',\n };\n } else if (value === true) {\n children[key] = {\n ...location,\n guards: optionalPaths.map((path) => ({ from, path })),\n kind: 'value',\n source: 'option',\n definition,\n };\n } else\n throw new LayoutConfigurationError(\n `Invalid reusable selection for \"${key}\".`,\n );\n }\n const origins = new Set<PlanLocation['from']>();\n function collectOrigins(node: Plan) {\n if (node.kind === 'value') origins.add(node.from);\n else Object.values(node.children).forEach(collectOrigins);\n }\n Object.values(children).forEach(collectOrigins);\n if (!origins.size) origins.add(from);\n return objectPlan(\n children,\n false,\n [...origins].map((origin) =>\n optionalPaths.map((path) => ({ from: origin, path })),\n ),\n );\n}\n\nfunction sameSelection(left: ValuePlan, right: ValuePlan) {\n return (\n left.source === right.source &&\n left.selector === right.selector &&\n left.path.join('.') === right.path.join('.') &&\n (left.source === 'option' || left.from === right.from)\n );\n}\n\nfunction mergePlans(\n left: ObjectPlan,\n right: ObjectPlan,\n overlap?: ReusableOverlap,\n path: string[] = [],\n): ObjectPlan {\n const children = { ...left.children };\n for (const [key, other] of Object.entries(right.children)) {\n const current = children[key];\n if (!current) {\n children[key] = other;\n continue;\n }\n if (current.kind === 'object' && other.kind === 'object') {\n children[key] = mergePlans(current, other, overlap, [...path, key]);\n } else if (\n current.kind === 'value' &&\n other.kind === 'value' &&\n sameSelection(current, other)\n ) {\n // A shared option selection uses one source value and executes only once.\n children[key] = other.from === 'options' ? other : current;\n } else if (overlap)\n children[key] = overlap === 'preferProps' ? current : other;\n else\n throw new LayoutConfigurationError(\n `Ambiguous reusable property \"${[...path, key].join(\n '.',\n )}\". Rename one result or set overlap to \"preferProps\" or \"preferSelect\".`,\n );\n }\n return {\n kind: 'object',\n children,\n optional: left.optional && right.optional,\n guards: [...left.guards, ...right.guards],\n };\n}\n\nfunction withoutSharedCallerValues(\n left: ObjectPlan,\n right: ObjectPlan,\n): ObjectPlan {\n const children = { ...left.children };\n for (const [key, other] of Object.entries(right.children)) {\n const current = children[key];\n if (current?.kind === 'object' && other.kind === 'object')\n children[key] = withoutSharedCallerValues(current, other);\n else if (\n current?.kind === 'value' &&\n other.kind === 'value' &&\n sameSelection(current, other) &&\n other.from === 'options'\n )\n delete children[key];\n }\n return { ...left, children };\n}\n\nfunction planDefinitions(\n plan: ObjectPlan,\n from: 'props' | 'options',\n): InPropsObject {\n const definitions: InPropsObject = {};\n for (const [key, value] of Object.entries(plan.children)) {\n if (value.kind === 'value') {\n if (value.from === from && value.definition)\n definitions[key] = value.definition;\n } else {\n const nested = planDefinitions(value, from);\n if (Object.keys(nested).length) {\n const definition = createProp.object(nested);\n definitions[key] = value.optional ? definition.optional() : definition;\n }\n }\n }\n return definitions;\n}\n\nfunction sourceSelection(\n selection: unknown,\n callbacksOnly: boolean,\n): true | RuntimeSelection {\n if (typeof selection === 'function') return true;\n if (selection === true) return callbacksOnly ? {} : true;\n const source: RuntimeSelection = {};\n for (const [key, value] of Object.entries(\n (selection ?? {}) as RuntimeSelection,\n )) {\n const nested = sourceSelection(value, callbacksOnly);\n if (nested === true || Object.keys(nested).length) source[key] = nested;\n }\n return source;\n}\n\nfunction mergeSelections(\n left: true | RuntimeSelection,\n right: true | RuntimeSelection,\n): true | RuntimeSelection {\n if (left === true || right === true) return true;\n const merged = { ...left };\n for (const [key, value] of Object.entries(right))\n merged[key] = Object.hasOwn(left, key)\n ? mergeSelections(\n left[key] as true | RuntimeSelection,\n value as true | RuntimeSelection,\n )\n : value;\n return merged;\n}\n\nfunction readLocation(\n location: PlanLocation,\n props: Record<string, unknown>,\n options: Record<string, unknown>,\n resources: unknown,\n) {\n let value: any =\n location.from === 'props'\n ? props\n : location.from === 'options'\n ? options\n : resources;\n for (const key of location.path) value = value?.[key];\n return value;\n}\n\nfunction resolvePlan(\n plan: ObjectPlan,\n props: Record<string, unknown>,\n options: Record<string, unknown>,\n resources: unknown,\n) {\n const result: Record<string, unknown> = {};\n for (const [key, node] of Object.entries(plan.children)) {\n if (node.kind === 'object') {\n if (\n node.guards.some((group) =>\n group.every(\n (location) =>\n readLocation(location, props, options, resources) !== undefined,\n ),\n )\n ) {\n result[key] = resolvePlan(node, props, options, resources);\n }\n } else {\n if (\n node.guards?.some(\n (location) =>\n readLocation(location, props, options, resources) === undefined,\n )\n )\n continue;\n const value = readLocation(node, props, options, resources);\n if (node.selector) result[key] = node.selector(value);\n else if (\n value !== undefined ||\n node.definition?.visibility !== 'optional'\n )\n result[key] = value;\n }\n }\n return result;\n}\n\nexport function createReusableBuilder<\n const Resources extends readonly ResourceDefinition[],\n Options extends InPropsDefinition<Resources>,\n>(resources: Resources, options: Options): CreateReusable<Resources, Options>;\nexport function createReusableBuilder(\n resources: readonly ResourceDefinition[],\n options: InPropsObject | ((...args: any[]) => InPropsObject),\n) {\n const keys = resources.map((entry) =>\n typeof entry === 'string' ? entry : entry.value,\n );\n const resource = createProp.string.enum(keys as [string, ...string[]]);\n const resourcesAccessor = createLayoutResourcesAccessor(resources);\n\n function createReusable(definition: {\n props?: PropsContract<RuntimeSelection, InPropsObject>;\n select?: RuntimeSelection;\n overlap?: ReusableOverlap;\n fn: (props: Record<string, unknown>) => unknown;\n }) {\n const include = definition.props?.include ?? {};\n const select = definition.select ?? {};\n if (\n definition.overlap !== undefined &&\n definition.overlap !== 'preferProps' &&\n definition.overlap !== 'preferSelect'\n ) {\n throw new LayoutConfigurationError('Unknown reusable overlap policy.');\n }\n const optionDefinitions =\n typeof options === 'function'\n ? options({ name: createProp.string.literal('Reusable'), resource })\n : options;\n\n function compile(selection: RuntimeSelection, from: 'props' | 'options') {\n let plan = objectPlan({});\n for (const [key, value] of Object.entries(selection)) {\n let next: ObjectPlan;\n if (key === 'options') {\n if (\n value !== true &&\n typeof value !== 'function' &&\n (!value || typeof value !== 'object' || Array.isArray(value))\n ) {\n throw new LayoutConfigurationError(\n 'Invalid reusable options selection.',\n );\n }\n next =\n typeof value === 'function'\n ? objectPlan({\n options: {\n kind: 'value',\n source: 'option',\n from: 'options',\n path: [],\n selector: value as ValuePlan['selector'],\n },\n })\n : optionPlan(optionDefinitions, value, from);\n } else if (\n key === 'resources' &&\n (value === true || typeof value === 'function')\n ) {\n next = objectPlan({\n resources: {\n kind: 'value',\n source: 'resource',\n from: value === true && from === 'props' ? 'props' : 'resources',\n path: value === true && from === 'props' ? ['resources'] : [],\n selector:\n typeof value === 'function'\n ? (value as ValuePlan['selector'])\n : undefined,\n definition:\n value === true && from === 'props'\n ? createProp.array(resource)\n : undefined,\n },\n });\n } else\n throw new LayoutConfigurationError(\n `Invalid reusable source \"${key}\".`,\n );\n plan = mergePlans(plan, next);\n }\n return plan;\n }\n\n let included = compile(include, 'props');\n const custom = objectPlan(\n Object.fromEntries(\n Object.entries(definition.props?.custom ?? {}).map(([key, value]) => [\n key,\n {\n kind: 'value',\n source: 'custom',\n from: 'props',\n path: [key],\n definition: value,\n } as ValuePlan,\n ]),\n ),\n );\n included = mergePlans(included, custom);\n const selected = compile(select, 'options');\n const plan = mergePlans(included, selected, definition.overlap);\n const callerDefinitions = planDefinitions(\n withoutSharedCallerValues(included, selected),\n 'props',\n );\n // Identical true selections supplied by select are removed from the caller props contract.\n const effectiveCallerDefinitions = planDefinitions(plan, 'props');\n const sources = mergeSelections(\n sourceSelection(include.options, true),\n sourceSelection(select.options, false),\n );\n const sourceDefinitions =\n sources === true\n ? optionDefinitions\n : planDefinitions(\n optionPlan(optionDefinitions, sources, 'options'),\n 'options',\n );\n const needsOptions = Object.keys(sourceDefinitions).length > 0;\n if (needsOptions && Object.hasOwn(callerDefinitions, 'options')) {\n throw new LayoutConfigurationError(\n 'Reusable prop \"options\" is reserved for source values.',\n );\n }\n\n return function reusable(props: Record<string, unknown> = {}) {\n // Validate configured caller props too when an explicit overlap policy discards their output.\n const definitions = definition.overlap\n ? callerDefinitions\n : effectiveCallerDefinitions;\n validateProps(definitions, props);\n if (\n needsOptions &&\n props.options !== undefined &&\n (props.options === null ||\n typeof props.options !== 'object' ||\n Array.isArray(props.options))\n ) {\n throw new LayoutConfigurationError(\n 'Reusable source options must be an object.',\n );\n }\n const values = (props.options ?? {}) as Record<string, unknown>;\n validateProps(sourceDefinitions, values);\n return definition.fn(resolvePlan(plan, props, values, resourcesAccessor));\n };\n }\n return createReusable as unknown;\n}\n"],"mappings":";;;;;AA8BA,SAAS,WACP,UACA,WAAW,OACX,SAA2B,CAAC,CAAC,CAAC,GAClB;CACZ,OAAO;EAAE,MAAM;EAAU;EAAU;EAAU;CAAO;AACtD;AAEA,SAAS,WACP,aACA,WACA,MACA,OAAiB,CAAC,GAClB,gBAA4B,CAAC,GACjB;CACZ,MAAM,UACJ,cAAc,O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ACxB,0BAA0B,UAAU,QAAQ,GAC5C,OACF;EAEA,MAAM,6BAA6B,gBAAgB,MAAM,OAAO;EAChE,MAAM,UAAU,gBACd,gBAAgB,QAAQ,SAAS,IAAI,GACrC,gBAAgB,OAAO,SAAS,KAAK,CACvC;EACA,MAAM,oBACJ,YAAY,OACR,oBACA,gBACE,WAAW,mBAAmB,SAAS,SAAS,GAChD,SACF;EACN,MAAM,eAAe,OAAO,KAAK,iBAAiB,EAAE,SAAS;EAC7D,IAAI,gBAAgB,OAAO,OAAO,mBAAmB,SAAS,GAC5D,MAAM,IAAI,yBACR,0DACF;EAGF,OAAO,SAAS,SAAS,QAAiC,CAAC,GAAG;GAK5D,cAHoB,WAAW,UAC3B,oBACA,4BACuB,KAAK;GAChC,IACE,gBACA,MAAM,YAAY,WACjB,MAAM,YAAY,QACjB,OAAO,MAAM,YAAY,YACzB,MAAM,QAAQ,MAAM,OAAO,IAE7B,MAAM,IAAI,yBACR,4CACF;GAEF,MAAM,SAAU,MAAM,WAAW,CAAC;GAClC,cAAc,mBAAmB,MAAM;GACvC,OAAO,WAAW,GAAG,YAAY,MAAM,OAAO,QAAQ,iBAAiB,CAAC;EAC1E;CACF;CACA,OAAO;AACT"}
|
|
@@ -10,7 +10,7 @@ import { IsSubResourceKey, IsSubResourceKeyOptions, IsSubResourceKeyResult } fro
|
|
|
10
10
|
import { ComponentTypes, CreateResourceConfigFn, CreateResourceConfigForResource, CreatedResourceConfig, GetComponent, GetComponentAtBound, GetComponentForResource, GetComponentForResourceOptions, GetComponentOptions, GetComponentOptionsForResource, ResourceConfigFragment, ResourceConfigPath, ResourceFromGetComponentBound, SubResourceFromGetComponentBound, ValidateForResourceBound } from "./get-component.cjs";
|
|
11
11
|
import { CreateResourceLinkConfig, CreateResourceLinkGroupInput, CreateResourceLinkGroupOptions, CreateResourceLinkOptions, CreateResourceLinksFn, CreateResourceLinksWithGroups, CreateResourceLinksWithGroupsFn, CreateResourceLinksWithGroupsResult, CreateResourceMap, CreateResourceMapFn, CreatedResourceHref, CreatedResourceLink, CreatedResourceLinkBase, CreatedResourceMap, DefineResourceIconFn, DefineResourceIconInputHelpers, DefineResourceIconInputResult, FindResolvedResourceGroupResult, FindResourceGroupResult, InferHashFromResourceLinkHref, ResolveResourceIconInput, ResolvedResourceLinksWithGroups, ResolvedResourceLinksWithGroupsResult, ResourceAnchorLinkFn, ResourceIcon, ResourceIconFn, ResourceLinkHref, ValidateResource } from "./create-resource-links.cjs";
|
|
12
12
|
import { ContextualInlineRenderState, ContextualInlineRenderStates, CreateResourceLayoutFn, CreateResourceLayoutMakeComposableOptions, CreateResourceLayoutWithLayoutOptions, CreateViewMapBuiltInRenderStatesOptions, CreateViewMapFunctionRenderOptions, CreateViewMapInlineRenderStatesOptions, CreateViewMapOptions, CreateViewMapRenderStatesOptions, DefineResourceLayout, DefineResourceLayoutFn, DefineResourceLayoutForResources, DefineResourceLayoutForResourcesFactory, DefineResourceLayoutWithLayoutFn, DefineResourcesFn, DefinedResourceLayout, DefinedResourceLayoutWithShell, LayoutDefinition, LayoutIncludeProps, LayoutRenderResourcesAccessor, LayoutResourcesAccessor, ResourceLayoutProvider, ResourceLayoutProviderProps, ResourceLayoutShellComponent, ResourceLayoutShellProps, ResourceSelection, ShellLayoutDefinition, ShellRenderContext, TypedBuiltInRenderStates, TypedInlineRenderState, defineResourceLayout } from "./define-layout.cjs";
|
|
13
|
-
import { CreateReusable, ReusableInclude, ReusableOptionSelection, ReusableProps } from "./
|
|
13
|
+
import { CreateReusable, ReusableArguments, ReusableDefinition, ReusableFunction, ReusableInclude, ReusableInput, ReusableOptionSelection, ReusableOverlap, ReusableProps, ReusableResolved, ReusableSelected } from "./reusable-types.cjs";
|
|
14
14
|
import { LazyResourceLayoutComponent, LazyResourceLayoutOptions } from "./lazy-resource-layout.cjs";
|
|
15
15
|
import { BoundDefineResourceLayout, CreateDefinedResourceLayoutOptions, CreateDefinedResourceLayoutResult, DefineLazyDefaults, DefinedResourceLayoutInput, NonEmptyResources, createDefinedResourceLayout } from "./create-defined-resource-layout.cjs";
|
|
16
16
|
import { ResourceLayoutShellPublisher } from "./shell-context.cjs";
|
|
@@ -10,7 +10,7 @@ import { IsSubResourceKey, IsSubResourceKeyOptions, IsSubResourceKeyResult } fro
|
|
|
10
10
|
import { ComponentTypes, CreateResourceConfigFn, CreateResourceConfigForResource, CreatedResourceConfig, GetComponent, GetComponentAtBound, GetComponentForResource, GetComponentForResourceOptions, GetComponentOptions, GetComponentOptionsForResource, ResourceConfigFragment, ResourceConfigPath, ResourceFromGetComponentBound, SubResourceFromGetComponentBound, ValidateForResourceBound } from "./get-component.mjs";
|
|
11
11
|
import { CreateResourceLinkConfig, CreateResourceLinkGroupInput, CreateResourceLinkGroupOptions, CreateResourceLinkOptions, CreateResourceLinksFn, CreateResourceLinksWithGroups, CreateResourceLinksWithGroupsFn, CreateResourceLinksWithGroupsResult, CreateResourceMap, CreateResourceMapFn, CreatedResourceHref, CreatedResourceLink, CreatedResourceLinkBase, CreatedResourceMap, DefineResourceIconFn, DefineResourceIconInputHelpers, DefineResourceIconInputResult, FindResolvedResourceGroupResult, FindResourceGroupResult, InferHashFromResourceLinkHref, ResolveResourceIconInput, ResolvedResourceLinksWithGroups, ResolvedResourceLinksWithGroupsResult, ResourceAnchorLinkFn, ResourceIcon, ResourceIconFn, ResourceLinkHref, ValidateResource } from "./create-resource-links.mjs";
|
|
12
12
|
import { ContextualInlineRenderState, ContextualInlineRenderStates, CreateResourceLayoutFn, CreateResourceLayoutMakeComposableOptions, CreateResourceLayoutWithLayoutOptions, CreateViewMapBuiltInRenderStatesOptions, CreateViewMapFunctionRenderOptions, CreateViewMapInlineRenderStatesOptions, CreateViewMapOptions, CreateViewMapRenderStatesOptions, DefineResourceLayout, DefineResourceLayoutFn, DefineResourceLayoutForResources, DefineResourceLayoutForResourcesFactory, DefineResourceLayoutWithLayoutFn, DefineResourcesFn, DefinedResourceLayout, DefinedResourceLayoutWithShell, LayoutDefinition, LayoutIncludeProps, LayoutRenderResourcesAccessor, LayoutResourcesAccessor, ResourceLayoutProvider, ResourceLayoutProviderProps, ResourceLayoutShellComponent, ResourceLayoutShellProps, ResourceSelection, ShellLayoutDefinition, ShellRenderContext, TypedBuiltInRenderStates, TypedInlineRenderState, defineResourceLayout } from "./define-layout.mjs";
|
|
13
|
-
import { CreateReusable, ReusableInclude, ReusableOptionSelection, ReusableProps } from "./
|
|
13
|
+
import { CreateReusable, ReusableArguments, ReusableDefinition, ReusableFunction, ReusableInclude, ReusableInput, ReusableOptionSelection, ReusableOverlap, ReusableProps, ReusableResolved, ReusableSelected } from "./reusable-types.mjs";
|
|
14
14
|
import { LazyResourceLayoutComponent, LazyResourceLayoutOptions } from "./lazy-resource-layout.mjs";
|
|
15
15
|
import { BoundDefineResourceLayout, CreateDefinedResourceLayoutOptions, CreateDefinedResourceLayoutResult, DefineLazyDefaults, DefinedResourceLayoutInput, NonEmptyResources, createDefinedResourceLayout } from "./create-defined-resource-layout.mjs";
|
|
16
16
|
import { ResourceLayoutShellPublisher } from "./shell-context.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-layout-props.cjs","names":[],"sources":["../../src/create-config/merge-layout-props.ts"],"sourcesContent":["/** Merge contracts by section and prop key; the closest declaration wins. */\nexport function mergeLayoutProps<\n A extends
|
|
1
|
+
{"version":3,"file":"merge-layout-props.cjs","names":[],"sources":["../../src/create-config/merge-layout-props.ts"],"sourcesContent":["import type { PropsContract } from '../props';\n\n/** Merge contracts by section and prop key; the closest declaration wins. */\nexport function mergeLayoutProps<\n A extends PropsContract | undefined,\n B extends PropsContract | undefined\n>(base: A, local: B) {\n if (!base && !local) return undefined;\n return {\n include: { ...base?.include, ...local?.include },\n custom: { ...base?.custom, ...local?.custom },\n } as {\n include: NonNullable<A>['include'] & NonNullable<B>['include'];\n custom: NonNullable<A>['custom'] & NonNullable<B>['custom'];\n };\n}\n"],"mappings":";;;AAGA,SAAgB,iBAGd,MAAS,OAAU;CACnB,IAAI,CAAC,QAAQ,CAAC,OAAO,OAAO;CAC5B,OAAO;EACL,SAAS;GAAE,GAAG,MAAM;GAAS,GAAG,OAAO;EAAQ;EAC/C,QAAQ;GAAE,GAAG,MAAM;GAAQ,GAAG,OAAO;EAAO;CAC9C;AAIF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-layout-props.mjs","names":[],"sources":["../../src/create-config/merge-layout-props.ts"],"sourcesContent":["/** Merge contracts by section and prop key; the closest declaration wins. */\nexport function mergeLayoutProps<\n A extends
|
|
1
|
+
{"version":3,"file":"merge-layout-props.mjs","names":[],"sources":["../../src/create-config/merge-layout-props.ts"],"sourcesContent":["import type { PropsContract } from '../props';\n\n/** Merge contracts by section and prop key; the closest declaration wins. */\nexport function mergeLayoutProps<\n A extends PropsContract | undefined,\n B extends PropsContract | undefined\n>(base: A, local: B) {\n if (!base && !local) return undefined;\n return {\n include: { ...base?.include, ...local?.include },\n custom: { ...base?.custom, ...local?.custom },\n } as {\n include: NonNullable<A>['include'] & NonNullable<B>['include'];\n custom: NonNullable<A>['custom'] & NonNullable<B>['custom'];\n };\n}\n"],"mappings":";;AAGA,SAAgB,iBAGd,MAAS,OAAU;CACnB,IAAI,CAAC,QAAQ,CAAC,OAAO,OAAO;CAC5B,OAAO;EACL,SAAS;GAAE,GAAG,MAAM;GAAS,GAAG,OAAO;EAAQ;EAC/C,QAAQ;GAAE,GAAG,MAAM;GAAQ,GAAG,OAAO;EAAO;CAC9C;AAIF"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { ResourceDefinition, ResourceEnum } from "../resource.cjs";
|
|
2
|
+
import { InPropsDefinition, InPropsObject, InferredInProps, PropsContract } from "../props.cjs";
|
|
3
|
+
import { LayoutResourcesAccessor } from "./define-layout.cjs";
|
|
4
|
+
import { AnyBuiltPropDefinition, ExtractDefinitionValue, ResolvedBuiltPropShape } from "@jfdevelops/react-layout-validator";
|
|
5
|
+
|
|
6
|
+
//#region src/create-config/reusable-types.d.ts
|
|
7
|
+
type Selector<Source> = (source: Source) => unknown;
|
|
8
|
+
type OptionValue<Definition extends AnyBuiltPropDefinition> = ExtractDefinitionValue<Definition> | (Definition['visibility'] extends 'optional' ? undefined : never);
|
|
9
|
+
/** Select or transform resolved option values, or drill into object values. */
|
|
10
|
+
type ReusableOptionSelection<Props extends InPropsObject> = { [Key in keyof Props]?: Props[Key] extends {
|
|
11
|
+
type: 'object';
|
|
12
|
+
properties: infer Shape extends InPropsObject;
|
|
13
|
+
} ? true | Selector<OptionValue<Props[Key]>> | ReusableOptionSelection<Shape> : true | Selector<OptionValue<Props[Key]>> };
|
|
14
|
+
type OptionDefinitions<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = InferredInProps<Resources, Options> extends infer Props extends InPropsObject ? Props : never;
|
|
15
|
+
/** Only data sources declared by the factory are available for selection. */
|
|
16
|
+
type ReusableInclude<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = {
|
|
17
|
+
resources?: true | Selector<LayoutResourcesAccessor<Resources>>;
|
|
18
|
+
} & (keyof OptionDefinitions<Resources, Options> extends never ? {} : {
|
|
19
|
+
options?: true | Selector<ResolvedBuiltPropShape<OptionDefinitions<Resources, Options>>> | ReusableOptionSelection<OptionDefinitions<Resources, Options>>;
|
|
20
|
+
});
|
|
21
|
+
type SelectedOptionValue<Definition extends AnyBuiltPropDefinition, Selection> = Selection extends true ? ExtractDefinitionValue<Definition> : Selection extends ((...args: any[]) => infer Result) ? Result : Definition extends {
|
|
22
|
+
properties: infer Shape extends InPropsObject;
|
|
23
|
+
} ? SelectedOptionProps<Shape, Selection> : never;
|
|
24
|
+
type SelectedOptionProps<Props extends InPropsObject, Selection> = { [Key in keyof Props & keyof Selection as Selection[Key] extends Selector<any> ? Key : Props[Key]['visibility'] extends 'required' ? Key : never]: SelectedOptionValue<Props[Key], Selection[Key]> } & { [Key in keyof Props & keyof Selection as Selection[Key] extends Selector<any> ? never : Props[Key]['visibility'] extends 'optional' ? Key : never]?: SelectedOptionValue<Props[Key], Selection[Key]> };
|
|
25
|
+
/** Options are flattened one level, so `options: { meta: true }` supplies `meta`. */
|
|
26
|
+
type ReusableProps<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject> = (Include extends {
|
|
27
|
+
resources: true;
|
|
28
|
+
} ? {
|
|
29
|
+
resources: ResourceEnum<Resources>[number][];
|
|
30
|
+
} : Include extends {
|
|
31
|
+
resources: (...args: any[]) => infer Result;
|
|
32
|
+
} ? {
|
|
33
|
+
resources: Result;
|
|
34
|
+
} : {}) & (Include extends {
|
|
35
|
+
options: infer Selection;
|
|
36
|
+
} ? Selection extends ((...args: any[]) => infer Result) ? {
|
|
37
|
+
options: Result;
|
|
38
|
+
} : Selection extends true ? ResolvedBuiltPropShape<OptionDefinitions<Resources, Options>> : SelectedOptionProps<OptionDefinitions<Resources, Options>, Selection> : {}) & ResolvedBuiltPropShape<Custom>;
|
|
39
|
+
/** Data selected for the reusable's single callback argument. */
|
|
40
|
+
type ReusableSelected<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Selection> = (Selection extends {
|
|
41
|
+
resources: infer Value;
|
|
42
|
+
} ? {
|
|
43
|
+
resources: Value extends ((...args: any[]) => infer Result) ? Result : LayoutResourcesAccessor<Resources>;
|
|
44
|
+
} : {}) & (Selection extends {
|
|
45
|
+
options: infer Value;
|
|
46
|
+
} ? Value extends ((...args: any[]) => infer Result) ? {
|
|
47
|
+
options: Result;
|
|
48
|
+
} : SelectedValues<OptionDefinitions<Resources, Options>, Value> : {});
|
|
49
|
+
type ReusableOverlap = 'preferProps' | 'preferSelect';
|
|
50
|
+
type SelectionShape<Props extends InPropsObject, Selection> = Selection extends Selector<any> ? 'value' : { [Key in keyof Props & (Selection extends true ? keyof Props : keyof Selection)]: SelectionAt<Selection, Key> extends Selector<any> ? 'value' : Props[Key] extends {
|
|
51
|
+
properties: infer Shape extends InPropsObject;
|
|
52
|
+
} ? SelectionShape<Shape, SelectionAt<Selection, Key>> : 'value' };
|
|
53
|
+
type ContractShape<Props extends InPropsObject, Contract, Custom> = (Contract extends {
|
|
54
|
+
resources: unknown;
|
|
55
|
+
} ? {
|
|
56
|
+
resources: 'value';
|
|
57
|
+
} : {}) & (Contract extends {
|
|
58
|
+
options: infer Selection;
|
|
59
|
+
} ? Selection extends Selector<any> ? {
|
|
60
|
+
options: 'value';
|
|
61
|
+
} : SelectionShape<Props, Selection> : {}) & { [Key in keyof Custom]: 'value' };
|
|
62
|
+
type MergeValue<Left, Right, Overlap, LeftShape, RightShape> = LeftShape extends object ? RightShape extends object ? MergeValues<NonNullable<Left>, NonNullable<Right>, Overlap, LeftShape, RightShape> : Overlap extends 'preferSelect' ? Right : Left : Overlap extends 'preferSelect' ? Right : Left;
|
|
63
|
+
type SharedKeys<Left, Right> = keyof Left & keyof Right;
|
|
64
|
+
type OptionalSharedKeys<Left, Right, Overlap, LeftShape, RightShape> = { [Key in SharedKeys<Left, Right>]: Key extends keyof LeftShape ? Key extends keyof RightShape ? LeftShape[Key] extends object ? RightShape[Key] extends object ? {} extends Pick<Left, Key> ? {} extends Pick<Right, Key> ? Key : never : never : Overlap extends 'preferSelect' ? {} extends Pick<Right, Key> ? Key : never : {} extends Pick<Left, Key> ? Key : never : Overlap extends 'preferSelect' ? {} extends Pick<Right, Key> ? Key : never : {} extends Pick<Left, Key> ? Key : never : never : never }[SharedKeys<Left, Right>];
|
|
65
|
+
type MergeValues<Left, Right, Overlap, LeftShape, RightShape> = Omit<Left, keyof Right> & Omit<Right, keyof Left> & { [Key in Exclude<SharedKeys<Left, Right>, OptionalSharedKeys<Left, Right, Overlap, LeftShape, RightShape>>]: MergeValue<Left[Key], Right[Key], Overlap, Key extends keyof LeftShape ? LeftShape[Key] : 'value', Key extends keyof RightShape ? RightShape[Key] : 'value'> } & { [Key in OptionalSharedKeys<Left, Right, Overlap, LeftShape, RightShape>]?: MergeValue<Left[Key], Right[Key], Overlap, Key extends keyof LeftShape ? LeftShape[Key] : 'value', Key extends keyof RightShape ? RightShape[Key] : 'value'> };
|
|
66
|
+
type IndependentSources<Props extends InPropsObject, Include, Select> = keyof CallerOptions<Props, Include, Select> extends never ? false : keyof (SourceValues<Props, Include, true> & SourceValues<Props, Select, false>) extends never ? false : true;
|
|
67
|
+
type BranchSelection<Selection> = Selection extends Selector<any> ? {} : Selection;
|
|
68
|
+
type GuardedFields<Value, Props extends InPropsObject, Include, Select, Shape, Independent extends boolean> = { [Key in keyof Value]: Key extends keyof Props ? Key extends keyof Shape ? Shape[Key] extends object ? Props[Key] extends {
|
|
69
|
+
properties: infer Nested extends InPropsObject;
|
|
70
|
+
} ? GuardedObject<NonNullable<Value[Key]>, Nested, BranchSelection<SelectionAt<Include, Key>>, BranchSelection<SelectionAt<Select, Key>>, Shape[Key], IndependentSources<Nested, BranchSelection<SelectionAt<Include, Key>>, BranchSelection<SelectionAt<Select, Key>>> extends true ? Independent extends true ? true : Props[Key]['visibility'] extends 'optional' ? true : false : false> | Extract<Value[Key], undefined> : Value[Key] : Value[Key] : Value[Key] : Value[Key] };
|
|
71
|
+
type GuardedObject<Value, Props extends InPropsObject, Include, Select, Shape, Independent extends boolean = false> = Independent extends true ? Partial<GuardedFields<Value, Props, Include, Select, Shape, Independent>> : GuardedFields<Value, Props, Include, Select, Shape, Independent>;
|
|
72
|
+
type MergedShape<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom, Select, Overlap> = MergeValues<ContractShape<OptionDefinitions<Resources, Options>, Include, Custom>, ContractShape<OptionDefinitions<Resources, Options>, Select, {}>, Overlap, ContractShape<OptionDefinitions<Resources, Options>, Include, Custom>, ContractShape<OptionDefinitions<Resources, Options>, Select, {}>>;
|
|
73
|
+
type ReusableResolved<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject, Select, Overlap = undefined> = Expanded<GuardedObject<MergeValues<ReusableProps<Resources, Options, Include, Custom>, ReusableSelected<Resources, Options, Select>, Overlap, ContractShape<OptionDefinitions<Resources, Options>, Include, Custom>, ContractShape<OptionDefinitions<Resources, Options>, Select, {}>>, OptionDefinitions<Resources, Options>, Include extends {
|
|
74
|
+
options: infer Selection;
|
|
75
|
+
} ? Selection : {}, Select extends {
|
|
76
|
+
options: infer Selection;
|
|
77
|
+
} ? Selection : {}, MergedShape<Resources, Options, Include, Custom, Select, Overlap>>>;
|
|
78
|
+
type SelectedValues<Props extends InPropsObject, Selection> = Selection extends ((...args: any[]) => infer Result) ? Result : Selection extends true ? ResolvedBuiltPropShape<Props> : SelectedOptionProps<Props, Selection>;
|
|
79
|
+
/** Sources are derived against the finite definition tree, not arbitrary input keys. */
|
|
80
|
+
type SourceValue<Definition extends AnyBuiltPropDefinition, Selection, CallbacksOnly extends boolean> = Selection extends Selector<any> ? OptionValue<Definition> : Selection extends true ? CallbacksOnly extends true ? never : OptionValue<Definition> : Definition extends {
|
|
81
|
+
properties: infer Shape extends InPropsObject;
|
|
82
|
+
} ? SourceValues<Shape, Selection, CallbacksOnly> : never;
|
|
83
|
+
type SourceKeys<Props extends InPropsObject, Selection, CallbacksOnly extends boolean> = { [Key in keyof Props & keyof Selection]: Selection[Key] extends Selector<any> ? Key : Selection[Key] extends true ? CallbacksOnly extends true ? never : Key : Props[Key] extends {
|
|
84
|
+
properties: infer Shape extends InPropsObject;
|
|
85
|
+
} ? keyof SourceValues<Shape, Selection[Key], CallbacksOnly> extends never ? never : Key : never }[keyof Props & keyof Selection];
|
|
86
|
+
type SourceValues<Props extends InPropsObject, Selection, CallbacksOnly extends boolean> = Selection extends Selector<any> ? ResolvedBuiltPropShape<Props> : Selection extends true ? CallbacksOnly extends true ? {} : ResolvedBuiltPropShape<Props> : { [Key in SourceKeys<Props, Selection, CallbacksOnly> as Props[Key]['visibility'] extends 'required' ? Key : never]: SourceValue<Props[Key], Selection[Key], CallbacksOnly> } & { [Key in SourceKeys<Props, Selection, CallbacksOnly> as Props[Key]['visibility'] extends 'optional' ? Key : never]?: SourceValue<Props[Key], Selection[Key], CallbacksOnly> };
|
|
87
|
+
type OptionSource<Props extends InPropsObject, Contract, CallbacksOnly extends boolean> = Contract extends {
|
|
88
|
+
options: infer Selection;
|
|
89
|
+
} ? SourceValues<Props, Selection, CallbacksOnly> : {};
|
|
90
|
+
/** Expand object intersections for readable public helper signatures. */
|
|
91
|
+
type Expanded<Value> = Value extends Promise<infer Result> ? Promise<Expanded<Result>> : Value extends ((...args: any[]) => any) ? Value : Value extends readonly unknown[] ? Value : Value extends object ? { [Key in keyof Value]: Expanded<Value[Key]> } : Value;
|
|
92
|
+
type SourceInput<Values> = keyof Values extends never ? {} : {} extends Values ? {
|
|
93
|
+
options?: Values;
|
|
94
|
+
} : {
|
|
95
|
+
options: Values;
|
|
96
|
+
};
|
|
97
|
+
type ReusableInput<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject, Select> = Expanded<ReusableProps<Resources, Options, CallerContract<Resources, Options, Include, Select>, Custom> & SourceInput<OptionSource<OptionDefinitions<Resources, Options>, Include, true> & OptionSource<OptionDefinitions<Resources, Options>, Select, false>>>;
|
|
98
|
+
type SelectionAt<Selection, Key extends PropertyKey> = Selection extends true ? true : Key extends keyof Selection ? Selection[Key] : undefined;
|
|
99
|
+
type CallerOptions<Props extends InPropsObject, Include, Select> = { [Key in keyof Props as SelectionAt<Include, Key> extends infer Value ? Value extends Selector<any> | undefined ? never : Value extends true ? SelectionAt<Select, Key> extends true ? never : Props[Key] extends {
|
|
100
|
+
properties: infer Shape extends InPropsObject;
|
|
101
|
+
} ? SelectionAt<Select, Key> extends object ? keyof CallerOptions<Shape, true, SelectionAt<Select, Key>> extends never ? never : Key : Key : Key : Props[Key] extends {
|
|
102
|
+
properties: infer Shape extends InPropsObject;
|
|
103
|
+
} ? keyof CallerOptions<Shape, Value, SelectionAt<Select, Key>> extends never ? never : Key : never : never]: Props[Key] extends {
|
|
104
|
+
properties: infer Shape extends InPropsObject;
|
|
105
|
+
} ? SelectionAt<Include, Key> extends true ? SelectionAt<Select, Key> extends object ? CallerOptions<Shape, true, SelectionAt<Select, Key>> : true : CallerOptions<Shape, SelectionAt<Include, Key>, SelectionAt<Select, Key>> : true };
|
|
106
|
+
type CallerContract<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Select> = (Include extends {
|
|
107
|
+
resources: true;
|
|
108
|
+
} ? {
|
|
109
|
+
resources: true;
|
|
110
|
+
} : {}) & (Include extends {
|
|
111
|
+
options: infer Value;
|
|
112
|
+
} ? Value extends Selector<any> ? {} : {
|
|
113
|
+
options: CallerOptions<OptionDefinitions<Resources, Options>, Value, Select extends {
|
|
114
|
+
options: infer Other;
|
|
115
|
+
} ? Other : {}>;
|
|
116
|
+
} : {});
|
|
117
|
+
type ExactSelection<Selection, Allowed> = { [Key in keyof Selection]: Key extends keyof Allowed ? Selection[Key] extends Selector<any> ? Allowed[Key] : Selection[Key] extends object ? ExactSelection<Selection[Key], Exclude<Allowed[Key], true | undefined | Selector<any>>> : Allowed[Key] : never };
|
|
118
|
+
/** Configuration accepted by the bound reusable factory. */
|
|
119
|
+
type ReusableDefinition<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include extends ReusableInclude<Resources, Options>, Custom extends InPropsObject, Select extends ReusableInclude<Resources, Options>, Result, Overlap extends ReusableOverlap | undefined = undefined> = {
|
|
120
|
+
props?: PropsContract<ReusableInclude<Resources, Options> & Include & ExactSelection<Include, ReusableInclude<Resources, Options>>, Custom>;
|
|
121
|
+
select?: ReusableInclude<Resources, Options> & Select & ExactSelection<Select, ReusableInclude<Resources, Options>>; /** Resolve ambiguous leaf collisions explicitly; the default rejects them. */
|
|
122
|
+
overlap?: Overlap;
|
|
123
|
+
fn: (props: ReusableResolved<Resources, Options, Include, Custom, Select, Overlap>) => Result;
|
|
124
|
+
};
|
|
125
|
+
type ReusableArguments<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject, Select> = {} extends ReusableInput<Resources, Options, Include, Custom, Select> ? [props?: ReusableInput<Resources, Options, Include, Custom, Select>] : [props: ReusableInput<Resources, Options, Include, Custom, Select>];
|
|
126
|
+
type ReusableFunction<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>, Include, Custom extends InPropsObject, Select, Result> = (...args: ReusableArguments<Resources, Options, Include, Custom, Select>) => Expanded<Result>;
|
|
127
|
+
/** Creates a validated function with one merged callback argument. */
|
|
128
|
+
type CreateReusable<Resources extends readonly ResourceDefinition[], Options extends InPropsDefinition<Resources>> = <const Include extends ReusableInclude<Resources, Options> = {}, const Custom extends InPropsObject = {}, const Select extends ReusableInclude<Resources, Options> = {}, Result = unknown, const Overlap extends ReusableOverlap | undefined = undefined>(definition: ReusableDefinition<Resources, Options, Include, Custom, Select, Result, Overlap>) => ReusableFunction<Resources, Options, Include, Custom, Select, Result>;
|
|
129
|
+
//#endregion
|
|
130
|
+
export { CreateReusable, ReusableArguments, ReusableDefinition, ReusableFunction, ReusableInclude, ReusableInput, ReusableOptionSelection, ReusableOverlap, ReusableProps, ReusableResolved, ReusableSelected };
|
|
131
|
+
//# sourceMappingURL=reusable-types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reusable-types.d.cts","names":[],"sources":["../../src/create-config/reusable-types.ts"],"mappings":";;;;;;KAcK,QAAA,YAAoB,MAAA,EAAQ,MAAM;AAAA,KAClC,WAAA,oBAA+B,sBAAA,IAChC,sBAAA,CAAuB,UAAA,KACtB,UAAA;AAL0D;AAAA,KAQnD,uBAAA,eAAsC,aAAA,oBAClC,KAAA,IAAS,KAAA,CAAM,GAAA;EAC3B,IAAA;EACA,UAAA,sBAAgC,aAAA;AAAA,WAEvB,QAAA,CAAS,WAAA,CAAY,KAAA,CAAM,GAAA,MAAS,uBAAA,CAAwB,KAAA,WAC5D,QAAA,CAAS,WAAA,CAAY,K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