@common-stack/components-pro 8.0.1-alpha.0 → 8.0.2-alpha.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.
Files changed (39) hide show
  1. package/lib/index.d.ts +2 -1
  2. package/lib/index.js +1 -1
  3. package/lib/index.server.d.ts +1 -0
  4. package/lib/index.server.js +1 -0
  5. package/lib/index.server.js.map +1 -0
  6. package/lib/plugin/context.d.ts +6 -0
  7. package/lib/plugin/context.js +1 -0
  8. package/lib/plugin/context.js.map +1 -0
  9. package/lib/plugin/dynamic-render.d.ts +5 -0
  10. package/lib/plugin/dynamic-render.js +19 -0
  11. package/lib/plugin/dynamic-render.js.map +1 -0
  12. package/lib/plugin/index.d.ts +2 -0
  13. package/lib/plugin/loader.d.ts +1 -0
  14. package/lib/plugin/loader.js +11 -0
  15. package/lib/plugin/loader.js.map +1 -0
  16. package/lib/plugin/middleware.d.ts +3 -0
  17. package/lib/plugin/middleware.js +19 -0
  18. package/lib/plugin/middleware.js.map +1 -0
  19. package/lib/plugin/plugin-render.d.ts +6 -0
  20. package/lib/plugin/plugin-render.js +38 -0
  21. package/lib/plugin/plugin-render.js.map +1 -0
  22. package/lib/plugin/provider.d.ts +6 -0
  23. package/lib/plugin/provider.js +4 -0
  24. package/lib/plugin/provider.js.map +1 -0
  25. package/lib/plugin/utils.server.d.ts +1 -0
  26. package/lib/slot-fill/base/fill.js +17 -15
  27. package/lib/slot-fill/base/fill.js.map +1 -1
  28. package/lib/slot-fill/base/provider.d.ts +4 -21
  29. package/lib/slot-fill/base/provider.js +61 -83
  30. package/lib/slot-fill/base/provider.js.map +1 -1
  31. package/lib/slot-fill/base/slot.js +51 -76
  32. package/lib/slot-fill/base/slot.js.map +1 -1
  33. package/lib/slot-fill/index.js.map +1 -1
  34. package/lib/slot-fill/utils/index.d.ts +7 -0
  35. package/lib/slot-fill/utils/index.js +9 -0
  36. package/lib/slot-fill/utils/index.js.map +1 -0
  37. package/package.json +3 -2
  38. package/lib/slot-fill/utils/isEmptyElement.js +0 -15
  39. package/lib/slot-fill/utils/isEmptyElement.js.map +0 -1
package/lib/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export { createSlotFill, Slot, Fill, Provider as SlotFillProvider, useSlot as __experimentalUseSlot } from './slot-fill';
1
+ export { createSlotFill, Slot, Fill, Provider as SlotFillProvider, useSlot as __experimentalUseSlot, } from './slot-fill';
2
2
  export { removeUniversalPortals, replaceServerFills } from './slot-fill/utils';
3
+ export * from './plugin';
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- export{Fill,Slot,Provider as SlotFillProvider,createSlotFill}from'./slot-fill/index.js';export{removeUniversalPortals}from'./slot-fill/utils/removeUniversalPortals.js';export{replaceServerFills}from'./slot-fill/utils/replaceServerFills.js';export{default as __experimentalUseSlot}from'./slot-fill/bubbles-virtually/use-slot.js';//# sourceMappingURL=index.js.map
1
+ export{Fill,Slot,Provider as SlotFillProvider,createSlotFill}from'./slot-fill/index.js';export{removeUniversalPortals}from'./slot-fill/utils/removeUniversalPortals.js';export{replaceServerFills}from'./slot-fill/utils/replaceServerFills.js';export{default as FillRenderProvider}from'./plugin/provider.js';export{PluginsLoader}from'./plugin/loader.js';export{default as __experimentalUseSlot}from'./slot-fill/bubbles-virtually/use-slot.js';//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ export * from './plugin/middleware';
@@ -0,0 +1 @@
1
+ export{middleware}from'./plugin/middleware.js';//# sourceMappingURL=index.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.server.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ export interface IFillRenderContext {
3
+ loadedPlugins: any;
4
+ }
5
+ declare const FillRenderContext: React.Context<IFillRenderContext>;
6
+ export default FillRenderContext;
@@ -0,0 +1 @@
1
+ import*as React from'react';const FillRenderContext = React.createContext(null);export{FillRenderContext as default};//# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sources":["../../src/plugin/context.tsx"],"sourcesContent":[null],"names":[],"mappings":"4BAMM,MAAA,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAA4B,IAAI"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare const DynamicRender: ({ renderImporter, ...props }: {
3
+ [x: string]: any;
4
+ renderImporter: any;
5
+ }) => React.JSX.Element;
@@ -0,0 +1,19 @@
1
+ import React__default,{useState,useEffect}from'react';const DynamicRender = ({ renderImporter, ...props }) => {
2
+ const [Component, setComponent] = useState(null);
3
+ useEffect(() => {
4
+ if (renderImporter) {
5
+ renderImporter()
6
+ .then((module) => {
7
+ const ImportedComponent = module.default;
8
+ setComponent(() => ImportedComponent);
9
+ })
10
+ .catch((error) => {
11
+ console.error(`Failed to load component from ${renderImporter}:`, error);
12
+ });
13
+ }
14
+ }, [renderImporter]);
15
+ if (!Component) {
16
+ return React__default.createElement(React__default.Fragment, null);
17
+ }
18
+ return React__default.createElement(Component, { ...props });
19
+ };export{DynamicRender};//# sourceMappingURL=dynamic-render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-render.js","sources":["../../src/plugin/dynamic-render.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"sDAEO,MAAM,aAAa,GAAG,CAAC,EAAE,cAAc,EAAE,GAAG,KAAK,EAAE,KAAI;IAC1D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAkB,IAAI,CAAC,CAAC;IAElE,SAAS,CAAC,MAAK;QACX,IAAI,cAAc,EAAE;AAChB,YAAA,cAAc,EAAE;AACX,iBAAA,IAAI,CAAC,CAAC,MAAM,KAAI;AACb,gBAAA,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC;AACzC,gBAAA,YAAY,CAAC,MAAM,iBAAiB,CAAC,CAAC;AAC1C,aAAC,CAAC;AACD,iBAAA,KAAK,CAAC,CAAC,KAAK,KAAI;gBACb,OAAO,CAAC,KAAK,CAAC,CAAA,8BAAA,EAAiC,cAAc,CAAG,CAAA,CAAA,EAAE,KAAK,CAAC,CAAC;AAC7E,aAAC,CAAC,CAAC;SACV;AACL,KAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAErB,IAAI,CAAC,SAAS,EAAE;AACZ,QAAA,OAAOA,2DAAK,CAAC;KAChB;AAED,IAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,SAAS,EAAK,EAAA,GAAA,KAAK,GAAI,CAAC;AACpC"}
@@ -0,0 +1,2 @@
1
+ export { default as FillRenderProvider } from './provider';
2
+ export { PluginsLoader } from './loader';
@@ -0,0 +1 @@
1
+ export declare function PluginsLoader(plugins: any[]): Promise<any[]>;
@@ -0,0 +1,11 @@
1
+ async function PluginsLoader(plugins) {
2
+ const loadedPlugins = await Promise.all(plugins.map(async (plugin) => {
3
+ if (plugin.renderImporter) {
4
+ const module = await plugin.renderImporter();
5
+ const ImportedComponent = module.default;
6
+ return { ...plugin, Component: ImportedComponent };
7
+ }
8
+ return plugin;
9
+ }));
10
+ return loadedPlugins;
11
+ }export{PluginsLoader};//# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sources":["../../src/plugin/loader.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAO,eAAe,aAAa,CAAC,OAAc,EAAA;AAC9C,IAAA,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,GAAG,CACnC,OAAO,CAAC,GAAG,CAAC,OAAO,MAAW,KAAI;AAC9B,QAAA,IAAI,MAAM,CAAC,cAAc,EAAE;AACvB,YAAA,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC;AAC7C,YAAA,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC;YACzC,OAAO,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;SACtD;AACD,QAAA,OAAO,MAAM,CAAC;KACjB,CAAC,CACL,CAAC;AACF,IAAA,OAAO,aAAa,CAAC;AACzB"}
@@ -0,0 +1,3 @@
1
+ export declare const middleware: ({ context }: {
2
+ context: any;
3
+ }, dataLoader: any, next: any) => Promise<void>;
@@ -0,0 +1,19 @@
1
+ const middleware = async ({ context }, dataLoader, next) => {
2
+ const { modules } = context;
3
+ try {
4
+ const plugins = modules.getComponentFillPlugins();
5
+ const loadedPlugins = await Promise.all(plugins.map(async (plugin) => {
6
+ if (plugin.renderImporter) {
7
+ const module = await plugin.renderImporter();
8
+ const ImportedComponent = module.default;
9
+ return { ...plugin, Component: ImportedComponent };
10
+ }
11
+ return plugin;
12
+ }));
13
+ dataLoader.loadedPlugins = loadedPlugins;
14
+ }
15
+ catch (error) {
16
+ console.error(error, 'Error with plugin middleware');
17
+ }
18
+ await next();
19
+ };export{middleware};//# sourceMappingURL=middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.js","sources":["../../src/plugin/middleware.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEO,MAAM,UAAU,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,KAAI;AAC9D,IAAA,MAAM,EAAE,OAAO,EAAE,GAAG,OAA0B,CAAC;AAE/C,IAAA,IAAI;AACA,QAAA,MAAM,OAAO,GAAI,OAAe,CAAC,uBAAuB,EAAE,CAAC;AAC3D,QAAA,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,GAAG,CACnC,OAAO,CAAC,GAAG,CAAC,OAAO,MAAW,KAAI;AAC9B,YAAA,IAAI,MAAM,CAAC,cAAc,EAAE;AACvB,gBAAA,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC;AAC7C,gBAAA,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC;gBACzC,OAAO,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;aACtD;AACD,YAAA,OAAO,MAAM,CAAC;SACjB,CAAC,CACL,CAAC;AACF,QAAA,UAAU,CAAC,aAAa,GAAG,aAAa,CAAC;KAC5C;IAAC,OAAO,KAAK,EAAE;AACZ,QAAA,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,8BAA8B,CAAC,CAAC;KACxD;IACD,MAAM,IAAI,EAAE,CAAC;AACjB"}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare const ChildrenRender: ({ children, ...props }: {
3
+ [x: string]: any;
4
+ children: any;
5
+ }) => React.JSX.Element;
6
+ export declare const PluginRender: (props: any) => React.JSX.Element;
@@ -0,0 +1,38 @@
1
+ import React__default,{useContext}from'react';import {DynamicRender}from'./dynamic-render.js';import {isFunction}from'../slot-fill/utils/index.js';import FillRenderContext from'./context.js';const ChildrenRender = ({ children, ...props }) => {
2
+ return React__default.createElement(React__default.Fragment, null, isFunction(children) ? children(props) : children);
3
+ };
4
+ const PluginRender = (props) => {
5
+ const loadedPlugins = useContext(FillRenderContext);
6
+ const plugins = typeof window === 'undefined' ? loadedPlugins.filter((plugin) => plugin.name === props.name) : props.fills;
7
+ return (React__default.createElement(React__default.Fragment, null, plugins.map((fill, i) => {
8
+ if (typeof window === 'undefined') {
9
+ if (fill.Component) {
10
+ return (React__default.createElement("div", { key: i, "data-slot-name": `slot-${fill.name}` },
11
+ React__default.createElement(fill.Component, { ...props })));
12
+ }
13
+ else if (fill.render) {
14
+ let children = null;
15
+ try {
16
+ const FillComponent = fill.render();
17
+ children = FillComponent.props?.children;
18
+ }
19
+ catch (error) {
20
+ console.error('Error in PluginRender', error);
21
+ }
22
+ if (children) {
23
+ return (React__default.createElement("div", { key: i, "data-slot-name": `slot-${fill.name}` },
24
+ React__default.createElement(ChildrenRender, { ...props, children: children })));
25
+ }
26
+ }
27
+ }
28
+ else {
29
+ if (fill.renderImporter) {
30
+ return React__default.createElement(DynamicRender, { key: i, ...props, renderImporter: fill.renderImporter });
31
+ }
32
+ else if (fill.children) {
33
+ return React__default.createElement(ChildrenRender, { key: i, ...props, children: fill.children });
34
+ }
35
+ }
36
+ return null;
37
+ })));
38
+ };export{ChildrenRender,PluginRender};//# sourceMappingURL=plugin-render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-render.js","sources":["../../src/plugin/plugin-render.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"+LAMO,MAAM,cAAc,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,KAAI;AACrD,IAAA,OAAOA,4DAAG,UAAU,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAI,CAAC;AACpE,EAAE;AAEW,MAAA,YAAY,GAAG,CAAC,KAAK,KAAI;AAClC,IAAA,MAAM,aAAa,GAAQ,UAAU,CAAqB,iBAAiB,CAAC,CAAC;AAE7E,IAAA,MAAM,OAAO,GACT,OAAO,MAAM,KAAK,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;IAE/G,QACIA,cACK,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA,EAAA,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAI;AACrB,QAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AAC/B,YAAA,IAAI,IAAI,CAAC,SAAS,EAAE;gBAChB,QACIA,cAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GAAG,EAAE,CAAC,oBAAkB,CAAQ,KAAA,EAAA,IAAI,CAAC,IAAI,CAAE,CAAA,EAAA;oBAC5CA,cAAC,CAAA,aAAA,CAAA,IAAI,CAAC,SAAS,EAAA,EAAA,GAAK,KAAK,EAAI,CAAA,CAC3B,EACR;aACL;AAAM,iBAAA,IAAI,IAAI,CAAC,MAAM,EAAE;gBACpB,IAAI,QAAQ,GAAG,IAAI,CAAC;AACpB,gBAAA,IAAI;AACA,oBAAA,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;AACpC,oBAAA,QAAQ,GAAG,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC;iBAC5C;gBAAC,OAAO,KAAK,EAAE;AACZ,oBAAA,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;iBACjD;gBACD,IAAI,QAAQ,EAAE;oBACV,QACIA,cAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GAAG,EAAE,CAAC,oBAAkB,CAAQ,KAAA,EAAA,IAAI,CAAC,IAAI,CAAE,CAAA,EAAA;wBAC5CA,cAAC,CAAA,aAAA,CAAA,cAAc,EAAK,EAAA,GAAA,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAA,CAAI,CAC/C,EACR;iBACL;aACJ;SACJ;aAAM;AACH,YAAA,IAAI,IAAI,CAAC,cAAc,EAAE;AACrB,gBAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,aAAa,EAAC,EAAA,GAAG,EAAE,CAAC,EAAA,GAAM,KAAK,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,GAAI,CAAC;aACpF;AAAM,iBAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;AACtB,gBAAA,OAAOA,cAAC,CAAA,aAAA,CAAA,cAAc,EAAC,EAAA,GAAG,EAAE,CAAC,EAAA,GAAM,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,GAAI,CAAC;aACzE;SACJ;AACD,QAAA,OAAO,IAAI,CAAC;KACf,CAAC,CACH,EACL;AACN"}
@@ -0,0 +1,6 @@
1
+ import React, { ReactNode } from 'react';
2
+ interface FillRenderProviderProps {
3
+ children: ReactNode;
4
+ }
5
+ declare const FillRenderProvider: React.FC<FillRenderProviderProps>;
6
+ export default FillRenderProvider;
@@ -0,0 +1,4 @@
1
+ import React__default from'react';import {useLoaderData}from'@remix-run/react';import FillRenderContext from'./context.js';const FillRenderProvider = ({ children }) => {
2
+ const { loadedPlugins } = useLoaderData();
3
+ return React__default.createElement(FillRenderContext.Provider, { value: loadedPlugins }, children);
4
+ };export{FillRenderProvider as default};//# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sources":["../../src/plugin/provider.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"2HAQA,MAAM,kBAAkB,GAAsC,CAAC,EAAE,QAAQ,EAAE,KAAI;AAC3E,IAAA,MAAM,EAAE,aAAa,EAAE,GAAQ,aAAa,EAAE,CAAC;IAE/C,OAAOA,cAAA,CAAA,aAAA,CAAC,iBAAiB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,aAAa,EAAA,EAAG,QAAQ,CAA8B,CAAC;AACrG"}
@@ -0,0 +1 @@
1
+ export declare function resolveComponent(renderImporter: string): Promise<any>;
@@ -1,10 +1,11 @@
1
- import React__default,{useRef}from'react';import {createPortal}from'react-dom';import {Consumer}from'./context.js';import {useSlot}from'./use-slot.js';const FillComponent = ({ name, children, registerFill, unregisterFill, serverMode }) => {
1
+ import React__default,{useRef}from'react';import {Consumer}from'./context.js';import {useSlot}from'./use-slot.js';const FillComponent = ({ name, renderImporter, children, registerFill, unregisterFill, serverMode, }) => {
2
2
  const slot = useSlot(name);
3
3
  let useLayoutEffect;
4
+ const nodeProps = { renderImporter, children };
4
5
  if (serverMode) {
5
6
  useLayoutEffect = (args) => { };
6
- if (!!name && !!children) {
7
- registerFill(name, children);
7
+ if (!!name) {
8
+ registerFill(name, nodeProps);
8
9
  }
9
10
  return null;
10
11
  }
@@ -13,33 +14,33 @@ import React__default,{useRef}from'react';import {createPortal}from'react-dom';i
13
14
  }
14
15
  const ref = useRef({
15
16
  name,
16
- children,
17
+ nodeProps,
17
18
  });
18
19
  useLayoutEffect(() => {
19
20
  const refValue = ref.current;
20
- registerFill(name, refValue);
21
- return () => unregisterFill(name, refValue);
21
+ registerFill(name, refValue.nodeProps);
22
+ return () => unregisterFill(name, refValue.nodeProps);
22
23
  // Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
23
24
  // We'll leave them as-is until a more detailed investigation/refactor can be performed.
24
25
  // eslint-disable-next-line react-hooks/exhaustive-deps
25
26
  }, []);
26
27
  useLayoutEffect(() => {
27
- ref.current.children = children;
28
+ ref.current.nodeProps = nodeProps;
28
29
  if (slot) {
29
30
  slot.forceUpdate();
30
31
  }
31
32
  // Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
32
33
  // We'll leave them as-is until a more detailed investigation/refactor can be performed.
33
34
  // eslint-disable-next-line react-hooks/exhaustive-deps
34
- }, [children]);
35
+ }, [renderImporter, children]);
35
36
  useLayoutEffect(() => {
36
37
  if (name === ref.current.name) {
37
38
  // ignore initial effect
38
39
  return;
39
40
  }
40
- unregisterFill(ref.current.name, ref.current);
41
+ unregisterFill(ref.current.name, ref.current.nodeProps);
41
42
  ref.current.name = name;
42
- registerFill(name, ref.current);
43
+ registerFill(name, ref.current.nodeProps);
43
44
  // Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
44
45
  // We'll leave them as-is until a more detailed investigation/refactor can be performed.
45
46
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -48,12 +49,13 @@ import React__default,{useRef}from'react';import {createPortal}from'react-dom';i
48
49
  return null;
49
50
  }
50
51
  // If a function is passed as a child, provide it with the fillProps.
51
- if (typeof children === 'function') {
52
- children = children(slot.props.fillProps);
53
- }
54
- return createPortal(children, slot.node);
52
+ // if (typeof children === 'function') {
53
+ // children = children(slot.props.fillProps);
54
+ // }
55
+ // return createPortal(children, slot.node);
56
+ return React__default.createElement(React__default.Fragment, null);
55
57
  };
56
58
  const Fill = (props) => {
57
- const serverMode = (typeof window === 'undefined');
59
+ const serverMode = typeof window === 'undefined';
58
60
  return (React__default.createElement(Consumer, null, ({ registerFill, unregisterFill }) => (React__default.createElement(FillComponent, { ...props, registerFill: registerFill, unregisterFill: unregisterFill, serverMode: serverMode }))));
59
61
  };export{Fill as default};//# sourceMappingURL=fill.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fill.js","sources":["../../../src/slot-fill/base/fill.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"uJASA,MAAM,aAAa,GAAG,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAyB,KAAI;AAC1G,IAAA,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAC3B,IAAA,IAAI,eAAe,CAAC;IAEpB,IAAI,UAAU,EAAE;AACZ,QAAA,eAAe,GAAG,CAAC,IAAI,KAAI,GAAG,CAAC;QAC/B,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,QAAQ,EAAE;AACtB,YAAA,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;SAChC;AACD,QAAA,OAAO,IAAI,CAAC;KACf;SAAM;AACH,QAAA,eAAe,GAAGA,cAAK,CAAC,eAAe,CAAC;KAC3C;IAED,MAAM,GAAG,GAAG,MAAM,CAAC;QACf,IAAI;QACJ,QAAQ;AACX,KAAA,CAAC,CAAC;IAEH,eAAe,CAAC,MAAK;AACjB,QAAA,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC;AAC7B,QAAA,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC7B,OAAO,MAAM,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;;;;KAI/C,EAAE,EAAE,CAAC,CAAC;IAEP,eAAe,CAAC,MAAK;AACjB,QAAA,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAChC,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,WAAW,EAAE,CAAC;SACtB;;;;AAIL,KAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,eAAe,CAAC,MAA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QACxB,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;;;;AAI9C,KAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;AACrB,QAAA,OAAO,IAAI,CAAC;KACf;;;;;;AAQD,IAAA,OAAOA,2DAAK,CAAC;AACjB,CAAC,CAAC;AAOF,MAAM,IAAI,GAAmB,CAAC,KAAK,KAAI;AACnC,IAAA,MAAM,UAAU,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;AACjD,IAAA,QACIA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,IAAA,EACJ,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,MAC9BA,6BAAC,aAAa,EAAA,EAAA,GACN,KAAK,EACT,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EAAA,CACxB,CACL,CACM,EACb;AACN"}
@@ -1,24 +1,7 @@
1
- import React, { Component, ReactNode } from 'react';
2
- import { IFill, ISlot } from '../interfaces';
3
- declare class SlotFillProvider extends Component<{
1
+ import React, { ReactNode } from 'react';
2
+ interface SlotFillProviderProps {
4
3
  children: ReactNode;
5
- }, {}> {
6
- private slots;
7
- private fills;
8
- private listeners;
9
- private contextValue;
10
- private returnValue;
11
- constructor(props: any);
12
- registerSlot(name: any, slot: any): void;
13
- registerFill(name: any, instance: any): void;
14
- unregisterSlot(name: any, instance: any): void;
15
- unregisterFill(name: any, instance: IFill): void;
16
- getSlot(name: any): ISlot;
17
- getFills(name: any, slotInstance: any): IFill[];
18
- hasFills(name: any): boolean;
19
- private forceUpdateSlot;
20
- private triggerListeners;
21
- subscribe(listener: any): () => void;
22
- render(): React.JSX.Element;
4
+ context?: any;
23
5
  }
6
+ declare const SlotFillProvider: React.FC<SlotFillProviderProps>;
24
7
  export default SlotFillProvider;
@@ -1,100 +1,78 @@
1
- import React__default,{Component}from'react';import {sortBy}from'lodash-es';import {Provider}from'./context.js';class SlotFillProvider extends Component {
2
- slots;
3
- fills;
4
- listeners;
5
- contextValue;
6
- returnValue;
7
- constructor(props) {
8
- super(props);
9
- this.registerSlot = this.registerSlot.bind(this);
10
- this.registerFill = this.registerFill.bind(this);
11
- this.unregisterSlot = this.unregisterSlot.bind(this);
12
- this.unregisterFill = this.unregisterFill.bind(this);
13
- this.getSlot = this.getSlot.bind(this);
14
- this.getFills = this.getFills.bind(this);
15
- this.subscribe = this.subscribe.bind(this);
16
- this.slots = {};
17
- this.fills = {};
18
- this.listeners = [];
19
- this.contextValue = {
20
- registerSlot: this.registerSlot,
21
- unregisterSlot: this.unregisterSlot,
22
- registerFill: this.registerFill,
23
- unregisterFill: this.unregisterFill,
24
- getSlot: this.getSlot,
25
- getFills: this.getFills,
26
- hasFills: this.hasFills,
27
- subscribe: this.subscribe,
28
- };
29
- if (props.context) {
30
- this.returnValue = props.context;
31
- this.returnValue.fills = this.fills;
1
+ import React__default,{useRef,useCallback}from'react';import {sortBy}from'lodash-es';import {Provider}from'./context.js';const SlotFillProvider = ({ children, context }) => {
2
+ const slots = useRef({});
3
+ const fills = useRef({});
4
+ const listeners = useRef([]);
5
+ const returnValue = useRef(context);
6
+ const forceUpdateSlot = useCallback((name) => {
7
+ const slot = slots.current[name];
8
+ if (slot) {
9
+ slot.forceUpdate();
32
10
  }
33
- }
34
- registerSlot(name, slot) {
35
- const previousSlot = this.slots[name];
36
- this.slots[name] = slot;
37
- this.triggerListeners();
11
+ }, []);
12
+ const triggerListeners = useCallback(() => {
13
+ listeners.current.forEach((listener) => listener());
14
+ }, []);
15
+ const registerSlot = useCallback((name, slot) => {
16
+ const previousSlot = slots.current[name];
17
+ slots.current[name] = slot;
18
+ triggerListeners();
38
19
  // Sometimes the fills are registered after the initial render of slot
39
20
  // But before the registerSlot call, we need to rerender the slot
40
- this.forceUpdateSlot(name);
21
+ forceUpdateSlot(name);
41
22
  // If a new instance of a slot is being mounted while another with the
42
23
  // same name exists, force its update _after_ the new slot has been
43
- // assigned into the instance, suich that its own rendering of children
24
+ // assigned into the instance, such that its own rendering of children
44
25
  // will be empty (the new Slot will subsume all fills for this name).
45
26
  if (previousSlot) {
46
27
  previousSlot.forceUpdate();
47
28
  }
48
- }
49
- registerFill(name, instance) {
50
- this.fills[name] = [...(this.fills[name] || []), instance];
51
- this.forceUpdateSlot(name);
52
- }
53
- unregisterSlot(name, instance) {
29
+ }, [forceUpdateSlot, triggerListeners]);
30
+ const registerFill = useCallback((name, instance) => {
31
+ fills.current[name] = [...(fills.current[name] || []), instance];
32
+ forceUpdateSlot(name);
33
+ }, [forceUpdateSlot]);
34
+ const unregisterSlot = useCallback((name, instance) => {
54
35
  // If a previous instance of a Slot by this name unmounts, do nothing,
55
36
  // as the slot and its fills should only be removed for the current
56
37
  // known instance.
57
- if (this.slots[name] !== instance) {
38
+ if (slots.current[name] !== instance) {
58
39
  return;
59
40
  }
60
- delete this.slots[name];
61
- this.triggerListeners();
62
- }
63
- unregisterFill(name, instance) {
64
- this.fills[name] = this.fills[name]?.filter((fill) => fill !== instance) ?? [];
65
- this.forceUpdateSlot(name);
66
- }
67
- getSlot(name) {
68
- return this.slots[name];
69
- }
70
- getFills(name, slotInstance) {
71
- // Commented following as we need the Slot to render at multiple places
72
- // Fills should only be returned for the current instance of the slot
73
- // in which they occupy.
74
- // if (this.slots[name] !== slotInstance) {
75
- // return [];
76
- // }
77
- return sortBy(this.fills[name]);
78
- }
79
- hasFills(name) {
80
- return this.fills[name] && !!this.fills[name].length;
81
- }
82
- forceUpdateSlot(name) {
83
- const slot = this.getSlot(name);
84
- if (slot) {
85
- slot.forceUpdate();
86
- }
87
- }
88
- triggerListeners() {
89
- this.listeners.forEach((listener) => listener());
90
- }
91
- subscribe(listener) {
92
- this.listeners.push(listener);
41
+ delete slots.current[name];
42
+ triggerListeners();
43
+ }, [triggerListeners]);
44
+ const unregisterFill = useCallback((name, instance) => {
45
+ fills.current[name] = fills.current[name]?.filter((fill) => fill !== instance) ?? [];
46
+ forceUpdateSlot(name);
47
+ }, [forceUpdateSlot]);
48
+ const getSlot = useCallback((name) => {
49
+ return slots.current[name];
50
+ }, []);
51
+ const getFills = useCallback((name, slotInstance) => {
52
+ return sortBy(fills.current[name]);
53
+ }, []);
54
+ const hasFills = useCallback((name) => {
55
+ return fills.current[name] && !!fills.current[name].length;
56
+ }, []);
57
+ const subscribe = useCallback((listener) => {
58
+ listeners.current.push(listener);
93
59
  return () => {
94
- this.listeners = this.listeners.filter((l) => l !== listener);
60
+ listeners.current = listeners.current.filter((l) => l !== listener);
95
61
  };
62
+ }, []);
63
+ const contextValue = {
64
+ registerSlot,
65
+ unregisterSlot,
66
+ registerFill,
67
+ unregisterFill,
68
+ getSlot,
69
+ getFills,
70
+ hasFills,
71
+ subscribe,
72
+ };
73
+ if (context) {
74
+ returnValue.current = context;
75
+ returnValue.current.fills = fills.current;
96
76
  }
97
- render() {
98
- return React__default.createElement(Provider, { value: this.contextValue }, this.props.children);
99
- }
100
- }export{SlotFillProvider as default};//# sourceMappingURL=provider.js.map
77
+ return React__default.createElement(Provider, { value: contextValue }, children);
78
+ };export{SlotFillProvider as default};//# sourceMappingURL=provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sources":["../../../src/slot-fill/base/provider.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"gHAKA,MAAM,gBAAiB,SAAQ,SAAsC,CAAA;AACzD,IAAA,KAAK,CAA2B;AAChC,IAAA,KAAK,CAA6B;AAClC,IAAA,SAAS,CAAC;AACV,IAAA,YAAY,CAAiB;AAC7B,IAAA,WAAW,CAAC;AACpB,IAAA,WAAA,CAAY,KAAK,EAAA;QACb,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YA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jC,QAAA,OAAO,MAAK;AACR,YAAA,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAC,CAAC;AACxE,SAAC,CAAC;KACL,EAAE,EAAE,CAAC,CAAC;AAEP,IAAA,MAAM,YAAY,GAAmB;QACjC,YAAY;QACZ,cAAc;QACd,YAAY;QACZ,cAAc;QACd,OAAO;QACP,QAAQ;QACR,QAAQ;QACR,SAAS;KACZ,CAAC;IAEF,IAAI,OAAO,EAAE;AACT,QAAA,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;QAC9B,WAAW,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;KAC7C;IAED,OAAOA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAC,EAAA,KAAK,EAAE,YAAY,EAAA,EAAG,QAAQ,CAAY,CAAC;AAChE"}
@@ -1,87 +1,62 @@
1
- import React__default,{Component,Children,cloneElement}from'react';import {Consumer}from'./context.js';import {isEmptyElement}from'../utils/isEmptyElement.js';/**
2
- * Whether the argument is a function.
3
- *
4
- * @param {*} maybeFunc The argument to check.
5
- * @returns {boolean} True if the argument is a function, false otherwise.
6
- */
7
- function isFunction(maybeFunc) {
8
- return typeof maybeFunc === 'function';
9
- }
10
- class SlotComponent extends Component {
11
- node;
12
- isUnmounted;
13
- constructor(props) {
14
- super(props);
15
- this.isUnmounted = false;
16
- this.bindNode = this.bindNode.bind(this);
17
- }
18
- componentDidMount() {
19
- const { registerSlot, serverMode } = this.props;
1
+ import React__default,{useRef,useState,useEffect,useCallback}from'react';import {Consumer}from'./context.js';import {PluginRender}from'../../plugin/plugin-render.js';const SlotComponent = (props) => {
2
+ const { registerSlot, unregisterSlot, getFills, serverMode, name, fillProps = {}, children } = props;
3
+ const nodeRef = useRef(null);
4
+ const isUnmountedRef = useRef(false);
5
+ const [_, setState] = useState({});
6
+ useEffect(() => {
20
7
  if (!serverMode) {
21
- registerSlot(this.props.name, this);
8
+ registerSlot(name, nodeRef.current);
22
9
  }
23
- }
24
- componentWillUnmount() {
25
- const { unregisterSlot } = this.props;
26
- this.isUnmounted = true;
27
- unregisterSlot(this.props.name, this);
28
- }
29
- componentDidUpdate(prevProps) {
30
- this.props;
31
- // Commented following as we need the Slot to render at multiple places
32
- // if (prevProps.name !== name) {
33
- // unregisterSlot(prevProps.name);
34
- // registerSlot(name, this);
35
- // }
36
- }
37
- bindNode(node) {
38
- this.node = node;
39
- }
40
- forceUpdate() {
41
- if (this.isUnmounted) {
10
+ return () => {
11
+ isUnmountedRef.current = true;
12
+ unregisterSlot(name, nodeRef.current);
13
+ };
14
+ }, [name, registerSlot, unregisterSlot, serverMode]);
15
+ useCallback(() => {
16
+ if (isUnmountedRef.current) {
42
17
  return;
43
18
  }
44
- if (!this.props.serverMode) {
45
- super.forceUpdate();
46
- }
47
- }
48
- render() {
49
- const { children, name, fillProps = {}, getFills, serverMode } = this.props;
50
- if (serverMode) {
51
- const fills = (getFills(name, this) ?? [])
52
- .map((fill, i) => {
53
- // unregisterFill(name, fill);
54
- if (typeof fill === 'function') {
55
- const child = fill({ ...fillProps, key: i });
56
- return React__default.createElement("div", { "data-slot-name": `slot-${name}` }, child);
57
- }
58
- return null;
59
- });
60
- return fills;
19
+ if (!serverMode) {
20
+ // Trigger re-render
21
+ console.log(`The slot ${name} is being updated`);
22
+ setState({});
61
23
  }
62
- const fills = (getFills(name, this) ?? [])
63
- .map((fill) => {
64
- const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children;
65
- return Children.map(fillChildren, (child, childIndex) => {
66
- if (!child || typeof child === 'string') {
67
- return child;
68
- }
69
- const childKey = child.key || childIndex;
70
- return cloneElement(child, { key: childKey });
71
- });
72
- })
73
- .filter(
74
- // In some cases fills are rendered only when some conditions apply.
75
- // This ensures that we only use non-empty fills when rendering, i.e.,
76
- // it allows us to render wrappers only when the fills are actually present.
77
- (element) => !isEmptyElement(element));
78
- return React__default.createElement(React__default.Fragment, null, isFunction(children) ? children(fills) : fills);
24
+ }, [serverMode]);
25
+ // const fills = (getFills(name) ?? [])
26
+ // .map((fill: any, i) => {
27
+ // if (serverMode) {
28
+ // if (typeof fill === 'function') {
29
+ // const child = fill({...fillProps, key: i});
30
+ // return <div data-slot-name={`slot-${name}`}>{child}</div>;
31
+ // }
32
+ // return null;
33
+ // } else {
34
+ // const fillChildren: ReactElement = isFunction(fill.children) ? fill.children(fillProps) : fill.children;
35
+ // return Children.map(fillChildren, (child, childIndex) => {
36
+ // if (!child || typeof child === 'string') {
37
+ // return child;
38
+ // }
39
+ // const childKey = child.key || childIndex;
40
+ // return cloneElement(child, { key: childKey });
41
+ // });
42
+ // }
43
+ // })
44
+ // .filter(
45
+ // // In some cases fills are rendered only when some conditions apply.
46
+ // // This ensures that we only use non-empty fills when rendering, i.e.,
47
+ // // it allows us to render wrappers only when the fills are actually present.
48
+ // (element) => !isEmptyElement(element),
49
+ // );
50
+ const fills = getFills(name);
51
+ if (fills.length > 0) {
52
+ return React__default.createElement(PluginRender, { ...fillProps, name: name, fills: fills });
79
53
  }
80
- }
54
+ return null;
55
+ };
81
56
  const Slot = (props) => {
82
- const serverMode = (typeof window === 'undefined');
57
+ const serverMode = typeof window === 'undefined';
83
58
  return (React__default.createElement(Consumer, null, ({ registerSlot, unregisterSlot, getFills }) => (React__default.createElement(SlotComponent, { ...props,
84
- // We need to add id to fillProps with slot name,
59
+ // We need to add id to fillProps with slot name,
85
60
  // so that we can use it when remove the component during hydration.
86
61
  getFills: getFills, registerSlot: registerSlot, unregisterSlot: unregisterSlot, serverMode: serverMode }))));
87
62
  };export{Slot as default};//# sourceMappingURL=slot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slot.js","sources":["../../../src/slot-fill/base/slot.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"+JASA;;;;;AAKG;AACH,SAAS,UAAU,CAAC,SAAS,EAAA;AACzB,IAAA,OAAO,OAAO,SAAS,K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aAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,IAAI,EAAM,GAAA,KAAK,GAAI,CAAC;AACnF,IAAA,aAAa,CAAC,WAAW,GAAG,IAAI,GAAG,MAAM,CAAC;AAC1C,IAAA,aAAa,CAAC,cAAc,GAAG,IAAI,CAAC;IAEpC,OAAO;AACL,QAAA,IAAI,EAAE,aAAa;AACnB,QAAA,IAAI,EAAE,aAAa;KACpB,CAAC;AACJ"}
1
+ {"version":3,"file":"index.js","sources":["../../src/slot-fill/index.tsx"],"sourcesContent":[null],"names":["React","BaseFill","BubblesVirtuallyFill","BaseSlot","BubblesVirtuallySlotFillProvider"],"mappings":"6ZAaM,SAAU,IAAI,CAAC,KAAK,EAAA;;;;AAItB,IAAA,QACIA,cAAA,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA;QACIA,cAAC,CAAA,aAAA,CAAAC,MAAQ,EAAK,EAAA,GAAA,KAAK,EAAI,CAAA;AACvB,QAAAD,cAAA,CAAA,aAAA,CAACE,MAAoB,EAAK,EAAA,GAAA,KAAK,EAAI,CAAA,CACpC,EACL;AACN,CAAC;AAEY,MAAA,IAAI,GAAG,UAAU,CAAC,CAAC,EAAE,gBAAgB,EAAE,GAAG,KAAK,EAAc,EAAE,GAAG,KAAI;IAC/E,IAAI,gBAAgB,EAAE;QAClB,OAAOF,cAAA,CAAA,aAAA,CAAC,oBAAoB,EAAK,EAAA,GAAA,KAAK,EAAE,GAAG,EAAE,GAAG,EAAA,CAAI,CAAC;KACxD;AACD,IAAA,OAAOA,cAAC,CAAA,aAAA,CAAAG,MAAQ,EAAK,EAAA,GAAA,KAAK,GAAI,CAAC;AACnC,CAAC,EAAE;AAEG,SAAU,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAA;AAC3C,IAAA,QACIH,cAAA,CAAA,aAAA,CAAC,gBAAgB,EAAA,EAAA,GAAK,KAAK,EAAA;AACvB,QAAAA,cAAA,CAAA,aAAA,CAACI,kBAAgC,EAAE,IAAA,EAAA,QAAQ,CAAoC,CAChE,EACrB;AACN,CAAC;AAEK,SAAU,cAAc,CAAkC,IAAY,EAAA;AACxE,IAAA,MAAM,aAAa,GAAG,CAAC,KAAyB,KAAKJ,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,IAAI,EAAM,GAAA,KAAK,GAAI,CAAC;AACrF,IAAA,aAAa,CAAC,WAAW,GAAG,IAAI,GAAG,MAAM,CAAC;AAE1C,IAAA,MAAM,aAAa,GAAG,CAAC,KAAuB,KAAKA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,IAAI,EAAM,GAAA,KAAK,GAAI,CAAC;AACnF,IAAA,aAAa,CAAC,WAAW,GAAG,IAAI,GAAG,MAAM,CAAC;AAC1C,IAAA,aAAa,CAAC,cAAc,GAAG,IAAI,CAAC;IAEpC,OAAO;AACH,QAAA,IAAI,EAAE,aAAa;AACnB,QAAA,IAAI,EAAE,aAAa;KACtB,CAAC;AACN"}
@@ -1,3 +1,10 @@
1
1
  export * from './isEmptyElement';
2
2
  export * from './removeUniversalPortals';
3
3
  export * from './replaceServerFills';
4
+ /**
5
+ * Whether the argument is a function.
6
+ *
7
+ * @param {*} maybeFunc The argument to check.
8
+ * @returns {boolean} True if the argument is a function, false otherwise.
9
+ */
10
+ export declare function isFunction(maybeFunc: any): boolean;
@@ -0,0 +1,9 @@
1
+ import'cheerio';/**
2
+ * Whether the argument is a function.
3
+ *
4
+ * @param {*} maybeFunc The argument to check.
5
+ * @returns {boolean} True if the argument is a function, false otherwise.
6
+ */
7
+ function isFunction(maybeFunc) {
8
+ return typeof maybeFunc === 'function';
9
+ }export{isFunction};//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/slot-fill/utils/index.ts"],"sourcesContent":[null],"names":[],"mappings":"gBAIA;;;;;AAKG;AACG,SAAU,UAAU,CAAC,SAAc,EAAA;AACrC,IAAA,OAAO,OAAO,SAAS,KAAK,UAAU,CAAC;AAC3C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common-stack/components-pro",
3
- "version": "8.0.1-alpha.0",
3
+ "version": "8.0.2-alpha.1",
4
4
  "description": "browser plugin for git",
5
5
  "homepage": "https://github.com/cdmbase/fullstack-pro#readme",
6
6
  "bugs": {
@@ -30,6 +30,7 @@
30
30
  "watch": "npm run build:lib:watch"
31
31
  },
32
32
  "dependencies": {
33
+ "@common-stack/client-core": "8.0.2-alpha.0",
33
34
  "@wordpress/element": "^5.30.0",
34
35
  "@wordpress/hooks": "^3.53.0",
35
36
  "@wordpress/is-shallow-equal": "^4.53.0",
@@ -52,5 +53,5 @@
52
53
  "typescript": {
53
54
  "definition": "lib/index.d.ts"
54
55
  },
55
- "gitHead": "73d9088ae254fbc43425eed5c9f5cd95bd66e921"
56
+ "gitHead": "82a7dcad7dc514c2cc92ec8f12832838c1fbec1a"
56
57
  }
@@ -1,15 +0,0 @@
1
- /**
2
- * Checks if the provided element to check.
3
- *
4
- * @param element React Component to check.
5
- * @returns True when an element is considered empty.
6
- */
7
- const isEmptyElement = (element) => {
8
- if (typeof element === 'number') {
9
- return false;
10
- }
11
- if (typeof element?.valueOf() === 'string' || Array.isArray(element)) {
12
- return !element.length;
13
- }
14
- return !element;
15
- };export{isEmptyElement};//# sourceMappingURL=isEmptyElement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isEmptyElement.js","sources":["../../../src/slot-fill/utils/isEmptyElement.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;AAKG;AAEU,MAAA,cAAc,GAAG,CAAE,OAAO,KAAK;AAC3C,IAAA,IAAK,OAAO,OAAO,KAAK,QAAQ,EAAG;AAClC,QAAA,OAAO,KAAK,CAAC;KACb;AAED,IAAA,IAAK,OAAO,OAAO,EAAE,OAAO,EAAE,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAE,OAAO,CAAE,EAAG;AACzE,QAAA,OAAO,CAAE,OAAO,CAAC,MAAM,CAAC;KACxB;IAED,OAAO,CAAE,OAAO,CAAC;AAClB"}