@plasmicpkgs/react-scroll-parallax 0.0.2 → 0.0.6
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/ParallaxProvider.d.ts +6 -0
- package/dist/ParallaxWrapper.d.ts +8 -2
- package/dist/index.d.ts +3 -1
- package/dist/react-scroll-parallax.cjs.development.js +65 -10
- 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 +61 -11
- package/dist/react-scroll-parallax.esm.js.map +1 -1
- package/package.json +4 -9
- package/ParallaxWrapper/dist/ParallaxWrapper.d.ts +0 -10
- package/ParallaxWrapper/dist/index.cjs.js +0 -61
- package/ParallaxWrapper/dist/index.cjs.js.map +0 -1
- package/ParallaxWrapper/dist/index.esm.js +0 -52
- package/ParallaxWrapper/dist/index.esm.js.map +0 -1
- package/ParallaxWrapper/package.json +0 -6
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import registerComponent, { ComponentMeta } from "@plasmicapp/host/registerComponent";
|
|
2
|
+
import { ParallaxProviderProps } from "react-scroll-parallax";
|
|
3
|
+
export declare const parallaxProviderMeta: ComponentMeta<ParallaxProviderProps>;
|
|
4
|
+
export declare function registerParallaxProvider(loader?: {
|
|
5
|
+
registerComponent: typeof registerComponent;
|
|
6
|
+
}, customParallaxProviderMeta?: ComponentMeta<ParallaxProviderProps>): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import registerComponent, { ComponentMeta } from "@plasmicapp/host/registerComponent";
|
|
2
|
+
import React from "react";
|
|
2
3
|
export interface ParallaxWrapperProps {
|
|
3
4
|
xStart?: string;
|
|
4
5
|
xEnd?: string;
|
|
@@ -6,5 +7,10 @@ export interface ParallaxWrapperProps {
|
|
|
6
7
|
yEnd?: string;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
previewInEditor?: boolean;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
className?: string;
|
|
9
12
|
}
|
|
10
|
-
export default function ParallaxWrapper({ xStart, xEnd, yStart, yEnd, disabled, previewInEditor, }: ParallaxWrapperProps): JSX.Element;
|
|
13
|
+
export default function ParallaxWrapper({ xStart, xEnd, yStart, yEnd, disabled, previewInEditor, children, className, }: ParallaxWrapperProps): JSX.Element;
|
|
14
|
+
export declare function registerParallaxWrapper(loader?: {
|
|
15
|
+
registerComponent: typeof registerComponent;
|
|
16
|
+
}, customParallaxWrapperMeta?: ComponentMeta<ParallaxWrapperProps>): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
4
6
|
|
|
5
|
-
var registerComponent = _interopDefault(require('@plasmicapp/host/registerComponent'));
|
|
6
7
|
var host = require('@plasmicapp/host');
|
|
8
|
+
var registerComponent = _interopDefault(require('@plasmicapp/host/registerComponent'));
|
|
7
9
|
var React = require('react');
|
|
8
10
|
var React__default = _interopDefault(React);
|
|
9
11
|
var reactScrollParallax = require('react-scroll-parallax');
|
|
@@ -18,19 +20,38 @@ function ParallaxWrapper(_ref) {
|
|
|
18
20
|
_ref$yEnd = _ref.yEnd,
|
|
19
21
|
yEnd = _ref$yEnd === void 0 ? "0" : _ref$yEnd,
|
|
20
22
|
disabled = _ref.disabled,
|
|
21
|
-
previewInEditor = _ref.previewInEditor
|
|
23
|
+
previewInEditor = _ref.previewInEditor,
|
|
24
|
+
children = _ref.children,
|
|
25
|
+
className = _ref.className;
|
|
22
26
|
var inEditor = React.useContext(host.PlasmicCanvasContext);
|
|
27
|
+
var hasContext = React.useContext(reactScrollParallax.ParallaxContext) != null;
|
|
28
|
+
|
|
29
|
+
if (!hasContext) {
|
|
30
|
+
throw new Error("Scroll Parallax can only be instantiated somewhere inside the Parallax Provider");
|
|
31
|
+
}
|
|
32
|
+
|
|
23
33
|
return React__default.createElement(reactScrollParallax.Parallax, {
|
|
24
34
|
disabled: disabled || inEditor && !previewInEditor,
|
|
25
35
|
x: [xStart, xEnd],
|
|
26
|
-
y: [yStart, yEnd]
|
|
27
|
-
|
|
36
|
+
y: [yStart, yEnd],
|
|
37
|
+
className: className
|
|
38
|
+
}, children);
|
|
28
39
|
}
|
|
29
|
-
|
|
30
|
-
name: "
|
|
31
|
-
|
|
40
|
+
var parallaxWrapperMeta = {
|
|
41
|
+
name: "hostless-scroll-parallax",
|
|
42
|
+
displayName: "Scroll Parallax",
|
|
43
|
+
importPath: "@plasmicpkgs/react-scroll-parallax",
|
|
32
44
|
props: {
|
|
33
|
-
children:
|
|
45
|
+
children: {
|
|
46
|
+
type: "slot",
|
|
47
|
+
defaultValue: {
|
|
48
|
+
type: "img",
|
|
49
|
+
src: "https://placekitten.com/300/200",
|
|
50
|
+
style: {
|
|
51
|
+
maxWidth: "100%"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
34
55
|
yStart: {
|
|
35
56
|
type: "string",
|
|
36
57
|
defaultValue: "-50%",
|
|
@@ -60,9 +81,43 @@ registerComponent(ParallaxWrapper, {
|
|
|
60
81
|
description: "Enable the parallax effect in the editor."
|
|
61
82
|
}
|
|
62
83
|
},
|
|
63
|
-
isDefaultExport: true,
|
|
64
84
|
defaultStyles: {
|
|
65
85
|
maxWidth: "100%"
|
|
66
86
|
}
|
|
67
|
-
}
|
|
87
|
+
};
|
|
88
|
+
function registerParallaxWrapper(loader, customParallaxWrapperMeta) {
|
|
89
|
+
if (loader) {
|
|
90
|
+
loader.registerComponent(ParallaxWrapper, customParallaxWrapperMeta != null ? customParallaxWrapperMeta : parallaxWrapperMeta);
|
|
91
|
+
} else {
|
|
92
|
+
registerComponent(ParallaxWrapper, customParallaxWrapperMeta != null ? customParallaxWrapperMeta : parallaxWrapperMeta);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
var parallaxProviderMeta = {
|
|
97
|
+
name: "hostless-parallax-provider",
|
|
98
|
+
displayName: "Parallax Provider",
|
|
99
|
+
importName: "ParallaxProvider",
|
|
100
|
+
importPath: "react-scroll-parallax",
|
|
101
|
+
props: {
|
|
102
|
+
children: "slot",
|
|
103
|
+
scrollAxis: {
|
|
104
|
+
type: "choice",
|
|
105
|
+
description: "Scroll axis for setting horizontal/vertical scrolling",
|
|
106
|
+
options: ["vertical", "horizontal"],
|
|
107
|
+
displayName: "Scroll Axis"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
function registerParallaxProvider(loader, customParallaxProviderMeta) {
|
|
112
|
+
if (loader) {
|
|
113
|
+
loader.registerComponent(reactScrollParallax.ParallaxProvider, customParallaxProviderMeta != null ? customParallaxProviderMeta : parallaxProviderMeta);
|
|
114
|
+
} else {
|
|
115
|
+
registerComponent(reactScrollParallax.ParallaxProvider, customParallaxProviderMeta != null ? customParallaxProviderMeta : parallaxProviderMeta);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
exports.ParallaxWrapper = ParallaxWrapper;
|
|
120
|
+
exports.parallaxProviderMeta = parallaxProviderMeta;
|
|
121
|
+
exports.registerParallaxProvider = registerParallaxProvider;
|
|
122
|
+
exports.registerParallaxWrapper = registerParallaxWrapper;
|
|
68
123
|
//# sourceMappingURL=react-scroll-parallax.cjs.development.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-scroll-parallax.cjs.development.js","sources":["../src/ParallaxWrapper.tsx"],"sourcesContent":["import
|
|
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 className?: string;\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 className,\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 className={className}\n >\n {children}\n </Parallax>\n );\n}\n\nconst parallaxWrapperMeta: ComponentMeta<ParallaxWrapperProps> = {\n name: \"hostless-scroll-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, {\n ComponentMeta,\n} 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: {\n children: \"slot\",\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 registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: ComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxProvider,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n } else {\n registerComponent(\n ParallaxProvider,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n }\n}\n"],"names":["ParallaxWrapper","xStart","xEnd","yStart","yEnd","disabled","previewInEditor","children","className","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","scrollAxis","options","registerParallaxProvider","customParallaxProviderMeta","ParallaxProvider"],"mappings":";;;;;;;;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FP;AALiE,CAAnE;AAgBP,SAAgBkB,yBACdP,QACAQ;AAEA,MAAIR,MAAJ,EAAY;AACVA,IAAAA,MAAM,CAACE,iBAAP,CACEO,oCADF,EAEED,0BAFF,WAEEA,0BAFF,GAEgCL,oBAFhC;AAID,GALD,MAKO;AACLD,IAAAA,iBAAiB,CACfO,oCADe,EAEfD,0BAFe,WAEfA,0BAFe,GAEeL,oBAFf,CAAjB;AAID;AACF;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}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,s=e.xEnd,n=void 0===s?"0":s,p=e.yStart,c=void 0===p?"0":p,d=e.yEnd,x=void 0===d?"0":d,u=e.disabled,h=e.previewInEditor,f=e.children,v=e.className,m=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||m&&!h,x:[i,n],y:[c,x],className:v},f)}var s={name:"hostless-scroll-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%"}},n={name:"hostless-parallax-provider",displayName:"Parallax Provider",importName:"ParallaxProvider",importPath:"react-scroll-parallax",props:{children:"slot",scrollAxis:{type:"choice",description:"Scroll axis for setting horizontal/vertical scrolling",options:["vertical","horizontal"],displayName:"Scroll Axis"}}};exports.ParallaxWrapper=i,exports.parallaxProviderMeta=n,exports.registerParallaxProvider=function(e,a){e?e.registerComponent(o.ParallaxProvider,null!=a?a:n):t(o.ParallaxProvider,null!=a?a:n)},exports.registerParallaxWrapper=function(e,a){e?e.registerComponent(i,null!=a?a:s):t(i,null!=a?a:s)};
|
|
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"],"sourcesContent":["import
|
|
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 className?: string;\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 className,\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 className={className}\n >\n {children}\n </Parallax>\n );\n}\n\nconst parallaxWrapperMeta: ComponentMeta<ParallaxWrapperProps> = {\n name: \"hostless-scroll-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, {\n ComponentMeta,\n} 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: {\n children: \"slot\",\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 registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: ComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxProvider,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n } else {\n registerComponent(\n ParallaxProvider,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n }\n}\n"],"names":["ParallaxWrapper","xStart","xEnd","yStart","yEnd","disabled","previewInEditor","children","className","inEditor","useContext","PlasmicCanvasContext","ParallaxContext","Error","React","Parallax","x","y","parallaxWrapperMeta","name","displayName","importPath","props","type","defaultValue","src","style","maxWidth","description","defaultStyles","parallaxProviderMeta","importName","scrollAxis","options","loader","customParallaxProviderMeta","registerComponent","ParallaxProvider","customParallaxWrapperMeta"],"mappings":"qSAkBwBA,aACtBC,OAAAA,aAAS,UACTC,KAAAA,aAAO,UACPC,OAAAA,aAAS,UACTC,KAAAA,aAAO,MACPC,IAAAA,SACAC,IAAAA,gBACAC,IAAAA,SACAC,IAAAA,UAEMC,EAAWC,aAAWC,2BACsB,MAA/BD,aAAWE,yBAEtB,IAAIC,MACR,0FAIFC,gBAACC,YACCV,SAAUA,GAAaI,IAAaH,EACpCU,EAAG,CAACf,EAAQC,GACZe,EAAG,CAACd,EAAQC,GACZI,UAAWA,GAEVD,GAKP,IAAMW,EAA2D,CAC/DC,KAAM,2BACNC,YAAa,kBACbC,WAAY,qCACZC,MAAO,CACLf,SAAU,CACRgB,KAAM,OACNC,aAAc,CACZD,KAAM,MACNE,IAAK,kCACLC,MAAO,CACLC,SAAU,UAIhBxB,OAAQ,CACNoB,KAAM,SACNC,aAAc,OACdI,YACE,qFAEJxB,KAAM,CACJmB,KAAM,SACNC,aAAc,MACdI,YACE,qFAEJ3B,OAAQ,CACNsB,KAAM,SACNC,aAAc,MACdI,YACE,uFAEJ1B,KAAM,CACJqB,KAAM,SACNC,aAAc,OACdI,YACE,uFAEJvB,SAAU,CACRkB,KAAM,UACNK,YAAa,iCAEftB,gBAAiB,CACfiB,KAAM,UACNK,YAAa,8CAGjBC,cAAe,CACbF,SAAU,SC3FDG,EAA6D,CACxEX,KAAM,6BACNC,YAAa,oBACbW,WAAY,mBACZV,WAAY,wBACZC,MAAO,CACLf,SAAU,OACVyB,WAAY,CACVT,KAAM,SACNK,YAAa,wDACbK,QAAS,CAAC,WAAY,cACtBb,YAAa,oHAMjBc,EACAC,GAEID,EACFA,EAAOE,kBACLC,yBACAF,EAAAA,EAA8BL,GAGhCM,EACEC,yBACAF,EAAAA,EAA8BL,6CDoElCI,EACAI,GAEIJ,EACFA,EAAOE,kBACLpC,QACAsC,EAAAA,EAA6BpB,GAG/BkB,EACEpC,QACAsC,EAAAA,EAA6BpB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
2
1
|
import { PlasmicCanvasContext } from '@plasmicapp/host';
|
|
2
|
+
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
3
3
|
import React, { useContext } from 'react';
|
|
4
|
-
import { Parallax } 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,
|
|
@@ -13,19 +13,38 @@ function ParallaxWrapper(_ref) {
|
|
|
13
13
|
_ref$yEnd = _ref.yEnd,
|
|
14
14
|
yEnd = _ref$yEnd === void 0 ? "0" : _ref$yEnd,
|
|
15
15
|
disabled = _ref.disabled,
|
|
16
|
-
previewInEditor = _ref.previewInEditor
|
|
16
|
+
previewInEditor = _ref.previewInEditor,
|
|
17
|
+
children = _ref.children,
|
|
18
|
+
className = _ref.className;
|
|
17
19
|
var inEditor = useContext(PlasmicCanvasContext);
|
|
20
|
+
var hasContext = useContext(ParallaxContext) != null;
|
|
21
|
+
|
|
22
|
+
if (!hasContext) {
|
|
23
|
+
throw new Error("Scroll Parallax can only be instantiated somewhere inside the Parallax Provider");
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
return React.createElement(Parallax, {
|
|
19
27
|
disabled: disabled || inEditor && !previewInEditor,
|
|
20
28
|
x: [xStart, xEnd],
|
|
21
|
-
y: [yStart, yEnd]
|
|
22
|
-
|
|
29
|
+
y: [yStart, yEnd],
|
|
30
|
+
className: className
|
|
31
|
+
}, children);
|
|
23
32
|
}
|
|
24
|
-
|
|
25
|
-
name: "
|
|
26
|
-
|
|
33
|
+
var parallaxWrapperMeta = {
|
|
34
|
+
name: "hostless-scroll-parallax",
|
|
35
|
+
displayName: "Scroll Parallax",
|
|
36
|
+
importPath: "@plasmicpkgs/react-scroll-parallax",
|
|
27
37
|
props: {
|
|
28
|
-
children:
|
|
38
|
+
children: {
|
|
39
|
+
type: "slot",
|
|
40
|
+
defaultValue: {
|
|
41
|
+
type: "img",
|
|
42
|
+
src: "https://placekitten.com/300/200",
|
|
43
|
+
style: {
|
|
44
|
+
maxWidth: "100%"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
29
48
|
yStart: {
|
|
30
49
|
type: "string",
|
|
31
50
|
defaultValue: "-50%",
|
|
@@ -55,9 +74,40 @@ registerComponent(ParallaxWrapper, {
|
|
|
55
74
|
description: "Enable the parallax effect in the editor."
|
|
56
75
|
}
|
|
57
76
|
},
|
|
58
|
-
isDefaultExport: true,
|
|
59
77
|
defaultStyles: {
|
|
60
78
|
maxWidth: "100%"
|
|
61
79
|
}
|
|
62
|
-
}
|
|
80
|
+
};
|
|
81
|
+
function registerParallaxWrapper(loader, customParallaxWrapperMeta) {
|
|
82
|
+
if (loader) {
|
|
83
|
+
loader.registerComponent(ParallaxWrapper, customParallaxWrapperMeta != null ? customParallaxWrapperMeta : parallaxWrapperMeta);
|
|
84
|
+
} else {
|
|
85
|
+
registerComponent(ParallaxWrapper, customParallaxWrapperMeta != null ? customParallaxWrapperMeta : parallaxWrapperMeta);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var parallaxProviderMeta = {
|
|
90
|
+
name: "hostless-parallax-provider",
|
|
91
|
+
displayName: "Parallax Provider",
|
|
92
|
+
importName: "ParallaxProvider",
|
|
93
|
+
importPath: "react-scroll-parallax",
|
|
94
|
+
props: {
|
|
95
|
+
children: "slot",
|
|
96
|
+
scrollAxis: {
|
|
97
|
+
type: "choice",
|
|
98
|
+
description: "Scroll axis for setting horizontal/vertical scrolling",
|
|
99
|
+
options: ["vertical", "horizontal"],
|
|
100
|
+
displayName: "Scroll Axis"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
function registerParallaxProvider(loader, customParallaxProviderMeta) {
|
|
105
|
+
if (loader) {
|
|
106
|
+
loader.registerComponent(ParallaxProvider, customParallaxProviderMeta != null ? customParallaxProviderMeta : parallaxProviderMeta);
|
|
107
|
+
} else {
|
|
108
|
+
registerComponent(ParallaxProvider, customParallaxProviderMeta != null ? customParallaxProviderMeta : parallaxProviderMeta);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { ParallaxWrapper, parallaxProviderMeta, registerParallaxProvider, registerParallaxWrapper };
|
|
63
113
|
//# sourceMappingURL=react-scroll-parallax.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-scroll-parallax.esm.js","sources":["../src/ParallaxWrapper.tsx"],"sourcesContent":["import
|
|
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 className?: string;\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 className,\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 className={className}\n >\n {children}\n </Parallax>\n );\n}\n\nconst parallaxWrapperMeta: ComponentMeta<ParallaxWrapperProps> = {\n name: \"hostless-scroll-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, {\n ComponentMeta,\n} 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: {\n children: \"slot\",\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 registerParallaxProvider(\n loader?: { registerComponent: typeof registerComponent },\n customParallaxProviderMeta?: ComponentMeta<ParallaxProviderProps>\n) {\n if (loader) {\n loader.registerComponent(\n ParallaxProvider,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n } else {\n registerComponent(\n ParallaxProvider,\n customParallaxProviderMeta ?? parallaxProviderMeta\n );\n }\n}\n"],"names":["ParallaxWrapper","xStart","xEnd","yStart","yEnd","disabled","previewInEditor","children","className","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","scrollAxis","options","registerParallaxProvider","customParallaxProviderMeta","ParallaxProvider"],"mappings":";;;;;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CAAnE;AAgBP,SAAgBkB,yBACdP,QACAQ;AAEA,MAAIR,MAAJ,EAAY;AACVA,IAAAA,MAAM,CAACE,iBAAP,CACEO,gBADF,EAEED,0BAFF,WAEEA,0BAFF,GAEgCL,oBAFhC;AAID,GALD,MAKO;AACLD,IAAAA,iBAAiB,CACfO,gBADe,EAEfD,0BAFe,WAEfA,0BAFe,GAEeL,oBAFf,CAAjB;AAID;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/react-scroll-parallax",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Plasmic registration call for the HTML5 video element",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"module": "dist/react-scroll-parallax.esm.js",
|
|
8
8
|
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
"ParallaxWrapper"
|
|
9
|
+
"dist"
|
|
11
10
|
],
|
|
12
11
|
"size-limit": [
|
|
13
12
|
{
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
}
|
|
21
20
|
],
|
|
22
21
|
"scripts": {
|
|
23
|
-
"build": "tsdx build
|
|
22
|
+
"build": "tsdx build",
|
|
24
23
|
"start": "tsdx watch",
|
|
25
24
|
"test": "tsdx test --passWithNoTests",
|
|
26
25
|
"lint": "tsdx lint",
|
|
@@ -29,19 +28,15 @@
|
|
|
29
28
|
"analyze": "size-limit --why"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
|
-
"@rollup/plugin-commonjs": "^19.0.0",
|
|
33
|
-
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
34
31
|
"@size-limit/preset-small-lib": "^4.11.0",
|
|
35
32
|
"@types/node": "^14.0.26",
|
|
36
|
-
"rollup": "^2.47.0",
|
|
37
|
-
"rollup-plugin-typescript2": "^0.30.0",
|
|
38
33
|
"size-limit": "^4.11.0",
|
|
39
34
|
"tsdx": "^0.14.1",
|
|
40
35
|
"tslib": "^2.2.0",
|
|
41
36
|
"typescript": "^3.9.7"
|
|
42
37
|
},
|
|
43
38
|
"dependencies": {
|
|
44
|
-
"@plasmicapp/host": "^0.0.
|
|
39
|
+
"@plasmicapp/host": "^0.0.47",
|
|
45
40
|
"react-scroll-parallax": "^2.4.0"
|
|
46
41
|
},
|
|
47
42
|
"peerDependencies": {
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export interface ParallaxWrapperProps {
|
|
3
|
-
xStart?: string;
|
|
4
|
-
xEnd?: string;
|
|
5
|
-
yStart?: string;
|
|
6
|
-
yEnd?: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
previewInEditor?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export default function ParallaxWrapper({ xStart, xEnd, yStart, yEnd, disabled, previewInEditor, }: ParallaxWrapperProps): JSX.Element;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var registerComponent = require('@plasmicapp/host/registerComponent');
|
|
6
|
-
var host = require('@plasmicapp/host');
|
|
7
|
-
var React = require('react');
|
|
8
|
-
var reactScrollParallax = require('react-scroll-parallax');
|
|
9
|
-
|
|
10
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
-
|
|
12
|
-
var registerComponent__default = /*#__PURE__*/_interopDefaultLegacy(registerComponent);
|
|
13
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
-
|
|
15
|
-
function ParallaxWrapper(_a) {
|
|
16
|
-
var _b = _a.xStart, xStart = _b === void 0 ? "0" : _b, _c = _a.xEnd, xEnd = _c === void 0 ? "0" : _c, _d = _a.yStart, yStart = _d === void 0 ? "0" : _d, _e = _a.yEnd, yEnd = _e === void 0 ? "0" : _e, disabled = _a.disabled, previewInEditor = _a.previewInEditor;
|
|
17
|
-
var inEditor = React.useContext(host.PlasmicCanvasContext);
|
|
18
|
-
return (React__default["default"].createElement(reactScrollParallax.Parallax, { disabled: disabled || (inEditor && !previewInEditor), x: [xStart, xEnd], y: [yStart, yEnd] }));
|
|
19
|
-
}
|
|
20
|
-
registerComponent__default["default"](ParallaxWrapper, {
|
|
21
|
-
name: "Parallax",
|
|
22
|
-
importPath: "@plasmicpkgs/react-scroll-parallax/ParallaxWrapper",
|
|
23
|
-
props: {
|
|
24
|
-
children: "slot",
|
|
25
|
-
yStart: {
|
|
26
|
-
type: "string",
|
|
27
|
-
defaultValue: "-50%",
|
|
28
|
-
description: "The vertical offset at the start (when just scrolling into view). Can be % or px.",
|
|
29
|
-
},
|
|
30
|
-
yEnd: {
|
|
31
|
-
type: "string",
|
|
32
|
-
defaultValue: "50%",
|
|
33
|
-
description: "The vertical offset at the end (when just scrolling out of view). Can be % or px.",
|
|
34
|
-
},
|
|
35
|
-
xStart: {
|
|
36
|
-
type: "string",
|
|
37
|
-
defaultValue: "50%",
|
|
38
|
-
description: "The horizontal offset at the start (when just scrolling into view). Can be % or px.",
|
|
39
|
-
},
|
|
40
|
-
xEnd: {
|
|
41
|
-
type: "string",
|
|
42
|
-
defaultValue: "-50%",
|
|
43
|
-
description: "The horizontal offset at the end (when just scrolling out of view). Can be % or px.",
|
|
44
|
-
},
|
|
45
|
-
disabled: {
|
|
46
|
-
type: "boolean",
|
|
47
|
-
description: "Disables the parallax effect.",
|
|
48
|
-
},
|
|
49
|
-
previewInEditor: {
|
|
50
|
-
type: "boolean",
|
|
51
|
-
description: "Enable the parallax effect in the editor.",
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
isDefaultExport: true,
|
|
55
|
-
defaultStyles: {
|
|
56
|
-
maxWidth: "100%",
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
exports["default"] = ParallaxWrapper;
|
|
61
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../src/ParallaxWrapper.tsx"],"sourcesContent":["import registerComponent from \"@plasmicapp/host/registerComponent\";\nimport { PlasmicCanvasContext } from \"@plasmicapp/host\";\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}\n\nexport default function ParallaxWrapper({\n xStart = \"0\",\n xEnd = \"0\",\n yStart = \"0\",\n yEnd = \"0\",\n disabled,\n previewInEditor,\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 );\n}\n\nregisterComponent(ParallaxWrapper, {\n name: \"Parallax\",\n importPath: \"@plasmicpkgs/react-scroll-parallax/ParallaxWrapper\",\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 isDefaultExport: true,\n defaultStyles: {\n maxWidth: \"100%\",\n },\n});\n"],"names":["useContext","PlasmicCanvasCont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ACrB,aAAa,EAAE;QACb,QAAQ,EAAE,MAAM;KACjB;CACF,CAAC;;;;"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
2
|
-
import { PlasmicCanvasContext } from '@plasmicapp/host';
|
|
3
|
-
import React, { useContext } from 'react';
|
|
4
|
-
import { Parallax } from 'react-scroll-parallax';
|
|
5
|
-
|
|
6
|
-
function ParallaxWrapper(_a) {
|
|
7
|
-
var _b = _a.xStart, xStart = _b === void 0 ? "0" : _b, _c = _a.xEnd, xEnd = _c === void 0 ? "0" : _c, _d = _a.yStart, yStart = _d === void 0 ? "0" : _d, _e = _a.yEnd, yEnd = _e === void 0 ? "0" : _e, disabled = _a.disabled, previewInEditor = _a.previewInEditor;
|
|
8
|
-
var inEditor = useContext(PlasmicCanvasContext);
|
|
9
|
-
return (React.createElement(Parallax, { disabled: disabled || (inEditor && !previewInEditor), x: [xStart, xEnd], y: [yStart, yEnd] }));
|
|
10
|
-
}
|
|
11
|
-
registerComponent(ParallaxWrapper, {
|
|
12
|
-
name: "Parallax",
|
|
13
|
-
importPath: "@plasmicpkgs/react-scroll-parallax/ParallaxWrapper",
|
|
14
|
-
props: {
|
|
15
|
-
children: "slot",
|
|
16
|
-
yStart: {
|
|
17
|
-
type: "string",
|
|
18
|
-
defaultValue: "-50%",
|
|
19
|
-
description: "The vertical offset at the start (when just scrolling into view). Can be % or px.",
|
|
20
|
-
},
|
|
21
|
-
yEnd: {
|
|
22
|
-
type: "string",
|
|
23
|
-
defaultValue: "50%",
|
|
24
|
-
description: "The vertical offset at the end (when just scrolling out of view). Can be % or px.",
|
|
25
|
-
},
|
|
26
|
-
xStart: {
|
|
27
|
-
type: "string",
|
|
28
|
-
defaultValue: "50%",
|
|
29
|
-
description: "The horizontal offset at the start (when just scrolling into view). Can be % or px.",
|
|
30
|
-
},
|
|
31
|
-
xEnd: {
|
|
32
|
-
type: "string",
|
|
33
|
-
defaultValue: "-50%",
|
|
34
|
-
description: "The horizontal offset at the end (when just scrolling out of view). Can be % or px.",
|
|
35
|
-
},
|
|
36
|
-
disabled: {
|
|
37
|
-
type: "boolean",
|
|
38
|
-
description: "Disables the parallax effect.",
|
|
39
|
-
},
|
|
40
|
-
previewInEditor: {
|
|
41
|
-
type: "boolean",
|
|
42
|
-
description: "Enable the parallax effect in the editor.",
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
isDefaultExport: true,
|
|
46
|
-
defaultStyles: {
|
|
47
|
-
maxWidth: "100%",
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export { ParallaxWrapper as default };
|
|
52
|
-
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../src/ParallaxWrapper.tsx"],"sourcesContent":["import registerComponent from \"@plasmicapp/host/registerComponent\";\nimport { PlasmicCanvasContext } from \"@plasmicapp/host\";\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}\n\nexport default function ParallaxWrapper({\n xStart = \"0\",\n xEnd = \"0\",\n yStart = \"0\",\n yEnd = \"0\",\n disabled,\n previewInEditor,\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 );\n}\n\nregisterComponent(ParallaxWrapper, {\n name: \"Parallax\",\n importPath: \"@plasmicpkgs/react-scroll-parallax/ParallaxWrapper\",\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 isDefaultExport: true,\n defaultStyles: {\n maxWidth: \"100%\",\n },\n});\n"],"names":[],"mappings":";;;;;SAcwB,eAAe,CAAC,EAOjB;QANrB,cAAY,EAAZ,MAAM,mBAAG,GAAG,KAAA,EACZ,YAAU,EAAV,IAAI,mBAAG,GAAG,KAAA,EACV,cAAY,EAAZ,MAAM,mBAAG,GAAG,KAAA,EACZ,YAAU,EAAV,IAAI,mBAAG,GAAG,KAAA,EACV,QAAQ,cAAA,EACR,eAAe,qBAAA;IAEf,IAAM,QAAQ,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IAClD,QACE,oBAAC,QAAQ,IACP,QAAQ,EAAE,QAAQ,KAAK,QAAQ,IAAI,CAAC,eAAe,CAAC,EACpD,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EACjB,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,GACjB,EACF;AACJ,CAAC;AAED,iBAAiB,CAAC,eAAe,EAAE;IACjC,IAAI,EAAE,UAAU;IAChB,UAAU,EAAE,oDAAoD;IAChE,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,YAAY,EAAE,MAAM;YACpB,WAAW,EACT,mFAAmF;SACtF;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,YAAY,EAAE,KAAK;YACnB,WAAW,EACT,mFAAmF;SACtF;QACD,MAAM,EAAE;YACN,IAAI,EA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