react-stick
Advanced tools
Comparing version 4.2.0 to 4.2.1
@@ -1,2 +0,2 @@ | ||
import _slicedToArray from "../node_modules/@babel/runtime/helpers/esm/slicedToArray.js"; | ||
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
import invariant from "invariant"; | ||
@@ -7,2 +7,3 @@ import { useState, useEffect, useCallback } from "react"; | ||
import getDefaultAlign from "../utils/getDefaultAlign.js"; | ||
import "@babel/runtime/helpers/defineProperty"; | ||
var useAutoFlip = function useAutoFlip2(enableAutoHorizontalFlip, enableAutoVerticalFlip, initialPosition, initialAlign) { | ||
@@ -9,0 +10,0 @@ var _useState = useState(initialPosition), _useState2 = _slicedToArray(_useState, 2), currentPosition = _useState2[0], setCurrentPosition = _useState2[1]; |
@@ -1,4 +0,4 @@ | ||
import _extends from "./node_modules/@babel/runtime/helpers/esm/extends.js"; | ||
import _slicedToArray from "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"; | ||
import _objectWithoutProperties from "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"; | ||
import _extends from "@babel/runtime/helpers/extends"; | ||
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; | ||
import "requestidlecallback"; | ||
@@ -5,0 +5,0 @@ import invariant from "invariant"; |
@@ -1,5 +0,6 @@ | ||
import _extends from "./node_modules/@babel/runtime/helpers/esm/extends.js"; | ||
import _objectWithoutProperties from "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"; | ||
import _extends from "@babel/runtime/helpers/extends"; | ||
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; | ||
import React from "react"; | ||
import useStyles from "substyle"; | ||
import "@babel/runtime/helpers/slicedToArray"; | ||
import getModifiers from "./utils/getModifiers.js"; | ||
@@ -6,0 +7,0 @@ var _excluded = ["node", "children", "component", "containerRef", "nestingKey", "align", "position", "style"]; |
@@ -1,4 +0,5 @@ | ||
import _extends from "./node_modules/@babel/runtime/helpers/esm/extends.js"; | ||
import _extends from "@babel/runtime/helpers/extends"; | ||
import React, { forwardRef } from "react"; | ||
import useStyles, { inline } from "substyle"; | ||
import "@babel/runtime/helpers/slicedToArray"; | ||
import getModifiers from "./utils/getModifiers.js"; | ||
@@ -5,0 +6,0 @@ function StickNode(_ref, ref) { |
@@ -1,4 +0,4 @@ | ||
import _extends from "./node_modules/@babel/runtime/helpers/esm/extends.js"; | ||
import _slicedToArray from "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"; | ||
import _objectWithoutProperties from "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"; | ||
import _extends from "@babel/runtime/helpers/extends"; | ||
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; | ||
import "requestidlecallback"; | ||
@@ -10,2 +10,3 @@ import invariant from "invariant"; | ||
import { scrollY, scrollX } from "./utils/scroll.js"; | ||
import "@babel/runtime/helpers/defineProperty"; | ||
import useWatcher from "./hooks/useWatcher.js"; | ||
@@ -12,0 +13,0 @@ var _excluded = ["children", "component", "style", "transportTo", "nestingKey", "node", "position", "containerRef", "updateOnAnimationFrame", "onReposition"]; |
@@ -1,2 +0,2 @@ | ||
import _slicedToArray from "../node_modules/@babel/runtime/helpers/esm/slicedToArray.js"; | ||
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
var isPositionedToTop = function isPositionedToTop2(position) { | ||
@@ -3,0 +3,0 @@ var _position$split = position.split(" "), _position$split2 = _slicedToArray(_position$split, 1), positionMarker = _position$split2[0]; |
@@ -1,3 +0,3 @@ | ||
import _defineProperty from "../node_modules/@babel/runtime/helpers/esm/defineProperty.js"; | ||
import _slicedToArray from "../node_modules/@babel/runtime/helpers/esm/slicedToArray.js"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
import DEFAULT_POSITION from "../defaultPosition.js"; | ||
@@ -4,0 +4,0 @@ import getDefaultAlign from "./getDefaultAlign.js"; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var d=require("../node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),D=require("invariant"),v=require("react"),L=require("../defaultPosition.js"),r=require("../utils/fit.js"),F=require("../utils/getDefaultAlign.js");function k(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var S=k(D),M=function(t,n,i,a){var l=v.useState(i),o=d.default(l,2),e=o[0],s=o[1],c=v.useState(a||F.default(i)),h=d.default(c,2),f=h[0],w=h[1];v.useEffect(function(){s(i),w(a||F.default(i))},[a,i]);var q=v.useCallback(function(m,A){var _=x(m,A,{enabled:t,initialPosition:i,initialAlign:a,currentPosition:e,currentAlign:f}),y=d.default(_,2),C=y[0],H=y[1],V=E(m,A,{enabled:n,initialPosition:i,initialAlign:a,currentPosition:C,currentAlign:H}),b=d.default(V,2),O=b[0],z=b[1];O!==e&&s(O),z!==f&&w(z)},[f,e,t,n,a,i]);return[e,f,q]},E=function(t,n,i){var a=i.enabled,l=i.initialPosition,o=i.currentPosition;i.initialAlign;var e=i.currentAlign;if(!a)return[o,e];var s=r.isPositionedToBottom(o),c=r.isPositionedToTop(o);if(r.isPositionedToBottom(l)){if(r.fitsOnBottom(t,n)){if(!s)return[p(o),T(e)]}else if(r.fitsOnTop(t,n)&&!c)return[T(o),p(e)]}if(r.isPositionedToTop(l)){if(r.fitsOnTop(t,n)){if(!c)return[T(o),p(e)]}else if(r.fitsOnBottom(t,n)&&!s)return[p(o),T(e)]}return[o,e]},x=function(t,n,i){var a=i.enabled,l=i.initialPosition,o=i.currentPosition;i.initialAlign;var e=i.currentAlign;if(!a)return[o,e];var s=r.isPositionedToLeft(o),c=r.isPositionedToRight(o);if(r.isPositionedToRight(l)){if(r.fitsOnRight(t,n)){if(!c)return[g(o),P(e)]}else if(r.fitsOnLeft(t,n)&&!s)return[P(o),g(e)]}if(r.isPositionedToLeft(l)){if(r.fitsOnLeft(t,n)){if(!s)return[P(o),g(e)]}else if(r.fitsOnRight(t,n)&&!c)return[g(o),P(e)]}return[o,e]},B=function(t,n){var i=L.positions.find(function(a){return a==="".concat(n," ").concat(t.split(" ")[1])});return S.default(i,'Could not determine new position. Old position "'.concat(t,'", new vertical target "').concat(n,'"')),i},j=function(t,n){var i=L.positions.find(function(a){return a==="".concat(t.split(" ")[0]," ").concat(n)});return S.default(i,'Could not determine new position. Old position "'.concat(t,'", new horizontal target "').concat(n,'"')),i},p=function(t){return B(t,"bottom")},T=function(t){return B(t,"top")},P=function(t){return j(t,"left")},g=function(t){return j(t,"right")};exports.default=M; | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var k=require("@babel/runtime/helpers/slicedToArray"),M=require("invariant"),d=require("react"),F=require("../defaultPosition.js"),r=require("../utils/fit.js"),z=require("../utils/getDefaultAlign.js");require("@babel/runtime/helpers/defineProperty");function L(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var v=L(k),S=L(M),E=function(t,n,i,a){var l=d.useState(i),o=v.default(l,2),e=o[0],s=o[1],c=d.useState(a||z.default(i)),h=v.default(c,2),f=h[0],w=h[1];d.useEffect(function(){s(i),w(a||z.default(i))},[a,i]);var j=d.useCallback(function(y,A){var C=G(y,A,{enabled:t,initialPosition:i,initialAlign:a,currentPosition:e,currentAlign:f}),m=v.default(C,2),H=m[0],V=m[1],D=x(y,A,{enabled:n,initialPosition:i,initialAlign:a,currentPosition:H,currentAlign:V}),b=v.default(D,2),O=b[0],_=b[1];O!==e&&s(O),_!==f&&w(_)},[f,e,t,n,a,i]);return[e,f,j]},x=function(t,n,i){var a=i.enabled,l=i.initialPosition,o=i.currentPosition;i.initialAlign;var e=i.currentAlign;if(!a)return[o,e];var s=r.isPositionedToBottom(o),c=r.isPositionedToTop(o);if(r.isPositionedToBottom(l)){if(r.fitsOnBottom(t,n)){if(!s)return[p(o),T(e)]}else if(r.fitsOnTop(t,n)&&!c)return[T(o),p(e)]}if(r.isPositionedToTop(l)){if(r.fitsOnTop(t,n)){if(!c)return[T(o),p(e)]}else if(r.fitsOnBottom(t,n)&&!s)return[p(o),T(e)]}return[o,e]},G=function(t,n,i){var a=i.enabled,l=i.initialPosition,o=i.currentPosition;i.initialAlign;var e=i.currentAlign;if(!a)return[o,e];var s=r.isPositionedToLeft(o),c=r.isPositionedToRight(o);if(r.isPositionedToRight(l)){if(r.fitsOnRight(t,n)){if(!c)return[g(o),P(e)]}else if(r.fitsOnLeft(t,n)&&!s)return[P(o),g(e)]}if(r.isPositionedToLeft(l)){if(r.fitsOnLeft(t,n)){if(!s)return[P(o),g(e)]}else if(r.fitsOnRight(t,n)&&!c)return[g(o),P(e)]}return[o,e]},q=function(t,n){var i=F.positions.find(function(a){return a==="".concat(n," ").concat(t.split(" ")[1])});return S.default(i,'Could not determine new position. Old position "'.concat(t,'", new vertical target "').concat(n,'"')),i},B=function(t,n){var i=F.positions.find(function(a){return a==="".concat(t.split(" ")[0]," ").concat(n)});return S.default(i,'Could not determine new position. Old position "'.concat(t,'", new horizontal target "').concat(n,'"')),i},p=function(t){return q(t,"bottom")},T=function(t){return q(t,"top")},P=function(t){return B(t,"left")},g=function(t){return B(t,"right")};exports.default=E; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var z=require("./node_modules/@babel/runtime/helpers/esm/extends.js"),j=require("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),ee=require("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js");require("requestidlecallback");var te=require("invariant"),r=require("react"),ne=require("substyle"),x=require("./StickContext.js"),ie=require("./StickInline.js"),M=require("./StickNode.js"),re=require("./StickPortal.js"),$=require("./defaultPosition.js"),ae=require("./hooks/useAutoFlip.js"),le=require("./hooks/useWatcher.js"),ue=require("./utils/scroll.js"),oe=require("./utils/getDefaultAlign.js"),se=require("./utils/getModifiers.js"),ce=require("./utils/uniqueId.js");function C(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var W=C(te),p=C(r),de=C(ne),fe=["inline","node","sameWidth","children","updateOnAnimationFrame","position","align","component","transportTo","autoFlipHorizontally","autoFlipVertically","onClickOutside","style","className","classNames"],me={node:{position:"absolute",zIndex:99,textAlign:"left"}};function ve(e){var s=e.inline,u=s===void 0?!1:s,n=e.node,o=e.sameWidth,l=o===void 0?!1:o,g=e.children,h=e.updateOnAnimationFrame,y=h===void 0?!1:h,k=e.position,c=e.align,S=e.component,f=e.transportTo,w=e.autoFlipHorizontally,H=w===void 0?!1:w,R=e.autoFlipVertically,K=R===void 0?!1:R,E=e.onClickOutside,I=e.style,V=e.className,D=e.classNames,_=ee.default(e,fe),B=r.useState(0),N=j.default(B,2),b=N[0],X=N[1],G=r.useState(function(){return ce.default()}),J=j.default(G,1),Q=J[0],q=[r.useContext(x.StickContext),Q].filter(function(t){return!!t}).join("_"),a=r.useRef(),m=r.useRef(),F=r.useRef(),U=ae.default(H,K,k||$.default,c||oe.default(k||$.default)),O=j.default(U,3),d=O[0],v=O[1],A=O[2],P=de.default(me,{style:I,className:V,classNames:D},se.default({position:d,align:v,sameWidth:l}));r.useEffect(function(){var t=function(){!m.current||!a.current||A(m.current,a.current)};return t(),window.addEventListener("scroll",t),function(){window.removeEventListener("scroll",t)}},[A]),r.useEffect(function(){var t=function(T){if(!!E){var L=T.target;L instanceof window.HTMLElement&&pe(a,F,L)&&E(T)}};return document.addEventListener("click",t,!0),function(){document.removeEventListener("click",t,!0)}},[E]);var Y=r.useCallback(function(){if(!!a.current){var t=a.current.getBoundingClientRect(),i=l?t.width:he(a.current,d,v,t);i!==b&&X(i)}},[v,d,l,b]);le.default(Y,{updateOnAnimationFrame:y,enabled:!!n});var Z=r.useCallback(function(){m.current&&a.current&&A(m.current,a.current)},[A]);return u?p.default.createElement(x.StickContext.Provider,{value:q},p.default.createElement(ie.default,z.default({},_,{position:d,align:v,style:P,node:n&&p.default.createElement(M.default,{width:b,position:d,align:v,sameWidth:l,ref:m},n),nestingKey:q,containerRef:function(i){a.current=i,F.current=i},component:S}),g)):p.default.createElement(x.StickContext.Provider,{value:q},p.default.createElement(re.default,z.default({},_,{updateOnAnimationFrame:y,transportTo:f,component:S,ref:function(i){W.default(!i||i instanceof Element,"Only HTML elements can be stick anchors."),a.current=i},position:d,node:n&&p.default.createElement(M.default,{width:b,position:d,align:v,sameWidth:l,ref:m},n),style:P,nestingKey:q,containerRef:F,onReposition:Z}),g))}function pe(e,s,u){if(e.current&&e.current.contains(u))return!1;var n=s.current&&s.current.getAttribute("data-sticknestingkey");if(n){var o=document.querySelectorAll("[data-stickNestingKey^='".concat(n,"']"));return!o||!Array.from(o).some(function(l){return l.contains(u)})}return!0}function he(e,s,u,n){var o=n.left,l=n.width,g=n.right;if(!e)return 0;W.default(document.documentElement,"Could not find document root node.");var h=document.documentElement.scrollWidth,y=s.split(" "),k=j.default(y,2),c=k[1];W.default(c==="left"||c==="center"||c==="right",'Expected horizontal position to be "left", "center", or "right" but got "'.concat(c,'".'));var S={left:o,center:o+l/2,right:g},f=ue.scrollX(e)+S[c];return u.indexOf("left")!==-1?h-f:u.indexOf("right")!==-1?f:u.indexOf("center")!==-1?Math.min(f,h-f)*2:0}exports.default=ve; | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var ee=require("@babel/runtime/helpers/extends"),te=require("@babel/runtime/helpers/slicedToArray"),ie=require("@babel/runtime/helpers/objectWithoutProperties");require("requestidlecallback");var ne=require("invariant"),r=require("react"),re=require("substyle"),O=require("./StickContext.js"),ae=require("./StickInline.js"),z=require("./StickNode.js"),le=require("./StickPortal.js"),M=require("./defaultPosition.js"),ue=require("./hooks/useAutoFlip.js"),oe=require("./hooks/useWatcher.js"),se=require("./utils/scroll.js"),ce=require("./utils/getDefaultAlign.js"),de=require("./utils/getModifiers.js"),fe=require("./utils/uniqueId.js");function h(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var $=h(ee),j=h(te),ve=h(ie),W=h(ne),p=h(r),me=h(re),pe=["inline","node","sameWidth","children","updateOnAnimationFrame","position","align","component","transportTo","autoFlipHorizontally","autoFlipVertically","onClickOutside","style","className","classNames"],he={node:{position:"absolute",zIndex:99,textAlign:"left"}};function ge(e){var s=e.inline,u=s===void 0?!1:s,i=e.node,o=e.sameWidth,l=o===void 0?!1:o,y=e.children,g=e.updateOnAnimationFrame,k=g===void 0?!1:g,S=e.position,c=e.align,b=e.component,f=e.transportTo,C=e.autoFlipHorizontally,H=C===void 0?!1:C,w=e.autoFlipVertically,K=w===void 0?!1:w,E=e.onClickOutside,I=e.style,V=e.className,D=e.classNames,P=ve.default(e,pe),B=r.useState(0),R=j.default(B,2),q=R[0],X=R[1],G=r.useState(function(){return fe.default()}),J=j.default(G,1),Q=J[0],A=[r.useContext(O.StickContext),Q].filter(function(t){return!!t}).join("_"),a=r.useRef(),v=r.useRef(),x=r.useRef(),U=ue.default(H,K,S||M.default,c||ce.default(S||M.default)),F=j.default(U,3),d=F[0],m=F[1],_=F[2],N=me.default(he,{style:I,className:V,classNames:D},de.default({position:d,align:m,sameWidth:l}));r.useEffect(function(){var t=function(){!v.current||!a.current||_(v.current,a.current)};return t(),window.addEventListener("scroll",t),function(){window.removeEventListener("scroll",t)}},[_]),r.useEffect(function(){var t=function(T){if(!!E){var L=T.target;L instanceof window.HTMLElement&&ye(a,x,L)&&E(T)}};return document.addEventListener("click",t,!0),function(){document.removeEventListener("click",t,!0)}},[E]);var Y=r.useCallback(function(){if(!!a.current){var t=a.current.getBoundingClientRect(),n=l?t.width:ke(a.current,d,m,t);n!==q&&X(n)}},[m,d,l,q]);oe.default(Y,{updateOnAnimationFrame:k,enabled:!!i});var Z=r.useCallback(function(){v.current&&a.current&&_(v.current,a.current)},[_]);return u?p.default.createElement(O.StickContext.Provider,{value:A},p.default.createElement(ae.default,$.default({},P,{position:d,align:m,style:N,node:i&&p.default.createElement(z.default,{width:q,position:d,align:m,sameWidth:l,ref:v},i),nestingKey:A,containerRef:function(n){a.current=n,x.current=n},component:b}),y)):p.default.createElement(O.StickContext.Provider,{value:A},p.default.createElement(le.default,$.default({},P,{updateOnAnimationFrame:k,transportTo:f,component:b,ref:function(n){W.default(!n||n instanceof Element,"Only HTML elements can be stick anchors."),a.current=n},position:d,node:i&&p.default.createElement(z.default,{width:q,position:d,align:m,sameWidth:l,ref:v},i),style:N,nestingKey:A,containerRef:x,onReposition:Z}),y))}function ye(e,s,u){if(e.current&&e.current.contains(u))return!1;var i=s.current&&s.current.getAttribute("data-sticknestingkey");if(i){var o=document.querySelectorAll("[data-stickNestingKey^='".concat(i,"']"));return!o||!Array.from(o).some(function(l){return l.contains(u)})}return!0}function ke(e,s,u,i){var o=i.left,l=i.width,y=i.right;if(!e)return 0;W.default(document.documentElement,"Could not find document root node.");var g=document.documentElement.scrollWidth,k=s.split(" "),S=j.default(k,2),c=S[1];W.default(c==="left"||c==="center"||c==="right",'Expected horizontal position to be "left", "center", or "right" but got "'.concat(c,'".'));var b={left:o,center:o+l/2,right:y},f=se.scrollX(e)+b[c];return u.indexOf("left")!==-1?g-f:u.indexOf("right")!==-1?f:u.indexOf("center")!==-1?Math.min(f,g-f)*2:0}exports.default=ge; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var v=require("./node_modules/@babel/runtime/helpers/esm/extends.js"),y=require("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),g=require("react"),m=require("substyle"),b=require("./utils/getModifiers.js");function i(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var o=i(g),h=i(m),j=["node","children","component","containerRef","nestingKey","align","position","style"];function S(e){var t=e.node,l=e.children,s=e.component,r=e.containerRef,a=e.nestingKey,d=e.align,u=e.position,p=e.style,c=y.default(e,j),n=h.default(q,{style:p},b.default({align:d,position:u})),f=s||"div";return o.default.createElement(f,v.default({},c,n,{ref:r,"data-sticknestingkey":a}),l,t&&o.default.createElement("div",n("node"),t))}var q={position:"relative",node:{position:"absolute",zIndex:99,textAlign:"left"},"&position-top":{node:{top:0}},"&position-middle":{node:{top:"50%"}},"&position-bottom":{node:{top:"100%"}},"&position-left":{node:{left:0}},"&position-center":{node:{left:"50%"}},"&position-right":{node:{left:"100%"}}};exports.default=S; | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var v=require("@babel/runtime/helpers/extends"),y=require("@babel/runtime/helpers/objectWithoutProperties"),b=require("react"),g=require("substyle");require("@babel/runtime/helpers/slicedToArray");var m=require("./utils/getModifiers.js");function t(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var h=t(v),_=t(y),o=t(b),j=t(g),q=["node","children","component","containerRef","nestingKey","align","position","style"];function x(e){var i=e.node,r=e.children,l=e.component,a=e.containerRef,s=e.nestingKey,d=e.align,u=e.position,p=e.style,c=_.default(e,q),n=j.default(S,{style:p},m.default({align:d,position:u})),f=l||"div";return o.default.createElement(f,h.default({},c,n,{ref:a,"data-sticknestingkey":s}),r,i&&o.default.createElement("div",n("node"),i))}var S={position:"relative",node:{position:"absolute",zIndex:99,textAlign:"left"},"&position-top":{node:{top:0}},"&position-middle":{node:{top:"50%"}},"&position-bottom":{node:{top:"100%"}},"&position-left":{node:{left:0}},"&position-center":{node:{left:"50%"}},"&position-right":{node:{left:"100%"}}};exports.default=x; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var f=require("./node_modules/@babel/runtime/helpers/esm/extends.js"),a=require("react"),n=require("substyle"),h=require("./utils/getModifiers.js");function l(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var i=l(a),m=l(n);function g(t,r){var o=t.children,d=t.width,s=t.align,u=t.position,c=t.sameWidth,e=m.default(p,{},h.default({align:s,position:u,sameWidth:c}));return i.default.createElement("div",n.inline(e,{width:d}),i.default.createElement("div",f.default({},e("content"),{ref:r}),o))}var p={position:"absolute",right:0,bottom:0,content:{position:"absolute",display:"inline-block",left:"inherit",right:"inherit",top:"inherit",bottom:"inherit"},"&sameWidth":{content:{display:"block",width:"100%"}},"&align-left":{right:"auto",left:0},"&align-top":{bottom:"auto",top:0},"&align-middle":{content:{transform:"translate(0, 50%)"}},"&align-center":{content:{transform:"translate(50%, 0)"},"&align-middle":{content:{transform:"translate(50%, 50%)"}}}},v=a.forwardRef(g);exports.default=v; | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var f=require("@babel/runtime/helpers/extends"),r=require("react"),n=require("substyle");require("@babel/runtime/helpers/slicedToArray");var h=require("./utils/getModifiers.js");function e(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var m=e(f),a=e(r),g=e(n);function b(t,l){var o=t.children,d=t.width,s=t.align,u=t.position,c=t.sameWidth,i=g.default(p,{},h.default({align:s,position:u,sameWidth:c}));return a.default.createElement("div",n.inline(i,{width:d}),a.default.createElement("div",m.default({},i("content"),{ref:l}),o))}var p={position:"absolute",right:0,bottom:0,content:{position:"absolute",display:"inline-block",left:"inherit",right:"inherit",top:"inherit",bottom:"inherit"},"&sameWidth":{content:{display:"block",width:"100%"}},"&align-left":{right:"auto",left:0},"&align-top":{bottom:"auto",top:0},"&align-middle":{content:{transform:"translate(0, 50%)"}},"&align-center":{content:{transform:"translate(50%, 0)"},"&align-middle":{content:{transform:"translate(50%, 50%)"}}}},v=r.forwardRef(b);exports.default=v; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var H=require("./node_modules/@babel/runtime/helpers/esm/extends.js"),h=require("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),V=require("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js");require("requestidlecallback");var z=require("invariant"),r=require("react"),G=require("react-dom"),I=require("substyle"),R=require("./utils/scroll.js"),J=require("./hooks/useWatcher.js");function N(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var k=N(z),C=N(r),Q=["children","component","style","transportTo","nestingKey","node","position","containerRef","updateOnAnimationFrame","onReposition"];function U(e,t){var d=e.children,o=e.component,a=e.style,l=e.transportTo,c=e.nestingKey,u=e.node,n=e.position,i=e.containerRef,v=e.updateOnAnimationFrame,b=e.onReposition,L=V.default(e,Q),y=r.useRef(),A=r.useState(null),_=h.default(A,2),p=_[0],F=_[1],D=r.useState(null),q=h.default(D,2),m=q[0],M=q[1],W=r.useState(!!u),T=h.default(W,2),g=T[0],X=T[1],K=ee(l),j=h.default(K,2),s=j[0],x=j[1];r.useEffect(function(){y.current&&b(y.current)},[b,p,m]),r.useEffect(function(){X(!!u)},[u]),r.useLayoutEffect(function(){if(g)return x.appendChild(s),function(){x.removeChild(s)}},[s,x,g]);var Y=r.useCallback(function(){var S=y.current;if(!(!S||!g)){var f=te(S,n,s),E=re(S,n,s);f!==p&&F(f),E!==m&&M(E)}},[s,m,n,p,g]);J.default(Y,{updateOnAnimationFrame:v,enabled:g});var $=o||"div";return C.default.createElement($,H.default({},L,a,{ref:function(f){typeof t=="function"?t(f):t.current=f,y.current=f}}),d,p!=null&&m!=null&&C.default.createElement(O.Provider,{value:s.parentNode||w},G.createPortal(C.default.createElement("div",H.default({ref:i,"data-sticknestingkey":c},I.inline(a("node"),{position:"absolute",top:p,left:m})),u),s)))}k.default(document.body,"Stick can only be used in a browser environment.");var w=document.body,O=r.createContext(w),Z=r.forwardRef(U);function ee(e){var t=r.useState(function(){return document.createElement("div")}),d=h.default(t,1),o=d[0],a=r.useContext(O),l=e||a;return k.default(l,"Could not determine a parent for the host node."),[o,l]}function te(e,t,d){var o=e.getBoundingClientRect(),a=o.top,l=o.height,c=o.bottom,u=P(d),n=0;if(t.indexOf("top")!==-1&&(n=a),t.indexOf("middle")!==-1&&(n=a+l/2),t.indexOf("bottom")!==-1&&(n=c),u){var i=u.getBoundingClientRect(),v=i.top;return n-v}return n+R.scrollY()}function re(e,t,d){var o=e.getBoundingClientRect(),a=o.left,l=o.width,c=o.right,u=P(d),n=B(e),i=0;if(t.indexOf("left")!==-1&&(i=a),t.indexOf("center")!==-1&&(i=a+l/2),t.indexOf("right")!==-1&&(i=c),u){var v=u.getBoundingClientRect(),b=v.left;return i-b}return n?i+R.scrollX(e)-n.scrollLeft:i+R.scrollX(e)}function B(e){if(!e||e.nodeName==="BODY"||e.nodeName==="HTML")return null;var t=getComputedStyle(e);return t.overflowX==="auto"||t.overflowX==="scroll"?e:e.parentNode instanceof Element?B(e.parentNode):null}function P(e){return e.nodeName==="BODY"||e.nodeName==="HTML"?null:getComputedStyle(e).position==="fixed"?e:e.parentNode instanceof Element?P(e.parentNode):null}exports.PortalContext=O;exports.default=Z; | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var V=require("@babel/runtime/helpers/extends"),z=require("@babel/runtime/helpers/slicedToArray"),G=require("@babel/runtime/helpers/objectWithoutProperties");require("requestidlecallback");var I=require("invariant"),r=require("react"),J=require("react-dom"),Q=require("substyle"),R=require("./utils/scroll.js");require("@babel/runtime/helpers/defineProperty");var U=require("./hooks/useWatcher.js");function g(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var k=g(V),b=g(z),Z=g(G),w=g(I),C=g(r),ee=["children","component","style","transportTo","nestingKey","node","position","containerRef","updateOnAnimationFrame","onReposition"];function te(e,t){var d=e.children,a=e.component,o=e.style,l=e.transportTo,c=e.nestingKey,i=e.node,n=e.position,u=e.containerRef,v=e.updateOnAnimationFrame,y=e.onReposition,j=Z.default(e,ee),S=r.useRef(),A=r.useState(null),q=b.default(A,2),p=q[0],F=q[1],W=r.useState(null),T=b.default(W,2),m=T[0],D=T[1],M=r.useState(!!i),E=b.default(M,2),h=E[0],X=E[1],K=ne(l),H=b.default(K,2),s=H[0],x=H[1];r.useEffect(function(){S.current&&y(S.current)},[y,p,m]),r.useEffect(function(){X(!!i)},[i]),r.useLayoutEffect(function(){if(h)return x.appendChild(s),function(){x.removeChild(s)}},[s,x,h]);var Y=r.useCallback(function(){var _=S.current;if(!(!_||!h)){var f=ae(_,n,s),N=oe(_,n,s);f!==p&&F(f),N!==m&&D(N)}},[s,m,n,p,h]);U.default(Y,{updateOnAnimationFrame:v,enabled:h});var $=a||"div";return C.default.createElement($,k.default({},j,o,{ref:function(f){typeof t=="function"?t(f):t.current=f,S.current=f}}),d,p!=null&&m!=null&&C.default.createElement(P.Provider,{value:s.parentNode||B},J.createPortal(C.default.createElement("div",k.default({ref:u,"data-sticknestingkey":c},Q.inline(o("node"),{position:"absolute",top:p,left:m})),i),s)))}w.default(document.body,"Stick can only be used in a browser environment.");var B=document.body,P=r.createContext(B),re=r.forwardRef(te);function ne(e){var t=r.useState(function(){return document.createElement("div")}),d=b.default(t,1),a=d[0],o=r.useContext(P),l=e||o;return w.default(l,"Could not determine a parent for the host node."),[a,l]}function ae(e,t,d){var a=e.getBoundingClientRect(),o=a.top,l=a.height,c=a.bottom,i=O(d),n=0;if(t.indexOf("top")!==-1&&(n=o),t.indexOf("middle")!==-1&&(n=o+l/2),t.indexOf("bottom")!==-1&&(n=c),i){var u=i.getBoundingClientRect(),v=u.top;return n-v}return n+R.scrollY()}function oe(e,t,d){var a=e.getBoundingClientRect(),o=a.left,l=a.width,c=a.right,i=O(d),n=L(e),u=0;if(t.indexOf("left")!==-1&&(u=o),t.indexOf("center")!==-1&&(u=o+l/2),t.indexOf("right")!==-1&&(u=c),i){var v=i.getBoundingClientRect(),y=v.left;return u-y}return n?u+R.scrollX(e)-n.scrollLeft:u+R.scrollX(e)}function L(e){if(!e||e.nodeName==="BODY"||e.nodeName==="HTML")return null;var t=getComputedStyle(e);return t.overflowX==="auto"||t.overflowX==="scroll"?e:e.parentNode instanceof Element?L(e.parentNode):null}function O(e){return e.nodeName==="BODY"||e.nodeName==="HTML"?null:getComputedStyle(e).position==="fixed"?e:e.parentNode instanceof Element?O(e.parentNode):null}exports.PortalContext=P;exports.default=re; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var d=require("../node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),g=function(t){var i=t.split(" "),o=d.default(i,1),n=o[0];return n==="top"},u=function(t){var i=t.split(" "),o=d.default(i,1),n=o[0];return n==="bottom"},a=function(t){var i=t.split(" ")[1];return i==="right"},f=function(t){var i=t.split(" ")[1];return i==="left"},h=function(t,i){var o=t.getBoundingClientRect(),n=o.width,r=i.getBoundingClientRect(),s=r.right;return s+n<=window.innerWidth},l=function(t,i){var o=t.getBoundingClientRect(),n=o.width,r=i.getBoundingClientRect(),s=r.left;return s-n>=0},c=function(t,i){var o=t.getBoundingClientRect(),n=o.height,r=i.getBoundingClientRect(),s=r.top;return s-n>=0},p=function(t,i){var o=t.getBoundingClientRect(),n=o.height,r=i.getBoundingClientRect(),s=r.bottom;return s+n<=window.innerHeight};exports.fitsOnBottom=p;exports.fitsOnLeft=l;exports.fitsOnRight=h;exports.fitsOnTop=c;exports.isPositionedToBottom=u;exports.isPositionedToLeft=f;exports.isPositionedToRight=a;exports.isPositionedToTop=g; | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var a=require("@babel/runtime/helpers/slicedToArray");function u(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var d=u(a),f=function(t){var i=t.split(" "),n=d.default(i,1),e=n[0];return e==="top"},g=function(t){var i=t.split(" "),n=d.default(i,1),e=n[0];return e==="bottom"},l=function(t){var i=t.split(" ")[1];return i==="right"},c=function(t){var i=t.split(" ")[1];return i==="left"},h=function(t,i){var n=t.getBoundingClientRect(),e=n.width,r=i.getBoundingClientRect(),s=r.right;return s+e<=window.innerWidth},p=function(t,i){var n=t.getBoundingClientRect(),e=n.width,r=i.getBoundingClientRect(),s=r.left;return s-e>=0},v=function(t,i){var n=t.getBoundingClientRect(),e=n.height,r=i.getBoundingClientRect(),s=r.top;return s-e>=0},B=function(t,i){var n=t.getBoundingClientRect(),e=n.height,r=i.getBoundingClientRect(),s=r.bottom;return s+e<=window.innerHeight};exports.fitsOnBottom=B;exports.fitsOnLeft=p;exports.fitsOnRight=h;exports.fitsOnTop=v;exports.isPositionedToBottom=g;exports.isPositionedToLeft=c;exports.isPositionedToRight=l;exports.isPositionedToTop=f; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=require("../node_modules/@babel/runtime/helpers/esm/defineProperty.js"),r=require("../node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),m=require("../defaultPosition.js"),P=require("./getDefaultAlign.js"),h=function(t){var e,n=t.align,s=t.position,u=t.sameWidth,a=s||m.default,d=a.split(" "),l=r.default(d,2),f=l[0],c=l[1],p=(n||P.default(a)).split(" "),o=r.default(p,2),g=o[0],v=o[1];return e={},i.default(e,"&position-".concat(c),!0),i.default(e,"&position-".concat(f),!0),i.default(e,"&align-".concat(v),!0),i.default(e,"&align-".concat(g),!0),i.default(e,"&sameWidth",!!u),e};exports.default=h; | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var y=require("@babel/runtime/helpers/defineProperty"),b=require("@babel/runtime/helpers/slicedToArray"),h=require("../defaultPosition.js"),A=require("./getDefaultAlign.js");function u(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var i=u(y),n=u(b),m=function(a){var e,s=a.align,d=a.position,f=a.sameWidth,r=d||h.default,c=r.split(" "),l=n.default(c,2),p=l[0],v=l[1],g=(s||A.default(r)).split(" "),o=n.default(g,2),_=o[0],P=o[1];return e={},i.default(e,"&position-".concat(v),!0),i.default(e,"&position-".concat(p),!0),i.default(e,"&align-".concat(P),!0),i.default(e,"&align-".concat(_),!0),i.default(e,"&sameWidth",!!f),e};exports.default=m; |
{ | ||
"name": "react-stick", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"description": "React component to stick a portaled node to an anchor node", | ||
@@ -33,2 +33,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@babel/runtime": "^7.17.9", | ||
"invariant": "^2.2.4", | ||
@@ -46,11 +47,11 @@ "requestidlecallback": "^0.3.0", | ||
"@testing-library/react": "12.1.5", | ||
"@vitejs/plugin-react": "^1.3.2", | ||
"@vitejs/plugin-react": "1.3.2", | ||
"babel-eslint": "10.1.0", | ||
"babel-loader": "^8.2.5", | ||
"babel-plugin-istanbul": "^6.1.1", | ||
"babel-loader": "8.2.5", | ||
"babel-plugin-istanbul": "6.1.1", | ||
"babel-plugin-syntax-dynamic-import": "6.18.0", | ||
"condition-circle": "2.0.2", | ||
"core-js": "3.22.3", | ||
"core-js": "3.22.4", | ||
"eslint": "7.32.0", | ||
"eslint-config-react-app": "6.0.0", | ||
"eslint-config-react-app": "7.0.1", | ||
"eslint-plugin-flowtype": "8.0.3", | ||
@@ -68,3 +69,3 @@ "eslint-plugin-import": "2.26.0", | ||
"karma": "6.3.19", | ||
"karma-chrome-launcher": "^3.1.1", | ||
"karma-chrome-launcher": "3.1.1", | ||
"karma-coverage": "2.2.0", | ||
@@ -81,8 +82,8 @@ "karma-mocha": "2.0.1", | ||
"rimraf": "3.0.2", | ||
"semantic-release": "17.4.7", | ||
"semantic-release": "19.0.2", | ||
"substyle-glamor": "4.1.2", | ||
"vite": "2.9.7", | ||
"vite": "2.9.8", | ||
"webpack": "4.46.0", | ||
"webpack-cli": "4.9.2", | ||
"webpack-dev-server": "^4.9.0" | ||
"webpack-dev-server": "4.9.0" | ||
}, | ||
@@ -89,0 +90,0 @@ "peerDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
114368
776
0
6
+ Added@babel/runtime@^7.17.9