size-sensor 1.0.0 → 1.0.1
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/README.md +1 -1
- package/dist/size-sensor.min.js +1 -1
- package/lib/constant.js +1 -3
- package/lib/index.js +1 -1
- package/lib/sensors/object.js +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -106,7 +106,7 @@ Online demo click [here](https://git.hust.cc/size-sensor). Used By:
|
|
|
106
106
|
|
|
107
107
|
- [hustcc/echarts-for-react](https://github.com/hustcc/echarts-for-react)
|
|
108
108
|
- [hustcc/canvas-nest.js](https://github.com/hustcc/canvas-nest.js)
|
|
109
|
-
- [
|
|
109
|
+
- [antvis/x6](https://github.com/antvis/x6)
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
|
package/dist/size-sensor.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).sizeSensor={})}(this,function(e){"use strict";function
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).sizeSensor={})}(this,function(e){"use strict";function s(o){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:60,u=null;return function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];clearTimeout(u),u=setTimeout(function(){o.apply(e,n)},r)}}function o(e){var t=e.getAttribute(u);if(t&&c[t])return c[t];var n="".concat(r++);e.setAttribute(u,n);var i=d(e);return c[n]=i}var r=1,u="size-sensor-id",d="undefined"!=typeof ResizeObserver?function(n){function i(){o.disconnect(),r=[],o=void 0}var o=void 0,r=[],u=s(function(){r.forEach(function(e){e(n)})});return{element:n,bind:function(e){var t;o||((t=new ResizeObserver(u)).observe(n),u(),o=t),-1===r.indexOf(e)&&r.push(e)},destroy:i,unbind:function(e){var t=r.indexOf(e);-1!==t&&r.splice(t,1),0===r.length&&o&&i()}}}:function(t){function n(){i&&i.parentNode&&(i.contentDocument&&i.contentDocument.defaultView.removeEventListener("resize",r),i.parentNode.removeChild(i),i=void 0,o=[])}var i=void 0,o=[],r=s(function(){o.forEach(function(e){e(t)})});return{element:t,bind:function(e){i=i||function(){"static"===getComputedStyle(t).position&&(t.style.position="relative");var e=document.createElement("object");return e.onload=function(){e.contentDocument.defaultView.addEventListener("resize",r),r()},e.style.display="block",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.height="100%",e.style.width="100%",e.style.overflow="hidden",e.style.pointerEvents="none",e.style.zIndex="-1",e.style.opacity="0",e.setAttribute("class","size-sensor-object"),e.setAttribute("tabindex","-1"),e.type="text/html",t.appendChild(e),e.data="about:blank",e}(),-1===o.indexOf(e)&&o.push(e)},destroy:n,unbind:function(e){var t=o.indexOf(e);-1!==t&&o.splice(t,1),0===o.length&&i&&n()}}},c={};e.bind=function(e,t){var n=o(e);return n.bind(t),function(){n.unbind(t)}},e.clear=function(e){var t,n,i=o(e);n=(t=i).element.getAttribute(u),t.element.removeAttribute(u),t.destroy(),n&&c[n]&&delete c[n]},e.ver="1.0.1",Object.defineProperty(e,"__esModule",{value:!0})});
|
package/lib/constant.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SensorTabIndex = exports.SensorClassName = exports.
|
|
6
|
+
exports.SensorTabIndex = exports.SensorClassName = exports.SizeSensorId = void 0;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Created by hustcc on 18/6/9.
|
|
@@ -11,8 +11,6 @@ exports.SensorTabIndex = exports.SensorClassName = exports.SensorStyle = exports
|
|
|
11
11
|
*/
|
|
12
12
|
var SizeSensorId = 'size-sensor-id';
|
|
13
13
|
exports.SizeSensorId = SizeSensorId;
|
|
14
|
-
var SensorStyle = 'display:block;position:absolute;top:0;left:0;height:100%;width:auto;overflow:hidden;pointer-events:none;z-index:-1;opacity:0';
|
|
15
|
-
exports.SensorStyle = SensorStyle;
|
|
16
14
|
var SensorClassName = 'size-sensor-object';
|
|
17
15
|
exports.SensorClassName = SensorClassName;
|
|
18
16
|
var SensorTabIndex = '-1';
|
package/lib/index.js
CHANGED
package/lib/sensors/object.js
CHANGED
|
@@ -38,7 +38,16 @@ var createSensor = function createSensor(element) {
|
|
|
38
38
|
resizeListener();
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
obj.
|
|
41
|
+
obj.style.display = 'block';
|
|
42
|
+
obj.style.position = 'absolute';
|
|
43
|
+
obj.style.top = '0';
|
|
44
|
+
obj.style.left = '0';
|
|
45
|
+
obj.style.height = '100%';
|
|
46
|
+
obj.style.width = '100%';
|
|
47
|
+
obj.style.overflow = 'hidden';
|
|
48
|
+
obj.style.pointerEvents = 'none';
|
|
49
|
+
obj.style.zIndex = '-1';
|
|
50
|
+
obj.style.opacity = '0';
|
|
42
51
|
obj.setAttribute('class', _constant.SensorClassName);
|
|
43
52
|
obj.setAttribute('tabindex', _constant.SensorTabIndex);
|
|
44
53
|
obj.type = 'text/html'; // append into dom
|