@plasmicpkgs/react-scroll-parallax 0.0.3 → 0.0.4
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/react-scroll-parallax.cjs.development.js +17 -1
- package/dist/react-scroll-parallax.cjs.development.js.map +1 -1
- package/dist/react-scroll-parallax.cjs.production.min.js +1 -1
- package/dist/react-scroll-parallax.cjs.production.min.js.map +1 -1
- package/dist/react-scroll-parallax.esm.js +18 -2
- package/dist/react-scroll-parallax.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -23,6 +23,12 @@ function ParallaxWrapper(_ref) {
|
|
|
23
23
|
previewInEditor = _ref.previewInEditor,
|
|
24
24
|
children = _ref.children;
|
|
25
25
|
var inEditor = React.useContext(host.PlasmicCanvasContext);
|
|
26
|
+
var hasContext = React.useContext(reactScrollParallax.ParallaxContext) != null;
|
|
27
|
+
|
|
28
|
+
if (!hasContext) {
|
|
29
|
+
throw new Error("Scroll Parallax can only be instantiated somewhere inside the Parallax Provider");
|
|
30
|
+
}
|
|
31
|
+
|
|
26
32
|
return React__default.createElement(reactScrollParallax.Parallax, {
|
|
27
33
|
disabled: disabled || inEditor && !previewInEditor,
|
|
28
34
|
x: [xStart, xEnd],
|
|
@@ -31,9 +37,19 @@ function ParallaxWrapper(_ref) {
|
|
|
31
37
|
}
|
|
32
38
|
var parallaxWrapperMeta = {
|
|
33
39
|
name: "Parallax",
|
|
40
|
+
displayName: "Scroll Parallax",
|
|
34
41
|
importPath: "@plasmicpkgs/react-scroll-parallax",
|
|
35
42
|
props: {
|
|
36
|
-
children:
|
|
43
|
+
children: {
|
|
44
|
+
type: "slot",
|
|
45
|
+
defaultValue: {
|
|
46
|
+
type: "img",
|
|
47
|
+
src: "https://placekitten.com/300/200",
|
|
48
|
+
style: {
|
|
49
|
+
maxWidth: "100%"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
37
53
|
yStart: {
|
|
38
54
|
type: "string",
|
|
39
55
|
defaultValue: "-50%",
|
|
@@ -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 ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, { useContext } from \"react\";\nimport { Parallax } from \"react-scroll-parallax\";\n\nexport interface ParallaxWrapperProps {\n xStart?: string;\n xEnd?: string;\n yStart?: string;\n yEnd?: string;\n disabled?: boolean;\n previewInEditor?: boolean;\n children: React.ReactNode;\n}\n\nexport default function ParallaxWrapper({\n xStart = \"0\",\n xEnd = \"0\",\n yStart = \"0\",\n yEnd = \"0\",\n disabled,\n previewInEditor,\n children,\n}: ParallaxWrapperProps) {\n const inEditor = useContext(PlasmicCanvasContext);\n return (\n <Parallax\n disabled={disabled || (inEditor && !previewInEditor)}\n x={[xStart, xEnd]}\n y={[yStart, yEnd]}\n >\n {children}\n </Parallax>\n );\n}\n\nconst parallaxWrapperMeta: ComponentMeta<ParallaxWrapperProps> = {\n name: \"Parallax\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: \"slot\",\n yStart: {\n type: \"string\",\n defaultValue: \"-50%\",\n description:\n \"The vertical offset at the start (when just scrolling into view). Can be % or px.\",\n },\n yEnd: {\n type: \"string\",\n defaultValue: \"50%\",\n description:\n \"The vertical offset at the end (when just scrolling out of view). Can be % or px.\",\n },\n xStart: {\n type: \"string\",\n defaultValue: \"50%\",\n description:\n \"The horizontal offset at the start (when just scrolling into view). Can be % or px.\",\n },\n xEnd: {\n type: \"string\",\n defaultValue: \"-50%\",\n description:\n \"The horizontal offset at the end (when just scrolling out of view). Can be % or px.\",\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 registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: ComponentMeta<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, { ComponentMeta } from \"@plasmicapp/host/registerComponent\";\nimport { ParallaxProvider, ParallaxProviderProps } from \"react-scroll-parallax\";\n\nexport const parallaxProviderMeta: ComponentMeta<ParallaxProviderProps> = {\n name: \"hostless-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProvider\",\n importPath: \"react-scroll-parallax\",\n props: {children: \"slot\"}\n}\n\nexport function registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: ComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(ParallaxProvider, customParallaxProviderMeta ?? parallaxProviderMeta);\n } else {\n registerComponent(ParallaxProvider, customParallaxProviderMeta ?? parallaxProviderMeta);\n }\n}\n"],"names":["ParallaxWrapper","xStart","xEnd","yStart","yEnd","disabled","previewInEditor","children","inEditor","useContext","PlasmicCanvasContext","React","Parallax","x","y","parallaxWrapperMeta","name","importPath","props","type","defaultValue","
|
|
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 ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, { useContext } from \"react\";\nimport { Parallax, ParallaxContext } from \"react-scroll-parallax\";\n\nexport interface ParallaxWrapperProps {\n xStart?: string;\n xEnd?: string;\n yStart?: string;\n yEnd?: string;\n disabled?: boolean;\n previewInEditor?: boolean;\n children: React.ReactNode;\n}\n\nexport default function ParallaxWrapper({\n xStart = \"0\",\n xEnd = \"0\",\n yStart = \"0\",\n yEnd = \"0\",\n disabled,\n previewInEditor,\n children,\n}: ParallaxWrapperProps) {\n const inEditor = useContext(PlasmicCanvasContext);\n const hasContext = useContext(ParallaxContext) != null;\n if (!hasContext) {\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 x={[xStart, xEnd]}\n y={[yStart, yEnd]}\n >\n {children}\n </Parallax>\n );\n}\n\nconst parallaxWrapperMeta: ComponentMeta<ParallaxWrapperProps> = {\n name: \"Parallax\",\n displayName: \"Scroll Parallax\",\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 style: {\n maxWidth: \"100%\",\n },\n },\n },\n yStart: {\n type: \"string\",\n defaultValue: \"-50%\",\n description:\n \"The vertical offset at the start (when just scrolling into view). Can be % or px.\",\n },\n yEnd: {\n type: \"string\",\n defaultValue: \"50%\",\n description:\n \"The vertical offset at the end (when just scrolling out of view). Can be % or px.\",\n },\n xStart: {\n type: \"string\",\n defaultValue: \"50%\",\n description:\n \"The horizontal offset at the start (when just scrolling into view). Can be % or px.\",\n },\n xEnd: {\n type: \"string\",\n defaultValue: \"-50%\",\n description:\n \"The horizontal offset at the end (when just scrolling out of view). Can be % or px.\",\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 registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: ComponentMeta<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, { ComponentMeta } from \"@plasmicapp/host/registerComponent\";\nimport { ParallaxProvider, ParallaxProviderProps } from \"react-scroll-parallax\";\n\nexport const parallaxProviderMeta: ComponentMeta<ParallaxProviderProps> = {\n name: \"hostless-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProvider\",\n importPath: \"react-scroll-parallax\",\n props: {children: \"slot\"}\n}\n\nexport function registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: ComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(ParallaxProvider, customParallaxProviderMeta ?? parallaxProviderMeta);\n } else {\n registerComponent(ParallaxProvider, customParallaxProviderMeta ?? parallaxProviderMeta);\n }\n}\n"],"names":["ParallaxWrapper","xStart","xEnd","yStart","yEnd","disabled","previewInEditor","children","inEditor","useContext","PlasmicCanvasContext","hasContext","ParallaxContext","Error","React","Parallax","x","y","parallaxWrapperMeta","name","displayName","importPath","props","type","defaultValue","src","style","maxWidth","description","defaultStyles","registerParallaxWrapper","loader","customParallaxWrapperMeta","registerComponent","parallaxProviderMeta","importName","registerParallaxProvider","customParallaxProviderMeta","ParallaxProvider"],"mappings":";;;;;;;;;;;;SAiBwBA;yBACtBC;MAAAA,kCAAS;uBACTC;MAAAA,8BAAO;yBACPC;MAAAA,kCAAS;uBACTC;MAAAA,8BAAO;MACPC,gBAAAA;MACAC,uBAAAA;MACAC,gBAAAA;AAEA,MAAMC,QAAQ,GAAGC,gBAAU,CAACC,yBAAD,CAA3B;AACA,MAAMC,UAAU,GAAGF,gBAAU,CAACG,mCAAD,CAAV,IAA+B,IAAlD;;AACA,MAAI,CAACD,UAAL,EAAiB;AACf,UAAM,IAAIE,KAAJ,CACJ,iFADI,CAAN;AAGD;;AACD,SACEC,4BAAA,CAACC,4BAAD;AACEV,IAAAA,QA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ADS;AAEfK,MAAAA,WAAW,EAAE;AAFE;AAvCZ,GAJwD;AAgD/DC,EAAAA,aAAa,EAAE;AACbF,IAAAA,QAAQ,EAAE;AADG;AAhDgD,CAAjE;SAqDgBG,wBACdC,QACAC;AAEA,MAAID,MAAJ,EAAY;AACVA,IAAAA,MAAM,CAACE,iBAAP,CACEjC,eADF,EAEEgC,yBAFF,WAEEA,yBAFF,GAE+Bd,mBAF/B;AAID,GALD,MAKO;AACLe,IAAAA,iBAAiB,CACfjC,eADe,EAEfgC,yBAFe,WAEfA,yBAFe,GAEcd,mBAFd,CAAjB;AAID;AACF;;IC7GYgB,oBAAoB,GAAyC;AACxEf,EAAAA,IAAI,EAAE,4BADkE;AAExEC,EAAAA,WAAW,EAAE,mBAF2D;AAGxEe,EAAAA,UAAU,EAAE,kBAH4D;AAIxEd,EAAAA,UAAU,EAAE,uBAJ4D;AAKxEC,EAAAA,KAAK,EAAE;AAACf,IAAAA,QAAQ,EAAE;AAAX;AALiE,CAAnE;AAQP,SAAgB6B,yBACdL,QACAM;AAEA,MAAIN,MAAJ,EAAY;AACVA,IAAAA,MAAM,CAACE,iBAAP,CAAyBK,oCAAzB,EAA2CD,0BAA3C,WAA2CA,0BAA3C,GAAyEH,oBAAzE;AACD,GAFD,MAEO;AACLD,IAAAA,iBAAiB,CAACK,oCAAD,EAAmBD,0BAAnB,WAAmBA,0BAAnB,GAAiDH,oBAAjD,CAAjB;AACD;AACF;;;;;;;"}
|
|
@@ -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
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var a=require("@plasmicapp/host"),t=e(require("@plasmicapp/host/registerComponent")),r=require("react"),l=e(r),o=require("react-scroll-parallax");function i(e){var t=e.xStart,i=void 0===t?"0":t,n=e.xEnd,s=void 0===n?"0":n,p=e.yStart,d=void 0===p?"0":p,c=e.yEnd,x=void 0===c?"0":c,u=e.disabled,h=e.previewInEditor,f=e.children,v=r.useContext(a.PlasmicCanvasContext);if(null==r.useContext(o.ParallaxContext))throw new Error("Scroll Parallax can only be instantiated somewhere inside the Parallax Provider");return l.createElement(o.Parallax,{disabled:u||v&&!h,x:[i,s],y:[d,x]},f)}var n={name:"Parallax",displayName:"Scroll Parallax",importPath:"@plasmicpkgs/react-scroll-parallax",props:{children:{type:"slot",defaultValue:{type:"img",src:"https://placekitten.com/300/200",style:{maxWidth:"100%"}}},yStart:{type:"string",defaultValue:"-50%",description:"The vertical offset at the start (when just scrolling into view). Can be % or px."},yEnd:{type:"string",defaultValue:"50%",description:"The vertical offset at the end (when just scrolling out of view). Can be % or px."},xStart:{type:"string",defaultValue:"50%",description:"The horizontal offset at the start (when just scrolling into view). Can be % or px."},xEnd:{type:"string",defaultValue:"-50%",description:"The horizontal offset at the end (when just scrolling out of view). Can be % or px."},disabled:{type:"boolean",description:"Disables the parallax effect."},previewInEditor:{type:"boolean",description:"Enable the parallax effect in the editor."}},defaultStyles:{maxWidth:"100%"}},s={name:"hostless-parallax-provider",displayName:"Parallax Provider",importName:"ParallaxProvider",importPath:"react-scroll-parallax",props:{children:"slot"}};exports.ParallaxWrapper=i,exports.parallaxProviderMeta=s,exports.registerParallaxProvider=function(e,a){e?e.registerComponent(o.ParallaxProvider,null!=a?a:s):t(o.ParallaxProvider,null!=a?a:s)},exports.registerParallaxWrapper=function(e,a){e?e.registerComponent(i,null!=a?a:n):t(i,null!=a?a:n)};
|
|
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 ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, { useContext } from \"react\";\nimport { Parallax } from \"react-scroll-parallax\";\n\nexport interface ParallaxWrapperProps {\n xStart?: string;\n xEnd?: string;\n yStart?: string;\n yEnd?: string;\n disabled?: boolean;\n previewInEditor?: boolean;\n children: React.ReactNode;\n}\n\nexport default function ParallaxWrapper({\n xStart = \"0\",\n xEnd = \"0\",\n yStart = \"0\",\n yEnd = \"0\",\n disabled,\n previewInEditor,\n children,\n}: ParallaxWrapperProps) {\n const inEditor = useContext(PlasmicCanvasContext);\n return (\n <Parallax\n disabled={disabled || (inEditor && !previewInEditor)}\n x={[xStart, xEnd]}\n y={[yStart, yEnd]}\n >\n {children}\n </Parallax>\n );\n}\n\nconst parallaxWrapperMeta: ComponentMeta<ParallaxWrapperProps> = {\n name: \"Parallax\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: \"slot\",\n yStart: {\n type: \"string\",\n defaultValue: \"-50%\",\n description:\n \"The vertical offset at the start (when just scrolling into view). Can be % or px.\",\n },\n yEnd: {\n type: \"string\",\n defaultValue: \"50%\",\n description:\n \"The vertical offset at the end (when just scrolling out of view). Can be % or px.\",\n },\n xStart: {\n type: \"string\",\n defaultValue: \"50%\",\n description:\n \"The horizontal offset at the start (when just scrolling into view). Can be % or px.\",\n },\n xEnd: {\n type: \"string\",\n defaultValue: \"-50%\",\n description:\n \"The horizontal offset at the end (when just scrolling out of view). Can be % or px.\",\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 registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: ComponentMeta<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, { ComponentMeta } from \"@plasmicapp/host/registerComponent\";\nimport { ParallaxProvider, ParallaxProviderProps } from \"react-scroll-parallax\";\n\nexport const parallaxProviderMeta: ComponentMeta<ParallaxProviderProps> = {\n name: \"hostless-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProvider\",\n importPath: \"react-scroll-parallax\",\n props: {children: \"slot\"}\n}\n\nexport function registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: ComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(ParallaxProvider, customParallaxProviderMeta ?? parallaxProviderMeta);\n } else {\n registerComponent(ParallaxProvider, customParallaxProviderMeta ?? parallaxProviderMeta);\n }\n}\n"],"names":["ParallaxWrapper","xStart","xEnd","yStart","yEnd","disabled","previewInEditor","children","inEditor","useContext","PlasmicCanvasContext","React","Parallax","x","y","parallaxWrapperMeta","name","importPath","props","type","defaultValue","
|
|
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 ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, { useContext } from \"react\";\nimport { Parallax, ParallaxContext } from \"react-scroll-parallax\";\n\nexport interface ParallaxWrapperProps {\n xStart?: string;\n xEnd?: string;\n yStart?: string;\n yEnd?: string;\n disabled?: boolean;\n previewInEditor?: boolean;\n children: React.ReactNode;\n}\n\nexport default function ParallaxWrapper({\n xStart = \"0\",\n xEnd = \"0\",\n yStart = \"0\",\n yEnd = \"0\",\n disabled,\n previewInEditor,\n children,\n}: ParallaxWrapperProps) {\n const inEditor = useContext(PlasmicCanvasContext);\n const hasContext = useContext(ParallaxContext) != null;\n if (!hasContext) {\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 x={[xStart, xEnd]}\n y={[yStart, yEnd]}\n >\n {children}\n </Parallax>\n );\n}\n\nconst parallaxWrapperMeta: ComponentMeta<ParallaxWrapperProps> = {\n name: \"Parallax\",\n displayName: \"Scroll Parallax\",\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 style: {\n maxWidth: \"100%\",\n },\n },\n },\n yStart: {\n type: \"string\",\n defaultValue: \"-50%\",\n description:\n \"The vertical offset at the start (when just scrolling into view). Can be % or px.\",\n },\n yEnd: {\n type: \"string\",\n defaultValue: \"50%\",\n description:\n \"The vertical offset at the end (when just scrolling out of view). Can be % or px.\",\n },\n xStart: {\n type: \"string\",\n defaultValue: \"50%\",\n description:\n \"The horizontal offset at the start (when just scrolling into view). Can be % or px.\",\n },\n xEnd: {\n type: \"string\",\n defaultValue: \"-50%\",\n description:\n \"The horizontal offset at the end (when just scrolling out of view). Can be % or px.\",\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 registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: ComponentMeta<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, { ComponentMeta } from \"@plasmicapp/host/registerComponent\";\nimport { ParallaxProvider, ParallaxProviderProps } from \"react-scroll-parallax\";\n\nexport const parallaxProviderMeta: ComponentMeta<ParallaxProviderProps> = {\n name: \"hostless-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProvider\",\n importPath: \"react-scroll-parallax\",\n props: {children: \"slot\"}\n}\n\nexport function registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: ComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(ParallaxProvider, customParallaxProviderMeta ?? parallaxProviderMeta);\n } else {\n registerComponent(ParallaxProvider, customParallaxProviderMeta ?? parallaxProviderMeta);\n }\n}\n"],"names":["ParallaxWrapper","xStart","xEnd","yStart","yEnd","disabled","previewInEditor","children","inEditor","useContext","PlasmicCanvasContext","ParallaxContext","Error","React","Parallax","x","y","parallaxWrapperMeta","name","displayName","importPath","props","type","defaultValue","src","style","maxWidth","description","defaultStyles","parallaxProviderMeta","importName","loader","customParallaxProviderMeta","registerComponent","ParallaxProvider","customParallaxWrapperMeta"],"mappings":"qSAiBwBA,aACtBC,OAAAA,aAAS,UACTC,KAAAA,aAAO,UACPC,OAAAA,aAAS,UACTC,KAAAA,aAAO,MACPC,IAAAA,SACAC,IAAAA,gBACAC,IAAAA,SAEMC,EAAWC,aAAWC,2BACsB,MAA/BD,aAAWE,yBAEtB,IAAIC,MACR,0FAIFC,gBAACC,YACCT,SAAUA,GAAaG,IAAaF,EACpCS,EAAG,CAACd,EAAQC,GACZc,EAAG,CAACb,EAAQC,IAEXG,GAKP,IAAMU,EAA2D,CAC/DC,KAAM,WACNC,YAAa,kBACbC,WAAY,qCACZC,MAAO,CACLd,SAAU,CACRe,KAAM,OACNC,aAAc,CACZD,KAAM,MACNE,IAAK,kCACLC,MAAO,CACLC,SAAU,UAIhBvB,OAAQ,CACNmB,KAAM,SACNC,aAAc,OACdI,YACE,qFAEJvB,KAAM,CACJkB,KAAM,SACNC,aAAc,MACdI,YACE,qFAEJ1B,OAAQ,CACNqB,KAAM,SACNC,aAAc,MACdI,YACE,uFAEJzB,KAAM,CACJoB,KAAM,SACNC,aAAc,OACdI,YACE,uFAEJtB,SAAU,CACRiB,KAAM,UACNK,YAAa,iCAEfrB,gBAAiB,CACfgB,KAAM,UACNK,YAAa,8CAGjBC,cAAe,CACbF,SAAU,SC1FDG,EAA6D,CACxEX,KAAM,6BACNC,YAAa,oBACbW,WAAY,mBACZV,WAAY,wBACZC,MAAO,CAACd,SAAU,4GAIlBwB,EACAC,GAEID,EACFA,EAAOE,kBAAkBC,yBAAkBF,EAAAA,EAA8BH,GAEzEI,EAAkBC,yBAAkBF,EAAAA,EAA8BH,6CDgFpEE,EACAI,GAEIJ,EACFA,EAAOE,kBACLjC,QACAmC,EAAAA,EAA6BlB,GAG/BgB,EACEjC,QACAmC,EAAAA,EAA6BlB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PlasmicCanvasContext } from '@plasmicapp/host';
|
|
2
2
|
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
3
3
|
import React, { useContext } from 'react';
|
|
4
|
-
import { Parallax, ParallaxProvider } from 'react-scroll-parallax';
|
|
4
|
+
import { ParallaxContext, Parallax, ParallaxProvider } from 'react-scroll-parallax';
|
|
5
5
|
|
|
6
6
|
function ParallaxWrapper(_ref) {
|
|
7
7
|
var _ref$xStart = _ref.xStart,
|
|
@@ -16,6 +16,12 @@ function ParallaxWrapper(_ref) {
|
|
|
16
16
|
previewInEditor = _ref.previewInEditor,
|
|
17
17
|
children = _ref.children;
|
|
18
18
|
var inEditor = useContext(PlasmicCanvasContext);
|
|
19
|
+
var hasContext = useContext(ParallaxContext) != null;
|
|
20
|
+
|
|
21
|
+
if (!hasContext) {
|
|
22
|
+
throw new Error("Scroll Parallax can only be instantiated somewhere inside the Parallax Provider");
|
|
23
|
+
}
|
|
24
|
+
|
|
19
25
|
return React.createElement(Parallax, {
|
|
20
26
|
disabled: disabled || inEditor && !previewInEditor,
|
|
21
27
|
x: [xStart, xEnd],
|
|
@@ -24,9 +30,19 @@ function ParallaxWrapper(_ref) {
|
|
|
24
30
|
}
|
|
25
31
|
var parallaxWrapperMeta = {
|
|
26
32
|
name: "Parallax",
|
|
33
|
+
displayName: "Scroll Parallax",
|
|
27
34
|
importPath: "@plasmicpkgs/react-scroll-parallax",
|
|
28
35
|
props: {
|
|
29
|
-
children:
|
|
36
|
+
children: {
|
|
37
|
+
type: "slot",
|
|
38
|
+
defaultValue: {
|
|
39
|
+
type: "img",
|
|
40
|
+
src: "https://placekitten.com/300/200",
|
|
41
|
+
style: {
|
|
42
|
+
maxWidth: "100%"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
30
46
|
yStart: {
|
|
31
47
|
type: "string",
|
|
32
48
|
defaultValue: "-50%",
|
|
@@ -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 ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, { useContext } from \"react\";\nimport { Parallax } from \"react-scroll-parallax\";\n\nexport interface ParallaxWrapperProps {\n xStart?: string;\n xEnd?: string;\n yStart?: string;\n yEnd?: string;\n disabled?: boolean;\n previewInEditor?: boolean;\n children: React.ReactNode;\n}\n\nexport default function ParallaxWrapper({\n xStart = \"0\",\n xEnd = \"0\",\n yStart = \"0\",\n yEnd = \"0\",\n disabled,\n previewInEditor,\n children,\n}: ParallaxWrapperProps) {\n const inEditor = useContext(PlasmicCanvasContext);\n return (\n <Parallax\n disabled={disabled || (inEditor && !previewInEditor)}\n x={[xStart, xEnd]}\n y={[yStart, yEnd]}\n >\n {children}\n </Parallax>\n );\n}\n\nconst parallaxWrapperMeta: ComponentMeta<ParallaxWrapperProps> = {\n name: \"Parallax\",\n importPath: \"@plasmicpkgs/react-scroll-parallax\",\n props: {\n children: \"slot\",\n yStart: {\n type: \"string\",\n defaultValue: \"-50%\",\n description:\n \"The vertical offset at the start (when just scrolling into view). Can be % or px.\",\n },\n yEnd: {\n type: \"string\",\n defaultValue: \"50%\",\n description:\n \"The vertical offset at the end (when just scrolling out of view). Can be % or px.\",\n },\n xStart: {\n type: \"string\",\n defaultValue: \"50%\",\n description:\n \"The horizontal offset at the start (when just scrolling into view). Can be % or px.\",\n },\n xEnd: {\n type: \"string\",\n defaultValue: \"-50%\",\n description:\n \"The horizontal offset at the end (when just scrolling out of view). Can be % or px.\",\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 registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: ComponentMeta<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, { ComponentMeta } from \"@plasmicapp/host/registerComponent\";\nimport { ParallaxProvider, ParallaxProviderProps } from \"react-scroll-parallax\";\n\nexport const parallaxProviderMeta: ComponentMeta<ParallaxProviderProps> = {\n name: \"hostless-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProvider\",\n importPath: \"react-scroll-parallax\",\n props: {children: \"slot\"}\n}\n\nexport function registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: ComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(ParallaxProvider, customParallaxProviderMeta ?? parallaxProviderMeta);\n } else {\n registerComponent(ParallaxProvider, customParallaxProviderMeta ?? parallaxProviderMeta);\n }\n}\n"],"names":["ParallaxWrapper","xStart","xEnd","yStart","yEnd","disabled","previewInEditor","children","inEditor","useContext","PlasmicCanvasContext","React","Parallax","x","y","parallaxWrapperMeta","name","importPath","props","type","defaultValue","
|
|
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 ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React, { useContext } from \"react\";\nimport { Parallax, ParallaxContext } from \"react-scroll-parallax\";\n\nexport interface ParallaxWrapperProps {\n xStart?: string;\n xEnd?: string;\n yStart?: string;\n yEnd?: string;\n disabled?: boolean;\n previewInEditor?: boolean;\n children: React.ReactNode;\n}\n\nexport default function ParallaxWrapper({\n xStart = \"0\",\n xEnd = \"0\",\n yStart = \"0\",\n yEnd = \"0\",\n disabled,\n previewInEditor,\n children,\n}: ParallaxWrapperProps) {\n const inEditor = useContext(PlasmicCanvasContext);\n const hasContext = useContext(ParallaxContext) != null;\n if (!hasContext) {\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 x={[xStart, xEnd]}\n y={[yStart, yEnd]}\n >\n {children}\n </Parallax>\n );\n}\n\nconst parallaxWrapperMeta: ComponentMeta<ParallaxWrapperProps> = {\n name: \"Parallax\",\n displayName: \"Scroll Parallax\",\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 style: {\n maxWidth: \"100%\",\n },\n },\n },\n yStart: {\n type: \"string\",\n defaultValue: \"-50%\",\n description:\n \"The vertical offset at the start (when just scrolling into view). Can be % or px.\",\n },\n yEnd: {\n type: \"string\",\n defaultValue: \"50%\",\n description:\n \"The vertical offset at the end (when just scrolling out of view). Can be % or px.\",\n },\n xStart: {\n type: \"string\",\n defaultValue: \"50%\",\n description:\n \"The horizontal offset at the start (when just scrolling into view). Can be % or px.\",\n },\n xEnd: {\n type: \"string\",\n defaultValue: \"-50%\",\n description:\n \"The horizontal offset at the end (when just scrolling out of view). Can be % or px.\",\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 registerParallaxWrapper(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxWrapperMeta?: ComponentMeta<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, { ComponentMeta } from \"@plasmicapp/host/registerComponent\";\nimport { ParallaxProvider, ParallaxProviderProps } from \"react-scroll-parallax\";\n\nexport const parallaxProviderMeta: ComponentMeta<ParallaxProviderProps> = {\n name: \"hostless-parallax-provider\",\n displayName: \"Parallax Provider\",\n importName: \"ParallaxProvider\",\n importPath: \"react-scroll-parallax\",\n props: {children: \"slot\"}\n}\n\nexport function registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: ComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(ParallaxProvider, customParallaxProviderMeta ?? parallaxProviderMeta);\n } else {\n registerComponent(ParallaxProvider, customParallaxProviderMeta ?? parallaxProviderMeta);\n }\n}\n"],"names":["ParallaxWrapper","xStart","xEnd","yStart","yEnd","disabled","previewInEditor","children","inEditor","useContext","PlasmicCanvasContext","hasContext","ParallaxContext","Error","React","Parallax","x","y","parallaxWrapperMeta","name","displayName","importPath","props","type","defaultValue","src","style","maxWidth","description","defaultStyles","registerParallaxWrapper","loader","customParallaxWrapperMeta","registerComponent","parallaxProviderMeta","importName","registerParallaxProvider","customParallaxProviderMeta","ParallaxProvider"],"mappings":";;;;;SAiBwBA;yBACt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,GAAiDH,oBAAjD,CAAjB;AACD;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/react-scroll-parallax",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Plasmic registration call for the HTML5 video element",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"typescript": "^3.9.7"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@plasmicapp/host": "^0.0.
|
|
39
|
+
"@plasmicapp/host": "^0.0.42",
|
|
40
40
|
"react-scroll-parallax": "^2.4.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|