Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rax-view

Package Overview
Dependencies
Maintainers
1
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rax-view - npm Package Compare versions

Comparing version 2.0.6-3 to 2.0.6-4

demo/index.md

2

CHANGELOG.md
# Changelog
## 2.1.0
- [feat] Support onAppear/onDisappear/onFirstAppear in wechat miniprogram
## 2.0.5

@@ -4,0 +6,0 @@ - [chore] Sync from rax-pkg-rax-view

2

dist/index-es6.js

@@ -1,1 +0,1 @@

!function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="./",t(t.s=4)}([function(e,r){e.exports=require("rax")},function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("classnames/dedupe")},function(e,r,t){},function(e,r,t){e.exports=t(5)},function(e,r,t){"use strict";t.r(r);var n=t(0),o=t(2),i=t.n(o),a=t(1),c=t(3);function p(){return(p=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var s=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t},f=t.n(c).a;function u(e){var r=f.__cache||(f.__cache={}),t=function e(){var r=[],t=arguments[0],n=Object.prototype.toString.call(t).slice(8,-1).toLowerCase();if("string"===n)(t=t.trim())&&r.push(t);else if("array"===n)t.forEach((function(t){(t=e(t).trim())&&r.push(t)}));else if("object"===n)for(var o in t)(o=o.trim())&&t.hasOwnProperty(o)&&t[o]&&r.push(o);return r.join(" ").trim()}(e),n=t.split(/\s+/),o=r[t];return o||(o={},1===n.length?o=f[n[0].trim()]:n.forEach((function(e){"object"==typeof f[e.trim()]&&(o=Object.assign(o,f[e.trim()]))})),r[t]=o),o}const l=Object(n.forwardRef)((e,r)=>{const t=Object(n.useRef)(null);let{className:o,style:c,onFirstAppear:f,onAppear:l,onDisappear:y}=e,b=s(e,["className","style","onFirstAppear","onAppear","onDisappear"]);if(a.isMiniApp)return Object(n.createElement)("view",p({},b,{onAppear:l,onDisappear:y,onFirstAppear:f,ref:r,className:"rax-view-v2 "+o,style:Object.assign({},u("rax-view-v2 "+o),c)}));Object(n.useEffect)(()=>{if(a.isWeChatMiniProgram){if("function"!=typeof l&&"function"!=typeof f&&"function"!=typeof y)return;if(!e.id)return void console.warn("id is required if using onAppear in wechat miniprogram!");const r=document.getElementById(e.id);return r&&r._internal&&(t.observer=r._internal.createIntersectionObserver().relativeToViewport(),t.observer.observe("#"+e.id,e=>{const{intersectionRatio:r=0}=e;r>0?("function"==typeof l&&l(e),"function"==typeof f&&(t.triggeredAppear||(f(e),t.triggeredAppear=!0,"function"==typeof f&&"function"!=typeof l&&"function"!=typeof y&&t.observer.disconnect()))):"function"==typeof y&&y(e)})),()=>{t.observer&&t.observer.disconnect()}}},[e.id,l,y]);let v=l;return f&&(v=e=>{l&&l(e),t.triggeredAppear||(f&&f(e),t.triggeredAppear=!0)}),Object(n.createElement)("div",p({},b,{onAppear:v,onDisappear:y,ref:r,className:i()(a.isWeex?"":"rax-view-v2",o),style:Object.assign({},u(i()(a.isWeex?"":"rax-view-v2",o)),c)}))});l.displayName="View",r.default=l}]);
!function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="/",t(t.s=3)}([function(e,r){e.exports=require("rax")},function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("classnames/dedupe")},function(e,r,t){e.exports=t(4)},function(e,r,t){"use strict";t.r(r);var n=t(0),o=t(2),i=t.n(o),a=t(1);t(5);function p(){return(p=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var s=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t};const c=Object(n.forwardRef)(((e,r)=>{const t=Object(n.useRef)(null);let{className:o,style:c,onFirstAppear:u,onAppear:f,onDisappear:l}=e,d=s(e,["className","style","onFirstAppear","onAppear","onDisappear"]);if(a.isMiniApp)return Object(n.createElement)("view",p({},d,{onAppear:f,onDisappear:l,onFirstAppear:u,ref:r,className:`rax-view-v2 ${o}`,style:c}));Object(n.useEffect)((()=>{if(a.isWeChatMiniProgram){if("function"!=typeof f&&"function"!=typeof u&&"function"!=typeof l)return;if(!e.id)return void console.warn("id is required if using onAppear in wechat miniprogram!");const r=document.getElementById(e.id);if(null==r?void 0:r._internal){const n=()=>{t.observer=r._internal.createIntersectionObserver().relativeToViewport(),t.observer.observe(`#${e.id}`,(e=>{const{intersectionRatio:r=0}=e;r>0?("function"==typeof f&&f(e),"function"==typeof u&&(t.triggeredAppear||(u(e),t.triggeredAppear=!0,"function"!=typeof f&&"function"!=typeof l&&t.observer.disconnect()))):"function"==typeof l&&l(e)})),window.removeEventListener("setDataFinished",n)};window.addEventListener("setDataFinished",n)}return()=>{t.observer&&t.observer.disconnect()}}}),[e.id,f,l]);let y=f;return u&&(y=e=>{f&&f(e),t.triggeredAppear||(u&&u(e),t.triggeredAppear=!0)}),Object(n.createElement)("div",p({},d,{onAppear:y,onDisappear:l,ref:r,className:i()(a.isWeex?"":"rax-view-v2",o),style:c}))}));c.displayName="View",r.default=c},function(e,r,t){}]);

@@ -1,1 +0,1 @@

!function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="./",t(t.s=4)}([function(e,r){e.exports=require("rax")},function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("classnames/dedupe")},function(e,r,t){},function(e,r,t){e.exports=t(5)},function(e,r,t){"use strict";t.r(r);var n=t(0),o=t(2),i=t.n(o),a=t(1),c=t(3);function f(){return(f=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var p=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t},u=t.n(c).a;function s(e){var r=u.__cache||(u.__cache={}),t=function e(){var r=[],t=arguments[0],n=Object.prototype.toString.call(t).slice(8,-1).toLowerCase();if("string"===n)(t=t.trim())&&r.push(t);else if("array"===n)t.forEach((function(t){(t=e(t).trim())&&r.push(t)}));else if("object"===n)for(var o in t)(o=o.trim())&&t.hasOwnProperty(o)&&t[o]&&r.push(o);return r.join(" ").trim()}(e),n=t.split(/\s+/),o=r[t];return o||(o={},1===n.length?o=u[n[0].trim()]:n.forEach((function(e){"object"==typeof u[e.trim()]&&(o=Object.assign(o,u[e.trim()]))})),r[t]=o),o}var l=Object(n.forwardRef)((function(e,r){var t=Object(n.useRef)(null),o=e.className,c=e.style,u=e.onFirstAppear,l=e.onAppear,v=e.onDisappear,y=p(e,["className","style","onFirstAppear","onAppear","onDisappear"]);if(a.isMiniApp)return Object(n.createElement)("view",f({},y,{onAppear:l,onDisappear:v,onFirstAppear:u,ref:r,className:"rax-view-v2 "+o,style:Object.assign({},s("rax-view-v2 "+o),c)}));Object(n.useEffect)((function(){if(a.isWeChatMiniProgram){if("function"!=typeof l&&"function"!=typeof u&&"function"!=typeof v)return;if(!e.id)return void console.warn("id is required if using onAppear in wechat miniprogram!");var r=document.getElementById(e.id);return r&&r._internal&&(t.observer=r._internal.createIntersectionObserver().relativeToViewport(),t.observer.observe("#"+e.id,(function(e){var r=e.intersectionRatio;(void 0===r?0:r)>0?("function"==typeof l&&l(e),"function"==typeof u&&(t.triggeredAppear||(u(e),t.triggeredAppear=!0,"function"==typeof u&&"function"!=typeof l&&"function"!=typeof v&&t.observer.disconnect()))):"function"==typeof v&&v(e)}))),function(){t.observer&&t.observer.disconnect()}}}),[e.id,l,v]);var b=l;return u&&(b=function(e){l&&l(e),t.triggeredAppear||(u&&u(e),t.triggeredAppear=!0)}),Object(n.createElement)("div",f({},y,{onAppear:b,onDisappear:v,ref:r,className:i()(a.isWeex?"":"rax-view-v2",o),style:Object.assign({},s(i()(a.isWeex?"":"rax-view-v2",o)),c)}))}));l.displayName="View",r.default=l}]);
!function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="/",t(t.s=3)}([function(e,r){e.exports=require("rax")},function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("classnames/dedupe")},function(e,r,t){e.exports=t(4)},function(e,r,t){"use strict";t.r(r);var n=t(0),o=t(2),i=t.n(o),a=t(1);t(5);function u(){return(u=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var p=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t},f=Object(n.forwardRef)((function(e,r){var t=Object(n.useRef)(null),o=e.className,f=e.style,c=e.onFirstAppear,s=e.onAppear,l=e.onDisappear,d=p(e,["className","style","onFirstAppear","onAppear","onDisappear"]);if(a.isMiniApp)return Object(n.createElement)("view",u({},d,{onAppear:s,onDisappear:l,onFirstAppear:c,ref:r,className:"rax-view-v2 "+o,style:f}));Object(n.useEffect)((function(){if(a.isWeChatMiniProgram){if("function"!=typeof s&&"function"!=typeof c&&"function"!=typeof l)return;if(!e.id)return void console.warn("id is required if using onAppear in wechat miniprogram!");var r=document.getElementById(e.id);if(null==r?void 0:r._internal){var n=function(){t.observer=r._internal.createIntersectionObserver().relativeToViewport(),t.observer.observe("#"+e.id,(function(e){var r=e.intersectionRatio;(void 0===r?0:r)>0?("function"==typeof s&&s(e),"function"==typeof c&&(t.triggeredAppear||(c(e),t.triggeredAppear=!0,"function"!=typeof s&&"function"!=typeof l&&t.observer.disconnect()))):"function"==typeof l&&l(e)})),window.removeEventListener("setDataFinished",n)};window.addEventListener("setDataFinished",n)}return function(){t.observer&&t.observer.disconnect()}}}),[e.id,s,l]);var v=s;return c&&(v=function(e){s&&s(e),t.triggeredAppear||(c&&c(e),t.triggeredAppear=!0)}),Object(n.createElement)("div",u({},d,{onAppear:v,onDisappear:l,ref:r,className:i()(a.isWeex?"":"rax-view-v2",o),style:f}))}));f.displayName="View",r.default=f},function(e,r,t){}]);

@@ -1,1 +0,1 @@

!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.raxView=r():e.raxView=r()}(window,(function(){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="./",t(t.s=4)}([function(e,r){e.exports=require("rax")},function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("classnames/dedupe")},function(e,r,t){},function(e,r,t){e.exports=t(5)},function(e,r,t){"use strict";t.r(r);var n=t(0),o=t(2),i=t.n(o),a=t(1),c=t(3);function f(){return(f=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var p=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t},u=t.n(c).a;function s(e){var r=u.__cache||(u.__cache={}),t=function e(){var r=[],t=arguments[0],n=Object.prototype.toString.call(t).slice(8,-1).toLowerCase();if("string"===n)(t=t.trim())&&r.push(t);else if("array"===n)t.forEach((function(t){(t=e(t).trim())&&r.push(t)}));else if("object"===n)for(var o in t)(o=o.trim())&&t.hasOwnProperty(o)&&t[o]&&r.push(o);return r.join(" ").trim()}(e),n=t.split(/\s+/),o=r[t];return o||(o={},1===n.length?o=u[n[0].trim()]:n.forEach((function(e){"object"==typeof u[e.trim()]&&(o=Object.assign(o,u[e.trim()]))})),r[t]=o),o}var l=Object(n.forwardRef)((function(e,r){var t=Object(n.useRef)(null),o=e.className,c=e.style,u=e.onFirstAppear,l=e.onAppear,d=e.onDisappear,y=p(e,["className","style","onFirstAppear","onAppear","onDisappear"]);if(a.isMiniApp)return Object(n.createElement)("view",f({},y,{onAppear:l,onDisappear:d,onFirstAppear:u,ref:r,className:"rax-view-v2 "+o,style:Object.assign({},s("rax-view-v2 "+o),c)}));Object(n.useEffect)((function(){if(a.isWeChatMiniProgram){if("function"!=typeof l&&"function"!=typeof u&&"function"!=typeof d)return;if(!e.id)return void console.warn("id is required if using onAppear in wechat miniprogram!");var r=document.getElementById(e.id);return r&&r._internal&&(t.observer=r._internal.createIntersectionObserver().relativeToViewport(),t.observer.observe("#"+e.id,(function(e){var r=e.intersectionRatio;(void 0===r?0:r)>0?("function"==typeof l&&l(e),"function"==typeof u&&(t.triggeredAppear||(u(e),t.triggeredAppear=!0,"function"==typeof u&&"function"!=typeof l&&"function"!=typeof d&&t.observer.disconnect()))):"function"==typeof d&&d(e)}))),function(){t.observer&&t.observer.disconnect()}}}),[e.id,l,d]);var v=l;return u&&(v=function(e){l&&l(e),t.triggeredAppear||(u&&u(e),t.triggeredAppear=!0)}),Object(n.createElement)("div",f({},y,{onAppear:v,onDisappear:d,ref:r,className:i()(a.isWeex?"":"rax-view-v2",o),style:Object.assign({},s(i()(a.isWeex?"":"rax-view-v2",o)),c)}))}));l.displayName="View",r.default=l}])}));
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.raxView=r():e.raxView=r()}(window,(function(){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="/",t(t.s=3)}([function(e,r){e.exports=require("rax")},function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("classnames/dedupe")},function(e,r,t){e.exports=t(4)},function(e,r,t){"use strict";t.r(r);var n=t(0),o=t(2),i=t.n(o),a=t(1);t(5);function f(){return(f=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var p=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t},u=Object(n.forwardRef)((function(e,r){var t=Object(n.useRef)(null),o=e.className,u=e.style,c=e.onFirstAppear,s=e.onAppear,l=e.onDisappear,d=p(e,["className","style","onFirstAppear","onAppear","onDisappear"]);if(a.isMiniApp)return Object(n.createElement)("view",f({},d,{onAppear:s,onDisappear:l,onFirstAppear:c,ref:r,className:"rax-view-v2 "+o,style:u}));Object(n.useEffect)((function(){if(a.isWeChatMiniProgram){if("function"!=typeof s&&"function"!=typeof c&&"function"!=typeof l)return;if(!e.id)return void console.warn("id is required if using onAppear in wechat miniprogram!");var r=document.getElementById(e.id);if(null==r?void 0:r._internal){var n=function(){t.observer=r._internal.createIntersectionObserver().relativeToViewport(),t.observer.observe("#"+e.id,(function(e){var r=e.intersectionRatio;(void 0===r?0:r)>0?("function"==typeof s&&s(e),"function"==typeof c&&(t.triggeredAppear||(c(e),t.triggeredAppear=!0,"function"!=typeof s&&"function"!=typeof l&&t.observer.disconnect()))):"function"==typeof l&&l(e)})),window.removeEventListener("setDataFinished",n)};window.addEventListener("setDataFinished",n)}return function(){t.observer&&t.observer.disconnect()}}}),[e.id,s,l]);var v=s;return c&&(v=function(e){s&&s(e),t.triggeredAppear||(c&&c(e),t.triggeredAppear=!0)}),Object(n.createElement)("div",f({},d,{onAppear:v,onDisappear:l,ref:r,className:i()(a.isWeex?"":"rax-view-v2",o),style:u}))}));u.displayName="View",r.default=u},function(e,r,t){}])}));
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var __rest = this && this.__rest || function (s, e) {
var t = {};
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
for (var p in s) {
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
}
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
import { createElement, useRef, forwardRef, useEffect } from 'rax';

@@ -85,3 +74,3 @@ import cx from 'classnames/dedupe';

onDisappear = props.onDisappear,
rest = __rest(props, ["className", "style", "onFirstAppear", "onAppear", "onDisappear"]);
rest = _objectWithoutPropertiesLoose(props, ["className", "style", "onFirstAppear", "onAppear", "onDisappear"]);

@@ -111,28 +100,32 @@ if (isMiniApp) {

var ele = document.getElementById(props.id); // @ts-ignore
var ele = document.getElementById(props.id);
if (ele && ele._internal) {
// @ts-ignore
selfRef.observer = ele._internal.createIntersectionObserver().relativeToViewport();
selfRef.observer.observe("#" + props.id, function (res) {
var _res$intersectionRati = res.intersectionRatio,
intersectionRatio = _res$intersectionRati === void 0 ? 0 : _res$intersectionRati;
if (ele != null && ele._internal) {
var observe = function () {
selfRef.observer = ele._internal.createIntersectionObserver().relativeToViewport();
selfRef.observer.observe("#" + props.id, function (res) {
var _res$intersectionRati = res.intersectionRatio,
intersectionRatio = _res$intersectionRati === void 0 ? 0 : _res$intersectionRati;
if (intersectionRatio > 0) {
typeof onAppear === 'function' && onAppear(res);
if (intersectionRatio > 0) {
typeof onAppear === 'function' && onAppear(res);
if (typeof onFirstAppear === 'function') {
if (!selfRef.triggeredAppear) {
onFirstAppear(res);
selfRef.triggeredAppear = true;
if (typeof onFirstAppear === 'function') {
if (!selfRef.triggeredAppear) {
onFirstAppear(res);
selfRef.triggeredAppear = true;
if (typeof onFirstAppear === 'function' && typeof onAppear !== 'function' && typeof onDisappear !== 'function') {
selfRef.observer.disconnect();
if (typeof onAppear !== 'function' && typeof onDisappear !== 'function') {
selfRef.observer.disconnect();
}
}
}
} else {
typeof onDisappear === 'function' && onDisappear(res);
}
} else {
typeof onDisappear === 'function' && onDisappear(res);
}
});
});
window.removeEventListener('setDataFinished', observe);
};
window.addEventListener('setDataFinished', observe);
}

@@ -139,0 +132,0 @@

@@ -18,15 +18,4 @@ "use strict";

var __rest = void 0 && (void 0).__rest || function (s, e) {
var t = {};
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
for (var p in s) {
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
}
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
var _styleSheet = _index.default;

@@ -97,3 +86,3 @@

onDisappear = props.onDisappear,
rest = __rest(props, ["className", "style", "onFirstAppear", "onAppear", "onDisappear"]);
rest = _objectWithoutPropertiesLoose(props, ["className", "style", "onFirstAppear", "onAppear", "onDisappear"]);

@@ -123,28 +112,32 @@ if (_universalEnv.isMiniApp) {

var ele = document.getElementById(props.id); // @ts-ignore
var ele = document.getElementById(props.id);
if (ele && ele._internal) {
// @ts-ignore
selfRef.observer = ele._internal.createIntersectionObserver().relativeToViewport();
selfRef.observer.observe("#" + props.id, function (res) {
var _res$intersectionRati = res.intersectionRatio,
intersectionRatio = _res$intersectionRati === void 0 ? 0 : _res$intersectionRati;
if (ele != null && ele._internal) {
var observe = function () {
selfRef.observer = ele._internal.createIntersectionObserver().relativeToViewport();
selfRef.observer.observe("#" + props.id, function (res) {
var _res$intersectionRati = res.intersectionRatio,
intersectionRatio = _res$intersectionRati === void 0 ? 0 : _res$intersectionRati;
if (intersectionRatio > 0) {
typeof onAppear === 'function' && onAppear(res);
if (intersectionRatio > 0) {
typeof onAppear === 'function' && onAppear(res);
if (typeof onFirstAppear === 'function') {
if (!selfRef.triggeredAppear) {
onFirstAppear(res);
selfRef.triggeredAppear = true;
if (typeof onFirstAppear === 'function') {
if (!selfRef.triggeredAppear) {
onFirstAppear(res);
selfRef.triggeredAppear = true;
if (typeof onFirstAppear === 'function' && typeof onAppear !== 'function' && typeof onDisappear !== 'function') {
selfRef.observer.disconnect();
if (typeof onAppear !== 'function' && typeof onDisappear !== 'function') {
selfRef.observer.disconnect();
}
}
}
} else {
typeof onDisappear === 'function' && onDisappear(res);
}
} else {
typeof onDisappear === 'function' && onDisappear(res);
}
});
});
window.removeEventListener('setDataFinished', observe);
};
window.addEventListener('setDataFinished', observe);
}

@@ -151,0 +144,0 @@

{
"name": "rax-view",
"version": "2.0.6-3",
"version": "2.0.6-4",
"description": "View component for Rax.",
"license": "BSD-3-Clause",
"main": "lib/index.js",
"module": "es/index.js",
"types": "lib/index.d.ts",
"scripts": {
"clean": "rm -rf ./lib && rm -rf ./package-lock.json && rm -f ./yarn.lock && rm -rf demo/miniapp/lib",
"build": "npm run clean && ../../node_modules/.bin/build-scripts build --config ../../build.json",
"build": "../../node_modules/.bin/build-scripts build --config ../../build.json --skip-demo",
"start": "../../node_modules/.bin/build-scripts start --config ../../build.json",
"prepublishOnly": "npm run build",
"test": "npm run build"
"prepublishOnly": "npm run build"
},
"keywords": [
"Rax",
"rax-component"
],
"repository": {

@@ -23,5 +18,11 @@ "type": "git",

},
"engines": {
"npm": ">=3.0.0"
"bugs": {
"url": "https://github.com/raxjs/rax-components/issues"
},
"homepage": "https://github.com/raxjs/rax-components#readme",
"keywords": [
"Rax",
"rax-component",
"react-component"
],
"dependencies": {

@@ -28,0 +29,0 @@ "classnames": "^2.2.6",

@@ -27,4 +27,4 @@ # rax-view

| onLongpress | `function` | - | false | 长按 | <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px">|
| onAppear | `function` | - | false | 当前元素可见时触发 | <img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" />|
| onDisappear | `function` | - | false | 当前元素从可见变为不可见时触发 | <img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /><img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" />|
| onAppear | `function` | - | false | 当前元素可见时触发 | <img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px">|
| onDisappear | `function` | - | false | 当前元素从可见变为不可见时触发 | <img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /><img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px">|
| onTouchStart | `function` | - | false | 触摸动作开始 | <img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /><img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px">|

@@ -31,0 +31,0 @@ | onTouchMove | `function` | - | false | 触摸后移动 | <img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /><img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px">|

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc