@webiny/react-composition 5.42.0 → 5.42.1-beta.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/Compose.js +1 -1
- package/Compose.js.map +1 -1
- package/Context.d.ts +1 -1
- package/Context.js +25 -51
- package/Context.js.map +1 -1
- package/package.json +4 -4
package/Compose.js
CHANGED
|
@@ -18,7 +18,7 @@ var Compose = exports.Compose = function Compose(props) {
|
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
var decorators = Array.isArray(props.with) ? props.with : [props.with];
|
|
21
|
-
return composeComponent(targetFn.original, decorators, scope);
|
|
21
|
+
return composeComponent(targetFn.original, decorators, scope[scope.length - 1]);
|
|
22
22
|
}, [props.with]);
|
|
23
23
|
return null;
|
|
24
24
|
};
|
package/Compose.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_Context","_CompositionScope","Compose","exports","props","_useComposition","useComposition","composeComponent","scope","useCompositionScope","targetFn","function","component","useEffect","original","console","warn","concat","originalName","name","decorators","Array","isArray","with"],"sources":["Compose.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { DecoratableTypes, useComposition } from \"./Context\";\nimport { useCompositionScope } from \"~/CompositionScope\";\nimport { ComposeWith, Decoratable, Enumerable } from \"./types\";\n\nexport interface ComposeProps {\n function?: DecoratableTypes;\n component?: DecoratableTypes;\n with: ComposeWith;\n}\n\nexport const Compose = (props: ComposeProps) => {\n const { composeComponent } = useComposition();\n const scope = useCompositionScope();\n\n const targetFn = (props.function ?? props.component) as Decoratable;\n\n useEffect(() => {\n if (typeof targetFn.original === \"undefined\") {\n console.warn(\n `You must make your function \"${\n targetFn.originalName ?? targetFn.name\n }\" composable, by using the makeDecoratable() function!`\n );\n\n return;\n }\n\n const decorators = Array.isArray(props.with) ? props.with : [props.with];\n return composeComponent(targetFn.original
|
|
1
|
+
{"version":3,"names":["_react","require","_Context","_CompositionScope","Compose","exports","props","_useComposition","useComposition","composeComponent","scope","useCompositionScope","targetFn","function","component","useEffect","original","console","warn","concat","originalName","name","decorators","Array","isArray","with","length"],"sources":["Compose.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { DecoratableTypes, useComposition } from \"./Context\";\nimport { useCompositionScope } from \"~/CompositionScope\";\nimport { ComposeWith, Decoratable, Enumerable } from \"./types\";\n\nexport interface ComposeProps {\n function?: DecoratableTypes;\n component?: DecoratableTypes;\n with: ComposeWith;\n}\n\nexport const Compose = (props: ComposeProps) => {\n const { composeComponent } = useComposition();\n const scope = useCompositionScope();\n\n const targetFn = (props.function ?? props.component) as Decoratable;\n\n useEffect(() => {\n if (typeof targetFn.original === \"undefined\") {\n console.warn(\n `You must make your function \"${\n targetFn.originalName ?? targetFn.name\n }\" composable, by using the makeDecoratable() function!`\n );\n\n return;\n }\n\n const decorators = Array.isArray(props.with) ? props.with : [props.with];\n return composeComponent(\n targetFn.original,\n decorators as Enumerable<ComposeWith>,\n scope[scope.length - 1]\n );\n }, [props.with]);\n\n return null;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AASO,IAAMG,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,SAAVA,OAAOA,CAAIE,KAAmB,EAAK;EAC5C,IAAAC,eAAA,GAA6B,IAAAC,uBAAc,EAAC,CAAC;IAArCC,gBAAgB,GAAAF,eAAA,CAAhBE,gBAAgB;EACxB,IAAMC,KAAK,GAAG,IAAAC,qCAAmB,EAAC,CAAC;EAEnC,IAAMC,QAAQ,GAAIN,KAAK,CAACO,QAAQ,IAAIP,KAAK,CAACQ,SAAyB;EAEnE,IAAAC,gBAAS,EAAC,YAAM;IACZ,IAAI,OAAOH,QAAQ,CAACI,QAAQ,KAAK,WAAW,EAAE;MAC1CC,OAAO,CAACC,IAAI,kCAAAC,MAAA,CAEJP,QAAQ,CAACQ,YAAY,IAAIR,QAAQ,CAACS,IAAI,4DAE9C,CAAC;MAED;IACJ;IAEA,IAAMC,UAAU,GAAGC,KAAK,CAACC,OAAO,CAAClB,KAAK,CAACmB,IAAI,CAAC,GAAGnB,KAAK,CAACmB,IAAI,GAAG,CAACnB,KAAK,CAACmB,IAAI,CAAC;IACxE,OAAOhB,gBAAgB,CACnBG,QAAQ,CAACI,QAAQ,EACjBM,UAAU,EACVZ,KAAK,CAACA,KAAK,CAACgB,MAAM,GAAG,CAAC,CAC1B,CAAC;EACL,CAAC,EAAE,CAACpB,KAAK,CAACmB,IAAI,CAAC,CAAC;EAEhB,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
|
package/Context.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ interface CompositionContextGetComponentCallable {
|
|
|
30
30
|
interface CompositionContext {
|
|
31
31
|
components: ComponentScopes;
|
|
32
32
|
getComponent: CompositionContextGetComponentCallable;
|
|
33
|
-
composeComponent(component: ComponentType<unknown>, hocs: Enumerable<ComposeWith>, scope?: string
|
|
33
|
+
composeComponent(component: ComponentType<unknown>, hocs: Enumerable<ComposeWith>, scope?: string): void;
|
|
34
34
|
}
|
|
35
35
|
declare const CompositionContext: React.Context<CompositionContext | undefined>;
|
|
36
36
|
export type DecoratorsTuple = [Decoratable, Decorator<any>[]];
|
package/Context.js
CHANGED
|
@@ -31,56 +31,31 @@ function compose() {
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
var CompositionContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var findComponentRecipe = function findComponentRecipe(component, lookupScopes, components) {
|
|
39
|
-
var _iterator = (0, _createForOfIteratorHelper2.default)(lookupScopes),
|
|
34
|
+
var composeComponents = function composeComponents(components, decorators) {
|
|
35
|
+
var scope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "*";
|
|
36
|
+
var scopeMap = components.get(scope) || new Map();
|
|
37
|
+
var _iterator = (0, _createForOfIteratorHelper2.default)(decorators),
|
|
40
38
|
_step;
|
|
41
39
|
try {
|
|
42
40
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} catch (err) {
|
|
51
|
-
_iterator.e(err);
|
|
52
|
-
} finally {
|
|
53
|
-
_iterator.f();
|
|
54
|
-
}
|
|
55
|
-
return {
|
|
56
|
-
component: null,
|
|
57
|
-
hocs: []
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
var composeComponents = function composeComponents(components, decorators) {
|
|
61
|
-
var scopes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
62
|
-
var targetScope = scopes[scopes.length - 1];
|
|
63
|
-
var targetComponents = components.get(targetScope) || new Map();
|
|
64
|
-
var lookupScopes = scopes.reverse();
|
|
65
|
-
var _iterator2 = (0, _createForOfIteratorHelper2.default)(decorators),
|
|
66
|
-
_step2;
|
|
67
|
-
try {
|
|
68
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
69
|
-
var _step2$value = (0, _slicedToArray2.default)(_step2.value, 2),
|
|
70
|
-
_component = _step2$value[0],
|
|
71
|
-
_hocs = _step2$value[1];
|
|
72
|
-
var recipe = findComponentRecipe(_component, lookupScopes, components);
|
|
41
|
+
var _step$value = (0, _slicedToArray2.default)(_step.value, 2),
|
|
42
|
+
_component = _step$value[0],
|
|
43
|
+
_hocs = _step$value[1];
|
|
44
|
+
var recipe = scopeMap.get(_component) || {
|
|
45
|
+
component: null,
|
|
46
|
+
hocs: []
|
|
47
|
+
};
|
|
73
48
|
var newHocs = [].concat((0, _toConsumableArray2.default)(recipe.hocs || []), (0, _toConsumableArray2.default)(_hocs));
|
|
74
|
-
|
|
49
|
+
scopeMap.set(_component, {
|
|
75
50
|
component: compose.apply(void 0, (0, _toConsumableArray2.default)((0, _toConsumableArray2.default)(newHocs).reverse()))(_component),
|
|
76
51
|
hocs: newHocs
|
|
77
52
|
});
|
|
78
|
-
components.set(
|
|
53
|
+
components.set(scope, scopeMap);
|
|
79
54
|
}
|
|
80
55
|
} catch (err) {
|
|
81
|
-
|
|
56
|
+
_iterator.e(err);
|
|
82
57
|
} finally {
|
|
83
|
-
|
|
58
|
+
_iterator.f();
|
|
84
59
|
}
|
|
85
60
|
return components;
|
|
86
61
|
};
|
|
@@ -91,20 +66,19 @@ var CompositionProvider = exports.CompositionProvider = function CompositionProv
|
|
|
91
66
|
var _useState = (0, _react.useState)(function () {
|
|
92
67
|
return composeComponents(new Map(), decorators.map(function (tuple) {
|
|
93
68
|
return [tuple[0].original, tuple[1]];
|
|
94
|
-
})
|
|
69
|
+
}));
|
|
95
70
|
}),
|
|
96
71
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
97
72
|
components = _useState2[0],
|
|
98
73
|
setComponents = _useState2[1];
|
|
99
74
|
var composeComponent = (0, _react.useCallback)(function (component, hocs) {
|
|
100
|
-
var
|
|
75
|
+
var scope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "*";
|
|
101
76
|
setComponents(function (prevComponents) {
|
|
102
|
-
return composeComponents(new Map(prevComponents), [[component, hocs]],
|
|
77
|
+
return composeComponents(new Map(prevComponents), [[component, hocs]], scope);
|
|
103
78
|
});
|
|
104
79
|
|
|
105
80
|
// Return a function that will remove the added HOCs.
|
|
106
81
|
return function () {
|
|
107
|
-
var scope = scopes[scopes.length - 1];
|
|
108
82
|
setComponents(function (prevComponents) {
|
|
109
83
|
var components = new Map(prevComponents);
|
|
110
84
|
var scopeMap = components.get(scope) || new Map();
|
|
@@ -128,21 +102,21 @@ var CompositionProvider = exports.CompositionProvider = function CompositionProv
|
|
|
128
102
|
var getComponent = (0, _react.useCallback)(function (Component) {
|
|
129
103
|
var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
130
104
|
var scopesToResolve = ["*"].concat((0, _toConsumableArray2.default)(scope)).reverse();
|
|
131
|
-
var
|
|
132
|
-
|
|
105
|
+
var _iterator2 = (0, _createForOfIteratorHelper2.default)(scopesToResolve),
|
|
106
|
+
_step2;
|
|
133
107
|
try {
|
|
134
|
-
for (
|
|
135
|
-
var
|
|
136
|
-
var scopeMap = components.get(
|
|
108
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
109
|
+
var _scope = _step2.value;
|
|
110
|
+
var scopeMap = components.get(_scope) || new Map();
|
|
137
111
|
var composedComponent = scopeMap.get(Component);
|
|
138
112
|
if (composedComponent) {
|
|
139
113
|
return composedComponent.component;
|
|
140
114
|
}
|
|
141
115
|
}
|
|
142
116
|
} catch (err) {
|
|
143
|
-
|
|
117
|
+
_iterator2.e(err);
|
|
144
118
|
} finally {
|
|
145
|
-
|
|
119
|
+
_iterator2.f();
|
|
146
120
|
}
|
|
147
121
|
return undefined;
|
|
148
122
|
}, [components]);
|
package/Context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_CompositionScope","compose","_len","arguments","length","fns","Array","_key","decoratee","reduceRight","decorator","CompositionContext","createContext","undefined","findComponentRecipe","component","lookupScopes","components","_iterator","_createForOfIteratorHelper2","default","_step","s","n","done","scope","value","scopeMap","get","Map","recipe","err","e","f","hocs","composeComponents","decorators","scopes","targetScope","targetComponents","reverse","_iterator2","_step2","_step2$value","_slicedToArray2","newHocs","concat","_toConsumableArray2","set","apply","CompositionProvider","exports","_ref","_ref$decorators","children","_useState","useState","map","tuple","original","_useState2","setComponents","composeComponent","useCallback","prevComponents","newHOCs","filter","hoc","includes","NewComponent","getComponent","Component","scopesToResolve","_iterator3","_step3","composedComponent","context","useMemo","createElement","Provider","useComponent","baseFunction","useOptionalComposition","useCompositionScope","useComposition","useContext","Error"],"sources":["Context.tsx"],"sourcesContent":["import React, {\n ComponentType,\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState\n} from \"react\";\nimport { useCompositionScope } from \"~/CompositionScope\";\nimport {\n ComposedFunction,\n ComposeWith,\n Decoratable,\n DecoratableComponent,\n DecoratableHook,\n Decorator,\n Enumerable,\n GenericComponent,\n GenericHook\n} from \"~/types\";\n\nexport function compose<T>(...fns: Decorator<T>[]) {\n return (decoratee: T): T => {\n return fns.reduceRight((decoratee, decorator) => decorator(decoratee), decoratee) as T;\n };\n}\n\ninterface ComposedComponent {\n /**\n * Ready to use React component.\n */\n component: GenericHook | GenericComponent;\n /**\n * HOCs used to compose the original component.\n */\n hocs: Decorator<GenericComponent | GenericHook>[];\n /**\n * Component composition can be scoped.\n */\n scope?: string;\n}\n\n/**\n * @deprecated Use `Decorator` instead.\n */\nexport interface HigherOrderComponent<TProps = any, TOutput = TProps> {\n (Component: GenericComponent<TProps>): GenericComponent<TOutput>;\n}\n\ntype ComposedComponents = Map<ComponentType<unknown>, ComposedComponent>;\ntype ComponentScopes = Map<string, ComposedComponents>;\n\nexport type DecoratableTypes = DecoratableComponent | DecoratableHook;\n\ninterface CompositionContextGetComponentCallable {\n (component: ComponentType<unknown>, scope: string[]):\n | ComposedFunction\n | GenericComponent\n | undefined;\n}\n\ninterface CompositionContext {\n components: ComponentScopes;\n getComponent: CompositionContextGetComponentCallable;\n composeComponent(\n component: ComponentType<unknown>,\n hocs: Enumerable<ComposeWith>,\n scope?: string[]\n ): void;\n}\n\nconst CompositionContext = createContext<CompositionContext | undefined>(undefined);\n\nexport type DecoratorsTuple = [Decoratable, Decorator<any>[]];\nexport type DecoratorsCollection = Array<DecoratorsTuple>;\n\ninterface CompositionProviderProps {\n decorators?: DecoratorsCollection;\n children: React.ReactNode;\n}\n\n/**\n * Scopes are ordered in reverse, to go from child to parent. As we iterate over scopes, we try to find the latest component\n * recipe (a \"recipe\" is a base component + all decorators registered so far). If none exist, we return an empty recipe.\n */\nconst findComponentRecipe = (\n component: GenericComponent | GenericHook,\n lookupScopes: string[],\n components: ComponentScopes\n) => {\n for (const scope of lookupScopes) {\n const scopeMap: ComposedComponents = components.get(scope) || new Map();\n const recipe = scopeMap.get(component);\n if (recipe) {\n return recipe;\n }\n }\n\n return { component: null, hocs: [] };\n};\n\nconst composeComponents = (\n components: ComponentScopes,\n decorators: Array<[GenericComponent | GenericHook, Decorator<any>[]]>,\n scopes: string[] = []\n) => {\n const targetScope = scopes[scopes.length - 1];\n const targetComponents = components.get(targetScope) || new Map();\n const lookupScopes = scopes.reverse();\n\n for (const [component, hocs] of decorators) {\n const recipe = findComponentRecipe(component, lookupScopes, components);\n\n const newHocs = [...(recipe.hocs || []), ...hocs] as Decorator<\n GenericHook | GenericComponent\n >[];\n\n targetComponents.set(component, {\n component: compose(...[...newHocs].reverse())(component),\n hocs: newHocs\n });\n\n components.set(targetScope, targetComponents);\n }\n\n return components;\n};\n\nexport const CompositionProvider = ({ decorators = [], children }: CompositionProviderProps) => {\n const [components, setComponents] = useState<ComponentScopes>(() => {\n return composeComponents(\n new Map(),\n decorators.map(tuple => {\n return [tuple[0].original, tuple[1]];\n }),\n [\"*\"]\n );\n });\n\n const composeComponent = useCallback(\n (\n component: GenericComponent | GenericHook,\n hocs: HigherOrderComponent<any, any>[],\n scopes: string[] = []\n ) => {\n setComponents(prevComponents => {\n return composeComponents(\n new Map(prevComponents),\n [[component, hocs]],\n [\"*\", ...scopes]\n );\n });\n\n // Return a function that will remove the added HOCs.\n return () => {\n const scope = scopes[scopes.length - 1];\n setComponents(prevComponents => {\n const components = new Map(prevComponents);\n const scopeMap: ComposedComponents = components.get(scope) || new Map();\n const recipe = scopeMap.get(component) || {\n component: null,\n hocs: []\n };\n\n const newHOCs = [...recipe.hocs].filter(hoc => !hocs.includes(hoc));\n const NewComponent = compose(...[...newHOCs].reverse())(component);\n\n scopeMap.set(component, {\n component: NewComponent,\n hocs: newHOCs\n });\n\n components.set(scope, scopeMap);\n return components;\n });\n };\n },\n [setComponents]\n );\n\n const getComponent = useCallback<CompositionContextGetComponentCallable>(\n (Component, scope = []) => {\n const scopesToResolve = [\"*\", ...scope].reverse();\n for (const scope of scopesToResolve) {\n const scopeMap: ComposedComponents = components.get(scope) || new Map();\n const composedComponent = scopeMap.get(Component);\n if (composedComponent) {\n return composedComponent.component;\n }\n }\n\n return undefined;\n },\n [components]\n );\n\n const context: CompositionContext = useMemo(\n () => ({\n getComponent,\n composeComponent,\n components\n }),\n [components, composeComponent]\n );\n\n return <CompositionContext.Provider value={context}>{children}</CompositionContext.Provider>;\n};\n\nexport function useComponent<T>(baseFunction: T) {\n const context = useOptionalComposition();\n const scope = useCompositionScope();\n\n if (!context) {\n return baseFunction;\n }\n\n return (context.getComponent(baseFunction as any, scope) || baseFunction) as T;\n}\n\n/**\n * This hook will throw an error if composition context doesn't exist.\n */\nexport function useComposition() {\n const context = useContext(CompositionContext);\n if (!context) {\n throw new Error(\n `You're missing a <CompositionProvider> higher up in your component hierarchy!`\n );\n }\n\n return context;\n}\n\n/**\n * This hook will not throw an error if composition context doesn't exist.\n */\nexport function useOptionalComposition() {\n return useContext(CompositionContext);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAQA,IAAAC,iBAAA,GAAAD,OAAA;AAaO,SAASE,OAAOA,CAAA,EAA4B;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAArBC,GAAG,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAHF,GAAG,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAC7B,OAAO,UAACC,SAAY,EAAQ;IACxB,OAAOH,GAAG,CAACI,WAAW,CAAC,UAACD,SAAS,EAAEE,SAAS;MAAA,OAAKA,SAAS,CAACF,SAAS,CAAC;IAAA,GAAEA,SAAS,CAAC;EACrF,CAAC;AACL;;AAiBA;AACA;AACA;;AA2BA,IAAMG,kBAAkB,gBA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AU,EAAC1E,kBAAkB,CAAC;AACzC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_CompositionScope","compose","_len","arguments","length","fns","Array","_key","decoratee","reduceRight","decorator","CompositionContext","createContext","undefined","composeComponents","components","decorators","scope","scopeMap","get","Map","_iterator","_createForOfIteratorHelper2","default","_step","s","n","done","_step$value","_slicedToArray2","value","component","hocs","recipe","newHocs","concat","_toConsumableArray2","set","apply","reverse","err","e","f","CompositionProvider","exports","_ref","_ref$decorators","children","_useState","useState","map","tuple","original","_useState2","setComponents","composeComponent","useCallback","prevComponents","newHOCs","filter","hoc","includes","NewComponent","getComponent","Component","scopesToResolve","_iterator2","_step2","composedComponent","context","useMemo","createElement","Provider","useComponent","baseFunction","useOptionalComposition","useCompositionScope","useComposition","useContext","Error"],"sources":["Context.tsx"],"sourcesContent":["import React, {\n ComponentType,\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState\n} from \"react\";\nimport { useCompositionScope } from \"~/CompositionScope\";\nimport {\n ComposedFunction,\n ComposeWith,\n Decoratable,\n DecoratableComponent,\n DecoratableHook,\n Decorator,\n Enumerable,\n GenericComponent,\n GenericHook\n} from \"~/types\";\n\nexport function compose<T>(...fns: Decorator<T>[]) {\n return (decoratee: T): T => {\n return fns.reduceRight((decoratee, decorator) => decorator(decoratee), decoratee) as T;\n };\n}\n\ninterface ComposedComponent {\n /**\n * Ready to use React component.\n */\n component: GenericHook | GenericComponent;\n /**\n * HOCs used to compose the original component.\n */\n hocs: Decorator<GenericComponent | GenericHook>[];\n /**\n * Component composition can be scoped.\n */\n scope?: string;\n}\n\n/**\n * @deprecated Use `Decorator` instead.\n */\nexport interface HigherOrderComponent<TProps = any, TOutput = TProps> {\n (Component: GenericComponent<TProps>): GenericComponent<TOutput>;\n}\n\ntype ComposedComponents = Map<ComponentType<unknown>, ComposedComponent>;\ntype ComponentScopes = Map<string, ComposedComponents>;\n\nexport type DecoratableTypes = DecoratableComponent | DecoratableHook;\n\ninterface CompositionContextGetComponentCallable {\n (component: ComponentType<unknown>, scope: string[]):\n | ComposedFunction\n | GenericComponent\n | undefined;\n}\n\ninterface CompositionContext {\n components: ComponentScopes;\n getComponent: CompositionContextGetComponentCallable;\n composeComponent(\n component: ComponentType<unknown>,\n hocs: Enumerable<ComposeWith>,\n scope?: string\n ): void;\n}\n\nconst CompositionContext = createContext<CompositionContext | undefined>(undefined);\n\nexport type DecoratorsTuple = [Decoratable, Decorator<any>[]];\nexport type DecoratorsCollection = Array<DecoratorsTuple>;\n\ninterface CompositionProviderProps {\n decorators?: DecoratorsCollection;\n children: React.ReactNode;\n}\n\nconst composeComponents = (\n components: ComponentScopes,\n decorators: Array<[GenericComponent | GenericHook, Decorator<any>[]]>,\n scope = \"*\"\n) => {\n const scopeMap: ComposedComponents = components.get(scope) || new Map();\n for (const [component, hocs] of decorators) {\n const recipe = scopeMap.get(component) || { component: null, hocs: [] };\n\n const newHocs = [...(recipe.hocs || []), ...hocs] as Decorator<\n GenericHook | GenericComponent\n >[];\n\n scopeMap.set(component, {\n component: compose(...[...newHocs].reverse())(component),\n hocs: newHocs\n });\n\n components.set(scope, scopeMap);\n }\n\n return components;\n};\n\nexport const CompositionProvider = ({ decorators = [], children }: CompositionProviderProps) => {\n const [components, setComponents] = useState<ComponentScopes>(() => {\n return composeComponents(\n new Map(),\n decorators.map(tuple => {\n return [tuple[0].original, tuple[1]];\n })\n );\n });\n\n const composeComponent = useCallback(\n (\n component: GenericComponent | GenericHook,\n hocs: HigherOrderComponent<any, any>[],\n scope: string | undefined = \"*\"\n ) => {\n setComponents(prevComponents => {\n return composeComponents(new Map(prevComponents), [[component, hocs]], scope);\n });\n\n // Return a function that will remove the added HOCs.\n return () => {\n setComponents(prevComponents => {\n const components = new Map(prevComponents);\n const scopeMap: ComposedComponents = components.get(scope) || new Map();\n const recipe = scopeMap.get(component) || {\n component: null,\n hocs: []\n };\n\n const newHOCs = [...recipe.hocs].filter(hoc => !hocs.includes(hoc));\n const NewComponent = compose(...[...newHOCs].reverse())(component);\n\n scopeMap.set(component, {\n component: NewComponent,\n hocs: newHOCs\n });\n\n components.set(scope, scopeMap);\n return components;\n });\n };\n },\n [setComponents]\n );\n\n const getComponent = useCallback<CompositionContextGetComponentCallable>(\n (Component, scope = []) => {\n const scopesToResolve = [\"*\", ...scope].reverse();\n for (const scope of scopesToResolve) {\n const scopeMap: ComposedComponents = components.get(scope) || new Map();\n const composedComponent = scopeMap.get(Component);\n if (composedComponent) {\n return composedComponent.component;\n }\n }\n\n return undefined;\n },\n [components]\n );\n\n const context: CompositionContext = useMemo(\n () => ({\n getComponent,\n composeComponent,\n components\n }),\n [components, composeComponent]\n );\n\n return <CompositionContext.Provider value={context}>{children}</CompositionContext.Provider>;\n};\n\nexport function useComponent<T>(baseFunction: T) {\n const context = useOptionalComposition();\n const scope = useCompositionScope();\n\n if (!context) {\n return baseFunction;\n }\n\n return (context.getComponent(baseFunction as any, scope) || baseFunction) as T;\n}\n\n/**\n * This hook will throw an error if composition context doesn't exist.\n */\nexport function useComposition() {\n const context = useContext(CompositionContext);\n if (!context) {\n throw new Error(\n `You're missing a <CompositionProvider> higher up in your component hierarchy!`\n );\n }\n\n return context;\n}\n\n/**\n * This hook will not throw an error if composition context doesn't exist.\n */\nexport function useOptionalComposition() {\n return useContext(CompositionContext);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAQA,IAAAC,iBAAA,GAAAD,OAAA;AAaO,SAASE,OAAOA,CAAA,EAA4B;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAArBC,GAAG,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAHF,GAAG,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAC7B,OAAO,UAACC,SAAY,EAAQ;IACxB,OAAOH,GAAG,CAACI,WAAW,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AAY;EACvB;EAEA,OAAQL,OAAO,CAACN,YAAY,CAACW,YAAY,EAASzD,KAAK,CAAC,IAAIyD,YAAY;AAC5E;;AAEA;AACA;AACA;AACO,SAASG,cAAcA,CAAA,EAAG;EAC7B,IAAMR,OAAO,GAAG,IAAAS,iBAAU,EAACnE,kBAAkB,CAAC;EAC9C,IAAI,CAAC0D,OAAO,EAAE;IACV,MAAM,IAAIU,KAAK,gFAEf,CAAC;EACL;EAEA,OAAOV,OAAO;AAClB;;AAEA;AACA;AACA;AACO,SAASM,sBAAsBA,CAAA,EAAG;EACrC,OAAO,IAAAG,iBAAU,EAACnE,kBAAkB,CAAC;AACzC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/react-composition",
|
|
3
|
-
"version": "5.42.0",
|
|
3
|
+
"version": "5.42.1-beta.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@testing-library/react": "15.0.7",
|
|
23
|
-
"@webiny/cli": "5.42.0",
|
|
24
|
-
"@webiny/project-utils": "5.42.0",
|
|
23
|
+
"@webiny/cli": "5.42.1-beta.0",
|
|
24
|
+
"@webiny/project-utils": "5.42.1-beta.0",
|
|
25
25
|
"ttypescript": "1.5.15",
|
|
26
26
|
"typescript": "4.9.5"
|
|
27
27
|
},
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"build": "yarn webiny run build",
|
|
34
34
|
"watch": "yarn webiny run watch"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "16fb9009f44f242bbc8ba0e02c1d49b1f7ab935b"
|
|
37
37
|
}
|