@plasmicpkgs/react-scroll-parallax 0.0.258 → 0.0.260

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.
@@ -1,19 +1,19 @@
1
- import registerComponent, { CodeComponentMeta } from "@plasmicapp/host/registerComponent";
2
- import registerGlobalContext, { GlobalContextMeta } from "@plasmicapp/host/registerGlobalContext";
3
- import React from "react";
4
- import { ParallaxProviderProps } from "react-scroll-parallax";
5
- export declare function ParallaxProviderWrapper({ children, ...props }: React.PropsWithChildren<ParallaxProviderProps>): React.JSX.Element;
6
- /**
7
- * @deprecated use `globalParallaxProviderMeta` instead.
8
- */
9
- export declare const parallaxProviderMeta: CodeComponentMeta<ParallaxProviderProps>;
10
- /**
11
- * @deprecated use `registerGlobalParallaxProvider` instead.
12
- */
13
- export declare function registerParallaxProvider(loader?: {
14
- registerComponent: typeof registerComponent;
15
- }, customParallaxProviderMeta?: CodeComponentMeta<ParallaxProviderProps>): void;
16
- export declare const globalParallaxProviderMeta: GlobalContextMeta<ParallaxProviderProps>;
17
- export declare function registerGlobalParallaxProvider(loader?: {
18
- registerGlobalContext: typeof registerGlobalContext;
19
- }, customParallaxProviderMeta?: GlobalContextMeta<ParallaxProviderProps>): void;
1
+ import registerComponent, { CodeComponentMeta } from "@plasmicapp/host/registerComponent";
2
+ import registerGlobalContext, { GlobalContextMeta } from "@plasmicapp/host/registerGlobalContext";
3
+ import React from "react";
4
+ import { ParallaxProviderProps } from "react-scroll-parallax";
5
+ export declare function ParallaxProviderWrapper({ children, ...props }: React.PropsWithChildren<ParallaxProviderProps>): React.JSX.Element;
6
+ /**
7
+ * @deprecated use `globalParallaxProviderMeta` instead.
8
+ */
9
+ export declare const parallaxProviderMeta: CodeComponentMeta<ParallaxProviderProps>;
10
+ /**
11
+ * @deprecated use `registerGlobalParallaxProvider` instead.
12
+ */
13
+ export declare function registerParallaxProvider(loader?: {
14
+ registerComponent: typeof registerComponent;
15
+ }, customParallaxProviderMeta?: CodeComponentMeta<ParallaxProviderProps>): void;
16
+ export declare const globalParallaxProviderMeta: GlobalContextMeta<ParallaxProviderProps>;
17
+ export declare function registerGlobalParallaxProvider(loader?: {
18
+ registerGlobalContext: typeof registerGlobalContext;
19
+ }, customParallaxProviderMeta?: GlobalContextMeta<ParallaxProviderProps>): void;
@@ -1,28 +1,28 @@
1
- import registerComponent, { CodeComponentMeta } from "@plasmicapp/host/registerComponent";
2
- import React from "react";
3
- export interface ParallaxWrapperProps {
4
- speed?: number;
5
- disabled?: boolean;
6
- previewInEditor?: boolean;
7
- children: React.ReactNode;
8
- className?: string;
9
- }
10
- export default function ParallaxWrapper({ speed, disabled, previewInEditor, children, className, }: ParallaxWrapperProps): React.JSX.Element;
11
- /**
12
- * We're keeping the old registration without attachments to avoid confusion
13
- * due to the parallax custom behavior not working in old projects that didn't
14
- * make use of global contexts (so simply adding the custom behavior would
15
- * break it and it wouldn't be clear that the user should also add a
16
- * `ParallaxProvider`).
17
- */
18
- export declare const deprecated_parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps>;
19
- export declare function deprecated_registerParallaxWrapper(loader?: {
20
- registerComponent: typeof registerComponent;
21
- }, customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>): void;
22
- /**
23
- * The new registration is only setting `isAttachment: true`.
24
- */
25
- export declare const parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps>;
26
- export declare function registerParallaxWrapper(loader?: {
27
- registerComponent: typeof registerComponent;
28
- }, customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>): void;
1
+ import registerComponent, { CodeComponentMeta } from "@plasmicapp/host/registerComponent";
2
+ import React from "react";
3
+ export interface ParallaxWrapperProps {
4
+ speed?: number;
5
+ disabled?: boolean;
6
+ previewInEditor?: boolean;
7
+ children: React.ReactNode;
8
+ className?: string;
9
+ }
10
+ export default function ParallaxWrapper({ speed, disabled, previewInEditor, children, className, }: ParallaxWrapperProps): React.JSX.Element;
11
+ /**
12
+ * We're keeping the old registration without attachments to avoid confusion
13
+ * due to the parallax custom behavior not working in old projects that didn't
14
+ * make use of global contexts (so simply adding the custom behavior would
15
+ * break it and it wouldn't be clear that the user should also add a
16
+ * `ParallaxProvider`).
17
+ */
18
+ export declare const deprecated_parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps>;
19
+ export declare function deprecated_registerParallaxWrapper(loader?: {
20
+ registerComponent: typeof registerComponent;
21
+ }, customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>): void;
22
+ /**
23
+ * The new registration is only setting `isAttachment: true`.
24
+ */
25
+ export declare const parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps>;
26
+ export declare function registerParallaxWrapper(loader?: {
27
+ registerComponent: typeof registerComponent;
28
+ }, customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>): void;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./ParallaxWrapper";
2
- export { default as ParallaxWrapper } from "./ParallaxWrapper";
3
- export * from "./ParallaxProvider";
1
+ export * from "./ParallaxWrapper";
2
+ export { default as ParallaxWrapper } from "./ParallaxWrapper";
3
+ export * from "./ParallaxProvider";
@@ -49,12 +49,12 @@ function ParallaxWrapper(_ref) {
49
49
  className: className
50
50
  }, children);
51
51
  }
52
- /**
53
- * We're keeping the old registration without attachments to avoid confusion
54
- * due to the parallax custom behavior not working in old projects that didn't
55
- * make use of global contexts (so simply adding the custom behavior would
56
- * break it and it wouldn't be clear that the user should also add a
57
- * `ParallaxProvider`).
52
+ /**
53
+ * We're keeping the old registration without attachments to avoid confusion
54
+ * due to the parallax custom behavior not working in old projects that didn't
55
+ * make use of global contexts (so simply adding the custom behavior would
56
+ * break it and it wouldn't be clear that the user should also add a
57
+ * `ParallaxProvider`).
58
58
  */
59
59
  var deprecated_parallaxWrapperMeta = {
60
60
  name: "hostless-scroll-parallax",
@@ -97,8 +97,8 @@ function deprecated_registerParallaxWrapper(loader, customParallaxWrapperMeta) {
97
97
  registerComponent(ParallaxWrapper, customParallaxWrapperMeta != null ? customParallaxWrapperMeta : deprecated_parallaxWrapperMeta);
98
98
  }
99
99
  }
100
- /**
101
- * The new registration is only setting `isAttachment: true`.
100
+ /**
101
+ * The new registration is only setting `isAttachment: true`.
102
102
  */
103
103
  var parallaxWrapperMeta = /*#__PURE__*/_extends({}, deprecated_parallaxWrapperMeta, {
104
104
  isAttachment: true
@@ -112,11 +112,11 @@ function registerParallaxWrapper(loader, customParallaxWrapperMeta) {
112
112
  }
113
113
 
114
114
  var _excluded = ["children"];
115
- /**
116
- * A safe wrapper around `useController()` to prevent errors when
117
- * `ParallaxProvider` is missing. If the context is unavailable,
118
- * `useParallaxController()` will throw an error, which we catch and handle
119
- * gracefully by returning `null` instead of crashing the component.
115
+ /**
116
+ * A safe wrapper around `useController()` to prevent errors when
117
+ * `ParallaxProvider` is missing. If the context is unavailable,
118
+ * `useParallaxController()` will throw an error, which we catch and handle
119
+ * gracefully by returning `null` instead of crashing the component.
120
120
  */
121
121
  function useSafeController() {
122
122
  try {
@@ -125,15 +125,15 @@ function useSafeController() {
125
125
  return null; // Return null instead of throwing an error
126
126
  }
127
127
  }
128
- /**
129
- * This is required to ensure the parallax scrolling works correctly, since if
130
- * (for instance) images load after the parallax wrapper has calculated the
131
- * dimensions of the space, it will result in incorrect parallax scrolling
132
- * amounts.
133
- *
134
- * This is not great since we need to mutation-observe the whole section of the
135
- * document (which may be large), but we can probably optimize this in the
136
- * future.
128
+ /**
129
+ * This is required to ensure the parallax scrolling works correctly, since if
130
+ * (for instance) images load after the parallax wrapper has calculated the
131
+ * dimensions of the space, it will result in incorrect parallax scrolling
132
+ * amounts.
133
+ *
134
+ * This is not great since we need to mutation-observe the whole section of the
135
+ * document (which may be large), but we can probably optimize this in the
136
+ * future.
137
137
  */
138
138
  function ParallaxCacheUpdate(_ref) {
139
139
  var children = _ref.children;
@@ -165,10 +165,10 @@ function ParallaxCacheUpdate(_ref) {
165
165
  function ParallaxProviderWrapper(_ref2) {
166
166
  var children = _ref2.children,
167
167
  props = _objectWithoutPropertiesLoose(_ref2, _excluded);
168
- return React__default.createElement(reactScrollParallax.ParallaxProvider, Object.assign({}, props), React__default.createElement(ParallaxCacheUpdate, null, children));
168
+ return React__default.createElement(reactScrollParallax.ParallaxProvider, _extends({}, props), React__default.createElement(ParallaxCacheUpdate, null, children));
169
169
  }
170
- /**
171
- * @deprecated use `globalParallaxProviderMeta` instead.
170
+ /**
171
+ * @deprecated use `globalParallaxProviderMeta` instead.
172
172
  */
173
173
  var parallaxProviderMeta = {
174
174
  name: "hostless-parallax-provider",
@@ -200,8 +200,8 @@ var parallaxProviderMeta = {
200
200
  }
201
201
  }
202
202
  };
203
- /**
204
- * @deprecated use `registerGlobalParallaxProvider` instead.
203
+ /**
204
+ * @deprecated use `registerGlobalParallaxProvider` instead.
205
205
  */
206
206
  function registerParallaxProvider(loader, customParallaxProviderMeta) {
207
207
  if (loader) {
@@ -1 +1 @@
1
- {"version":3,"file":"react-scroll-parallax.cjs.development.js","sources":["../src/ParallaxWrapper.tsx","../src/ParallaxProvider.tsx"],"sourcesContent":["import { PlasmicCanvasContext } from \"@plasmicapp/host\";\nimport registerComponent, {\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, { useContext } from \"react\";\nimport { Parallax, ParallaxContext } from \"react-scroll-parallax\";\n\nexport interface ParallaxWrapperProps {\n speed?: number;\n disabled?: boolean;\n previewInEditor?: boolean;\n children: React.ReactNode;\n className?: string;\n}\n\nexport default function ParallaxWrapper({\n speed,\n disabled,\n previewInEditor,\n children,\n className,\n}: ParallaxWrapperProps) {\n const inEditor = useContext(PlasmicCanvasContext);\n const hasContext = useContext(ParallaxContext) != null;\n const isServer = typeof window === \"undefined\";\n if (!hasContext && !isServer) {\n throw new Error(\n \"Scroll Parallax can only be instantiated somewhere inside the Parallax Provider\"\n );\n }\n return (\n <Parallax\n disabled={disabled || (inEditor && !previewInEditor)}\n speed={speed}\n className={className}\n >\n {children}\n </Parallax>\n );\n}\n\n/**\n * We're keeping the old registration without attachments to avoid confusion\n * due to the parallax custom behavior not working in old projects that didn't\n * make use of global contexts (so simply adding the custom behavior would\n * break it and it wouldn't be clear that the user should also add a\n * `ParallaxProvider`).\n */\nexport const deprecated_parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps> =\n {\n name: \"hostless-scroll-parallax\",\n displayName: \"Scroll Parallax\",\n importName: \"ParallaxWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"img\",\n src: \"https://placekitten.com/300/200\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n },\n speed: {\n type: \"number\",\n description:\n \"How much to speed up or slow down this element while scrolling. Try -20 for slower, 20 for faster.\",\n defaultValue: 20,\n },\n disabled: {\n type: \"boolean\",\n description: \"Disables the parallax effect.\",\n },\n previewInEditor: {\n type: \"boolean\",\n description: \"Enable the parallax effect in the editor.\",\n },\n },\n defaultStyles: {\n maxWidth: \"100%\",\n },\n };\n\nexport function deprecated_registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? deprecated_parallaxWrapperMeta\n );\n } else {\n registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? deprecated_parallaxWrapperMeta\n );\n }\n}\n\n/**\n * The new registration is only setting `isAttachment: true`.\n */\nexport const parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps> = {\n ...deprecated_parallaxWrapperMeta,\n isAttachment: true,\n};\n\nexport function registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? parallaxWrapperMeta\n );\n } else {\n registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? parallaxWrapperMeta\n );\n }\n}\n","import registerComponent, {\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext, {\n GlobalContextMeta,\n} from \"@plasmicapp/host/registerGlobalContext\";\nimport React, { useEffect, useRef } from \"react\";\nimport {\n ParallaxProvider,\n ParallaxProviderProps,\n useParallaxController,\n} from \"react-scroll-parallax\";\nimport ResizeObserver from \"resize-observer-polyfill\";\n\n/**\n * A safe wrapper around `useController()` to prevent errors when\n * `ParallaxProvider` is missing. If the context is unavailable,\n * `useParallaxController()` will throw an error, which we catch and handle\n * gracefully by returning `null` instead of crashing the component.\n */\nfunction useSafeController() {\n try {\n return useParallaxController();\n } catch {\n return null; // Return null instead of throwing an error\n }\n}\n\n/**\n * This is required to ensure the parallax scrolling works correctly, since if\n * (for instance) images load after the parallax wrapper has calculated the\n * dimensions of the space, it will result in incorrect parallax scrolling\n * amounts.\n *\n * This is not great since we need to mutation-observe the whole section of the\n * document (which may be large), but we can probably optimize this in the\n * future.\n */\nfunction ParallaxCacheUpdate({ children }: React.PropsWithChildren<{}>) {\n const parallaxController = useSafeController();\n const ref = useRef<HTMLDivElement | null>(null);\n\n useEffect(() => {\n if (ref.current?.parentElement) {\n const targetNode = ref.current.parentElement;\n const observer = new ResizeObserver(() => {\n if (parallaxController) {\n parallaxController.update();\n }\n });\n observer.observe(targetNode);\n return () => {\n observer.disconnect();\n };\n }\n return () => {};\n }, [ref.current]);\n\n return (\n <div style={{ display: \"contents\" }} ref={ref}>\n {children}\n </div>\n );\n}\n\nexport function ParallaxProviderWrapper({\n children,\n ...props\n}: React.PropsWithChildren<ParallaxProviderProps>) {\n return (\n <ParallaxProvider {...props}>\n <ParallaxCacheUpdate>{children}</ParallaxCacheUpdate>\n </ParallaxProvider>\n );\n}\n\n/**\n * @deprecated use `globalParallaxProviderMeta` instead.\n */\nexport const parallaxProviderMeta: CodeComponentMeta<ParallaxProviderProps> = {\n name: \"hostless-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProviderWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"vbox\",\n children: [\n {\n type: \"text\",\n value:\n \"Wrap any element in a Scroll Parallax component. Ensure they're all inside this Parallax Provider. Example:\",\n styles: {\n marginBottom: \"20px\",\n },\n },\n {\n type: \"component\",\n name: \"hostless-scroll-parallax\",\n },\n ],\n },\n },\n scrollAxis: {\n type: \"choice\",\n description: \"Scroll axis for setting horizontal/vertical scrolling\",\n options: [\"vertical\", \"horizontal\"],\n displayName: \"Scroll Axis\",\n },\n },\n};\n\n/**\n * @deprecated use `registerGlobalParallaxProvider` instead.\n */\nexport function registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: CodeComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n } else {\n registerComponent(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n }\n}\n\nexport const globalParallaxProviderMeta: GlobalContextMeta<ParallaxProviderProps> =\n {\n name: \"global-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProviderWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n scrollAxis: {\n type: \"choice\",\n description: \"Scroll axis for setting horizontal/vertical scrolling\",\n options: [\"vertical\", \"horizontal\"],\n displayName: \"Scroll Axis\",\n },\n },\n };\n\nexport function registerGlobalParallaxProvider(\n loader?: { registerGlobalContext: typeof registerGlobalContext },\n customParallaxProviderMeta?: GlobalContextMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerGlobalContext(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? globalParallaxProviderMeta\n );\n } else {\n registerGlobalContext(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? globalParallaxProviderMeta\n );\n }\n}\n"],"names":["ParallaxWrapper","_ref","speed","disabled","previewInEditor","children","className","inEditor","useContext","PlasmicCanvasContext","hasContext","ParallaxContext","isServer","window","Error","React","Parallax","deprecated_parallaxWrapperMeta","name","displayName","importName","importPath","props","type","defaultValue","src","styles","maxWidth","description","defaultStyles","deprecated_registerParallaxWrapper","loader","customParallaxWrapperMeta","registerComponent","parallaxWrapperMeta","_extends","isAttachment","registerParallaxWrapper","useSafeController","useParallaxController","_unused","ParallaxCacheUpdate","parallaxController","ref","useRef","useEffect","_ref$current","current","parentElement","targetNode","observer","ResizeObserver","update","observe","disconnect","style","display","ParallaxProviderWrapper","_ref2","_objectWithoutPropertiesLoose","_excluded","ParallaxProvider","parallaxProviderMeta","value","marginBottom","scrollAxis","options","registerParallaxProvider","customParallaxProviderMeta","globalParallaxProviderMeta","registerGlobalParallaxProvider","registerGlobalContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAewBA,eAAeA,CAAAC,IAAA;MACrCC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,eAAe,GAAAH,IAAA,CAAfG,eAAe;IACfC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;IACRC,SAAS,GAAAL,IAAA,CAATK,SAAS;EAET,IAAMC,QAAQ,GAAGC,gBAAU,CAACC,yBAAoB,CAAC;EACjD,IAAMC,UAAU,GAAGF,gBAAU,CAACG,mCAAe,CAAC,IAAI,IAAI;EACtD,IAAMC,QAAQ,GAAG,OAAOC,MAAM,KAAK,WAAW;EAC9C,IAAI,CAACH,UAAU,IAAI,CAACE,QAAQ,EAAE;IAC5B,MAAM,IAAIE,KAAK,CACb,iFAAiF,CAClF;;EAEH,OACEC,6BAACC,4BAAQ;IACPb,QAAQ,EAAEA,QAAQ,IAAKI,QAAQ,IAAI,CAACH,eAAgB;IACpDF,KAAK,EAAEA,KA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,MAAM,CAACwC,qBAAqB,CAC1Bd,uBAAuB,EACvBW,0BAA0B,WAA1BA,0BAA0B,GAAIC,0BAA0B,CACzD;GACF,MAAM;IACLE,qBAAqB,CACnBd,uBAAuB,EACvBW,0BAA0B,WAA1BA,0BAA0B,GAAIC,0BAA0B,CACzD;;AAEL;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"react-scroll-parallax.cjs.development.js","sources":["../src/ParallaxWrapper.tsx","../src/ParallaxProvider.tsx"],"sourcesContent":["import { PlasmicCanvasContext } from \"@plasmicapp/host\";\nimport registerComponent, {\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, { useContext } from \"react\";\nimport { Parallax, ParallaxContext } from \"react-scroll-parallax\";\n\nexport interface ParallaxWrapperProps {\n speed?: number;\n disabled?: boolean;\n previewInEditor?: boolean;\n children: React.ReactNode;\n className?: string;\n}\n\nexport default function ParallaxWrapper({\n speed,\n disabled,\n previewInEditor,\n children,\n className,\n}: ParallaxWrapperProps) {\n const inEditor = useContext(PlasmicCanvasContext);\n const hasContext = useContext(ParallaxContext) != null;\n const isServer = typeof window === \"undefined\";\n if (!hasContext && !isServer) {\n throw new Error(\n \"Scroll Parallax can only be instantiated somewhere inside the Parallax Provider\"\n );\n }\n return (\n <Parallax\n disabled={disabled || (inEditor && !previewInEditor)}\n speed={speed}\n className={className}\n >\n {children}\n </Parallax>\n );\n}\n\n/**\n * We're keeping the old registration without attachments to avoid confusion\n * due to the parallax custom behavior not working in old projects that didn't\n * make use of global contexts (so simply adding the custom behavior would\n * break it and it wouldn't be clear that the user should also add a\n * `ParallaxProvider`).\n */\nexport const deprecated_parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps> =\n {\n name: \"hostless-scroll-parallax\",\n displayName: \"Scroll Parallax\",\n importName: \"ParallaxWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"img\",\n src: \"https://placekitten.com/300/200\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n },\n speed: {\n type: \"number\",\n description:\n \"How much to speed up or slow down this element while scrolling. Try -20 for slower, 20 for faster.\",\n defaultValue: 20,\n },\n disabled: {\n type: \"boolean\",\n description: \"Disables the parallax effect.\",\n },\n previewInEditor: {\n type: \"boolean\",\n description: \"Enable the parallax effect in the editor.\",\n },\n },\n defaultStyles: {\n maxWidth: \"100%\",\n },\n };\n\nexport function deprecated_registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? deprecated_parallaxWrapperMeta\n );\n } else {\n registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? deprecated_parallaxWrapperMeta\n );\n }\n}\n\n/**\n * The new registration is only setting `isAttachment: true`.\n */\nexport const parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps> = {\n ...deprecated_parallaxWrapperMeta,\n isAttachment: true,\n};\n\nexport function registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? parallaxWrapperMeta\n );\n } else {\n registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? parallaxWrapperMeta\n );\n }\n}\n","import registerComponent, {\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext, {\n GlobalContextMeta,\n} from \"@plasmicapp/host/registerGlobalContext\";\nimport React, { useEffect, useRef } from \"react\";\nimport {\n ParallaxProvider,\n ParallaxProviderProps,\n useParallaxController,\n} from \"react-scroll-parallax\";\nimport ResizeObserver from \"resize-observer-polyfill\";\n\n/**\n * A safe wrapper around `useController()` to prevent errors when\n * `ParallaxProvider` is missing. If the context is unavailable,\n * `useParallaxController()` will throw an error, which we catch and handle\n * gracefully by returning `null` instead of crashing the component.\n */\nfunction useSafeController() {\n try {\n return useParallaxController();\n } catch {\n return null; // Return null instead of throwing an error\n }\n}\n\n/**\n * This is required to ensure the parallax scrolling works correctly, since if\n * (for instance) images load after the parallax wrapper has calculated the\n * dimensions of the space, it will result in incorrect parallax scrolling\n * amounts.\n *\n * This is not great since we need to mutation-observe the whole section of the\n * document (which may be large), but we can probably optimize this in the\n * future.\n */\nfunction ParallaxCacheUpdate({ children }: React.PropsWithChildren<{}>) {\n const parallaxController = useSafeController();\n const ref = useRef<HTMLDivElement | null>(null);\n\n useEffect(() => {\n if (ref.current?.parentElement) {\n const targetNode = ref.current.parentElement;\n const observer = new ResizeObserver(() => {\n if (parallaxController) {\n parallaxController.update();\n }\n });\n observer.observe(targetNode);\n return () => {\n observer.disconnect();\n };\n }\n return () => {};\n }, [ref.current]);\n\n return (\n <div style={{ display: \"contents\" }} ref={ref}>\n {children}\n </div>\n );\n}\n\nexport function ParallaxProviderWrapper({\n children,\n ...props\n}: React.PropsWithChildren<ParallaxProviderProps>) {\n return (\n <ParallaxProvider {...props}>\n <ParallaxCacheUpdate>{children}</ParallaxCacheUpdate>\n </ParallaxProvider>\n );\n}\n\n/**\n * @deprecated use `globalParallaxProviderMeta` instead.\n */\nexport const parallaxProviderMeta: CodeComponentMeta<ParallaxProviderProps> = {\n name: \"hostless-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProviderWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"vbox\",\n children: [\n {\n type: \"text\",\n value:\n \"Wrap any element in a Scroll Parallax component. Ensure they're all inside this Parallax Provider. Example:\",\n styles: {\n marginBottom: \"20px\",\n },\n },\n {\n type: \"component\",\n name: \"hostless-scroll-parallax\",\n },\n ],\n },\n },\n scrollAxis: {\n type: \"choice\",\n description: \"Scroll axis for setting horizontal/vertical scrolling\",\n options: [\"vertical\", \"horizontal\"],\n displayName: \"Scroll Axis\",\n },\n },\n};\n\n/**\n * @deprecated use `registerGlobalParallaxProvider` instead.\n */\nexport function registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: CodeComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n } else {\n registerComponent(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n }\n}\n\nexport const globalParallaxProviderMeta: GlobalContextMeta<ParallaxProviderProps> =\n {\n name: \"global-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProviderWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n scrollAxis: {\n type: \"choice\",\n description: \"Scroll axis for setting horizontal/vertical scrolling\",\n options: [\"vertical\", \"horizontal\"],\n displayName: \"Scroll Axis\",\n },\n },\n };\n\nexport function registerGlobalParallaxProvider(\n loader?: { registerGlobalContext: typeof registerGlobalContext },\n customParallaxProviderMeta?: GlobalContextMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerGlobalContext(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? globalParallaxProviderMeta\n );\n } else {\n registerGlobalContext(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? globalParallaxProviderMeta\n );\n }\n}\n"],"names":["ParallaxWrapper","_ref","speed","disabled","previewInEditor","children","className","inEditor","useContext","PlasmicCanvasContext","hasContext","ParallaxContext","isServer","window","Error","React","Parallax","deprecated_parallaxWrapperMeta","name","displayName","importName","importPath","props","type","defaultValue","src","styles","maxWidth","description","defaultStyles","deprecated_registerParallaxWrapper","loader","customParallaxWrapperMeta","registerComponent","parallaxWrapperMeta","_extends","isAttachment","registerParallaxWrapper","useSafeController","useParallaxController","_unused","ParallaxCacheUpdate","parallaxController","ref","useRef","useEffect","_ref$current","current","parentElement","targetNode","observer","ResizeObserver","update","observe","disconnect","style","display","ParallaxProviderWrapper","_ref2","_objectWithoutPropertiesLoose","_excluded","ParallaxProvider","parallaxProviderMeta","value","marginBottom","scrollAxis","options","registerParallaxProvider","customParallaxProviderMeta","globalParallaxProviderMeta","registerGlobalParallaxProvider","registerGlobalContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAewBA,eAAeA,CAAAC,IAAA;MACrCC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,eAAe,GAAAH,IAAA,CAAfG,eAAe;IACfC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;IACRC,SAAS,GAAAL,IAAA,CAATK,SAAS;EAET,IAAMC,QAAQ,GAAGC,gBAAU,CAACC,yBAAoB,CAAC;EACjD,IAAMC,UAAU,GAAGF,gBAAU,CAACG,mCAAe,CAAC,IAAI,IAAI;EACtD,IAAMC,QAAQ,GAAG,OAAOC,MAAM,KAAK,WAAW;EAC9C,IAAI,CAACH,UAAU,IAAI,CAACE,QAAQ,EAAE;IAC5B,MAAM,IAAIE,KAAK,CACb,iFAAiF,CAClF;;EAEH,OACEC,6BAACC,4BAAQ;IACPb,QAAQ,EAAEA,QAAQ,IAAKI,QAAQ,IAAI,CAACH,eAAgB;IACpDF,KAAK,EAAEA,KAAK;IACZI,SAAS,EAAEA;KAEVD,QAAQ,CACA;AAEf;AAEA;;;;;;;IAOaY,8BAA8B,GACzC;EACEC,IAAI,EAAE,0BAA0B;EAChCC,WAAW,EAAE,iBAAiB;EAC9BC,UAAU,EAAE,iBAAiB;EAC7BC,UAAU,EAAE,oCAAoC;EAChDC,KAAK,EAAE;IACLjB,QAAQ,EAAE;MACRkB,IAAI,EAAE,MAAM;MACZC,YAAY,EAAE;QACZD,IAAI,EAAE,KAAK;QACXE,GAAG,EAAE,iCAAiC;QACtCC,MAAM,EAAE;UACNC,QAAQ,EAAE;;;KAGf;IACDzB,KAAK,EAAE;MACL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IACD+C,UAAU,EAAE;MACV1C,IAAI,EAAE,QAAQ;MACdK,WAAW,EAAE,uDAAuD;MACpEsC,OAAO,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC;MACnC/C,WAAW,EAAE;;;CAGlB;AAED;;;AAGA,SAAgBgD,wBAAwBA,CACtCpC,MAAwD,EACxDqC,0BAAqE;EAErE,IAAIrC,MAAM,EAAE;IACVA,MAAM,CAACE,iBAAiB,CACtBwB,uBAAuB,EACvBW,0BAA0B,WAA1BA,0BAA0B,GAAIN,oBAAoB,CACnD;GACF,MAAM;IACL7B,iBAAiB,CACfwB,uBAAuB,EACvBW,0BAA0B,WAA1BA,0BAA0B,GAAIN,oBAAoB,CACnD;;AAEL;AAEA,IAAaO,0BAA0B,GACrC;EACEnD,IAAI,EAAE,0BAA0B;EAChCC,WAAW,EAAE,mBAAmB;EAChCC,UAAU,EAAE,yBAAyB;EACrCC,UAAU,EAAE,oCAAoC;EAChDC,KAAK,EAAE;IACL2C,UAAU,EAAE;MACV1C,IAAI,EAAE,QAAQ;MACdK,WAAW,EAAE,uDAAuD;MACpEsC,OAAO,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC;MACnC/C,WAAW,EAAE;;;CAGlB;AAEH,SAAgBmD,8BAA8BA,CAC5CvC,MAAgE,EAChEqC,0BAAqE;EAErE,IAAIrC,MAAM,EAAE;IACVA,MAAM,CAACwC,qBAAqB,CAC1Bd,uBAAuB,EACvBW,0BAA0B,WAA1BA,0BAA0B,GAAIC,0BAA0B,CACzD;GACF,MAAM;IACLE,qBAAqB,CACnBd,uBAAuB,EACvBW,0BAA0B,WAA1BA,0BAA0B,GAAIC,0BAA0B,CACzD;;AAEL;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@plasmicapp/host"),a=e(require("@plasmicapp/host/registerComponent")),l=require("react"),t=e(l),n=require("react-scroll-parallax"),o=e(require("@plasmicapp/host/registerGlobalContext")),i=e(require("resize-observer-polyfill"));function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var l in a)({}).hasOwnProperty.call(a,l)&&(e[l]=a[l])}return e}).apply(null,arguments)}function p(e){var a=e.speed,o=e.disabled,i=e.previewInEditor,s=e.children,p=e.className,c=l.useContext(r.PlasmicCanvasContext),u=null!=l.useContext(n.ParallaxContext),d="undefined"==typeof window;if(!u&&!d)throw new Error("Scroll Parallax can only be instantiated somewhere inside the Parallax Provider");return t.createElement(n.Parallax,{disabled:o||c&&!i,speed:a,className:p},s)}var c={name:"hostless-scroll-parallax",displayName:"Scroll Parallax",importName:"ParallaxWrapper",importPath:"@plasmicpkgs/react-scroll-parallax",props:{children:{type:"slot",defaultValue:{type:"img",src:"https://placekitten.com/300/200",styles:{maxWidth:"100%"}}},speed:{type:"number",description:"How much to speed up or slow down this element while scrolling. Try -20 for slower, 20 for faster.",defaultValue:20},disabled:{type:"boolean",description:"Disables the parallax effect."},previewInEditor:{type:"boolean",description:"Enable the parallax effect in the editor."}},defaultStyles:{maxWidth:"100%"}},u=s({},c,{isAttachment:!0}),d=["children"];function x(e){var r=e.children,a=function(){try{return n.useParallaxController()}catch(e){return null}}(),o=l.useRef(null);return l.useEffect((function(){var e;if(null!=(e=o.current)&&e.parentElement){var r=o.current.parentElement,l=new i((function(){a&&a.update()}));return l.observe(r),function(){l.disconnect()}}return function(){}}),[o.current]),t.createElement("div",{style:{display:"contents"},ref:o},r)}function m(e){var r=e.children,a=function(e,r){if(null==e)return{};var a={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(-1!==r.indexOf(l))continue;a[l]=e[l]}return a}(e,d);return t.createElement(n.ParallaxProvider,Object.assign({},a),t.createElement(x,null,r))}var f={name:"hostless-parallax-provider",displayName:"Parallax Provider",importName:"ParallaxProviderWrapper",importPath:"@plasmicpkgs/react-scroll-parallax",props:{children:{type:"slot",defaultValue:{type:"vbox",children:[{type:"text",value:"Wrap any element in a Scroll Parallax component. Ensure they're all inside this Parallax Provider. Example:",styles:{marginBottom:"20px"}},{type:"component",name:"hostless-scroll-parallax"}]}},scrollAxis:{type:"choice",description:"Scroll axis for setting horizontal/vertical scrolling",options:["vertical","horizontal"],displayName:"Scroll Axis"}}},h={name:"global-parallax-provider",displayName:"Parallax Provider",importName:"ParallaxProviderWrapper",importPath:"@plasmicpkgs/react-scroll-parallax",props:{scrollAxis:{type:"choice",description:"Scroll axis for setting horizontal/vertical scrolling",options:["vertical","horizontal"],displayName:"Scroll Axis"}}};exports.ParallaxProviderWrapper=m,exports.ParallaxWrapper=p,exports.deprecated_parallaxWrapperMeta=c,exports.deprecated_registerParallaxWrapper=function(e,r){e?e.registerComponent(p,null!=r?r:c):a(p,null!=r?r:c)},exports.globalParallaxProviderMeta=h,exports.parallaxProviderMeta=f,exports.parallaxWrapperMeta=u,exports.registerGlobalParallaxProvider=function(e,r){e?e.registerGlobalContext(m,null!=r?r:h):o(m,null!=r?r:h)},exports.registerParallaxProvider=function(e,r){e?e.registerComponent(m,null!=r?r:f):a(m,null!=r?r:f)},exports.registerParallaxWrapper=function(e,r){e?e.registerComponent(p,null!=r?r:u):a(p,null!=r?r:u)};
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@plasmicapp/host"),a=e(require("@plasmicapp/host/registerComponent")),l=require("react"),t=e(l),o=require("react-scroll-parallax"),n=e(require("@plasmicapp/host/registerGlobalContext")),i=e(require("resize-observer-polyfill"));function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var l in a)({}).hasOwnProperty.call(a,l)&&(e[l]=a[l])}return e}).apply(null,arguments)}function p(e){var a=e.speed,n=e.disabled,i=e.previewInEditor,s=e.children,p=e.className,c=l.useContext(r.PlasmicCanvasContext),u=null!=l.useContext(o.ParallaxContext),d="undefined"==typeof window;if(!u&&!d)throw new Error("Scroll Parallax can only be instantiated somewhere inside the Parallax Provider");return t.createElement(o.Parallax,{disabled:n||c&&!i,speed:a,className:p},s)}var c={name:"hostless-scroll-parallax",displayName:"Scroll Parallax",importName:"ParallaxWrapper",importPath:"@plasmicpkgs/react-scroll-parallax",props:{children:{type:"slot",defaultValue:{type:"img",src:"https://placekitten.com/300/200",styles:{maxWidth:"100%"}}},speed:{type:"number",description:"How much to speed up or slow down this element while scrolling. Try -20 for slower, 20 for faster.",defaultValue:20},disabled:{type:"boolean",description:"Disables the parallax effect."},previewInEditor:{type:"boolean",description:"Enable the parallax effect in the editor."}},defaultStyles:{maxWidth:"100%"}},u=s({},c,{isAttachment:!0}),d=["children"];function x(e){var r=e.children,a=function(){try{return o.useParallaxController()}catch(e){return null}}(),n=l.useRef(null);return l.useEffect((function(){var e;if(null!=(e=n.current)&&e.parentElement){var r=n.current.parentElement,l=new i((function(){a&&a.update()}));return l.observe(r),function(){l.disconnect()}}return function(){}}),[n.current]),t.createElement("div",{style:{display:"contents"},ref:n},r)}function m(e){var r=e.children,a=function(e,r){if(null==e)return{};var a={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(-1!==r.indexOf(l))continue;a[l]=e[l]}return a}(e,d);return t.createElement(o.ParallaxProvider,s({},a),t.createElement(x,null,r))}var f={name:"hostless-parallax-provider",displayName:"Parallax Provider",importName:"ParallaxProviderWrapper",importPath:"@plasmicpkgs/react-scroll-parallax",props:{children:{type:"slot",defaultValue:{type:"vbox",children:[{type:"text",value:"Wrap any element in a Scroll Parallax component. Ensure they're all inside this Parallax Provider. Example:",styles:{marginBottom:"20px"}},{type:"component",name:"hostless-scroll-parallax"}]}},scrollAxis:{type:"choice",description:"Scroll axis for setting horizontal/vertical scrolling",options:["vertical","horizontal"],displayName:"Scroll Axis"}}},h={name:"global-parallax-provider",displayName:"Parallax Provider",importName:"ParallaxProviderWrapper",importPath:"@plasmicpkgs/react-scroll-parallax",props:{scrollAxis:{type:"choice",description:"Scroll axis for setting horizontal/vertical scrolling",options:["vertical","horizontal"],displayName:"Scroll Axis"}}};exports.ParallaxProviderWrapper=m,exports.ParallaxWrapper=p,exports.deprecated_parallaxWrapperMeta=c,exports.deprecated_registerParallaxWrapper=function(e,r){e?e.registerComponent(p,null!=r?r:c):a(p,null!=r?r:c)},exports.globalParallaxProviderMeta=h,exports.parallaxProviderMeta=f,exports.parallaxWrapperMeta=u,exports.registerGlobalParallaxProvider=function(e,r){e?e.registerGlobalContext(m,null!=r?r:h):n(m,null!=r?r:h)},exports.registerParallaxProvider=function(e,r){e?e.registerComponent(m,null!=r?r:f):a(m,null!=r?r:f)},exports.registerParallaxWrapper=function(e,r){e?e.registerComponent(p,null!=r?r:u):a(p,null!=r?r:u)};
2
2
  //# sourceMappingURL=react-scroll-parallax.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-scroll-parallax.cjs.production.min.js","sources":["../src/ParallaxWrapper.tsx","../src/ParallaxProvider.tsx"],"sourcesContent":["import { PlasmicCanvasContext } from \"@plasmicapp/host\";\nimport registerComponent, {\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, { useContext } from \"react\";\nimport { Parallax, ParallaxContext } from \"react-scroll-parallax\";\n\nexport interface ParallaxWrapperProps {\n speed?: number;\n disabled?: boolean;\n previewInEditor?: boolean;\n children: React.ReactNode;\n className?: string;\n}\n\nexport default function ParallaxWrapper({\n speed,\n disabled,\n previewInEditor,\n children,\n className,\n}: ParallaxWrapperProps) {\n const inEditor = useContext(PlasmicCanvasContext);\n const hasContext = useContext(ParallaxContext) != null;\n const isServer = typeof window === \"undefined\";\n if (!hasContext && !isServer) {\n throw new Error(\n \"Scroll Parallax can only be instantiated somewhere inside the Parallax Provider\"\n );\n }\n return (\n <Parallax\n disabled={disabled || (inEditor && !previewInEditor)}\n speed={speed}\n className={className}\n >\n {children}\n </Parallax>\n );\n}\n\n/**\n * We're keeping the old registration without attachments to avoid confusion\n * due to the parallax custom behavior not working in old projects that didn't\n * make use of global contexts (so simply adding the custom behavior would\n * break it and it wouldn't be clear that the user should also add a\n * `ParallaxProvider`).\n */\nexport const deprecated_parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps> =\n {\n name: \"hostless-scroll-parallax\",\n displayName: \"Scroll Parallax\",\n importName: \"ParallaxWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"img\",\n src: \"https://placekitten.com/300/200\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n },\n speed: {\n type: \"number\",\n description:\n \"How much to speed up or slow down this element while scrolling. Try -20 for slower, 20 for faster.\",\n defaultValue: 20,\n },\n disabled: {\n type: \"boolean\",\n description: \"Disables the parallax effect.\",\n },\n previewInEditor: {\n type: \"boolean\",\n description: \"Enable the parallax effect in the editor.\",\n },\n },\n defaultStyles: {\n maxWidth: \"100%\",\n },\n };\n\nexport function deprecated_registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? deprecated_parallaxWrapperMeta\n );\n } else {\n registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? deprecated_parallaxWrapperMeta\n );\n }\n}\n\n/**\n * The new registration is only setting `isAttachment: true`.\n */\nexport const parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps> = {\n ...deprecated_parallaxWrapperMeta,\n isAttachment: true,\n};\n\nexport function registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? parallaxWrapperMeta\n );\n } else {\n registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? parallaxWrapperMeta\n );\n }\n}\n","import registerComponent, {\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext, {\n GlobalContextMeta,\n} from \"@plasmicapp/host/registerGlobalContext\";\nimport React, { useEffect, useRef } from \"react\";\nimport {\n ParallaxProvider,\n ParallaxProviderProps,\n useParallaxController,\n} from \"react-scroll-parallax\";\nimport ResizeObserver from \"resize-observer-polyfill\";\n\n/**\n * A safe wrapper around `useController()` to prevent errors when\n * `ParallaxProvider` is missing. If the context is unavailable,\n * `useParallaxController()` will throw an error, which we catch and handle\n * gracefully by returning `null` instead of crashing the component.\n */\nfunction useSafeController() {\n try {\n return useParallaxController();\n } catch {\n return null; // Return null instead of throwing an error\n }\n}\n\n/**\n * This is required to ensure the parallax scrolling works correctly, since if\n * (for instance) images load after the parallax wrapper has calculated the\n * dimensions of the space, it will result in incorrect parallax scrolling\n * amounts.\n *\n * This is not great since we need to mutation-observe the whole section of the\n * document (which may be large), but we can probably optimize this in the\n * future.\n */\nfunction ParallaxCacheUpdate({ children }: React.PropsWithChildren<{}>) {\n const parallaxController = useSafeController();\n const ref = useRef<HTMLDivElement | null>(null);\n\n useEffect(() => {\n if (ref.current?.parentElement) {\n const targetNode = ref.current.parentElement;\n const observer = new ResizeObserver(() => {\n if (parallaxController) {\n parallaxController.update();\n }\n });\n observer.observe(targetNode);\n return () => {\n observer.disconnect();\n };\n }\n return () => {};\n }, [ref.current]);\n\n return (\n <div style={{ display: \"contents\" }} ref={ref}>\n {children}\n </div>\n );\n}\n\nexport function ParallaxProviderWrapper({\n children,\n ...props\n}: React.PropsWithChildren<ParallaxProviderProps>) {\n return (\n <ParallaxProvider {...props}>\n <ParallaxCacheUpdate>{children}</ParallaxCacheUpdate>\n </ParallaxProvider>\n );\n}\n\n/**\n * @deprecated use `globalParallaxProviderMeta` instead.\n */\nexport const parallaxProviderMeta: CodeComponentMeta<ParallaxProviderProps> = {\n name: \"hostless-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProviderWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"vbox\",\n children: [\n {\n type: \"text\",\n value:\n \"Wrap any element in a Scroll Parallax component. Ensure they're all inside this Parallax Provider. Example:\",\n styles: {\n marginBottom: \"20px\",\n },\n },\n {\n type: \"component\",\n name: \"hostless-scroll-parallax\",\n },\n ],\n },\n },\n scrollAxis: {\n type: \"choice\",\n description: \"Scroll axis for setting horizontal/vertical scrolling\",\n options: [\"vertical\", \"horizontal\"],\n displayName: \"Scroll Axis\",\n },\n },\n};\n\n/**\n * @deprecated use `registerGlobalParallaxProvider` instead.\n */\nexport function registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: CodeComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n } else {\n registerComponent(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n }\n}\n\nexport const globalParallaxProviderMeta: GlobalContextMeta<ParallaxProviderProps> =\n {\n name: \"global-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProviderWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n scrollAxis: {\n type: \"choice\",\n description: \"Scroll axis for setting horizontal/vertical scrolling\",\n options: [\"vertical\", \"horizontal\"],\n displayName: \"Scroll Axis\",\n },\n },\n };\n\nexport function registerGlobalParallaxProvider(\n loader?: { registerGlobalContext: typeof registerGlobalContext },\n customParallaxProviderMeta?: GlobalContextMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerGlobalContext(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? globalParallaxProviderMeta\n );\n } else {\n registerGlobalContext(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? globalParallaxProviderMeta\n );\n }\n}\n"],"names":["ParallaxWrapper","_ref","speed","disabled","previewInEditor","children","className","inEditor","useContext","PlasmicCanvasContext","hasContext","ParallaxContext","isServer","window","Error","React","Parallax","deprecated_parallaxWrapperMeta","name","displayName","importName","importPath","props","type","defaultValue","src","styles","maxWidth","description","defaultStyles","parallaxWrapperMeta","_extends","isAttachment","ParallaxCacheUpdate","parallaxController","useParallaxController","_unused","useSafeController","ref","useRef","useEffect","_ref$current","current","parentElement","targetNode","observer","ResizeObserver","update","observe","disconnect","style","display","ParallaxProviderWrapper","_ref2","_objectWithoutPropertiesLoose","_excluded","ParallaxProvider","parallaxProviderMeta","value","marginBottom","scrollAxis","options","globalParallaxProviderMeta","loader","customParallaxWrapperMeta","registerComponent","customParallaxProviderMeta","registerGlobalContext"],"mappings":"4lBAewBA,EAAeC,OACrCC,EAAKD,EAALC,MACAC,EAAQF,EAARE,SACAC,EAAeH,EAAfG,gBACAC,EAAQJ,EAARI,SACAC,EAASL,EAATK,UAEMC,EAAWC,aAAWC,wBACtBC,EAA4C,MAA/BF,aAAWG,mBACxBC,EAA6B,oBAAXC,OACxB,IAAKH,IAAeE,EAClB,MAAM,IAAIE,MACR,mFAGJ,OACEC,gBAACC,YACCb,SAAUA,GAAaI,IAAaH,EACpCF,MAAOA,EACPI,UAAWA,GAEVD,OAYMY,EACX,CACEC,KAAM,2BACNC,YAAa,kBACbC,WAAY,kBACZC,WAAY,qCACZC,MAAO,CACLjB,SAAU,CACRkB,KAAM,OACNC,aAAc,CACZD,KAAM,MACNE,IAAK,kCACLC,OAAQ,CACNC,SAAU,UAIhBzB,MAAO,CACLqB,KAAM,SACNK,YACE,qGACFJ,aAAc,IAEhBrB,SAAU,CACRoB,KAAM,UACNK,YAAa,iCAEfxB,gBAAiB,CACfmB,KAAM,UACNK,YAAa,8CAGjBC,cAAe,CACbF,SAAU,SAwBHG,EAAmBC,KAC3Bd,GACHe,cAAc,mBCrEhB,SAASC,EAAmBhC,OAAGI,EAAQJ,EAARI,SACvB6B,EAnBR,WACE,IACE,OAAOC,0BACP,MAA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GAGhCQ,EACEb,QACAc,EAAAA,EAA8BT,6CDlBlCM,EACAC,GAEID,EACFA,EAAOE,kBACLjE,QACAgE,EAAAA,EAA6BlC,GAG/BmC,EACEjE,QACAgE,EAAAA,EAA6BlC"}
1
+ {"version":3,"file":"react-scroll-parallax.cjs.production.min.js","sources":["../src/ParallaxWrapper.tsx","../src/ParallaxProvider.tsx"],"sourcesContent":["import { PlasmicCanvasContext } from \"@plasmicapp/host\";\nimport registerComponent, {\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, { useContext } from \"react\";\nimport { Parallax, ParallaxContext } from \"react-scroll-parallax\";\n\nexport interface ParallaxWrapperProps {\n speed?: number;\n disabled?: boolean;\n previewInEditor?: boolean;\n children: React.ReactNode;\n className?: string;\n}\n\nexport default function ParallaxWrapper({\n speed,\n disabled,\n previewInEditor,\n children,\n className,\n}: ParallaxWrapperProps) {\n const inEditor = useContext(PlasmicCanvasContext);\n const hasContext = useContext(ParallaxContext) != null;\n const isServer = typeof window === \"undefined\";\n if (!hasContext && !isServer) {\n throw new Error(\n \"Scroll Parallax can only be instantiated somewhere inside the Parallax Provider\"\n );\n }\n return (\n <Parallax\n disabled={disabled || (inEditor && !previewInEditor)}\n speed={speed}\n className={className}\n >\n {children}\n </Parallax>\n );\n}\n\n/**\n * We're keeping the old registration without attachments to avoid confusion\n * due to the parallax custom behavior not working in old projects that didn't\n * make use of global contexts (so simply adding the custom behavior would\n * break it and it wouldn't be clear that the user should also add a\n * `ParallaxProvider`).\n */\nexport const deprecated_parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps> =\n {\n name: \"hostless-scroll-parallax\",\n displayName: \"Scroll Parallax\",\n importName: \"ParallaxWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"img\",\n src: \"https://placekitten.com/300/200\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n },\n speed: {\n type: \"number\",\n description:\n \"How much to speed up or slow down this element while scrolling. Try -20 for slower, 20 for faster.\",\n defaultValue: 20,\n },\n disabled: {\n type: \"boolean\",\n description: \"Disables the parallax effect.\",\n },\n previewInEditor: {\n type: \"boolean\",\n description: \"Enable the parallax effect in the editor.\",\n },\n },\n defaultStyles: {\n maxWidth: \"100%\",\n },\n };\n\nexport function deprecated_registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? deprecated_parallaxWrapperMeta\n );\n } else {\n registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? deprecated_parallaxWrapperMeta\n );\n }\n}\n\n/**\n * The new registration is only setting `isAttachment: true`.\n */\nexport const parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps> = {\n ...deprecated_parallaxWrapperMeta,\n isAttachment: true,\n};\n\nexport function registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? parallaxWrapperMeta\n );\n } else {\n registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? parallaxWrapperMeta\n );\n }\n}\n","import registerComponent, {\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext, {\n GlobalContextMeta,\n} from \"@plasmicapp/host/registerGlobalContext\";\nimport React, { useEffect, useRef } from \"react\";\nimport {\n ParallaxProvider,\n ParallaxProviderProps,\n useParallaxController,\n} from \"react-scroll-parallax\";\nimport ResizeObserver from \"resize-observer-polyfill\";\n\n/**\n * A safe wrapper around `useController()` to prevent errors when\n * `ParallaxProvider` is missing. If the context is unavailable,\n * `useParallaxController()` will throw an error, which we catch and handle\n * gracefully by returning `null` instead of crashing the component.\n */\nfunction useSafeController() {\n try {\n return useParallaxController();\n } catch {\n return null; // Return null instead of throwing an error\n }\n}\n\n/**\n * This is required to ensure the parallax scrolling works correctly, since if\n * (for instance) images load after the parallax wrapper has calculated the\n * dimensions of the space, it will result in incorrect parallax scrolling\n * amounts.\n *\n * This is not great since we need to mutation-observe the whole section of the\n * document (which may be large), but we can probably optimize this in the\n * future.\n */\nfunction ParallaxCacheUpdate({ children }: React.PropsWithChildren<{}>) {\n const parallaxController = useSafeController();\n const ref = useRef<HTMLDivElement | null>(null);\n\n useEffect(() => {\n if (ref.current?.parentElement) {\n const targetNode = ref.current.parentElement;\n const observer = new ResizeObserver(() => {\n if (parallaxController) {\n parallaxController.update();\n }\n });\n observer.observe(targetNode);\n return () => {\n observer.disconnect();\n };\n }\n return () => {};\n }, [ref.current]);\n\n return (\n <div style={{ display: \"contents\" }} ref={ref}>\n {children}\n </div>\n );\n}\n\nexport function ParallaxProviderWrapper({\n children,\n ...props\n}: React.PropsWithChildren<ParallaxProviderProps>) {\n return (\n <ParallaxProvider {...props}>\n <ParallaxCacheUpdate>{children}</ParallaxCacheUpdate>\n </ParallaxProvider>\n );\n}\n\n/**\n * @deprecated use `globalParallaxProviderMeta` instead.\n */\nexport const parallaxProviderMeta: CodeComponentMeta<ParallaxProviderProps> = {\n name: \"hostless-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProviderWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"vbox\",\n children: [\n {\n type: \"text\",\n value:\n \"Wrap any element in a Scroll Parallax component. Ensure they're all inside this Parallax Provider. Example:\",\n styles: {\n marginBottom: \"20px\",\n },\n },\n {\n type: \"component\",\n name: \"hostless-scroll-parallax\",\n },\n ],\n },\n },\n scrollAxis: {\n type: \"choice\",\n description: \"Scroll axis for setting horizontal/vertical scrolling\",\n options: [\"vertical\", \"horizontal\"],\n displayName: \"Scroll Axis\",\n },\n },\n};\n\n/**\n * @deprecated use `registerGlobalParallaxProvider` instead.\n */\nexport function registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: CodeComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n } else {\n registerComponent(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n }\n}\n\nexport const globalParallaxProviderMeta: GlobalContextMeta<ParallaxProviderProps> =\n {\n name: \"global-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProviderWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n scrollAxis: {\n type: \"choice\",\n description: \"Scroll axis for setting horizontal/vertical scrolling\",\n options: [\"vertical\", \"horizontal\"],\n displayName: \"Scroll Axis\",\n },\n },\n };\n\nexport function registerGlobalParallaxProvider(\n loader?: { registerGlobalContext: typeof registerGlobalContext },\n customParallaxProviderMeta?: GlobalContextMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerGlobalContext(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? globalParallaxProviderMeta\n );\n } else {\n registerGlobalContext(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? globalParallaxProviderMeta\n );\n }\n}\n"],"names":["ParallaxWrapper","_ref","speed","disabled","previewInEditor","children","className","inEditor","useContext","PlasmicCanvasContext","hasContext","ParallaxContext","isServer","window","Error","React","Parallax","deprecated_parallaxWrapperMeta","name","displayName","importName","importPath","props","type","defaultValue","src","styles","maxWidth","description","defaultStyles","parallaxWrapperMeta","_extends","isAttachment","ParallaxCacheUpdate","parallaxController","useParallaxController","_unused","useSafeController","ref","useRef","useEffect","_ref$current","current","parentElement","targetNode","observer","ResizeObserver","update","observe","disconnect","style","display","ParallaxProviderWrapper","_ref2","_objectWithoutPropertiesLoose","_excluded","ParallaxProvider","parallaxProviderMeta","value","marginBottom","scrollAxis","options","globalParallaxProviderMeta","loader","customParallaxWrapperMeta","registerComponent","customParallaxProviderMeta","registerGlobalContext"],"mappings":"4lBAewBA,EAAeC,OACrCC,EAAKD,EAALC,MACAC,EAAQF,EAARE,SACAC,EAAeH,EAAfG,gBACAC,EAAQJ,EAARI,SACAC,EAASL,EAATK,UAEMC,EAAWC,aAAWC,wBACtBC,EAA4C,MAA/BF,aAAWG,mBACxBC,EAA6B,oBAAXC,OACxB,IAAKH,IAAeE,EAClB,MAAM,IAAIE,MACR,mFAGJ,OACEC,gBAACC,YACCb,SAAUA,GAAaI,IAAaH,EACpCF,MAAOA,EACPI,UAAWA,GAEVD,OAYMY,EACX,CACEC,KAAM,2BACNC,YAAa,kBACbC,WAAY,kBACZC,WAAY,qCACZC,MAAO,CACLjB,SAAU,CACRkB,KAAM,OACNC,aAAc,CACZD,KAAM,MACNE,IAAK,kCACLC,OAAQ,CACNC,SAAU,UAIhBzB,MAAO,CACLqB,KAAM,SACNK,YACE,qGACFJ,aAAc,IAEhBrB,SAAU,CACRoB,KAAM,UACNK,YAAa,iCAEfxB,gBAAiB,CACfmB,KAAM,UACNK,YAAa,8CAGjBC,cAAe,CACbF,SAAU,SAwBHG,EAAmBC,KAC3Bd,GACHe,cAAc,mBCrEhB,SAASC,EAAmBhC,OAAGI,EAAQJ,EAARI,SACvB6B,EAnBR,WACE,IACE,OAAOC,0BACP,MAAAC,GACA,OAAO,MAekBC,GACrBC,EAAMC,SAA8B,MAkB1C,OAhBAC,aAAU,iBACR,UAAAC,EAAIH,EAAII,UAAJD,EAAaE,cAAe,CAC9B,IAAMC,EAAaN,EAAII,QAAQC,cACzBE,EAAW,IAAIC,GAAe,WAC9BZ,GACFA,EAAmBa,YAIvB,OADAF,EAASG,QAAQJ,GACV,WACLC,EAASI,cAGb,OAAO,eACN,CAACX,EAAII,UAGN3B,uBAAKmC,MAAO,CAAEC,QAAS,YAAcb,IAAKA,GACvCjC,YAKS+C,EAAuBC,OACrChD,EAAQgD,EAARhD,SACGiB,6IAAKgC,CAAAD,EAAAE,GAER,OACExC,gBAACyC,mBAAgBzB,KAAKT,GACpBP,gBAACkB,OAAqB5B,IAQ5B,IAAaoD,EAAiE,CAC5EvC,KAAM,6BACNC,YAAa,oBACbC,WAAY,0BACZC,WAAY,qCACZC,MAAO,CACLjB,SAAU,CACRkB,KAAM,OACNC,aAAc,CACZD,KAAM,OACNlB,SAAU,CACR,CACEkB,KAAM,OACNmC,MACE,8GACFhC,OAAQ,CACNiC,aAAc,SAGlB,CACEpC,KAAM,YACNL,KAAM,+BAKd0C,WAAY,CACVrC,KAAM,SACNK,YAAa,wDACbiC,QAAS,CAAC,WAAY,cACtB1C,YAAa,iBAyBN2C,EACX,CACE5C,KAAM,2BACNC,YAAa,oBACbC,WAAY,0BACZC,WAAY,qCACZC,MAAO,CACLsC,WAAY,CACVrC,KAAM,SACNK,YAAa,wDACbiC,QAAS,CAAC,WAAY,cACtB1C,YAAa,0KD3DnB4C,EACAC,GAEID,EACFA,EAAOE,kBACLjE,QACAgE,EAAAA,EAA6B/C,GAG/BgD,EACEjE,QACAgE,EAAAA,EAA6B/C,sJCsDjC8C,EACAG,GAEIH,EACFA,EAAOI,sBACLf,QACAc,EAAAA,EAA8BJ,GAGhCK,EACEf,QACAc,EAAAA,EAA8BJ,8CA5ClCC,EACAG,GAEIH,EACFA,EAAOE,kBACLb,QACAc,EAAAA,EAA8BT,GAGhCQ,EACEb,QACAc,EAAAA,EAA8BT,6CDlBlCM,EACAC,GAEID,EACFA,EAAOE,kBACLjE,QACAgE,EAAAA,EAA6BlC,GAG/BmC,EACEjE,QACAgE,EAAAA,EAA6BlC"}
@@ -42,12 +42,12 @@ function ParallaxWrapper(_ref) {
42
42
  className: className
43
43
  }, children);
44
44
  }
45
- /**
46
- * We're keeping the old registration without attachments to avoid confusion
47
- * due to the parallax custom behavior not working in old projects that didn't
48
- * make use of global contexts (so simply adding the custom behavior would
49
- * break it and it wouldn't be clear that the user should also add a
50
- * `ParallaxProvider`).
45
+ /**
46
+ * We're keeping the old registration without attachments to avoid confusion
47
+ * due to the parallax custom behavior not working in old projects that didn't
48
+ * make use of global contexts (so simply adding the custom behavior would
49
+ * break it and it wouldn't be clear that the user should also add a
50
+ * `ParallaxProvider`).
51
51
  */
52
52
  var deprecated_parallaxWrapperMeta = {
53
53
  name: "hostless-scroll-parallax",
@@ -90,8 +90,8 @@ function deprecated_registerParallaxWrapper(loader, customParallaxWrapperMeta) {
90
90
  registerComponent(ParallaxWrapper, customParallaxWrapperMeta != null ? customParallaxWrapperMeta : deprecated_parallaxWrapperMeta);
91
91
  }
92
92
  }
93
- /**
94
- * The new registration is only setting `isAttachment: true`.
93
+ /**
94
+ * The new registration is only setting `isAttachment: true`.
95
95
  */
96
96
  var parallaxWrapperMeta = /*#__PURE__*/_extends({}, deprecated_parallaxWrapperMeta, {
97
97
  isAttachment: true
@@ -105,11 +105,11 @@ function registerParallaxWrapper(loader, customParallaxWrapperMeta) {
105
105
  }
106
106
 
107
107
  var _excluded = ["children"];
108
- /**
109
- * A safe wrapper around `useController()` to prevent errors when
110
- * `ParallaxProvider` is missing. If the context is unavailable,
111
- * `useParallaxController()` will throw an error, which we catch and handle
112
- * gracefully by returning `null` instead of crashing the component.
108
+ /**
109
+ * A safe wrapper around `useController()` to prevent errors when
110
+ * `ParallaxProvider` is missing. If the context is unavailable,
111
+ * `useParallaxController()` will throw an error, which we catch and handle
112
+ * gracefully by returning `null` instead of crashing the component.
113
113
  */
114
114
  function useSafeController() {
115
115
  try {
@@ -118,15 +118,15 @@ function useSafeController() {
118
118
  return null; // Return null instead of throwing an error
119
119
  }
120
120
  }
121
- /**
122
- * This is required to ensure the parallax scrolling works correctly, since if
123
- * (for instance) images load after the parallax wrapper has calculated the
124
- * dimensions of the space, it will result in incorrect parallax scrolling
125
- * amounts.
126
- *
127
- * This is not great since we need to mutation-observe the whole section of the
128
- * document (which may be large), but we can probably optimize this in the
129
- * future.
121
+ /**
122
+ * This is required to ensure the parallax scrolling works correctly, since if
123
+ * (for instance) images load after the parallax wrapper has calculated the
124
+ * dimensions of the space, it will result in incorrect parallax scrolling
125
+ * amounts.
126
+ *
127
+ * This is not great since we need to mutation-observe the whole section of the
128
+ * document (which may be large), but we can probably optimize this in the
129
+ * future.
130
130
  */
131
131
  function ParallaxCacheUpdate(_ref) {
132
132
  var children = _ref.children;
@@ -158,10 +158,10 @@ function ParallaxCacheUpdate(_ref) {
158
158
  function ParallaxProviderWrapper(_ref2) {
159
159
  var children = _ref2.children,
160
160
  props = _objectWithoutPropertiesLoose(_ref2, _excluded);
161
- return React.createElement(ParallaxProvider, Object.assign({}, props), React.createElement(ParallaxCacheUpdate, null, children));
161
+ return React.createElement(ParallaxProvider, _extends({}, props), React.createElement(ParallaxCacheUpdate, null, children));
162
162
  }
163
- /**
164
- * @deprecated use `globalParallaxProviderMeta` instead.
163
+ /**
164
+ * @deprecated use `globalParallaxProviderMeta` instead.
165
165
  */
166
166
  var parallaxProviderMeta = {
167
167
  name: "hostless-parallax-provider",
@@ -193,8 +193,8 @@ var parallaxProviderMeta = {
193
193
  }
194
194
  }
195
195
  };
196
- /**
197
- * @deprecated use `registerGlobalParallaxProvider` instead.
196
+ /**
197
+ * @deprecated use `registerGlobalParallaxProvider` instead.
198
198
  */
199
199
  function registerParallaxProvider(loader, customParallaxProviderMeta) {
200
200
  if (loader) {
@@ -1 +1 @@
1
- {"version":3,"file":"react-scroll-parallax.esm.js","sources":["../src/ParallaxWrapper.tsx","../src/ParallaxProvider.tsx"],"sourcesContent":["import { PlasmicCanvasContext } from \"@plasmicapp/host\";\nimport registerComponent, {\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, { useContext } from \"react\";\nimport { Parallax, ParallaxContext } from \"react-scroll-parallax\";\n\nexport interface ParallaxWrapperProps {\n speed?: number;\n disabled?: boolean;\n previewInEditor?: boolean;\n children: React.ReactNode;\n className?: string;\n}\n\nexport default function ParallaxWrapper({\n speed,\n disabled,\n previewInEditor,\n children,\n className,\n}: ParallaxWrapperProps) {\n const inEditor = useContext(PlasmicCanvasContext);\n const hasContext = useContext(ParallaxContext) != null;\n const isServer = typeof window === \"undefined\";\n if (!hasContext && !isServer) {\n throw new Error(\n \"Scroll Parallax can only be instantiated somewhere inside the Parallax Provider\"\n );\n }\n return (\n <Parallax\n disabled={disabled || (inEditor && !previewInEditor)}\n speed={speed}\n className={className}\n >\n {children}\n </Parallax>\n );\n}\n\n/**\n * We're keeping the old registration without attachments to avoid confusion\n * due to the parallax custom behavior not working in old projects that didn't\n * make use of global contexts (so simply adding the custom behavior would\n * break it and it wouldn't be clear that the user should also add a\n * `ParallaxProvider`).\n */\nexport const deprecated_parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps> =\n {\n name: \"hostless-scroll-parallax\",\n displayName: \"Scroll Parallax\",\n importName: \"ParallaxWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"img\",\n src: \"https://placekitten.com/300/200\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n },\n speed: {\n type: \"number\",\n description:\n \"How much to speed up or slow down this element while scrolling. Try -20 for slower, 20 for faster.\",\n defaultValue: 20,\n },\n disabled: {\n type: \"boolean\",\n description: \"Disables the parallax effect.\",\n },\n previewInEditor: {\n type: \"boolean\",\n description: \"Enable the parallax effect in the editor.\",\n },\n },\n defaultStyles: {\n maxWidth: \"100%\",\n },\n };\n\nexport function deprecated_registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? deprecated_parallaxWrapperMeta\n );\n } else {\n registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? deprecated_parallaxWrapperMeta\n );\n }\n}\n\n/**\n * The new registration is only setting `isAttachment: true`.\n */\nexport const parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps> = {\n ...deprecated_parallaxWrapperMeta,\n isAttachment: true,\n};\n\nexport function registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? parallaxWrapperMeta\n );\n } else {\n registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? parallaxWrapperMeta\n );\n }\n}\n","import registerComponent, {\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext, {\n GlobalContextMeta,\n} from \"@plasmicapp/host/registerGlobalContext\";\nimport React, { useEffect, useRef } from \"react\";\nimport {\n ParallaxProvider,\n ParallaxProviderProps,\n useParallaxController,\n} from \"react-scroll-parallax\";\nimport ResizeObserver from \"resize-observer-polyfill\";\n\n/**\n * A safe wrapper around `useController()` to prevent errors when\n * `ParallaxProvider` is missing. If the context is unavailable,\n * `useParallaxController()` will throw an error, which we catch and handle\n * gracefully by returning `null` instead of crashing the component.\n */\nfunction useSafeController() {\n try {\n return useParallaxController();\n } catch {\n return null; // Return null instead of throwing an error\n }\n}\n\n/**\n * This is required to ensure the parallax scrolling works correctly, since if\n * (for instance) images load after the parallax wrapper has calculated the\n * dimensions of the space, it will result in incorrect parallax scrolling\n * amounts.\n *\n * This is not great since we need to mutation-observe the whole section of the\n * document (which may be large), but we can probably optimize this in the\n * future.\n */\nfunction ParallaxCacheUpdate({ children }: React.PropsWithChildren<{}>) {\n const parallaxController = useSafeController();\n const ref = useRef<HTMLDivElement | null>(null);\n\n useEffect(() => {\n if (ref.current?.parentElement) {\n const targetNode = ref.current.parentElement;\n const observer = new ResizeObserver(() => {\n if (parallaxController) {\n parallaxController.update();\n }\n });\n observer.observe(targetNode);\n return () => {\n observer.disconnect();\n };\n }\n return () => {};\n }, [ref.current]);\n\n return (\n <div style={{ display: \"contents\" }} ref={ref}>\n {children}\n </div>\n );\n}\n\nexport function ParallaxProviderWrapper({\n children,\n ...props\n}: React.PropsWithChildren<ParallaxProviderProps>) {\n return (\n <ParallaxProvider {...props}>\n <ParallaxCacheUpdate>{children}</ParallaxCacheUpdate>\n </ParallaxProvider>\n );\n}\n\n/**\n * @deprecated use `globalParallaxProviderMeta` instead.\n */\nexport const parallaxProviderMeta: CodeComponentMeta<ParallaxProviderProps> = {\n name: \"hostless-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProviderWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"vbox\",\n children: [\n {\n type: \"text\",\n value:\n \"Wrap any element in a Scroll Parallax component. Ensure they're all inside this Parallax Provider. Example:\",\n styles: {\n marginBottom: \"20px\",\n },\n },\n {\n type: \"component\",\n name: \"hostless-scroll-parallax\",\n },\n ],\n },\n },\n scrollAxis: {\n type: \"choice\",\n description: \"Scroll axis for setting horizontal/vertical scrolling\",\n options: [\"vertical\", \"horizontal\"],\n displayName: \"Scroll Axis\",\n },\n },\n};\n\n/**\n * @deprecated use `registerGlobalParallaxProvider` instead.\n */\nexport function registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: CodeComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n } else {\n registerComponent(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n }\n}\n\nexport const globalParallaxProviderMeta: GlobalContextMeta<ParallaxProviderProps> =\n {\n name: \"global-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProviderWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n scrollAxis: {\n type: \"choice\",\n description: \"Scroll axis for setting horizontal/vertical scrolling\",\n options: [\"vertical\", \"horizontal\"],\n displayName: \"Scroll Axis\",\n },\n },\n };\n\nexport function registerGlobalParallaxProvider(\n loader?: { registerGlobalContext: typeof registerGlobalContext },\n customParallaxProviderMeta?: GlobalContextMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerGlobalContext(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? globalParallaxProviderMeta\n );\n } else {\n registerGlobalContext(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? globalParallaxProviderMeta\n );\n }\n}\n"],"names":["ParallaxWrapper","_ref","speed","disabled","previewInEditor","children","className","inEditor","useContext","PlasmicCanvasContext","hasContext","ParallaxContext","isServer","window","Error","React","Parallax","deprecated_parallaxWrapperMeta","name","displayName","importName","importPath","props","type","defaultValue","src","styles","maxWidth","description","defaultStyles","deprecated_registerParallaxWrapper","loader","customParallaxWrapperMeta","registerComponent","parallaxWrapperMeta","_extends","isAttachment","registerParallaxWrapper","useSafeController","useParallaxController","_unused","ParallaxCacheUpdate","parallaxController","ref","useRef","useEffect","_ref$current","current","parentElement","targetNode","observer","ResizeObserver","update","observe","disconnect","style","display","ParallaxProviderWrapper","_ref2","_objectWithoutPropertiesLoose","_excluded","ParallaxProvider","parallaxProviderMeta","value","marginBottom","scrollAxis","options","registerParallaxProvider","customParallaxProviderMeta","globalParallaxProviderMeta","registerGlobalParallaxProvider","registerGlobalContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;SAewBA,eAAeA,CAAAC,IAAA;MACrCC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,eAAe,GAAAH,IAAA,CAAfG,eAAe;IACfC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;IACRC,SAAS,GAAAL,IAAA,CAATK,SAAS;EAET,IAAMC,QAAQ,GAAGC,UAAU,CAACC,oBAAoB,CAAC;EACjD,IAAMC,UAAU,GAAGF,UAAU,CAACG,eAAe,CAAC,IAAI,IAAI;EACtD,IAAMC,QAAQ,GAAG,OAAOC,MAAM,KAAK,WA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,EAAE,QAAQ;MACdK,WAAW,EAAE,uDAAuD;MACpEsC,OAAO,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC;MACnC/C,WAAW,EAAE;;;CAGlB;AAEH,SAAgBmD,8BAA8BA,CAC5CvC,MAAgE,EAChEqC,0BAAqE;EAErE,IAAIrC,MAAM,EAAE;IACVA,MAAM,CAACwC,qBAAqB,CAC1Bd,uBAAuB,EACvBW,0BAA0B,WAA1BA,0BAA0B,GAAIC,0BAA0B,CACzD;GACF,MAAM;IACLE,qBAAqB,CACnBd,uBAAuB,EACvBW,0BAA0B,WAA1BA,0BAA0B,GAAIC,0BAA0B,CACzD;;AAEL;;;;"}
1
+ {"version":3,"file":"react-scroll-parallax.esm.js","sources":["../src/ParallaxWrapper.tsx","../src/ParallaxProvider.tsx"],"sourcesContent":["import { PlasmicCanvasContext } from \"@plasmicapp/host\";\nimport registerComponent, {\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, { useContext } from \"react\";\nimport { Parallax, ParallaxContext } from \"react-scroll-parallax\";\n\nexport interface ParallaxWrapperProps {\n speed?: number;\n disabled?: boolean;\n previewInEditor?: boolean;\n children: React.ReactNode;\n className?: string;\n}\n\nexport default function ParallaxWrapper({\n speed,\n disabled,\n previewInEditor,\n children,\n className,\n}: ParallaxWrapperProps) {\n const inEditor = useContext(PlasmicCanvasContext);\n const hasContext = useContext(ParallaxContext) != null;\n const isServer = typeof window === \"undefined\";\n if (!hasContext && !isServer) {\n throw new Error(\n \"Scroll Parallax can only be instantiated somewhere inside the Parallax Provider\"\n );\n }\n return (\n <Parallax\n disabled={disabled || (inEditor && !previewInEditor)}\n speed={speed}\n className={className}\n >\n {children}\n </Parallax>\n );\n}\n\n/**\n * We're keeping the old registration without attachments to avoid confusion\n * due to the parallax custom behavior not working in old projects that didn't\n * make use of global contexts (so simply adding the custom behavior would\n * break it and it wouldn't be clear that the user should also add a\n * `ParallaxProvider`).\n */\nexport const deprecated_parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps> =\n {\n name: \"hostless-scroll-parallax\",\n displayName: \"Scroll Parallax\",\n importName: \"ParallaxWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"img\",\n src: \"https://placekitten.com/300/200\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n },\n speed: {\n type: \"number\",\n description:\n \"How much to speed up or slow down this element while scrolling. Try -20 for slower, 20 for faster.\",\n defaultValue: 20,\n },\n disabled: {\n type: \"boolean\",\n description: \"Disables the parallax effect.\",\n },\n previewInEditor: {\n type: \"boolean\",\n description: \"Enable the parallax effect in the editor.\",\n },\n },\n defaultStyles: {\n maxWidth: \"100%\",\n },\n };\n\nexport function deprecated_registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? deprecated_parallaxWrapperMeta\n );\n } else {\n registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? deprecated_parallaxWrapperMeta\n );\n }\n}\n\n/**\n * The new registration is only setting `isAttachment: true`.\n */\nexport const parallaxWrapperMeta: CodeComponentMeta<ParallaxWrapperProps> = {\n ...deprecated_parallaxWrapperMeta,\n isAttachment: true,\n};\n\nexport function registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: CodeComponentMeta<ParallaxWrapperProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? parallaxWrapperMeta\n );\n } else {\n registerComponent(\n ParallaxWrapper,\n customParallaxWrapperMeta ?? parallaxWrapperMeta\n );\n }\n}\n","import registerComponent, {\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext, {\n GlobalContextMeta,\n} from \"@plasmicapp/host/registerGlobalContext\";\nimport React, { useEffect, useRef } from \"react\";\nimport {\n ParallaxProvider,\n ParallaxProviderProps,\n useParallaxController,\n} from \"react-scroll-parallax\";\nimport ResizeObserver from \"resize-observer-polyfill\";\n\n/**\n * A safe wrapper around `useController()` to prevent errors when\n * `ParallaxProvider` is missing. If the context is unavailable,\n * `useParallaxController()` will throw an error, which we catch and handle\n * gracefully by returning `null` instead of crashing the component.\n */\nfunction useSafeController() {\n try {\n return useParallaxController();\n } catch {\n return null; // Return null instead of throwing an error\n }\n}\n\n/**\n * This is required to ensure the parallax scrolling works correctly, since if\n * (for instance) images load after the parallax wrapper has calculated the\n * dimensions of the space, it will result in incorrect parallax scrolling\n * amounts.\n *\n * This is not great since we need to mutation-observe the whole section of the\n * document (which may be large), but we can probably optimize this in the\n * future.\n */\nfunction ParallaxCacheUpdate({ children }: React.PropsWithChildren<{}>) {\n const parallaxController = useSafeController();\n const ref = useRef<HTMLDivElement | null>(null);\n\n useEffect(() => {\n if (ref.current?.parentElement) {\n const targetNode = ref.current.parentElement;\n const observer = new ResizeObserver(() => {\n if (parallaxController) {\n parallaxController.update();\n }\n });\n observer.observe(targetNode);\n return () => {\n observer.disconnect();\n };\n }\n return () => {};\n }, [ref.current]);\n\n return (\n <div style={{ display: \"contents\" }} ref={ref}>\n {children}\n </div>\n );\n}\n\nexport function ParallaxProviderWrapper({\n children,\n ...props\n}: React.PropsWithChildren<ParallaxProviderProps>) {\n return (\n <ParallaxProvider {...props}>\n <ParallaxCacheUpdate>{children}</ParallaxCacheUpdate>\n </ParallaxProvider>\n );\n}\n\n/**\n * @deprecated use `globalParallaxProviderMeta` instead.\n */\nexport const parallaxProviderMeta: CodeComponentMeta<ParallaxProviderProps> = {\n name: \"hostless-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProviderWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"vbox\",\n children: [\n {\n type: \"text\",\n value:\n \"Wrap any element in a Scroll Parallax component. Ensure they're all inside this Parallax Provider. Example:\",\n styles: {\n marginBottom: \"20px\",\n },\n },\n {\n type: \"component\",\n name: \"hostless-scroll-parallax\",\n },\n ],\n },\n },\n scrollAxis: {\n type: \"choice\",\n description: \"Scroll axis for setting horizontal/vertical scrolling\",\n options: [\"vertical\", \"horizontal\"],\n displayName: \"Scroll Axis\",\n },\n },\n};\n\n/**\n * @deprecated use `registerGlobalParallaxProvider` instead.\n */\nexport function registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: CodeComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n } else {\n registerComponent(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n }\n}\n\nexport const globalParallaxProviderMeta: GlobalContextMeta<ParallaxProviderProps> =\n {\n name: \"global-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProviderWrapper\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n scrollAxis: {\n type: \"choice\",\n description: \"Scroll axis for setting horizontal/vertical scrolling\",\n options: [\"vertical\", \"horizontal\"],\n displayName: \"Scroll Axis\",\n },\n },\n };\n\nexport function registerGlobalParallaxProvider(\n loader?: { registerGlobalContext: typeof registerGlobalContext },\n customParallaxProviderMeta?: GlobalContextMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerGlobalContext(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? globalParallaxProviderMeta\n );\n } else {\n registerGlobalContext(\n ParallaxProviderWrapper,\n customParallaxProviderMeta ?? globalParallaxProviderMeta\n );\n }\n}\n"],"names":["ParallaxWrapper","_ref","speed","disabled","previewInEditor","children","className","inEditor","useContext","PlasmicCanvasContext","hasContext","ParallaxContext","isServer","window","Error","React","Parallax","deprecated_parallaxWrapperMeta","name","displayName","importName","importPath","props","type","defaultValue","src","styles","maxWidth","description","defaultStyles","deprecated_registerParallaxWrapper","loader","customParallaxWrapperMeta","registerComponent","parallaxWrapperMeta","_extends","isAttachment","registerParallaxWrapper","useSafeController","useParallaxController","_unused","ParallaxCacheUpdate","parallaxController","ref","useRef","useEffect","_ref$current","current","parentElement","targetNode","observer","ResizeObserver","update","observe","disconnect","style","display","ParallaxProviderWrapper","_ref2","_objectWithoutPropertiesLoose","_excluded","ParallaxProvider","parallaxProviderMeta","value","marginBottom","scrollAxis","options","registerParallaxProvider","customParallaxProviderMeta","globalParallaxProviderMeta","registerGlobalParallaxProvider","registerGlobalContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;SAewBA,eAAeA,CAAAC,IAAA;MACrCC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,eAAe,GAAAH,IAAA,CAAfG,eAAe;IACfC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;IACRC,SAAS,GAAAL,IAAA,CAATK,SAAS;EAET,IAAMC,QAAQ,GAAGC,UAAU,CAACC,oBAAoB,CAAC;EACjD,IAAMC,UAAU,GAAGF,UAAU,CAACG,eAAe,CAAC,IAAI,IAAI;EACtD,IAAMC,QAAQ,GAAG,OAAOC,MAAM,KAAK,WAAW;EAC9C,IAAI,CAACH,UAAU,IAAI,CAACE,QAAQ,EAAE;IAC5B,MAAM,IAAIE,KAAK,CACb,iFAAiF,CAClF;;EAEH,OACEC,oBAACC,QAAQ;IACPb,QAAQ,EAAEA,QAAQ,IAAKI,QAAQ,IAAI,CAACH,eAAgB;IACpDF,KAAK,EAAEA,KAAK;IACZI,SAAS,EAAEA;KAEVD,QAAQ,CACA;AAEf;AAEA;;;;;;;IAOaY,8BAA8B,GACzC;EACEC,IAAI,EAAE,0BAA0B;EAChCC,WAAW,EAAE,iBAAiB;EAC9BC,UAAU,EAAE,iBAAiB;EAC7BC,UAAU,EAAE,oCAAoC;EAChDC,KAAK,EAAE;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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicpkgs/react-scroll-parallax",
3
- "version": "0.0.258",
3
+ "version": "0.0.260",
4
4
  "description": "Plasmic registration call for the HTML5 video element",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,15 +21,15 @@
21
21
  "scripts": {
22
22
  "build": "tsdx build",
23
23
  "start": "tsdx watch",
24
- "test": "TEST_CWD=`pwd` yarn --cwd=../.. test --passWithNoTests",
24
+ "test": "TEST_CWD=`pwd` pnpm -w test --passWithNoTests",
25
25
  "lint": "tsdx lint",
26
26
  "prepublishOnly": "npm run build",
27
27
  "size": "size-limit",
28
28
  "analyze": "size-limit --why"
29
29
  },
30
30
  "devDependencies": {
31
- "@plasmicapp/host": "2.0.6",
32
- "@types/node": "^14.0.26",
31
+ "@plasmicapp/host": "2.0.8",
32
+ "@types/node": "^14.18.63",
33
33
  "@types/react": "^18",
34
34
  "tsdx": "^0.14.1",
35
35
  "tslib": "^2.2.0"
@@ -43,5 +43,5 @@
43
43
  "react": ">=16.8.0",
44
44
  "react-dom": ">=16.8.0"
45
45
  },
46
- "gitHead": "baa35758ccd16c32259942faebbcbd62d5f174a4"
46
+ "gitHead": "f2542f3c07f280e033323f363580af5dd8dc534b"
47
47
  }