@modular-component/core 0.1.2 → 0.1.4
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/CHANGELOG.md +13 -0
- package/dist/index.d.ts +304 -91
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +107 -53
- package/dist/index.js.map +1 -1
- package/dist/types/arguments.d.ts +33 -0
- package/dist/types/arguments.d.ts.map +1 -0
- package/dist/types/arguments.js +6 -0
- package/dist/types/arguments.js.map +1 -0
- package/dist/types/methods/add.d.ts +23 -0
- package/dist/types/methods/add.d.ts.map +1 -0
- package/dist/types/methods/add.js +8 -0
- package/dist/types/methods/add.js.map +1 -0
- package/dist/types/methods/at.d.ts +22 -0
- package/dist/types/methods/at.d.ts.map +1 -0
- package/dist/types/methods/at.js +7 -0
- package/dist/types/methods/at.js.map +1 -0
- package/dist/types/methods/hook.d.ts +14 -0
- package/dist/types/methods/hook.d.ts.map +1 -0
- package/dist/types/methods/hook.js +7 -0
- package/dist/types/methods/hook.js.map +1 -0
- package/dist/types/methods/mock.d.ts +26 -0
- package/dist/types/methods/mock.d.ts.map +1 -0
- package/dist/types/methods/mock.js +6 -0
- package/dist/types/methods/mock.js.map +1 -0
- package/dist/types/methods/with.d.ts +44 -0
- package/dist/types/methods/with.d.ts.map +1 -0
- package/dist/types/methods/with.js +8 -0
- package/dist/types/methods/with.js.map +1 -0
- package/dist/types/methods.d.ts +10 -0
- package/dist/types/methods.d.ts.map +1 -0
- package/dist/types/methods.js +5 -0
- package/dist/types/methods.js.map +1 -0
- package/dist/types/modular-component.d.ts +15 -0
- package/dist/types/modular-component.d.ts.map +1 -0
- package/dist/types/modular-component.js +5 -0
- package/dist/types/modular-component.js.map +1 -0
- package/dist/types/stage.d.ts +41 -0
- package/dist/types/stage.d.ts.map +1 -0
- package/dist/types/stage.js +5 -0
- package/dist/types/stage.js.map +1 -0
- package/dist/types/utils.d.ts +24 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/utils.js +5 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/types/validation.d.ts +4 -0
- package/dist/types/validation.d.ts.map +1 -0
- package/dist/types/validation.js +2 -0
- package/dist/types/validation.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +185 -83
- package/src/types/arguments.ts +55 -0
- package/src/types/methods/add.ts +50 -0
- package/src/types/methods/at.ts +64 -0
- package/src/types/methods/hook.ts +27 -0
- package/src/types/methods/mock.ts +90 -0
- package/src/types/methods/with.ts +153 -0
- package/src/types/methods.ts +11 -0
- package/src/types/modular-component.ts +25 -0
- package/src/types/stage.ts +91 -0
- package/src/types/utils.ts +63 -0
- package/src/types/validation.ts +13 -0
- package/dist/types.d.ts +0 -76
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/src/types.ts +0 -279
package/dist/index.js
CHANGED
|
@@ -1,80 +1,132 @@
|
|
|
1
|
+
import { forwardRef, memo } from 'react';
|
|
1
2
|
function ModularFactory(methods) {
|
|
2
3
|
return {
|
|
3
4
|
build: (stages = []) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// that will call the hooks for each registered stages in order.
|
|
7
|
-
const Component = ((props) => {
|
|
8
|
-
// Prepare the shared arguments object, prefilling it with the props
|
|
9
|
-
// and an empty render result
|
|
10
|
-
const useComponent = Component.asHook();
|
|
11
|
-
const args = useComponent(props);
|
|
12
|
-
return args.render ?? null;
|
|
13
|
-
});
|
|
14
|
-
// Set the debug display name if provided
|
|
15
|
-
Component.displayName = displayName;
|
|
16
|
-
// Add an asHook system to get the components args as a reusable hook
|
|
17
|
-
Component.asHook = ((field) => (props) => {
|
|
5
|
+
const factory = (displayName, options) => {
|
|
6
|
+
const generateAsHook = (ref, field) => () => (props = {}) => {
|
|
18
7
|
// Prepare the shared arguments object, prefilling it with the props
|
|
19
8
|
// and an empty render result
|
|
20
|
-
let args = {
|
|
9
|
+
let args = {
|
|
10
|
+
props,
|
|
11
|
+
children: props?.children,
|
|
12
|
+
render: null,
|
|
13
|
+
ref,
|
|
14
|
+
};
|
|
15
|
+
const methodsArray = Object.values(methods);
|
|
21
16
|
// Run each stage in order, replacing the arguments by the response
|
|
22
17
|
// from the last stage
|
|
23
18
|
for (const stage of stages) {
|
|
24
|
-
const method =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
: useStage);
|
|
19
|
+
const method = methodsArray.find((method) => method.symbol === stage.stage);
|
|
20
|
+
let useTransform =
|
|
21
|
+
// Never transform mocked stages
|
|
22
|
+
(stage.mocked ? undefined : method?.transform) ??
|
|
23
|
+
(() => stage.value);
|
|
30
24
|
args = {
|
|
31
25
|
...args,
|
|
32
|
-
[method
|
|
26
|
+
[method?.field]: useTransform(args, stage.value),
|
|
33
27
|
};
|
|
34
28
|
}
|
|
35
29
|
// Finally, return the args
|
|
36
30
|
return field ? args[field] : args;
|
|
31
|
+
};
|
|
32
|
+
// Create the actual Component. This is a simple React Functional Component
|
|
33
|
+
// that will call the hooks for each registered stages in order.
|
|
34
|
+
const Component = forwardRef((props, ref) => {
|
|
35
|
+
// Prepare the shared arguments object, prefilling it with the props
|
|
36
|
+
// and an empty render result
|
|
37
|
+
const useComponent = generateAsHook(ref)();
|
|
38
|
+
const args = useComponent(props);
|
|
39
|
+
return args.render ?? null;
|
|
37
40
|
});
|
|
38
|
-
//
|
|
39
|
-
Component.
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
// Set the debug display name if provided
|
|
42
|
+
Component.displayName = displayName;
|
|
43
|
+
// Add an asHook system to get the components args as a reusable hook
|
|
44
|
+
Component.asHook = generateAsHook();
|
|
45
|
+
// Add each configured stage methods to the component
|
|
46
|
+
Object.keys(methods).forEach((method) => {
|
|
47
|
+
// Check if a stage of the same key already exists
|
|
48
|
+
const stageIndices = stages
|
|
42
49
|
// Map all stages to an [index, stage] tuple
|
|
43
50
|
.map((record, index) => [index, record])
|
|
44
51
|
// Remove all tuples not matching our stage
|
|
45
|
-
.filter(([, record]) => record.
|
|
46
|
-
// Get the index
|
|
47
|
-
.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
// Otherwise, keep all stages up to and including the found stage
|
|
53
|
-
return ModularFactory(methods).build(stages.slice(0, stageIndex + 1))(displayName);
|
|
54
|
-
});
|
|
55
|
-
// Add each configured stage method to the component
|
|
56
|
-
Object.keys(methods).forEach((method) => {
|
|
57
|
-
Component[method] = ((value) => {
|
|
52
|
+
.filter(([, record]) => record.stage === methods[method].symbol)
|
|
53
|
+
// Get the index
|
|
54
|
+
.map(([index]) => index);
|
|
55
|
+
const lastIndex = [...stageIndices].pop();
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
Component[`with${method}`] = (value, forceIndex) => {
|
|
58
58
|
// Prepare the new stage
|
|
59
|
-
const stage = {
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// For other stages, check if a stage of the same key already exists
|
|
65
|
-
const index = stages.findIndex((st) => st.key === method);
|
|
59
|
+
const stage = { stage: methods[method].symbol, value };
|
|
60
|
+
// Check if a stage of the same key already exists
|
|
61
|
+
const stageIndex = (forceIndex !== undefined
|
|
62
|
+
? stageIndices[forceIndex]
|
|
63
|
+
: lastIndex) ?? -1;
|
|
66
64
|
// If so, copy the stages and replace the previous record
|
|
67
|
-
if (
|
|
65
|
+
if (stageIndex > -1) {
|
|
68
66
|
const nextStages = [...stages];
|
|
69
|
-
nextStages[
|
|
67
|
+
nextStages[stageIndex] = stage;
|
|
70
68
|
return ModularFactory(methods).build(nextStages)(displayName);
|
|
71
69
|
}
|
|
72
|
-
// Otherwise, append the stage
|
|
70
|
+
// Otherwise, append the stage
|
|
73
71
|
return ModularFactory(methods).build([...stages, stage])(displayName);
|
|
74
|
-
}
|
|
72
|
+
};
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
Component[`add${method}`] =
|
|
75
|
+
stageIndices.length < 1
|
|
76
|
+
? undefined
|
|
77
|
+
: (value) => {
|
|
78
|
+
// Prepare the new stage
|
|
79
|
+
const stage = {
|
|
80
|
+
stage: methods[method].symbol,
|
|
81
|
+
value,
|
|
82
|
+
};
|
|
83
|
+
// Append the stage as in multiple mode
|
|
84
|
+
return ModularFactory(methods).build([
|
|
85
|
+
...stages,
|
|
86
|
+
stage,
|
|
87
|
+
])(displayName);
|
|
88
|
+
};
|
|
89
|
+
// @ts-ignore
|
|
90
|
+
Component[`at${method}`] =
|
|
91
|
+
stageIndices.length < 1
|
|
92
|
+
? undefined
|
|
93
|
+
: (forceIndex) => {
|
|
94
|
+
// Find the needed stage
|
|
95
|
+
const stageIndex = (forceIndex !== undefined
|
|
96
|
+
? stageIndices[forceIndex]
|
|
97
|
+
: lastIndex) ?? lastIndex;
|
|
98
|
+
// Otherwise, keep all stages up to and including the found stage
|
|
99
|
+
return ModularFactory(methods).build(stages.slice(0, stageIndex + 1))(displayName);
|
|
100
|
+
};
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
Component[`mock${method}`] =
|
|
103
|
+
stageIndices.length < 1
|
|
104
|
+
? undefined
|
|
105
|
+
: (value, forceIndex) => {
|
|
106
|
+
// Prepare the mocked stage
|
|
107
|
+
const stage = {
|
|
108
|
+
stage: methods[method].symbol,
|
|
109
|
+
value,
|
|
110
|
+
mocked: true,
|
|
111
|
+
};
|
|
112
|
+
// Find the needed stage
|
|
113
|
+
const stageIndex = (forceIndex !== undefined
|
|
114
|
+
? stageIndices[forceIndex]
|
|
115
|
+
: lastIndex) ?? lastIndex;
|
|
116
|
+
// Replace the stage with its mock
|
|
117
|
+
const nextStages = [...stages];
|
|
118
|
+
nextStages[stageIndex] = stage;
|
|
119
|
+
return ModularFactory(methods).build(nextStages)(displayName);
|
|
120
|
+
};
|
|
121
|
+
const capitalize = (str) => str[0].toUpperCase() + str.slice(1);
|
|
122
|
+
// @ts-ignore
|
|
123
|
+
Component[`asUse${capitalize(methods[method].field)}`] =
|
|
124
|
+
generateAsHook(undefined, methods[method].field);
|
|
75
125
|
});
|
|
76
|
-
return Component;
|
|
126
|
+
return (options?.memo ? memo(Component) : Component);
|
|
77
127
|
};
|
|
128
|
+
factory.memo = (displayName) => factory(displayName, { memo: true });
|
|
129
|
+
return factory;
|
|
78
130
|
},
|
|
79
131
|
extend: (_methods) => {
|
|
80
132
|
return ModularFactory({
|
|
@@ -84,10 +136,12 @@ function ModularFactory(methods) {
|
|
|
84
136
|
},
|
|
85
137
|
};
|
|
86
138
|
}
|
|
139
|
+
const withRender = Symbol();
|
|
87
140
|
export const modularFactory = ModularFactory({
|
|
88
|
-
|
|
141
|
+
Render: {
|
|
142
|
+
symbol: withRender,
|
|
89
143
|
field: 'render',
|
|
90
|
-
|
|
144
|
+
transform: (args, useStage) => useStage(args),
|
|
91
145
|
},
|
|
92
146
|
});
|
|
93
147
|
export function createMethodRecord(record) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,UAAU,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAQzE,SAAS,cAAc,CACrB,OAAgB;IAMhB,OAAO;QACL,KAAK,EAAE,CAAiC,SAAqB,EAAE,EAAE,EAAE;YACjE,MAAM,OAAO,GAAG,CACd,WAAoB,EACpB,OAA2B,EAC3B,EAAE;gBACF,MAAM,cAAc,GAClB,CAAC,GAAuB,EAAE,KAAc,EAAE,EAAE,CAC5C,GAAG,EAAE,CACL,CAAC,QAAe,EAAW,EAAE,EAAE;oBAC7B,oEAAoE;oBACpE,6BAA6B;oBAC7B,IAAI,IAAI,GAAG;wBACT,KAAK;wBACL,QAAQ,EAAG,KAAgC,EAAE,QAAQ;wBACrD,MAAM,EAAE,IAAI;wBACZ,GAAG;qBACJ,CAAA;oBAED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EAClB,EAAE;YACF,OAAO,cAAc,CAAqB;gBACxC,GAAG,OAAO;gBACV,GAAG,QAAQ;aACZ,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC;AAED,MAAM,UAAU,GAAG,MAAM,EAAE,CAAA;AAa3B,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;IAC3C,MAAM,EAAE;QACN,MAAM,EAAE,UAAU;QAClB,KAAK,EAAE,QAAQ;QACf,SAAS,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;KAC9C;CACO,CAAC,CAAA;AAEX,MAAM,UAAU,kBAAkB,CAChC,MAAS;IAET,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for computing the arguments map generated by a given
|
|
3
|
+
* set of stages
|
|
4
|
+
*/
|
|
5
|
+
import { PropsWithChildren } from 'react';
|
|
6
|
+
import { StageTuple, ModularStages, BeforeStage, CleanUpStages } from './stage';
|
|
7
|
+
import { UnionToIntersection } from './utils';
|
|
8
|
+
export declare type ComputeArguments<Props extends {}, Ref, Methods extends Record<string, {
|
|
9
|
+
symbol: keyof ModularStages;
|
|
10
|
+
field: string;
|
|
11
|
+
}>, Stages extends StageTuple, CleanedStages extends StageTuple = CleanUpStages<Stages>, MethodList = Methods[keyof Methods]> = {
|
|
12
|
+
props: Props extends {
|
|
13
|
+
children: unknown;
|
|
14
|
+
} ? Props : PropsWithChildren<Props>;
|
|
15
|
+
ref: Ref;
|
|
16
|
+
children: Props extends {
|
|
17
|
+
children: infer C;
|
|
18
|
+
} ? C : PropsWithChildren['children'];
|
|
19
|
+
} & (Stages['length'] extends 0 ? {} : UnionToIntersection<{
|
|
20
|
+
[key in keyof CleanedStages]: MethodList extends {
|
|
21
|
+
symbol: CleanedStages[key]['stage'];
|
|
22
|
+
field: infer F;
|
|
23
|
+
} ? {
|
|
24
|
+
[k in F extends string ? F : never]: ModularStages<ComputeArguments<Props, Ref, Methods, BeforeStage<CleanedStages, key>>, CleanedStages[key]['value']>[CleanedStages[key]['stage']] extends {
|
|
25
|
+
transform: infer T;
|
|
26
|
+
} ? T : CleanedStages[key]['value'];
|
|
27
|
+
} : never;
|
|
28
|
+
}[number]>) extends infer U ? {
|
|
29
|
+
[key in keyof U]: U[key] extends Record<string, unknown> ? U[key] extends infer V ? {
|
|
30
|
+
[key in keyof V]: V[key];
|
|
31
|
+
} : never : U[key];
|
|
32
|
+
} : never;
|
|
33
|
+
//# sourceMappingURL=arguments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arguments.d.ts","sourceRoot":"","sources":["../../src/types/arguments.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAE7C,oBAAY,gBAAgB,CAC1B,KAAK,SAAS,EAAE,EAChB,GAAG,EACH,OAAO,SAAS,MAAM,CACpB,MAAM,EACN;IAAE,MAAM,EAAE,MAAM,aAAa,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAC/C,EACD,MAAM,SAAS,UAAU,EACzB,aAAa,SAAS,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,EACxD,UAAU,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IACjC;IACF,KAAK,EAAE,KAAK,SAAS;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,GAAG,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA;IAC7E,GAAG,EAAE,GAAG,CAAA;IACR,QAAQ,EAAE,KAAK,SAAS;QAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,CAAC,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAA;CAClF,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,GAC3B,EAAE,GACF,mBAAmB,CACjB;KACG,GAAG,IAAI,MAAM,aAAa,GAAG,UAAU,SAAS;QAC/C,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAA;QACnC,KAAK,EAAE,MAAM,CAAC,CAAA;KACf,GACG;SACG,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,aAAa,CAChD,gBAAgB,CACd,KAAK,EACL,GAAG,EACH,OAAO,EACP,WAAW,CAAC,aAAa,EAAE,GAAG,CAAC,CAChC,EACD,aAAa,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAC5B,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS;YAAE,SAAS,EAAE,MAAM,CAAC,CAAA;SAAE,GACzD,CAAC,GACD,aAAa,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;KAChC,GACD,KAAK;CACV,CAAC,MAAM,CAAC,CACV,CAAC,SAAS,MAAM,CAAC,GAClB;KACG,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACpD,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GACpB;SAAG,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;KAAE,GAC5B,KAAK,GACP,CAAC,CAAC,GAAG,CAAC;CACX,GACD,KAAK,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arguments.js","sourceRoot":"","sources":["../../src/types/arguments.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Methods for adding a new entry for a previous stage, rather
|
|
3
|
+
* than reusing the previous one.
|
|
4
|
+
* One two entries for the same stage have been added, `with`, `at` and
|
|
5
|
+
* `mock` methods can take an optional index to select the entry to target
|
|
6
|
+
*/
|
|
7
|
+
import { ModularComponent } from '../modular-component';
|
|
8
|
+
import { AddStage, ModularStages, StageIndices, StageTuple } from '../stage';
|
|
9
|
+
import { ComputeArguments } from '../arguments';
|
|
10
|
+
import { RestrictValue } from '../validation';
|
|
11
|
+
import { MethodRecord } from '../methods';
|
|
12
|
+
import { FilterNever } from '../utils';
|
|
13
|
+
interface ModularAddMethod<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple, Method extends keyof Methods, Symbol extends keyof ModularStages = Methods[Method]['symbol']> {
|
|
14
|
+
<Value extends RestrictValue<Arguments, Symbol>, Arguments extends ComputeArguments<Props, Ref, Methods, Stages>>(value: Value): ModularComponent<Props, Ref, Methods, AddStage<Stages, {
|
|
15
|
+
stage: Symbol;
|
|
16
|
+
value: Value;
|
|
17
|
+
}>>;
|
|
18
|
+
}
|
|
19
|
+
export declare type ModularAddMethods<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple> = FilterNever<{
|
|
20
|
+
[Method in keyof Methods as `add${Method extends string ? Method : never}`]: StageIndices<Stages, Methods[Method]['symbol']>['length'] extends 0 ? never : ModularAddMethod<Props, Ref, Methods, Stages, Method>;
|
|
21
|
+
}>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/types/methods/add.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AA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|
|
2
|
+
* Methods for adding a new entry for a previous stage, rather
|
|
3
|
+
* than reusing the previous one.
|
|
4
|
+
* One two entries for the same stage have been added, `with`, `at` and
|
|
5
|
+
* `mock` methods can take an optional index to select the entry to target
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/types/methods/add.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Methods for rewinding a modular component up to a given stage.
|
|
3
|
+
* If multiple entries of the same stage were previously added,
|
|
4
|
+
* it's possible to pass the index for the entry to rewind to.
|
|
5
|
+
*/
|
|
6
|
+
import { ModularComponent } from '../modular-component';
|
|
7
|
+
import { AtStage, StageIndices, StageTuple } from '../stage';
|
|
8
|
+
import { FilterNever, Last, ToIndices } from '../utils';
|
|
9
|
+
import { ValidateIndex } from '../validation';
|
|
10
|
+
import { MethodRecord } from '../methods';
|
|
11
|
+
interface ModularAtMethodIndices<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple, Method extends keyof Methods, Indices extends number[]> {
|
|
12
|
+
<StageIndex extends Index extends number ? Indices[Index] : Last<Indices>, ValidIndex extends ValidateIndex<Index, ToIndices<Indices>>, Index extends number>(index: ValidIndex extends true ? Index : ToIndices<Indices>): ModularComponent<Props, Ref, Methods, AtStage<Stages, StageIndex>>;
|
|
13
|
+
}
|
|
14
|
+
interface ModularAtMethodLast<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple, Method extends keyof Methods, Index extends number> {
|
|
15
|
+
(): ModularComponent<Props, Ref, Methods, AtStage<Stages, Index>>;
|
|
16
|
+
}
|
|
17
|
+
declare type ModularAtMethod<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple, Method extends keyof Methods, Symbol extends symbol = Methods[Method]['symbol'], Indices extends StageIndices<Stages, Symbol> = StageIndices<Stages, Symbol>> = Indices['length'] extends 0 ? never : ModularAtMethodIndices<Props, Ref, Methods, Stages, Method, Indices> & ModularAtMethodLast<Props, Ref, Methods, Stages, Method, Last<Indices>>;
|
|
18
|
+
export declare type ModularAtMethods<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple> = FilterNever<{
|
|
19
|
+
[Method in keyof Methods as `at${Method extends string ? Method : never}`]: ModularAtMethod<Props, Ref, Methods, Stages, Method>;
|
|
20
|
+
}>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=at.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"at.d.ts","sourceRoot":"","sources":["../../../src/types/methods/at.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEzC,UAAU,sBAAsB,CAC9B,KAAK,SAAS,EAAE,EAChB,GAAG,EACH,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EAC5C,MAAM,SAAS,UAAU,EACzB,MAAM,SAAS,MAAM,OAAO,EAC5B,OAAO,SAAS,MAAM,EAAE;IAExB,CAEE,UAAU,SAAS,KAAK,SAAS,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,EACxE,UAAU,SAAS,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,EAC3D,KAAK,SAAS,MAAM,EAEpB,KAAK,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,CAAC;KACb,MAAM,IAAI,MAAM,OAAO,IAAI,KAAK,MAAM,SAAS,MAAM,GAClD,MAAM,GACN,KAAK,EAAE,GAAG,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;CACnE,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"at.js","sourceRoot":"","sources":["../../../src/types/methods/at.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Methods for converting a modular component to hooks, either
|
|
3
|
+
* a generic hook returning all the arguments, or a specific hook
|
|
4
|
+
* returning one given argument.
|
|
5
|
+
*/
|
|
6
|
+
import { StageTuple } from '../stage';
|
|
7
|
+
import { MethodRecord } from '../methods';
|
|
8
|
+
import { ComputeArguments } from '../arguments';
|
|
9
|
+
export declare type ModularHookMethods<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple, Arguments extends {} = ComputeArguments<Props, Ref, Methods, Stages>> = {
|
|
10
|
+
asHook(): keyof Props extends never ? () => Arguments : (props: Props) => Arguments;
|
|
11
|
+
} & {
|
|
12
|
+
[Arg in keyof Arguments as `asUse${Capitalize<Arg extends string ? Arg : never>}`]: keyof Props extends never ? () => () => Arguments[Arg] : () => (props: Props) => Arguments[Arg];
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/types/methods/hook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/C,oBAAY,kBAAkB,CAC5B,KAAK,SAAS,EAAE,EAChB,GAAG,EACH,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EAC5C,MAAM,SAAS,UAAU,EACzB,SAAS,SAAS,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,IAClE;IACF,MAAM,IAAI,MAAM,KAAK,SAAS,KAAK,GAC/B,MAAM,SAAS,GACf,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAA;CAChC,GAAG;KACD,GAAG,IAAI,MAAM,SAAS,IAAI,QAAQ,UAAU,CAC3C,GAAG,SAAS,MAAM,GAAG,GAAG,GAAG,KAAK,CACjC,EAAE,GAAG,MAAM,KAAK,SAAS,KAAK,GAC3B,MAAM,MAAM,SAAS,CAAC,GAAG,CAAC,GAC1B,MAAM,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,GAAG,CAAC;CAC3C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.js","sourceRoot":"","sources":["../../../src/types/methods/hook.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Methods for mocking the value returned by a given stage,
|
|
3
|
+
* replacing the stage and bypassing its transform function
|
|
4
|
+
*/
|
|
5
|
+
import { ModularComponent } from '../modular-component';
|
|
6
|
+
import { MethodRecord } from '../methods';
|
|
7
|
+
import { ValidateIndex } from '../validation';
|
|
8
|
+
import { ComputeArguments } from '../arguments';
|
|
9
|
+
import { FilterNever, Last, ToIndices } from '../utils';
|
|
10
|
+
import { BeforeStage, ModularStages, StageIndices, StageTuple } from '../stage';
|
|
11
|
+
interface ModularMockMethodIndices<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple, Method extends keyof Methods, Indices extends number[], Symbol extends keyof ModularStages = Methods[Method]['symbol']> {
|
|
12
|
+
<Arguments extends ComputeArguments<Props, Ref, Methods, BeforeStage<Stages, StageIndex>>, Value extends Stages[StageIndex]['value'], Mock extends ModularStages<Arguments, Value>[Symbol] extends {
|
|
13
|
+
transform: infer T;
|
|
14
|
+
} ? T : Value, StageIndex extends Index extends number ? Indices[Index] : Last<Indices>, ValidIndex extends ValidateIndex<Index, ToIndices<Indices>>, Index extends number>(mock: Mock, index: ValidIndex extends true ? Index : ToIndices<Indices>): ModularComponent<Props, Ref, Methods, Stages>;
|
|
15
|
+
}
|
|
16
|
+
interface ModularMockMethodLast<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple, Method extends keyof Methods, Index extends number, Symbol extends keyof ModularStages = Methods[Method]['symbol']> {
|
|
17
|
+
<Value extends Stages[Index]['value'], Mock extends ModularStages<any, Value>[Symbol] extends {
|
|
18
|
+
transform: infer T;
|
|
19
|
+
} ? T : Value>(mock: Mock): ModularComponent<Props, Ref, Methods, Stages>;
|
|
20
|
+
}
|
|
21
|
+
declare type ModularMockMethod<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple, Method extends keyof Methods, Symbol extends keyof ModularStages = Methods[Method]['symbol'], Indices extends StageIndices<Stages, Symbol> = StageIndices<Stages, Symbol>> = Indices['length'] extends 0 ? never : ModularMockMethodIndices<Props, Ref, Methods, Stages, Method, Indices> & ModularMockMethodLast<Props, Ref, Methods, Stages, Method, Last<Indices>>;
|
|
22
|
+
export declare type ModularMockMethods<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple> = FilterNever<{
|
|
23
|
+
[Method in keyof Methods as `mock${Method extends string ? Method : never}`]: ModularMockMethod<Props, Ref, Methods, Stages, Method>;
|
|
24
|
+
}>;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=mock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/types/methods/mock.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gB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CAAC,OAAO,CAAC,CAAC,CAAA;AAE/E,oBAAY,kBAAkB,CAC5B,KAAK,SAAS,EAAE,EAChB,GAAG,EACH,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EAC5C,MAAM,SAAS,UAAU,IACvB,WAAW,CAAC;KACb,MAAM,IAAI,MAAM,OAAO,IAAI,OAAO,MAAM,SAAS,MAAM,GACpD,MAAM,GACN,KAAK,EAAE,GAAG,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;CACrE,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock.js","sourceRoot":"","sources":["../../../src/types/methods/mock.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main factory methods adding or editing an entry for a given
|
|
3
|
+
* stage. If multiple entries for the same stage were added
|
|
4
|
+
* with the `add` method, an index can be passed to select the
|
|
5
|
+
* entry to edit.
|
|
6
|
+
*/
|
|
7
|
+
import { ModularComponent } from '../modular-component';
|
|
8
|
+
import { Last, ToIndices } from '../utils';
|
|
9
|
+
import { BeforeStage, ModularStages, StageIndices, StageTuple, UpsertStage } from '../stage';
|
|
10
|
+
import { MethodRecord } from '../methods';
|
|
11
|
+
import { ComputeArguments } from '../arguments';
|
|
12
|
+
import { RestrictValue, ValidateIndex } from '../validation';
|
|
13
|
+
interface ModularWithMethodDefault<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple, Method extends keyof Methods, Symbol extends keyof ModularStages = Methods[Method]['symbol'], Arguments extends {} = ComputeArguments<Props, Ref, Methods, Stages>> {
|
|
14
|
+
<Value extends RestrictValue<Arguments, Symbol>>(value: Value): ModularComponent<Props, Ref, Methods, UpsertStage<Stages, {
|
|
15
|
+
stage: Symbol;
|
|
16
|
+
value: Value;
|
|
17
|
+
}>>;
|
|
18
|
+
}
|
|
19
|
+
interface ModularWithMethodIndices<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple, Method extends keyof Methods, Indices extends number[], Symbol extends keyof ModularStages = Methods[Method]['symbol']> {
|
|
20
|
+
<Arguments extends ComputeArguments<Props, Ref, Methods, BeforeStage<Stages, StageIndex>>, Value extends RestrictValue<Arguments, Symbol>, PreviousValue extends Stages[StageIndex]['value'], Valid extends ModularStages<Arguments, Value>[Symbol] extends {
|
|
21
|
+
validate: infer V;
|
|
22
|
+
} ? V : Value, PreviousValid extends ModularStages<Arguments, PreviousValue>[Symbol] extends {
|
|
23
|
+
validate: infer V;
|
|
24
|
+
} ? V : PreviousValue, ValidValue extends [Valid] extends [PreviousValid] ? true : false, StageIndex extends Index extends number ? Indices[Index] : Last<Indices>, ValidIndex extends ValidateIndex<Index, ToIndices<Indices>>, Index extends number>(value: ValidValue extends true ? Value : PreviousValue, index: ValidIndex extends true ? Index : ToIndices<Indices>): ModularComponent<Props, Ref, Methods, UpsertStage<Stages, {
|
|
25
|
+
stage: Symbol;
|
|
26
|
+
value: Value;
|
|
27
|
+
}, StageIndex>>;
|
|
28
|
+
}
|
|
29
|
+
interface ModularWithMethodLast<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple, Method extends keyof Methods, Index extends number, Symbol extends keyof ModularStages = Methods[Method]['symbol'], Arguments extends {} = ComputeArguments<Props, Ref, Methods, BeforeStage<Stages, Index>>> {
|
|
30
|
+
<Value extends RestrictValue<Arguments, Symbol>, PreviousValue extends Stages[Index]['value'], Valid extends ModularStages<Arguments, Value>[Symbol] extends {
|
|
31
|
+
validate: infer V;
|
|
32
|
+
} ? V : Value, PreviousValid extends ModularStages<Arguments, PreviousValue>[Symbol] extends {
|
|
33
|
+
validate: infer V;
|
|
34
|
+
} ? V : PreviousValue, ValidValue extends [Valid] extends [PreviousValid] ? true : false>(value: ValidValue extends true ? Value : PreviousValue): ModularComponent<Props, Ref, Methods, UpsertStage<Stages, {
|
|
35
|
+
stage: Symbol;
|
|
36
|
+
value: Value;
|
|
37
|
+
}, Index>>;
|
|
38
|
+
}
|
|
39
|
+
declare type ModularWithMethod<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple, Method extends keyof Methods, Symbol extends keyof ModularStages = Methods[Method]['symbol'], Indices extends StageIndices<Stages, Symbol> = StageIndices<Stages, Symbol>> = Indices['length'] extends 0 ? ModularWithMethodDefault<Props, Ref, Methods, Stages, Method> : ModularWithMethodIndices<Props, Ref, Methods, Stages, Method, Indices> & ModularWithMethodLast<Props, Ref, Methods, Stages, Method, Last<Indices>>;
|
|
40
|
+
export declare type ModularWithMethods<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple> = {
|
|
41
|
+
[Method in keyof Methods as `with${Method extends string ? Method : never}`]: ModularWithMethod<Props, Ref, Methods, Stages, Method>;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=with.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with.d.ts","sourceRoot":"","sources":["../../../src/types/methods/with.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EACL,WAAW,EACX,aAAa,EACb,YAAY,EACZ,UAAU,EACV,WAAW,EACZ,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE5D,UAAU,wBAAwB,CAChC,KAAK,SAAS,EAAE,EAChB,GAAG,EACH,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EAC5C,MA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EAAE,EAChB,GAAG,EACH,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EAC5C,MAAM,SAAS,UAAU,IACvB;KACD,MAAM,IAAI,MAAM,OAAO,IAAI,OAAO,MAAM,SAAS,MAAM,GACpD,MAAM,GACN,KAAK,EAAE,GAAG,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;CACrE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with.js","sourceRoot":"","sources":["../../../src/types/methods/with.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper types for handling method records
|
|
3
|
+
*/
|
|
4
|
+
import { ModularStages } from './stage';
|
|
5
|
+
export declare type MethodRecord = {
|
|
6
|
+
symbol: keyof ModularStages;
|
|
7
|
+
field: string;
|
|
8
|
+
transform?: (args: any, value: any) => any;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=methods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../src/types/methods.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,oBAAY,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,aAAa,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,CAAA;CAC3C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.js","sourceRoot":"","sources":["../../src/types/methods.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main ModularComponent type
|
|
3
|
+
*/
|
|
4
|
+
import { ForwardedRef, FunctionComponent, PropsWithChildren } from 'react';
|
|
5
|
+
import { StageTuple } from './stage';
|
|
6
|
+
import { MethodRecord } from './methods';
|
|
7
|
+
import { ModularWithMethods } from './methods/with';
|
|
8
|
+
import { ModularAddMethods } from './methods/add';
|
|
9
|
+
import { ModularAtMethods } from './methods/at';
|
|
10
|
+
import { ModularMockMethods } from './methods/mock';
|
|
11
|
+
import { ModularHookMethods } from './methods/hook';
|
|
12
|
+
export declare type ModularComponent<Props extends {}, Ref, Methods extends Record<string, MethodRecord>, Stages extends StageTuple> = ModularWithMethods<Props, Ref, Methods, Stages> & ModularAddMethods<Props, Ref, Methods, Stages> & ModularAtMethods<Props, Ref, Methods, Stages> & ModularMockMethods<Props, Ref, Methods, Stages> & ModularHookMethods<Props, Ref, Methods, Stages> & FunctionComponent<PropsWithChildren<Props & {
|
|
13
|
+
ref?: ForwardedRef<Ref>;
|
|
14
|
+
}>>;
|
|
15
|
+
//# sourceMappingURL=modular-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modular-component.d.ts","sourceRoot":"","sources":["../../src/types/modular-component.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAE1E,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAEnD,oBAAY,gBAAgB,CAC1B,KAAK,SAAS,EAAE,EAChB,GAAG,EACH,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EAC5C,MAAM,SAAS,UAAU,IACvB,kBAAkB,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,GACjD,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,GAC9C,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,GAC7C,kBAAkB,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,GAC/C,kBAAkB,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,GAC/C,iBAAiB,CAAC,iBAAiB,CAAC,KAAK,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modular-component.js","sourceRoot":"","sources":["../../src/types/modular-component.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|