@webiny/react-composition 0.0.0-unstable.99666aeb00 → 0.0.0-unstable.a9593f74dd

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.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  import { HigherOrderComponent } from "./Context";
3
- export interface ComposableFC<TProps = unknown> extends React.FC<TProps> {
4
- original: React.FC<TProps>;
3
+ export declare type ComposableFC<TProps = unknown> = React.ComponentType<TProps> & {
4
+ original: React.ComponentType<TProps>;
5
5
  originalName: string;
6
- }
6
+ };
7
7
  export interface ComposeProps {
8
8
  /**
9
9
  * Component to compose.
@@ -12,4 +12,4 @@ export interface ComposeProps {
12
12
  component: ComposableFC<any>;
13
13
  with: HigherOrderComponent | HigherOrderComponent[];
14
14
  }
15
- export declare const Compose: React.FC<ComposeProps>;
15
+ export declare const Compose: (props: ComposeProps) => null;
package/Compose.js CHANGED
@@ -21,4 +21,6 @@ var Compose = function Compose(props) {
21
21
  }, [props.with]);
22
22
  return null;
23
23
  };
24
- exports.Compose = Compose;
24
+ exports.Compose = Compose;
25
+
26
+ //# sourceMappingURL=Compose.js.map
package/Compose.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["Compose","props","useComposition","composeComponent","scope","useCompositionScope","useEffect","component","original","console","warn","displayName","hocs","Array","isArray","with"],"sources":["Compose.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { HigherOrderComponent, useComposition } from \"./Context\";\nimport { useCompositionScope } from \"~/CompositionScope\";\n\nexport interface ComposableFC<TProps = unknown> extends React.FC<TProps> {\n original: React.FC<TProps>;\n originalName: string;\n}\n\nexport interface ComposeProps {\n /**\n * Component to compose.\n * NOTE: ComposableFC<TProps> use `any` because the type of the component props is irrelevant.\n */\n component: ComposableFC<any>;\n with: HigherOrderComponent | HigherOrderComponent[];\n}\n\nexport const Compose: React.FC<ComposeProps> = props => {\n const { composeComponent } = useComposition();\n const scope = useCompositionScope();\n\n useEffect(() => {\n if (typeof props.component.original === \"undefined\") {\n console.warn(\n `You must make your component \"<${props.component.displayName}>\" composable, by using the makeComposable() function!`\n );\n\n return;\n }\n\n const hocs = Array.isArray(props.with) ? props.with : [props.with];\n return composeComponent(props.component.original, hocs, scope);\n }, [props.with]);\n\n return null;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AAgBO,IAAMA,OAA+B,GAAG,SAAlCA,OAA+B,CAAGC,KAAK,EAAI;EACpD,sBAA6B,IAAAC,uBAAc,GAAE;IAArCC,gBAAgB,mBAAhBA,gBAAgB;EACxB,IAAMC,KAAK,GAAG,IAAAC,qCAAmB,GAAE;EAEnC,IAAAC,gBAAS,EAAC,YAAM;IACZ,IAAI,OAAOL,KAAK,CAACM,SAAS,CAACC,QAAQ,KAAK,WAAW,EAAE;MACjDC,OAAO,CAACC,IAAI,2CAC0BT,KAAK,CAACM,SAAS,CAACI,WAAW,6DAChE;MAED;IACJ;IAEA,IAAMC,IAAI,GAAGC,KAAK,CAACC,OAAO,CAACb,KAAK,CAACc,IAAI,CAAC,GAAGd,KAAK,CAACc,IAAI,GAAG,CAACd,KAAK,CAACc,IAAI,CAAC;IAClE,OAAOZ,gBAAgB,CAACF,KAAK,CAACM,SAAS,CAACC,QAAQ,EAAEI,IAAI,EAAER,KAAK,CAAC;EAClE,CAAC,EAAE,CAACH,KAAK,CAACc,IAAI,CAAC,CAAC;EAEhB,OAAO,IAAI;AACf,CAAC;AAAC"}
1
+ {"version":3,"names":["_react","require","_Context","_CompositionScope","Compose","props","_useComposition","useComposition","composeComponent","scope","useCompositionScope","useEffect","component","original","console","warn","concat","displayName","hocs","Array","isArray","with","exports"],"sources":["Compose.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { HigherOrderComponent, useComposition } from \"./Context\";\nimport { useCompositionScope } from \"~/CompositionScope\";\n\nexport type ComposableFC<TProps = unknown> = React.ComponentType<TProps> & {\n original: React.ComponentType<TProps>;\n originalName: string;\n};\n\nexport interface ComposeProps {\n /**\n * Component to compose.\n * NOTE: ComposableFC<TProps> use `any` because the type of the component props is irrelevant.\n */\n component: ComposableFC<any>;\n with: HigherOrderComponent | HigherOrderComponent[];\n}\n\nexport const Compose = (props: ComposeProps) => {\n const { composeComponent } = useComposition();\n const scope = useCompositionScope();\n\n useEffect(() => {\n if (typeof props.component.original === \"undefined\") {\n console.warn(\n `You must make your component \"<${props.component.displayName}>\" composable, by using the makeComposable() function!`\n );\n\n return;\n }\n\n const hocs = Array.isArray(props.with) ? props.with : [props.with];\n return composeComponent(props.component.original, hocs, 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;AAgBO,IAAMG,OAAO,GAAG,SAAVA,OAAOA,CAAIC,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,IAAAC,gBAAS,EAAC,YAAM;IACZ,IAAI,OAAON,KAAK,CAACO,SAAS,CAACC,QAAQ,KAAK,WAAW,EAAE;MACjDC,OAAO,CAACC,IAAI,oCAAAC,MAAA,CAC0BX,KAAK,CAACO,SAAS,CAACK,WAAW,4DACjE,CAAC;MAED;IACJ;IAEA,IAAMC,IAAI,GAAGC,KAAK,CAACC,OAAO,CAACf,KAAK,CAACgB,IAAI,CAAC,GAAGhB,KAAK,CAACgB,IAAI,GAAG,CAAChB,KAAK,CAACgB,IAAI,CAAC;IAClE,OAAOb,gBAAgB,CAACH,KAAK,CAACO,SAAS,CAACC,QAAQ,EAAEK,IAAI,EAAET,KAAK,CAAC;EAClE,CAAC,EAAE,CAACJ,KAAK,CAACgB,IAAI,CAAC,CAAC;EAEhB,OAAO,IAAI;AACf,CAAC;AAACC,OAAA,CAAAlB,OAAA,GAAAA,OAAA"}
@@ -24,4 +24,6 @@ function useCompositionScope() {
24
24
  return undefined;
25
25
  }
26
26
  return context.name;
27
- }
27
+ }
28
+
29
+ //# sourceMappingURL=CompositionScope.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CompositionScopeContext","React","createContext","undefined","CompositionScope","name","children","useCompositionScope","context","useContext"],"sources":["CompositionScope.tsx"],"sourcesContent":["import React from \"react\";\n\nexport interface CompositionScopeContext {\n name: string;\n}\n\nconst CompositionScopeContext = React.createContext<CompositionScopeContext | undefined>(undefined);\n\ninterface CompositionScopeProps {\n name: string;\n children: React.ReactNode;\n}\n\nexport const CompositionScope = ({ name, children }: CompositionScopeProps) => {\n return (\n <CompositionScopeContext.Provider value={{ name }}>\n {children}\n </CompositionScopeContext.Provider>\n );\n};\n\nexport function useCompositionScope() {\n const context = React.useContext(CompositionScopeContext);\n if (!context) {\n return undefined;\n }\n return context.name;\n}\n"],"mappings":";;;;;;;;AAAA;AAMA,IAAMA,uBAAuB,gBAAGC,cAAK,CAACC,aAAa,CAAsCC,SAAS,CAAC;AAO5F,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgB,OAAkD;EAAA,IAA5CC,IAAI,QAAJA,IAAI;IAAEC,QAAQ,QAARA,QAAQ;EAC7C,oBACI,6BAAC,uBAAuB,CAAC,QAAQ;IAAC,KAAK,EAAE;MAAED,IAAI,EAAJA;IAAK;EAAE,GAC7CC,QAAQ,CACsB;AAE3C,CAAC;AAAC;AAEK,SAASC,mBAAmB,GAAG;EAClC,IAAMC,OAAO,GAAGP,cAAK,CAACQ,UAAU,CAACT,uBAAuB,CAAC;EACzD,IAAI,CAACQ,OAAO,EAAE;IACV,OAAOL,SAAS;EACpB;EACA,OAAOK,OAAO,CAACH,IAAI;AACvB"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","CompositionScopeContext","React","createContext","undefined","CompositionScope","_ref","name","children","default","createElement","Provider","value","exports","useCompositionScope","context","useContext"],"sources":["CompositionScope.tsx"],"sourcesContent":["import React from \"react\";\n\nexport interface CompositionScopeContext {\n name: string;\n}\n\nconst CompositionScopeContext = React.createContext<CompositionScopeContext | undefined>(undefined);\n\ninterface CompositionScopeProps {\n name: string;\n children: React.ReactNode;\n}\n\nexport const CompositionScope = ({ name, children }: CompositionScopeProps) => {\n return (\n <CompositionScopeContext.Provider value={{ name }}>\n {children}\n </CompositionScopeContext.Provider>\n );\n};\n\nexport function useCompositionScope() {\n const context = React.useContext(CompositionScopeContext);\n if (!context) {\n return undefined;\n }\n return context.name;\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAMA,IAAMC,uBAAuB,gBAAGC,cAAK,CAACC,aAAa,CAAsCC,SAAS,CAAC;AAO5F,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAAkD;EAAA,IAA5CC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;EAC7C,oBACIV,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACT,uBAAuB,CAACU,QAAQ;IAACC,KAAK,EAAE;MAAEL,IAAI,EAAJA;IAAK;EAAE,GAC7CC,QAC6B,CAAC;AAE3C,CAAC;AAACK,OAAA,CAAAR,gBAAA,GAAAA,gBAAA;AAEK,SAASS,mBAAmBA,CAAA,EAAG;EAClC,IAAMC,OAAO,GAAGb,cAAK,CAACc,UAAU,CAACf,uBAAuB,CAAC;EACzD,IAAI,CAACc,OAAO,EAAE;IACV,OAAOX,SAAS;EACpB;EACA,OAAOW,OAAO,CAACR,IAAI;AACvB"}
package/Context.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import React, { FC, ComponentType } from "react";
2
- export declare function compose(...fns: Decorator[]): (Base: FC<unknown>) => FC<unknown>;
1
+ import React, { ComponentType } from "react";
2
+ export declare function compose(...fns: Decorator[]): (Base: ComponentType<unknown>) => ComponentType<unknown>;
3
3
  interface ComposedComponent {
4
4
  /**
5
5
  * Ready to use React component.
@@ -20,13 +20,13 @@ interface ComposedComponent {
20
20
  * to let it be `any` in this interface.
21
21
  */
22
22
  export interface Decorator<TProps = any> {
23
- (Component: FC<TProps>): FC<TProps>;
23
+ (Component: ComponentType<TProps>): ComponentType<TProps>;
24
24
  }
25
25
  /**
26
26
  * @deprecated Use `Decorator` instead.
27
27
  */
28
28
  export interface HigherOrderComponent<TProps = any, TOutput = TProps> {
29
- (Component: FC<TProps>): FC<TOutput>;
29
+ (Component: ComponentType<TProps>): ComponentType<TOutput>;
30
30
  }
31
31
  declare type ComposedComponents = Map<ComponentType<unknown>, ComposedComponent>;
32
32
  declare type ComponentScopes = Map<string, ComposedComponents>;
@@ -36,7 +36,10 @@ interface CompositionContext {
36
36
  composeComponent(component: ComponentType<unknown>, hocs: HigherOrderComponent[], scope?: string): void;
37
37
  }
38
38
  declare const CompositionContext: React.Context<CompositionContext | undefined>;
39
- export declare const CompositionProvider: React.FC;
39
+ interface CompositionProviderProps {
40
+ children: React.ReactNode;
41
+ }
42
+ export declare const CompositionProvider: ({ children }: CompositionProviderProps) => JSX.Element;
40
43
  export declare function useComponent(Component: ComponentType<any>): React.ComponentType<any>;
41
44
  /**
42
45
  * This hook will throw an error if composition context doesn't exist.
package/Context.js CHANGED
@@ -24,6 +24,17 @@ function compose() {
24
24
  }, Base);
25
25
  };
26
26
  }
27
+
28
+ /**
29
+ * IMPORTANT: TProps default type is `any` because this interface is use as a prop type in the `Compose` component.
30
+ * You can pass any Decorator as a prop, regardless of its TProps type. The only way to allow that is
31
+ * to let it be `any` in this interface.
32
+ */
33
+
34
+ /**
35
+ * @deprecated Use `Decorator` instead.
36
+ */
37
+
27
38
  var CompositionContext = /*#__PURE__*/(0, _react.createContext)(undefined);
28
39
  var CompositionProvider = function CompositionProvider(_ref) {
29
40
  var children = _ref.children;
@@ -120,4 +131,6 @@ function useComposition() {
120
131
  */
121
132
  function useOptionalComposition() {
122
133
  return (0, _react.useContext)(CompositionContext);
123
- }
134
+ }
135
+
136
+ //# sourceMappingURL=Context.js.map
package/Context.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["compose","fns","ComposedComponent","Base","reduceRight","Component","hoc","CompositionContext","createContext","undefined","CompositionProvider","children","useState","Map","components","setComponents","composeComponent","useCallback","component","hocs","scope","prevComponents","scopeMap","get","recipe","newHocs","set","reverse","newHOCs","filter","includes","NewComponent","getComponent","composedComponent","defaultScopeMap","defaultComponent","context","useMemo","useComponent","useOptionalComposition","useCompositionScope","useComposition","useContext","Error"],"sources":["Context.tsx"],"sourcesContent":["import React, {\n FC,\n ComponentType,\n useState,\n useCallback,\n createContext,\n useContext,\n useMemo\n} from \"react\";\nimport { useCompositionScope } from \"~/CompositionScope\";\n\nexport function compose(...fns: Decorator[]) {\n return function ComposedComponent(Base: FC<unknown>): FC<unknown> {\n return fns.reduceRight((Component, hoc) => hoc(Component), Base);\n };\n}\n\ninterface ComposedComponent {\n /**\n * Ready to use React component.\n */\n component: ComponentType<unknown>;\n /**\n * HOCs used to compose the original component.\n */\n hocs: Decorator[];\n /**\n * Component composition can be scoped.\n */\n scope?: string;\n}\n\n/**\n * IMPORTANT: TProps default type is `any` because this interface is use as a prop type in the `Compose` component.\n * You can pass any Decorator as a prop, regardless of its TProps type. The only way to allow that is\n * to let it be `any` in this interface.\n */\nexport interface Decorator<TProps = any> {\n (Component: FC<TProps>): FC<TProps>;\n}\n\n/**\n * @deprecated Use `Decorator` instead.\n */\nexport interface HigherOrderComponent<TProps = any, TOutput = TProps> {\n (Component: FC<TProps>): FC<TOutput>;\n}\n\ntype ComposedComponents = Map<ComponentType<unknown>, ComposedComponent>;\ntype ComponentScopes = Map<string, ComposedComponents>;\n\ninterface CompositionContext {\n components: ComponentScopes;\n getComponent(\n component: ComponentType<unknown>,\n scope?: string\n ): ComponentType<unknown> | undefined;\n composeComponent(\n component: ComponentType<unknown>,\n hocs: HigherOrderComponent[],\n scope?: string\n ): void;\n}\n\nconst CompositionContext = createContext<CompositionContext | undefined>(undefined);\n\nexport const CompositionProvider: React.FC = ({ children }) => {\n const [components, setComponents] = useState<ComponentScopes>(new Map());\n\n const composeComponent = useCallback(\n (component, hocs, scope = \"*\") => {\n setComponents(prevComponents => {\n const components = new Map(prevComponents);\n const scopeMap: ComposedComponents = components.get(scope) || new Map();\n const recipe = scopeMap.get(component) || { component: null, hocs: [] };\n\n const newHocs = [...(recipe.hocs || []), ...hocs];\n\n scopeMap.set(component, {\n component: compose(...[...newHocs].reverse())(component),\n hocs: newHocs\n });\n\n components.set(scope, scopeMap);\n return components;\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: CompositionContext[\"getComponent\"] = useCallback(\n (Component, scope = \"*\") => {\n const scopeMap: ComposedComponents = components.get(scope) || new Map();\n const composedComponent = scopeMap.get(Component);\n if (!composedComponent && scope !== \"*\") {\n // Check if a default scope component exists\n const defaultScopeMap: ComposedComponents = components.get(\"*\") || new Map();\n const defaultComponent = defaultScopeMap.get(Component);\n return defaultComponent ? defaultComponent.component : undefined;\n }\n return composedComponent ? composedComponent.component : 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(Component: ComponentType<any>) {\n const context = useOptionalComposition();\n const scope = useCompositionScope();\n\n if (!context) {\n return Component;\n }\n\n return context.getComponent(Component, scope) || Component;\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;AASA;AAEO,SAASA,OAAO,GAAsB;EAAA,kCAAlBC,GAAG;IAAHA,GAAG;EAAA;EAC1B,OAAO,SAASC,iBAAiB,CAACC,IAAiB,EAAe;IAC9D,OAAOF,GAAG,CAACG,WAAW,CAAC,UAACC,SAAS,EAAEC,GAAG;MAAA,OAAKA,GAAG,CAACD,SAAS,CAAC;IAAA,GAAEF,IAAI,CAAC;EACpE,CAAC;AACL;AAiDA,IAAMI,kBAAkB,gBAAG,IAAAC,oBAAa,EAAiCC,SAAS,CAAC;AAE5E,IAAMC,mBAA6B,GAAG,SAAhCA,mBAA6B,OAAqB;EAAA,IAAfC,QAAQ,QAARA,QAAQ;EACpD,gBAAoC,IAAAC,eAAQ,EAAkB,IAAIC,GAAG,EAAE,CAAC;IAAA;IAAjEC,UAAU;IAAEC,aAAa;EAEhC,IAAMC,gBAAgB,GAAG,IAAAC,kBAAW,EAChC,UAACC,SAAS,EAAEC,IAAI,EAAkB;IAAA,IAAhBC,KAAK,uEAAG,GAAG;IACzBL,aAAa,CAAC,UAAAM,cAAc,EAAI;MAC5B,IAAMP,UAAU,GAAG,IAAID,GAAG,CAACQ,cAAc,CAAC;MAC1C,IAAMC,QAA4B,GAAGR,UAAU,CAACS,GAAG,CAACH,KAAK,CAAC,IAAI,IAAIP,GAAG,EAAE;MACvE,IAAMW,MAAM,GAAGF,QAAQ,CAACC,GAAG,CAACL,SAAS,CAAC,IAAI;QAAEA,SAAS,EAAE,IAAI;QAAEC,IAAI,EAAE;MAAG,CAAC;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ASoC,cAAc,GAAG;EAC7B,IAAML,OAAO,GAAG,IAAAM,iBAAU,EAACnC,kBAAkB,CAAC;EAC9C,IAAI,CAAC6B,OAAO,EAAE;IACV,MAAM,IAAIO,KAAK,iFAEd;EACL;EAEA,OAAOP,OAAO;AAClB;;AAEA;AACA;AACA;AACO,SAASG,sBAAsB,GAAG;EACrC,OAAO,IAAAG,iBAAU,EAACnC,kBAAkB,CAAC;AACzC"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_CompositionScope","compose","_len","arguments","length","fns","Array","_key","ComposedComponent","Base","reduceRight","Component","hoc","CompositionContext","createContext","undefined","CompositionProvider","_ref","children","_useState","useState","Map","_useState2","_slicedToArray2","default","components","setComponents","composeComponent","useCallback","component","hocs","scope","prevComponents","scopeMap","get","recipe","newHocs","concat","_toConsumableArray2","set","apply","reverse","newHOCs","filter","includes","NewComponent","getComponent","composedComponent","defaultScopeMap","defaultComponent","context","useMemo","createElement","Provider","value","exports","useComponent","useOptionalComposition","useCompositionScope","useComposition","useContext","Error"],"sources":["Context.tsx"],"sourcesContent":["import React, {\n ComponentType,\n useState,\n useCallback,\n createContext,\n useContext,\n useMemo\n} from \"react\";\nimport { useCompositionScope } from \"~/CompositionScope\";\n\nexport function compose(...fns: Decorator[]) {\n return function ComposedComponent(Base: ComponentType<unknown>): ComponentType<unknown> {\n return fns.reduceRight((Component, hoc) => hoc(Component), Base);\n };\n}\n\ninterface ComposedComponent {\n /**\n * Ready to use React component.\n */\n component: ComponentType<unknown>;\n /**\n * HOCs used to compose the original component.\n */\n hocs: Decorator[];\n /**\n * Component composition can be scoped.\n */\n scope?: string;\n}\n\n/**\n * IMPORTANT: TProps default type is `any` because this interface is use as a prop type in the `Compose` component.\n * You can pass any Decorator as a prop, regardless of its TProps type. The only way to allow that is\n * to let it be `any` in this interface.\n */\nexport interface Decorator<TProps = any> {\n (Component: ComponentType<TProps>): ComponentType<TProps>;\n}\n\n/**\n * @deprecated Use `Decorator` instead.\n */\nexport interface HigherOrderComponent<TProps = any, TOutput = TProps> {\n (Component: ComponentType<TProps>): ComponentType<TOutput>;\n}\n\ntype ComposedComponents = Map<ComponentType<unknown>, ComposedComponent>;\ntype ComponentScopes = Map<string, ComposedComponents>;\n\ninterface CompositionContext {\n components: ComponentScopes;\n getComponent(\n component: ComponentType<unknown>,\n scope?: string\n ): ComponentType<unknown> | undefined;\n composeComponent(\n component: ComponentType<unknown>,\n hocs: HigherOrderComponent[],\n scope?: string\n ): void;\n}\n\nconst CompositionContext = createContext<CompositionContext | undefined>(undefined);\n\ninterface CompositionProviderProps {\n children: React.ReactNode;\n}\n\nexport const CompositionProvider = ({ children }: CompositionProviderProps) => {\n const [components, setComponents] = useState<ComponentScopes>(new Map());\n\n const composeComponent = useCallback(\n (component, hocs, scope = \"*\") => {\n setComponents(prevComponents => {\n const components = new Map(prevComponents);\n const scopeMap: ComposedComponents = components.get(scope) || new Map();\n const recipe = scopeMap.get(component) || { component: null, hocs: [] };\n\n const newHocs = [...(recipe.hocs || []), ...hocs];\n\n scopeMap.set(component, {\n component: compose(...[...newHocs].reverse())(component),\n hocs: newHocs\n });\n\n components.set(scope, scopeMap);\n return components;\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: CompositionContext[\"getComponent\"] = useCallback(\n (Component, scope = \"*\") => {\n const scopeMap: ComposedComponents = components.get(scope) || new Map();\n const composedComponent = scopeMap.get(Component);\n if (!composedComponent && scope !== \"*\") {\n // Check if a default scope component exists\n const defaultScopeMap: ComposedComponents = components.get(\"*\") || new Map();\n const defaultComponent = defaultScopeMap.get(Component);\n return defaultComponent ? defaultComponent.component : undefined;\n }\n return composedComponent ? composedComponent.component : 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(Component: ComponentType<any>) {\n const context = useOptionalComposition();\n const scope = useCompositionScope();\n\n if (!context) {\n return Component;\n }\n\n return context.getComponent(Component, scope) || Component;\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;AAEO,SAASE,OAAOA,CAAA,EAAsB;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAlBC,GAAG,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAHF,GAAG,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAC1B,OAAO,SAASC,iBAAiBA,CAACC,IAA4B,EAA0B;IACpF,OAAOJ,GAAG,CAACK,WAAW,CAAC,UAACC,SAAS,EAAEC,GAAG;MAAA,OAAKA,GAAG,CAACD,SAAS,CAAC;IAAA,GAAEF,IAAI,CAAC;EACpE,CAAC;AACL;;AAiBA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAqBA,IAAMI,kBAAkB,gBAAG,IAAAC,oBAAa,EAAiCC,SAAS,CAAC;AAM5E,IA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cAAcA,CAAA,EAAG;EAC7B,IAAMT,OAAO,GAAG,IAAAU,iBAAU,EAAC/C,kBAAkB,CAAC;EAC9C,IAAI,CAACqC,OAAO,EAAE;IACV,MAAM,IAAIW,KAAK,gFAEf,CAAC;EACL;EAEA,OAAOX,OAAO;AAClB;;AAEA;AACA;AACA;AACO,SAASO,sBAAsBA,CAAA,EAAG;EACrC,OAAO,IAAAG,iBAAU,EAAC/C,kBAAkB,CAAC;AACzC"}
@@ -1,8 +1,11 @@
1
- import React, { ComponentProps } from "react";
1
+ import { ComponentProps } from "react";
2
2
  import { ComposableFC, HigherOrderComponent } from "./index";
3
3
  /**
4
4
  * Creates a component which, when mounted, registers a Higher Order Component for the given base component.
5
5
  * This is particularly useful for decorating (wrapping) existing composable components.
6
6
  * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.
7
7
  */
8
- export declare function createComponentPlugin<T extends ComposableFC<ComponentProps<T>>>(Base: T, hoc: HigherOrderComponent<ComponentProps<T>>): React.FC;
8
+ export declare function createComponentPlugin<T extends ComposableFC<ComponentProps<T>>>(Base: T, hoc: HigherOrderComponent<ComponentProps<T>>): {
9
+ (): JSX.Element;
10
+ displayName: string | undefined;
11
+ };
@@ -21,4 +21,6 @@ function createComponentPlugin(Base, hoc) {
21
21
  };
22
22
  ComponentPlugin.displayName = Base.displayName;
23
23
  return ComponentPlugin;
24
- }
24
+ }
25
+
26
+ //# sourceMappingURL=createComponentPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createComponentPlugin","Base","hoc","ComponentPlugin","displayName"],"sources":["createComponentPlugin.tsx"],"sourcesContent":["import React, { ComponentProps } from \"react\";\nimport { ComposableFC, Compose, HigherOrderComponent } from \"./index\";\n\n/**\n * Creates a component which, when mounted, registers a Higher Order Component for the given base component.\n * This is particularly useful for decorating (wrapping) existing composable components.\n * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.\n */\nexport function createComponentPlugin<T extends ComposableFC<ComponentProps<T>>>(\n Base: T,\n hoc: HigherOrderComponent<ComponentProps<T>>\n): React.FC {\n const ComponentPlugin = () => <Compose component={Base} with={hoc} />;\n ComponentPlugin.displayName = Base.displayName;\n return ComponentPlugin;\n}\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAqB,CACjCC,IAAO,EACPC,GAA4C,EACpC;EACR,IAAMC,eAAe,GAAG,SAAlBA,eAAe;IAAA,oBAAS,6BAAC,cAAO;MAAC,SAAS,EAAEF,IAAK;MAAC,IAAI,EAAEC;IAAI,EAAG;EAAA;EACrEC,eAAe,CAACC,WAAW,GAAGH,IAAI,CAACG,WAAW;EAC9C,OAAOD,eAAe;AAC1B"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_index","createComponentPlugin","Base","hoc","ComponentPlugin","default","createElement","Compose","component","with","displayName"],"sources":["createComponentPlugin.tsx"],"sourcesContent":["import React, { ComponentProps } from \"react\";\nimport { ComposableFC, Compose, HigherOrderComponent } from \"./index\";\n\n/**\n * Creates a component which, when mounted, registers a Higher Order Component for the given base component.\n * This is particularly useful for decorating (wrapping) existing composable components.\n * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.\n */\nexport function createComponentPlugin<T extends ComposableFC<ComponentProps<T>>>(\n Base: T,\n hoc: HigherOrderComponent<ComponentProps<T>>\n) {\n const ComponentPlugin = () => <Compose component={Base} with={hoc} />;\n ComponentPlugin.displayName = Base.displayName;\n return ComponentPlugin;\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,SAASE,qBAAqBA,CACjCC,IAAO,EACPC,GAA4C,EAC9C;EACE,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAA;IAAA,oBAASP,MAAA,CAAAQ,OAAA,CAAAC,aAAA,CAACN,MAAA,CAAAO,OAAO;MAACC,SAAS,EAAEN,IAAK;MAACO,IAAI,EAAEN;IAAI,CAAE,CAAC;EAAA;EACrEC,eAAe,CAACM,WAAW,GAAGR,IAAI,CAACQ,WAAW;EAC9C,OAAON,eAAe;AAC1B"}
package/decorators.js CHANGED
@@ -36,4 +36,6 @@ function createDecoratorFactory() {
36
36
  };
37
37
  };
38
38
  };
39
- }
39
+ }
40
+
41
+ //# sourceMappingURL=decorators.js.map
package/decorators.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createConditionalDecorator","shouldDecorate","decorator","decoratorProps","Original","ShouldDecorate","props","Component","createDecoratorFactory","from","createDecorator","DecoratorPlugin"],"sources":["decorators.tsx"],"sourcesContent":["import React from \"react\";\nimport { Decorator } from \"~/Context\";\nimport { ComposableFC, Compose } from \"~/Compose\";\n\ninterface ShouldDecorate<TDecorator = any, TComponent = any> {\n (decoratorProps: TDecorator, componentProps: TComponent): boolean;\n}\n\nexport function createConditionalDecorator(\n shouldDecorate: ShouldDecorate,\n decorator: Decorator,\n decoratorProps: unknown\n): Decorator {\n return (Original: React.FC) => {\n return function ShouldDecorate(props) {\n if (shouldDecorate(decoratorProps, props)) {\n const Component = decorator(Original);\n return <Component {...props} />;\n }\n\n return <Original {...props} />;\n };\n };\n}\n\nexport function createDecoratorFactory<TDecorator>() {\n return function from<TComponent>(\n Component: ComposableFC<TComponent>,\n shouldDecorate?: ShouldDecorate<TDecorator, TComponent>\n ) {\n return function createDecorator(decorator: Decorator<TComponent>) {\n return function DecoratorPlugin(props: TDecorator) {\n if (shouldDecorate) {\n return (\n <Compose\n component={Component}\n with={createConditionalDecorator(shouldDecorate, decorator, props)}\n />\n );\n }\n return <Compose component={Component} with={decorator} />;\n };\n };\n };\n}\n"],"mappings":";;;;;;;;AAAA;AAEA;AAMO,SAASA,0BAA0B,CACtCC,cAA8B,EAC9BC,SAAoB,EACpBC,cAAuB,EACd;EACT,OAAO,UAACC,QAAkB,EAAK;IAC3B,OAAO,SAASC,cAAc,CAACC,KAAK,EAAE;MAClC,IAAIL,cAAc,CAACE,cAAc,EAAEG,KAAK,CAAC,EAAE;QACvC,IAAMC,SAAS,GAAGL,SAAS,CAACE,QAAQ,CAAC;QACrC,oBAAO,6BAAC,SAAS,EAAKE,KAAK,CAAI;MACnC;MAEA,oBAAO,6BAAC,QAAQ,EAAKA,KAAK,CAAI;IAClC,CAAC;EACL,CAAC;AACL;AAEO,SAASE,sBAAsB,GAAe;EACjD,OAAO,SAASC,IAAI,CAChBF,SAAmC,EACnCN,cAAuD,EACzD;IACE,OAAO,SAASS,eAAe,CAACR,SAAgC,EAAE;MAC9D,OAAO,SAASS,eAAe,CAACL,KAAiB,EAAE;QAC/C,IAAIL,cAAc,EAAE;UAChB,oBACI,6BAAC,gBAAO;YACJ,SAAS,EAAEM,SAAU;YACrB,IAAI,EAAEP,0BAA0B,CAACC,cAAc,EAAEC,SAAS,EAAEI,KAAK;UAAE,EACrE;QAEV;QACA,oBAAO,6BAAC,gBAAO;UAAC,SAAS,EAAEC,SAAU;UAAC,IAAI,EAAEL;QAAU,EAAG;MAC7D,CAAC;IACL,CAAC;EACL,CAAC;AACL"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_Compose","createConditionalDecorator","shouldDecorate","decorator","decoratorProps","Original","ShouldDecorate","props","Component","default","createElement","createDecoratorFactory","from","createDecorator","DecoratorPlugin","Compose","component","with"],"sources":["decorators.tsx"],"sourcesContent":["import React from \"react\";\nimport { Decorator } from \"~/Context\";\nimport { ComposableFC, Compose } from \"~/Compose\";\n\ninterface ShouldDecorate<TDecorator = any, TComponent = any> {\n (decoratorProps: TDecorator, componentProps: TComponent): boolean;\n}\n\nexport function createConditionalDecorator(\n shouldDecorate: ShouldDecorate,\n decorator: Decorator,\n decoratorProps: unknown\n): Decorator {\n return (Original: React.ComponentType) => {\n return function ShouldDecorate(props) {\n if (shouldDecorate(decoratorProps, props)) {\n const Component = decorator(Original);\n return <Component {...props} />;\n }\n\n return <Original {...props} />;\n };\n };\n}\n\nexport function createDecoratorFactory<TDecorator>() {\n return function from<TComponent>(\n Component: ComposableFC<TComponent>,\n shouldDecorate?: ShouldDecorate<TDecorator, TComponent>\n ) {\n return function createDecorator(decorator: Decorator<TComponent>) {\n return function DecoratorPlugin(props: TDecorator) {\n if (shouldDecorate) {\n return (\n <Compose\n component={Component}\n with={createConditionalDecorator(shouldDecorate, decorator, props)}\n />\n );\n }\n return <Compose component={Component} with={decorator} />;\n };\n };\n };\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAMO,SAASE,0BAA0BA,CACtCC,cAA8B,EAC9BC,SAAoB,EACpBC,cAAuB,EACd;EACT,OAAO,UAACC,QAA6B,EAAK;IACtC,OAAO,SAASC,cAAcA,CAACC,KAAK,EAAE;MAClC,IAAIL,cAAc,CAACE,cAAc,EAAEG,KAAK,CAAC,EAAE;QACvC,IAAMC,SAAS,GAAGL,SAAS,CAACE,QAAQ,CAAC;QACrC,oBAAOR,MAAA,CAAAY,OAAA,CAAAC,aAAA,CAACF,SAAS,EAAKD,KAAQ,CAAC;MACnC;MAEA,oBAAOV,MAAA,CAAAY,OAAA,CAAAC,aAAA,CAACL,QAAQ,EAAKE,KAAQ,CAAC;IAClC,CAAC;EACL,CAAC;AACL;AAEO,SAASI,sBAAsBA,CAAA,EAAe;EACjD,OAAO,SAASC,IAAIA,CAChBJ,SAAmC,EACnCN,cAAuD,EACzD;IACE,OAAO,SAASW,eAAeA,CAACV,SAAgC,EAAE;MAC9D,OAAO,SAASW,eAAeA,CAACP,KAAiB,EAAE;QAC/C,IAAIL,cAAc,EAAE;UAChB,oBACIL,MAAA,CAAAY,OAAA,CAAAC,aAAA,CAACV,QAAA,CAAAe,OAAO;YACJC,SAAS,EAAER,SAAU;YACrBS,IAAI,EAAEhB,0BAA0B,CAACC,cAAc,EAAEC,SAAS,EAAEI,KAAK;UAAE,CACtE,CAAC;QAEV;QACA,oBAAOV,MAAA,CAAAY,OAAA,CAAAC,aAAA,CAACV,QAAA,CAAAe,OAAO;UAACC,SAAS,EAAER,SAAU;UAACS,IAAI,EAAEd;QAAU,CAAE,CAAC;MAC7D,CAAC;IACL,CAAC;EACL,CAAC;AACL"}
package/index.js CHANGED
@@ -68,4 +68,6 @@ Object.keys(_CompositionScope).forEach(function (key) {
68
68
  return _CompositionScope[key];
69
69
  }
70
70
  });
71
- });
71
+ });
72
+
73
+ //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Context\";\nexport * from \"./Compose\";\nexport * from \"./makeComposable\";\nexport * from \"./createComponentPlugin\";\nexport * from \"./decorators\";\nexport * from \"./CompositionScope\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":["_Context","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_Compose","_makeComposable","_createComponentPlugin","_decorators","_CompositionScope"],"sources":["index.ts"],"sourcesContent":["export * from \"./Context\";\nexport * from \"./Compose\";\nexport * from \"./makeComposable\";\nexport * from \"./createComponentPlugin\";\nexport * from \"./decorators\";\nexport * from \"./CompositionScope\";\n"],"mappings":";;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GA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,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAG,sBAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,WAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,WAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,WAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAI,WAAA,CAAAR,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,iBAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,iBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,iBAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAK,iBAAA,CAAAT,GAAA;IAAA;EAAA;AAAA"}
@@ -1,3 +1,5 @@
1
1
  import React from "react";
2
- import { ComposableFC } from "./Compose";
3
- export declare function makeComposable<TProps>(name: string, Component?: React.FC<TProps>): ComposableFC<TProps>;
2
+ export declare function makeComposable<TProps>(name: string, Component?: React.ComponentType<TProps>): React.FunctionComponent<TProps> & {
3
+ original: React.ComponentType<TProps>;
4
+ originalName: string;
5
+ };
package/makeComposable.js CHANGED
@@ -9,7 +9,7 @@ exports.makeComposable = makeComposable;
9
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
- var _lodash = _interopRequireDefault(require("lodash.debounce"));
12
+ var _debounce = _interopRequireDefault(require("lodash/debounce"));
13
13
  var _Context = require("./Context");
14
14
  var ComposableContext = /*#__PURE__*/(0, _react.createContext)([]);
15
15
  ComposableContext.displayName = "ComposableContext";
@@ -25,7 +25,7 @@ var createEmptyRenderer = function createEmptyRenderer(name) {
25
25
  (0, _react.useEffect)(function () {
26
26
  // We need to debounce the log, as it sometimes only requires a single tick to get the new
27
27
  // composed component to render, and we don't want to scare developers for no reason.
28
- var debounced = (0, _lodash.default)(function () {
28
+ var debounced = (0, _debounce.default)(function () {
29
29
  console.info("<".concat(name, "/> is not implemented! To provide an implementation, use the <Compose/> component."));
30
30
  }, 100);
31
31
  return function () {
@@ -54,4 +54,6 @@ function makeComposable(name, Component) {
54
54
  Composable.originalName = name;
55
55
  Composable.displayName = "Composable<".concat(name, ">");
56
56
  return Composable;
57
- }
57
+ }
58
+
59
+ //# sourceMappingURL=makeComposable.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ComposableContext","createContext","displayName","useComposableParents","context","useContext","createEmptyRenderer","name","useEffect","debounced","debounce","console","info","cancel","makeComposable","Component","Composable","props","parents","ComposedComponent","useComponent","useMemo","children","original","originalName"],"sources":["makeComposable.tsx"],"sourcesContent":["import React, { createContext, useContext, useEffect, useMemo } from \"react\";\nimport debounce from \"lodash.debounce\";\nimport { ComposableFC } from \"./Compose\";\nimport { useComponent } from \"./Context\";\n\nconst ComposableContext = createContext<string[]>([]);\nComposableContext.displayName = \"ComposableContext\";\n\nfunction useComposableParents() {\n const context = useContext(ComposableContext);\n if (!context) {\n return [];\n }\n\n return context;\n}\n\nconst createEmptyRenderer = (name: string): React.FC => {\n return {\n [name]: function () {\n useEffect(() => {\n // We need to debounce the log, as it sometimes only requires a single tick to get the new\n // composed component to render, and we don't want to scare developers for no reason.\n const debounced = debounce(() => {\n console.info(\n `<${name}/> is not implemented! To provide an implementation, use the <Compose/> component.`\n );\n }, 100);\n\n return () => {\n debounced.cancel();\n };\n }, []);\n\n return null;\n }\n }[name];\n};\n\nexport function makeComposable<TProps>(name: string, Component?: React.FC<TProps>) {\n if (!Component) {\n Component = createEmptyRenderer(name);\n }\n\n const Composable: ComposableFC<TProps> = props => {\n const parents = useComposableParents();\n const ComposedComponent = useComponent(Component as React.FC<TProps>);\n\n const context = useMemo(() => [...parents, name], [parents, name]);\n\n return (\n <ComposableContext.Provider value={context}>\n <ComposedComponent {...props}>{props.children}</ComposedComponent>\n </ComposableContext.Provider>\n );\n };\n\n Component.displayName = name;\n\n Composable.original = Component;\n Composable.originalName = name;\n Composable.displayName = `Composable<${name}>`;\n\n return Composable;\n}\n"],"mappings":";;;;;;;;;;AAAA;AACA;AAEA;AAEA,IAAMA,iBAAiB,gBAAG,IAAAC,oBAAa,EAAW,EAAE,CAAC;AACrDD,iBAAiB,CAACE,WAAW,GAAG,mBAAmB;AAEnD,SAASC,oBAAoB,GAAG;EAC5B,IAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACL,iBAAiB,CAAC;EAC7C,IAAI,CAACI,OAAO,EAAE;IACV,OAAO,EAAE;EACb;EAEA,OAAOA,OAAO;AAClB;AAEA,IAAME,mBAAmB,GAAG,SAAtBA,mBAAmB,CAAIC,IAAY,EAAe;EACpD,OAAO,kCACFA,IAAI,EAAG,YAAY;IAChB,IAAAC,gBAAS,EAAC,YAAM;MACZ;MACA;MACA,IAAMC,SAAS,GAAG,IAAAC,eAAQ,EAAC,YAAM;QAC7BC,OAAO,CAACC,IAAI,YACJL,IAAI,wFACX;MACL,CAAC,EAAE,GAAG,CAAC;MAEP,OAAO,YAAM;QACTE,SAAS,CAACI,MAAM,EAAE;MACtB,CAAC;IACL,CAAC,EAAE,EAAE,CAAC;IAEN,OAAO,IAAI;EACf,CAAC,EACHN,IAAI,CAAC;AACX,CAAC;AAEM,SAASO,cAAc,CAASP,IAAY,EAAEQ,SAA4B,EAAE;EAC/E,IAAI,CAACA,SAAS,EAAE;IACZA,SAAS,GAAGT,mBAAmB,CAACC,IAAI,CAAC;EACzC;EAEA,IAAMS,UAAgC,GAAG,SAAnCA,UAAgC,CAAGC,KAAK,EAAI;IAC9C,IAAMC,OAAO,GAAGf,oBAAoB,EAAE;IACtC,IAAMgB,iBAAiB,GAAG,IAAAC,qBAAY,EAACL,SAAS,CAAqB;IAErE,IAAMX,OAAO,GAAG,IAAAiB,cAAO,EAAC;MAAA,kDAAUH,OAAO,IAAEX,IAAI;IAAA,CAAC,EAAE,CAACW,OAAO,EAAEX,IAAI,CAAC,CAAC;IAElE,oBACI,6BAAC,iBAAiB,CAAC,QAAQ;MAAC,KAAK,EAAEH;IAAQ,gBACvC,6BAAC,iBAAiB,EAAKa,KAAK,EAAGA,KAAK,CAACK,QAAQ,CAAqB,CACzC;EAErC,CAAC;EAEDP,SAAS,CAACb,WAAW,GAAGK,IAAI;EAE5BS,UAAU,CAACO,QAAQ,GAAGR,SAAS;EAC/BC,UAAU,CAACQ,YAAY,GAAGjB,IAAI;EAC9BS,UAAU,CAACd,WAAW,wBAAiBK,IAAI,MAAG;EAE9C,OAAOS,UAAU;AACrB"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_debounce","_interopRequireDefault","_Context","ComposableContext","createContext","displayName","useComposableParents","context","useContext","createEmptyRenderer","name","_defineProperty2","default","useEffect","debounced","debounce","console","info","concat","cancel","makeComposable","Component","Composable","props","parents","ComposedComponent","useComponent","useMemo","_toConsumableArray2","createElement","Provider","value","children","original","originalName"],"sources":["makeComposable.tsx"],"sourcesContent":["import React, { createContext, useContext, useEffect, useMemo } from \"react\";\nimport debounce from \"lodash/debounce\";\nimport { ComposableFC } from \"./Compose\";\nimport { useComponent } from \"./Context\";\n\nconst ComposableContext = createContext<string[]>([]);\nComposableContext.displayName = \"ComposableContext\";\n\nfunction useComposableParents() {\n const context = useContext(ComposableContext);\n if (!context) {\n return [];\n }\n\n return context;\n}\n\nconst createEmptyRenderer = (name: string) => {\n return {\n [name]: function () {\n useEffect(() => {\n // We need to debounce the log, as it sometimes only requires a single tick to get the new\n // composed component to render, and we don't want to scare developers for no reason.\n const debounced = debounce(() => {\n console.info(\n `<${name}/> is not implemented! To provide an implementation, use the <Compose/> component.`\n );\n }, 100);\n\n return () => {\n debounced.cancel();\n };\n }, []);\n\n return null;\n }\n }[name];\n};\n\nexport function makeComposable<TProps>(name: string, Component?: React.ComponentType<TProps>) {\n if (!Component) {\n Component = createEmptyRenderer(name);\n }\n\n const Composable: ComposableFC<TProps> = props => {\n const parents = useComposableParents();\n const ComposedComponent = useComponent(Component as React.ComponentType<TProps>);\n\n const context = useMemo(() => [...parents, name], [parents, name]);\n\n return (\n <ComposableContext.Provider value={context}>\n <ComposedComponent {...props}>{props.children}</ComposedComponent>\n </ComposableContext.Provider>\n );\n };\n\n Component.displayName = name;\n\n Composable.original = Component;\n Composable.originalName = name;\n Composable.displayName = `Composable<${name}>`;\n\n return Composable;\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAMI,iBAAiB,gBAAG,IAAAC,oBAAa,EAAW,EAAE,CAAC;AACrDD,iBAAiB,CAACE,WAAW,GAAG,mBAAmB;AAEnD,SAASC,oBAAoBA,CAAA,EAAG;EAC5B,IAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACL,iBAAiB,CAAC;EAC7C,IAAI,CAACI,OAAO,EAAE;IACV,OAAO,EAAE;EACb;EAEA,OAAOA,OAAO;AAClB;AAEA,IAAME,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,IAAY,EAAK;EAC1C,OAAO,IAAAC,gBAAA,CAAAC,OAAA,MACFF,IAAI,EAAG,YAAY;IAChB,IAAAG,gBAAS,EAAC,YAAM;MACZ;MACA;MACA,IAAMC,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-1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/react-composition",
3
- "version": "0.0.0-unstable.99666aeb00",
3
+ "version": "0.0.0-unstable.a9593f74dd",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,19 +14,19 @@
14
14
  ],
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
- "@babel/runtime": "7.20.13",
17
+ "@babel/runtime": "7.22.6",
18
18
  "@types/react": "17.0.39",
19
- "lodash.debounce": "4.0.8",
19
+ "lodash": "4.17.21",
20
20
  "react": "17.0.2",
21
21
  "react-dom": "17.0.2"
22
22
  },
23
23
  "devDependencies": {
24
- "@babel/cli": "7.20.7",
25
- "@babel/core": "7.20.12",
26
- "@babel/preset-env": "7.20.2",
27
- "@babel/preset-typescript": "7.18.6",
28
- "@webiny/cli": "0.0.0-unstable.99666aeb00",
29
- "@webiny/project-utils": "0.0.0-unstable.99666aeb00",
24
+ "@babel/cli": "7.22.6",
25
+ "@babel/core": "7.22.8",
26
+ "@babel/preset-env": "7.22.7",
27
+ "@babel/preset-typescript": "7.22.5",
28
+ "@webiny/cli": "0.0.0-unstable.a9593f74dd",
29
+ "@webiny/project-utils": "0.0.0-unstable.a9593f74dd",
30
30
  "ttypescript": "1.5.15",
31
31
  "typescript": "4.7.4"
32
32
  },
@@ -38,5 +38,5 @@
38
38
  "build": "yarn webiny run build",
39
39
  "watch": "yarn webiny run watch"
40
40
  },
41
- "gitHead": "99666aeb00056c56292eeb5dbb6aba7fda2439e2"
41
+ "gitHead": "a9593f74ddf9ce93263eadb0ddc0807ed343f5ee"
42
42
  }