@webiny/react-composition 5.41.5-beta.1 → 5.41.5-beta.3
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 +28 -50
- 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,32 +31,9 @@ function compose() {
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
var CompositionContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
34
|
-
var getCacheKey = function getCacheKey(scopes) {
|
|
35
|
-
return scopes.join(";");
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Scopes are ordered in reverse, to go from child to parent. As we iterate over scopes, we try to find the latest component
|
|
40
|
-
* recipe (a "recipe" is a base component + all decorators registered so far). If none exist, we return an empty recipe.
|
|
41
|
-
*/
|
|
42
|
-
var findComponentRecipe = function findComponentRecipe(component, lookupScopes, components) {
|
|
43
|
-
for (var i = lookupScopes.length; i > 0; i--) {
|
|
44
|
-
var cacheKey = getCacheKey(lookupScopes.slice(0, i));
|
|
45
|
-
var scopeMap = components.get(cacheKey) || new Map();
|
|
46
|
-
var recipe = scopeMap.get(component);
|
|
47
|
-
if (recipe) {
|
|
48
|
-
return recipe;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
component: null,
|
|
53
|
-
hocs: []
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
34
|
var composeComponents = function composeComponents(components, decorators) {
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
var targetComponents = components.get(cacheKey) || new Map();
|
|
35
|
+
var scope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "*";
|
|
36
|
+
var scopeMap = components.get(scope) || new Map();
|
|
60
37
|
var _iterator = (0, _createForOfIteratorHelper2.default)(decorators),
|
|
61
38
|
_step;
|
|
62
39
|
try {
|
|
@@ -64,13 +41,16 @@ var composeComponents = function composeComponents(components, decorators) {
|
|
|
64
41
|
var _step$value = (0, _slicedToArray2.default)(_step.value, 2),
|
|
65
42
|
_component = _step$value[0],
|
|
66
43
|
_hocs = _step$value[1];
|
|
67
|
-
var recipe =
|
|
44
|
+
var recipe = scopeMap.get(_component) || {
|
|
45
|
+
component: null,
|
|
46
|
+
hocs: []
|
|
47
|
+
};
|
|
68
48
|
var newHocs = [].concat((0, _toConsumableArray2.default)(recipe.hocs || []), (0, _toConsumableArray2.default)(_hocs));
|
|
69
|
-
|
|
49
|
+
scopeMap.set(_component, {
|
|
70
50
|
component: compose.apply(void 0, (0, _toConsumableArray2.default)((0, _toConsumableArray2.default)(newHocs).reverse()))(_component),
|
|
71
51
|
hocs: newHocs
|
|
72
52
|
});
|
|
73
|
-
components.set(
|
|
53
|
+
components.set(scope, scopeMap);
|
|
74
54
|
}
|
|
75
55
|
} catch (err) {
|
|
76
56
|
_iterator.e(err);
|
|
@@ -86,24 +66,22 @@ var CompositionProvider = exports.CompositionProvider = function CompositionProv
|
|
|
86
66
|
var _useState = (0, _react.useState)(function () {
|
|
87
67
|
return composeComponents(new Map(), decorators.map(function (tuple) {
|
|
88
68
|
return [tuple[0].original, tuple[1]];
|
|
89
|
-
})
|
|
69
|
+
}));
|
|
90
70
|
}),
|
|
91
71
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
92
72
|
components = _useState2[0],
|
|
93
73
|
setComponents = _useState2[1];
|
|
94
74
|
var composeComponent = (0, _react.useCallback)(function (component, hocs) {
|
|
95
|
-
var
|
|
96
|
-
var allScopes = ["*"].concat((0, _toConsumableArray2.default)(scopes));
|
|
75
|
+
var scope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "*";
|
|
97
76
|
setComponents(function (prevComponents) {
|
|
98
|
-
return composeComponents(new Map(prevComponents), [[component, hocs]],
|
|
77
|
+
return composeComponents(new Map(prevComponents), [[component, hocs]], scope);
|
|
99
78
|
});
|
|
100
79
|
|
|
101
80
|
// Return a function that will remove the added HOCs.
|
|
102
81
|
return function () {
|
|
103
|
-
var cacheKey = getCacheKey(allScopes);
|
|
104
82
|
setComponents(function (prevComponents) {
|
|
105
83
|
var components = new Map(prevComponents);
|
|
106
|
-
var scopeMap = components.get(
|
|
84
|
+
var scopeMap = components.get(scope) || new Map();
|
|
107
85
|
var recipe = scopeMap.get(component) || {
|
|
108
86
|
component: null,
|
|
109
87
|
hocs: []
|
|
@@ -116,21 +94,29 @@ var CompositionProvider = exports.CompositionProvider = function CompositionProv
|
|
|
116
94
|
component: NewComponent,
|
|
117
95
|
hocs: newHOCs
|
|
118
96
|
});
|
|
119
|
-
components.set(
|
|
97
|
+
components.set(scope, scopeMap);
|
|
120
98
|
return components;
|
|
121
99
|
});
|
|
122
100
|
};
|
|
123
101
|
}, [setComponents]);
|
|
124
102
|
var getComponent = (0, _react.useCallback)(function (Component) {
|
|
125
103
|
var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
104
|
+
var scopesToResolve = ["*"].concat((0, _toConsumableArray2.default)(scope)).reverse();
|
|
105
|
+
var _iterator2 = (0, _createForOfIteratorHelper2.default)(scopesToResolve),
|
|
106
|
+
_step2;
|
|
107
|
+
try {
|
|
108
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
109
|
+
var _scope = _step2.value;
|
|
110
|
+
var scopeMap = components.get(_scope) || new Map();
|
|
111
|
+
var composedComponent = scopeMap.get(Component);
|
|
112
|
+
if (composedComponent) {
|
|
113
|
+
return composedComponent.component;
|
|
114
|
+
}
|
|
133
115
|
}
|
|
116
|
+
} catch (err) {
|
|
117
|
+
_iterator2.e(err);
|
|
118
|
+
} finally {
|
|
119
|
+
_iterator2.f();
|
|
134
120
|
}
|
|
135
121
|
return undefined;
|
|
136
122
|
}, [components]);
|
|
@@ -141,14 +127,6 @@ var CompositionProvider = exports.CompositionProvider = function CompositionProv
|
|
|
141
127
|
components: components
|
|
142
128
|
};
|
|
143
129
|
}, [components, composeComponent]);
|
|
144
|
-
(0, _react.useEffect)(function () {
|
|
145
|
-
if (process.env.NODE_ENV !== "production") {
|
|
146
|
-
// @ts-expect-error This is a developers-only utility.
|
|
147
|
-
window["debug_printComposedComponents"] = function () {
|
|
148
|
-
console.log(components);
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
}, [components]);
|
|
152
130
|
return /*#__PURE__*/_react.default.createElement(CompositionContext.Provider, {
|
|
153
131
|
value: context
|
|
154
132
|
}, children);
|
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","getCacheKey","scopes","join","findComponentRecipe","component","lookupScopes","components","i","cacheKey","slice","scopeMap","get","Map","recipe","hocs","composeComponents","decorators","targetComponents","_iterator","_createForOfIteratorHelper2","default","_step","s","n","done","_step$value","_slicedToArray2","value","newHocs","concat","_toConsumableArray2","set","apply","reverse","err","e","f","CompositionProvider","exports","_ref","_ref$decorators","children","_useState","useState","map","tuple","original","_useState2","setComponents","composeComponent","useCallback","allScopes","prevComponents","newHOCs","filter","hoc","includes","NewComponent","getComponent","Component","scope","composedComponent","context","useMemo","useEffect","process","env","NODE_ENV","window","console","log","createElement","Provider","useComponent","baseFunction","useOptionalComposition","useCompositionScope","useComposition","useContext","Error"],"sources":["Context.tsx"],"sourcesContent":["import React, {\n ComponentType,\n createContext,\n useCallback,\n useContext,\n useEffect,\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 getCacheKey = (scopes: string[]) => {\n return scopes.join(\";\");\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 (let i = lookupScopes.length; i > 0; i--) {\n const cacheKey = getCacheKey(lookupScopes.slice(0, i));\n const scopeMap: ComposedComponents = components.get(cacheKey) || 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 cacheKey = getCacheKey(scopes);\n const targetComponents: ComposedComponents = components.get(cacheKey) || new Map();\n\n for (const [component, hocs] of decorators) {\n const recipe = findComponentRecipe(component, scopes, 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(cacheKey, 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 const allScopes = [\"*\", ...scopes];\n\n setComponents(prevComponents => {\n return composeComponents(new Map(prevComponents), [[component, hocs]], allScopes);\n });\n\n // Return a function that will remove the added HOCs.\n return () => {\n const cacheKey = getCacheKey(allScopes);\n setComponents(prevComponents => {\n const components = new Map(prevComponents);\n const scopeMap: ComposedComponents = components.get(cacheKey) || 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(cacheKey, scopeMap);\n return components;\n });\n };\n },\n [setComponents]\n );\n\n const getComponent = useCallback<CompositionContextGetComponentCallable>(\n (Component, scope = []) => {\n const scopes = [\"*\", ...scope];\n for (let i = scopes.length; i > 0; i--) {\n const cacheKey = getCacheKey(scopes.slice(0, i));\n const scopeMap: ComposedComponents = components.get(cacheKey) || 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 useEffect(() => {\n if (process.env.NODE_ENV !== \"production\") {\n // @ts-expect-error This is a developers-only utility.\n window[\"debug_printComposedComponents\"] = () => {\n console.log(components);\n };\n }\n }, [components]);\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;AASA,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,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,MAAgB,EAAK;EACtC,OAAOA,MAAM,CAACC,IAAI,CAAC,GAAG,CAAC;AAC3B,CAAC;;AAED;AACA;AACA;AACA;AACA,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CACrBC,SAAyC,EACzCC,YAAsB,EACtBC,UAA2B,EAC1B;EACD,KAAK,IAAIC,CAAC,GAAGF,YAAY,CAACf,MAAM,EAAEiB,CAAC,GAAG,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC1C,IAAMC,QAAQ,GAAGR,WAAW,CAACK,YAAY,CAACI,KAAK,CAAC,CAAC,EAAEF,CAAC,CAAC,CAAC;IACtD,IAAMG,QAA4B,GAAGJ,UAAU,CAACK,GAAG,CAACH,QAAQ,CAAC,IA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hB,oBAAOvB,MAAA,CAAAqC,OAAA,CAAAmD,aAAA,CAAC1E,kBAAkB,CAAC2E,QAAQ;IAAC7C,KAAK,EAAEmC;EAAQ,GAAErB,QAAsC,CAAC;AAChG,CAAC;AAEM,SAASgC,YAAYA,CAAIC,YAAe,EAAE;EAC7C,IAAMZ,OAAO,GAAGa,sBAAsB,CAAC,CAAC;EACxC,IAAMf,KAAK,GAAG,IAAAgB,qCAAmB,EAAC,CAAC;EAEnC,IAAI,CAACd,OAAO,EAAE;IACV,OAAOY,YAAY;EACvB;EAEA,OAAQZ,OAAO,CAACJ,YAAY,CAACgB,YAAY,EAASd,KAAK,CAAC,IAAIc,YAAY;AAC5E;;AAEA;AACA;AACA;AACO,SAASG,cAAcA,CAAA,EAAG;EAC7B,IAAMf,OAAO,GAAG,IAAAgB,iBAAU,EAACjF,kBAAkB,CAAC;EAC9C,IAAI,CAACiE,OAAO,EAAE;IACV,MAAM,IAAIiB,KAAK,gFAEf,CAAC;EACL;EAEA,OAAOjB,OAAO;AAClB;;AAEA;AACA;AACA;AACO,SAASa,sBAAsBA,CAAA,EAAG;EACrC,OAAO,IAAAG,iBAAU,EAACjF,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,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,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CACnBC,UAA2B,EAC3BC,UAAqE,EAEpE;EAAA,IADDC,KAAK,GAAAd,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAU,SAAA,GAAAV,SAAA,MAAG,GAAG;EAEX,IAAMe,QAA4B,GAAGH,UAAU,CAACI,GAAG,CAACF,KAAK,CAAC,IAAI,IAAIG,GAAG,CAAC,CAAC;EAAC,IAAAC,SAAA,OAAAC,2BAAA,CAAAC,OAAA,EACxC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": "5.41.5-beta.
|
|
3
|
+
"version": "5.41.5-beta.3",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@babel/preset-env": "7.24.3",
|
|
26
26
|
"@babel/preset-typescript": "7.24.1",
|
|
27
27
|
"@testing-library/react": "15.0.7",
|
|
28
|
-
"@webiny/cli": "5.41.5-beta.
|
|
29
|
-
"@webiny/project-utils": "5.41.5-beta.
|
|
28
|
+
"@webiny/cli": "5.41.5-beta.3",
|
|
29
|
+
"@webiny/project-utils": "5.41.5-beta.3",
|
|
30
30
|
"ttypescript": "1.5.15",
|
|
31
31
|
"typescript": "4.9.5"
|
|
32
32
|
},
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"build": "yarn webiny run build",
|
|
39
39
|
"watch": "yarn webiny run watch"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "f700f04287fb4f2128da1a207fb0fa486a2dd773"
|
|
42
42
|
}
|