@plasmicpkgs/react-scroll-parallax
Advanced tools
Comparing version 0.0.20 to 0.0.21
import registerComponent, { ComponentMeta } from "@plasmicapp/host/registerComponent"; | ||
import registerGlobalContext, { GlobalContextMeta } from "@plasmicapp/host/registerGlobalContext"; | ||
import React from "react"; | ||
@@ -9,1 +10,5 @@ import { ParallaxProviderProps } from "react-scroll-parallax/dist/components/ParallaxProvider/types"; | ||
}, customParallaxProviderMeta?: ComponentMeta<ParallaxProviderProps>): void; | ||
export declare const globalParallaxProviderMeta: GlobalContextMeta<ParallaxProviderProps>; | ||
export declare function registerGlobalParallaxProvider(loader?: { | ||
registerGlobalContext: typeof registerGlobalContext; | ||
}, customParallaxProviderMeta?: GlobalContextMeta<ParallaxProviderProps>): void; |
@@ -12,2 +12,3 @@ 'use strict'; | ||
var reactScrollParallax = require('react-scroll-parallax'); | ||
var registerGlobalContext = _interopDefault(require('@plasmicapp/host/registerGlobalContext')); | ||
var ResizeObserver = _interopDefault(require('resize-observer-polyfill')); | ||
@@ -177,9 +178,32 @@ | ||
} | ||
var globalParallaxProviderMeta = { | ||
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" | ||
} | ||
} | ||
}; | ||
function registerGlobalParallaxProvider(loader, customParallaxProviderMeta) { | ||
if (loader) { | ||
loader.registerGlobalContext(ParallaxProviderWrapper, customParallaxProviderMeta != null ? customParallaxProviderMeta : globalParallaxProviderMeta); | ||
} else { | ||
registerGlobalContext(ParallaxProviderWrapper, customParallaxProviderMeta != null ? customParallaxProviderMeta : globalParallaxProviderMeta); | ||
} | ||
} | ||
exports.ParallaxProviderWrapper = ParallaxProviderWrapper; | ||
exports.ParallaxWrapper = ParallaxWrapper; | ||
exports.globalParallaxProviderMeta = globalParallaxProviderMeta; | ||
exports.parallaxProviderMeta = parallaxProviderMeta; | ||
exports.parallaxWrapperMeta = parallaxWrapperMeta; | ||
exports.registerGlobalParallaxProvider = registerGlobalParallaxProvider; | ||
exports.registerParallaxProvider = registerParallaxProvider; | ||
exports.registerParallaxWrapper = registerParallaxWrapper; | ||
//# sourceMappingURL=react-scroll-parallax.cjs.development.js.map |
@@ -1,2 +0,2 @@ | ||
"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("resize-observer-polyfill"));function i(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 s={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",style:{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%"}},p=["children"];function c(e){var r=e.children,a=n.useController(),i=l.useRef(null);return l.useEffect((function(){var e;if(null!=(e=i.current)&&e.parentElement){var r=i.current.parentElement,l=new o((function(){a&&a.update()}));return l.observe(r),function(){l.disconnect()}}return function(){}}),[i.current]),t.createElement("div",{style:{display:"contents"},ref:i},r)}function u(e){var r=e.children,a=function(e,r){if(null==e)return{};var a,l,t={},n=Object.keys(e);for(l=0;l<n.length;l++)r.indexOf(a=n[l])>=0||(t[a]=e[a]);return t}(e,p);return t.createElement(n.ParallaxProvider,Object.assign({},a),t.createElement(c,null,r))}var d={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"}}};exports.ParallaxProviderWrapper=u,exports.ParallaxWrapper=i,exports.parallaxProviderMeta=d,exports.parallaxWrapperMeta=s,exports.registerParallaxProvider=function(e,r){e?e.registerComponent(u,null!=r?r:d):a(u,null!=r?r:d)},exports.registerParallaxWrapper=function(e,r){e?e.registerComponent(i,null!=r?r:s):a(i,null!=r?r:s)}; | ||
"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"),l=e(require("@plasmicapp/host/registerComponent")),a=require("react"),t=e(a),o=require("react-scroll-parallax"),i=e(require("@plasmicapp/host/registerGlobalContext")),n=e(require("resize-observer-polyfill"));function s(e){var l=e.speed,i=e.disabled,n=e.previewInEditor,s=e.children,p=e.className,c=a.useContext(r.PlasmicCanvasContext),d=null!=a.useContext(o.ParallaxContext),u="undefined"==typeof window;if(!d&&!u)throw new Error("Scroll Parallax can only be instantiated somewhere inside the Parallax Provider");return t.createElement(o.Parallax,{disabled:i||c&&!n,speed:l,className:p},s)}var p={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",style:{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%"}},c=["children"];function d(e){var r=e.children,l=o.useController(),i=a.useRef(null);return a.useEffect((function(){var e;if(null!=(e=i.current)&&e.parentElement){var r=i.current.parentElement,a=new n((function(){l&&l.update()}));return a.observe(r),function(){a.disconnect()}}return function(){}}),[i.current]),t.createElement("div",{style:{display:"contents"},ref:i},r)}function u(e){var r=e.children,l=function(e,r){if(null==e)return{};var l,a,t={},o=Object.keys(e);for(a=0;a<o.length;a++)r.indexOf(l=o[a])>=0||(t[l]=e[l]);return t}(e,c);return t.createElement(o.ParallaxProvider,Object.assign({},l),t.createElement(d,null,r))}var x={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"}}},m={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=u,exports.ParallaxWrapper=s,exports.globalParallaxProviderMeta=m,exports.parallaxProviderMeta=x,exports.parallaxWrapperMeta=p,exports.registerGlobalParallaxProvider=function(e,r){e?e.registerGlobalContext(u,null!=r?r:m):i(u,null!=r?r:m)},exports.registerParallaxProvider=function(e,r){e?e.registerComponent(u,null!=r?r:x):l(u,null!=r?r:x)},exports.registerParallaxWrapper=function(e,r){e?e.registerComponent(s,null!=r?r:p):l(s,null!=r?r:p)}; | ||
//# sourceMappingURL=react-scroll-parallax.cjs.production.min.js.map |
@@ -5,2 +5,3 @@ import { PlasmicCanvasContext } from '@plasmicapp/host'; | ||
import { ParallaxContext, Parallax, ParallaxProvider, useController } from 'react-scroll-parallax'; | ||
import registerGlobalContext from '@plasmicapp/host/registerGlobalContext'; | ||
import ResizeObserver from 'resize-observer-polyfill'; | ||
@@ -170,4 +171,25 @@ | ||
} | ||
var globalParallaxProviderMeta = { | ||
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" | ||
} | ||
} | ||
}; | ||
function registerGlobalParallaxProvider(loader, customParallaxProviderMeta) { | ||
if (loader) { | ||
loader.registerGlobalContext(ParallaxProviderWrapper, customParallaxProviderMeta != null ? customParallaxProviderMeta : globalParallaxProviderMeta); | ||
} else { | ||
registerGlobalContext(ParallaxProviderWrapper, customParallaxProviderMeta != null ? customParallaxProviderMeta : globalParallaxProviderMeta); | ||
} | ||
} | ||
export { ParallaxProviderWrapper, ParallaxWrapper, parallaxProviderMeta, parallaxWrapperMeta, registerParallaxProvider, registerParallaxWrapper }; | ||
export { ParallaxProviderWrapper, ParallaxWrapper, globalParallaxProviderMeta, parallaxProviderMeta, parallaxWrapperMeta, registerGlobalParallaxProvider, registerParallaxProvider, registerParallaxWrapper }; | ||
//# sourceMappingURL=react-scroll-parallax.esm.js.map |
{ | ||
"name": "@plasmicpkgs/react-scroll-parallax", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"description": "Plasmic registration call for the HTML5 video element", | ||
@@ -31,3 +31,3 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@plasmicapp/host": "1.0.15", | ||
"@plasmicapp/host": "1.0.16", | ||
"@size-limit/preset-small-lib": "^4.11.0", | ||
@@ -34,0 +34,0 @@ "@types/node": "^14.0.26", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
53076
421