@pack/react 0.1.1 → 0.1.2

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/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { RenderSections } from "./render-sections";
1
+ import { RenderSections, useSections } from "./render-sections";
2
2
  import { PreviewProvider } from "./preview/preview-provider";
3
3
  import { usePreviewContext } from "./preview/preview-content";
4
4
  import { useSiteSettings } from "./use-site-settings";
5
5
  import { useOverlayScript } from "./use-overlay-script";
6
6
  import { registerSection } from "./register-section";
7
7
  import { registerStorefrontSettingsSchema } from "./register-storefront-settings-schema";
8
- export { registerSection, registerStorefrontSettingsSchema, usePreviewContext, useSiteSettings, useOverlayScript, PreviewProvider, RenderSections, };
8
+ export { registerSection, registerStorefrontSettingsSchema, usePreviewContext, useSiteSettings, useOverlayScript, PreviewProvider, RenderSections, useSections, };
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAEzF,OAAO,EACL,eAAe,EACf,gCAAgC,EAChC,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAEzF,OAAO,EACL,eAAe,EACf,gCAAgC,EAChC,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,WAAW,GACZ,CAAC"}
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { RenderSections } from "./render-sections";
1
+ import { RenderSections, useSections } from "./render-sections";
2
2
  import { PreviewProvider } from "./preview/preview-provider";
3
3
  import { usePreviewContext } from "./preview/preview-content";
4
4
  import { useSiteSettings } from "./use-site-settings";
5
5
  import { useOverlayScript } from "./use-overlay-script";
6
6
  import { registerSection } from "./register-section";
7
7
  import { registerStorefrontSettingsSchema } from "./register-storefront-settings-schema";
8
- export { registerSection, registerStorefrontSettingsSchema, usePreviewContext, useSiteSettings, useOverlayScript, PreviewProvider, RenderSections, };
8
+ export { registerSection, registerStorefrontSettingsSchema, usePreviewContext, useSiteSettings, useOverlayScript, PreviewProvider, RenderSections, useSections, };
@@ -1,3 +1,4 @@
1
1
  import React from "react";
2
+ export declare function useSections({ content }: any): any;
2
3
  export declare function RenderSections({ content }: any): React.JSX.Element | null;
3
4
  //# sourceMappingURL=render-sections.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-sections.d.ts","sourceRoot":"","sources":["../src/render-sections.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAoClD,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,4BAiC9C"}
1
+ {"version":3,"file":"render-sections.d.ts","sourceRoot":"","sources":["../src/render-sections.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAuElD,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,OAM3C;AAED,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,4BAI9C"}
@@ -25,7 +25,7 @@ function Sections({ sections }) {
25
25
  }, [sections]);
26
26
  return React.createElement(React.Fragment, null, renderedSections);
27
27
  }
28
- export function RenderSections({ content }) {
28
+ function useRenderSections({ content }) {
29
29
  const { isPreview, setPreviewStorefrontSettings, customizerMeta } = usePreviewContext();
30
30
  const { content: liveContent, storefrontSettings } = useCustomizerShell({
31
31
  environment: "production",
@@ -49,6 +49,19 @@ export function RenderSections({ content }) {
49
49
  const sections = useMemo(() => {
50
50
  return liveContent?.sections?.nodes || liveContent?.sections;
51
51
  }, [liveContent?.sections]);
52
+ return {
53
+ sections,
54
+ };
55
+ }
56
+ export function useSections({ content }) {
57
+ const { sections } = useRenderSections({ content });
58
+ if (!sections)
59
+ return null;
60
+ const visibleSections = Sections({ sections });
61
+ return visibleSections?.props?.children || null;
62
+ }
63
+ export function RenderSections({ content }) {
64
+ const { sections } = useRenderSections({ content });
52
65
  if (!sections)
53
66
  return null;
54
67
  return React.createElement(Sections, { sections: sections });
@@ -1 +1 @@
1
- {"version":3,"file":"use-overlay-script.d.ts","sourceRoot":"","sources":["../src/use-overlay-script.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,IAAI,CAAC,EAAE;YACL,uBAAuB,EAAE,OAAO,CAAC;SAClC,CAAC;KACH;CACF;AAED,eAAO,MAAM,gBAAgB,4BAG1B;IACD,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C,SAkBA,CAAC"}
1
+ {"version":3,"file":"use-overlay-script.d.ts","sourceRoot":"","sources":["../src/use-overlay-script.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,IAAI,CAAC,EAAE;YACL,uBAAuB,EAAE,OAAO,CAAC;SAClC,CAAC;KACH;CACF;AAED,eAAO,MAAM,gBAAgB;eAIhB,OAAO;aACT;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;UAmB5C,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pack/react",
3
3
  "description": "React",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "exports": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "engines": {