@webiny/react-composition 5.41.4 → 5.42.0-beta.1
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 +51 -25
- package/Context.js.map +1 -1
- package/package.json +4 -9
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);
|
|
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"
|
|
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, decorators as Enumerable<ComposeWith>, scope);\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,CAACG,QAAQ,CAACI,QAAQ,EAAEM,UAAU,EAA6BZ,KAAK,CAAC;EAC5F,CAAC,EAAE,CAACJ,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): void;
|
|
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,31 +31,56 @@ function compose() {
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
var CompositionContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Scopes are ordered in reverse, to go from child to parent. As we iterate over scopes, we try to find the latest component
|
|
36
|
+
* recipe (a "recipe" is a base component + all decorators registered so far). If none exist, we return an empty recipe.
|
|
37
|
+
*/
|
|
38
|
+
var findComponentRecipe = function findComponentRecipe(component, lookupScopes, components) {
|
|
39
|
+
var _iterator = (0, _createForOfIteratorHelper2.default)(lookupScopes),
|
|
38
40
|
_step;
|
|
39
41
|
try {
|
|
40
42
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
var _scope = _step.value;
|
|
44
|
+
var scopeMap = components.get(_scope) || new Map();
|
|
45
|
+
var recipe = scopeMap.get(component);
|
|
46
|
+
if (recipe) {
|
|
47
|
+
return recipe;
|
|
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);
|
|
48
73
|
var newHocs = [].concat((0, _toConsumableArray2.default)(recipe.hocs || []), (0, _toConsumableArray2.default)(_hocs));
|
|
49
|
-
|
|
74
|
+
targetComponents.set(_component, {
|
|
50
75
|
component: compose.apply(void 0, (0, _toConsumableArray2.default)((0, _toConsumableArray2.default)(newHocs).reverse()))(_component),
|
|
51
76
|
hocs: newHocs
|
|
52
77
|
});
|
|
53
|
-
components.set(
|
|
78
|
+
components.set(targetScope, targetComponents);
|
|
54
79
|
}
|
|
55
80
|
} catch (err) {
|
|
56
|
-
|
|
81
|
+
_iterator2.e(err);
|
|
57
82
|
} finally {
|
|
58
|
-
|
|
83
|
+
_iterator2.f();
|
|
59
84
|
}
|
|
60
85
|
return components;
|
|
61
86
|
};
|
|
@@ -66,19 +91,20 @@ var CompositionProvider = exports.CompositionProvider = function CompositionProv
|
|
|
66
91
|
var _useState = (0, _react.useState)(function () {
|
|
67
92
|
return composeComponents(new Map(), decorators.map(function (tuple) {
|
|
68
93
|
return [tuple[0].original, tuple[1]];
|
|
69
|
-
}));
|
|
94
|
+
}), ["*"]);
|
|
70
95
|
}),
|
|
71
96
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
72
97
|
components = _useState2[0],
|
|
73
98
|
setComponents = _useState2[1];
|
|
74
99
|
var composeComponent = (0, _react.useCallback)(function (component, hocs) {
|
|
75
|
-
var
|
|
100
|
+
var scopes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
76
101
|
setComponents(function (prevComponents) {
|
|
77
|
-
return composeComponents(new Map(prevComponents), [[component, hocs]],
|
|
102
|
+
return composeComponents(new Map(prevComponents), [[component, hocs]], ["*"].concat((0, _toConsumableArray2.default)(scopes)));
|
|
78
103
|
});
|
|
79
104
|
|
|
80
105
|
// Return a function that will remove the added HOCs.
|
|
81
106
|
return function () {
|
|
107
|
+
var scope = scopes[scopes.length - 1];
|
|
82
108
|
setComponents(function (prevComponents) {
|
|
83
109
|
var components = new Map(prevComponents);
|
|
84
110
|
var scopeMap = components.get(scope) || new Map();
|
|
@@ -102,21 +128,21 @@ var CompositionProvider = exports.CompositionProvider = function CompositionProv
|
|
|
102
128
|
var getComponent = (0, _react.useCallback)(function (Component) {
|
|
103
129
|
var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
104
130
|
var scopesToResolve = ["*"].concat((0, _toConsumableArray2.default)(scope)).reverse();
|
|
105
|
-
var
|
|
106
|
-
|
|
131
|
+
var _iterator3 = (0, _createForOfIteratorHelper2.default)(scopesToResolve),
|
|
132
|
+
_step3;
|
|
107
133
|
try {
|
|
108
|
-
for (
|
|
109
|
-
var
|
|
110
|
-
var scopeMap = components.get(
|
|
134
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
135
|
+
var _scope2 = _step3.value;
|
|
136
|
+
var scopeMap = components.get(_scope2) || new Map();
|
|
111
137
|
var composedComponent = scopeMap.get(Component);
|
|
112
138
|
if (composedComponent) {
|
|
113
139
|
return composedComponent.component;
|
|
114
140
|
}
|
|
115
141
|
}
|
|
116
142
|
} catch (err) {
|
|
117
|
-
|
|
143
|
+
_iterator3.e(err);
|
|
118
144
|
} finally {
|
|
119
|
-
|
|
145
|
+
_iterator3.f();
|
|
120
146
|
}
|
|
121
147
|
return undefined;
|
|
122
148
|
}, [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","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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,CAAC;EAEnC,IAAI,CAACP,OAAO,EAAE;IACV,OAAOK,YAAY;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":[]}
|
|
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,gBAAG,IAAAC,oBAAa,EAAiCC,SAAS,CAAC;AAUnF;AACA;AACA;AACA;AACA,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CACrBC,SAAyC,EACzCC,YAAsB,EACtBC,UAA2B,EAC1B;EAAA,IAAAC,SAAA,OAAAC,2BAAA,CAA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AAAzC,CAAA,CAAAD,GAAA;IAAA;MAAA0C,UAAA,CAAAxC,CAAA;IAAA;IAED,OAAOpB,SAAS;EACpB,CAAC,EACD,CAACI,UAAU,CACf,CAAC;EAED,IAAM2D,OAA2B,GAAG,IAAAC,cAAO,EACvC;IAAA,OAAO;MACHP,YAAY,EAAZA,YAAY;MACZR,gBAAgB,EAAhBA,gBAAgB;MAChB7C,UAAU,EAAVA;IACJ,CAAC;EAAA,CAAC,EACF,CAACA,UAAU,EAAE6C,gBAAgB,CACjC,CAAC;EAED,oBAAOjE,MAAA,CAAAuB,OAAA,CAAA0D,aAAA,CAACnE,kBAAkB,CAACoE,QAAQ;IAACrD,KAAK,EAAEkD;EAAQ,GAAEtB,QAAsC,CAAC;AAChG,CAAC;AAEM,SAAS0B,YAAYA,CAAIC,YAAe,EAAE;EAC7C,IAAML,OAAO,GAAGM,sBAAsB,CAAC,CAAC;EACxC,IAAMzD,KAAK,GAAG,IAAA0D,qCAAmB,EAAC,CAAC;EAEnC,IAAI,CAACP,OAAO,EAAE;IACV,OAAOK,YAAY;EACvB;EAEA,OAAQL,OAAO,CAACN,YAAY,CAACW,YAAY,EAASxD,KAAK,CAAC,IAAIwD,YAAY;AAC5E;;AAEA;AACA;AACA;AACO,SAASG,cAAcA,CAAA,EAAG;EAC7B,IAAMR,OAAO,GAAG,IAAAS,iBAAU,EAAC1E,kBAAkB,CAAC;EAC9C,IAAI,CAACiE,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,EAAC1E,kBAAkB,CAAC;AACzC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/react-composition",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.42.0-beta.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,19 +14,14 @@
|
|
|
14
14
|
],
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@babel/runtime": "7.24.1",
|
|
18
17
|
"@types/react": "18.2.79",
|
|
19
18
|
"react": "18.2.0",
|
|
20
19
|
"react-dom": "18.2.0"
|
|
21
20
|
},
|
|
22
21
|
"devDependencies": {
|
|
23
|
-
"@babel/cli": "7.24.1",
|
|
24
|
-
"@babel/core": "7.24.3",
|
|
25
|
-
"@babel/preset-env": "7.24.3",
|
|
26
|
-
"@babel/preset-typescript": "7.24.1",
|
|
27
22
|
"@testing-library/react": "15.0.7",
|
|
28
|
-
"@webiny/cli": "5.
|
|
29
|
-
"@webiny/project-utils": "5.
|
|
23
|
+
"@webiny/cli": "5.42.0-beta.1",
|
|
24
|
+
"@webiny/project-utils": "5.42.0-beta.1",
|
|
30
25
|
"ttypescript": "1.5.15",
|
|
31
26
|
"typescript": "4.9.5"
|
|
32
27
|
},
|
|
@@ -38,5 +33,5 @@
|
|
|
38
33
|
"build": "yarn webiny run build",
|
|
39
34
|
"watch": "yarn webiny run watch"
|
|
40
35
|
},
|
|
41
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "5e69da579efa4f2c8268e0c97ac6407ddc3f5f07"
|
|
42
37
|
}
|