@bbn/bbn 1.0.177 → 1.0.178

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.
@@ -0,0 +1,2 @@
1
+ declare const isInViewport: (ele: HTMLElement, fully?: Boolean) => boolean;
2
+ export { isInViewport };
@@ -0,0 +1,17 @@
1
+ var isInViewport = function (ele, fully) {
2
+ if (fully === void 0) { fully = false; }
3
+ var bounding = ele.getBoundingClientRect();
4
+ if (fully) {
5
+ return (bounding.top >= 0
6
+ && bounding.left >= 0
7
+ && bounding.right <= (window.innerWidth || document.documentElement.clientWidth)
8
+ && bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight));
9
+ }
10
+ var eleHeight = ele.offsetHeight;
11
+ var eleWidth = ele.offsetWidth;
12
+ return (bounding.top >= -eleHeight
13
+ && bounding.left >= -eleWidth
14
+ && bounding.right <= (window.innerWidth || document.documentElement.clientWidth) + eleWidth
15
+ && bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) + eleHeight);
16
+ };
17
+ export { isInViewport };
package/dist/fn.d.ts CHANGED
@@ -152,6 +152,7 @@ declare const fn: {
152
152
  isHostname: (...args: any[]) => boolean;
153
153
  isInside: (ele: any, ancestor: any) => boolean;
154
154
  isInt: (...args: any[]) => boolean;
155
+ isInViewport: (ele: HTMLElement, fully?: Boolean) => boolean;
155
156
  isIP: (...args: any[]) => boolean;
156
157
  isIterable: (...args: any[]) => boolean;
157
158
  isMobile: () => boolean;
package/dist/fn.js CHANGED
@@ -137,6 +137,7 @@ import { isFunction } from './fn/type/isFunction.js';
137
137
  import { isHostname } from './fn/type/isHostname.js';
138
138
  import { isInside } from './fn/html/isInside.js';
139
139
  import { isInt } from './fn/type/isInt.js';
140
+ import { isInViewport } from './fn/html/isInViewport.js';
140
141
  import { isIP } from './fn/type/isIP.js';
141
142
  import { isIterable } from './fn/type/isIterable.js';
142
143
  import { isMobile } from './fn/browser/isMobile.js';
@@ -365,6 +366,7 @@ var fn = {
365
366
  isHostname: isHostname,
366
367
  isInside: isInside,
367
368
  isInt: isInt,
369
+ isInViewport: isInViewport,
368
370
  isIP: isIP,
369
371
  isIterable: isIterable,
370
372
  isMobile: isMobile,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.177",
3
+ "version": "1.0.178",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",