@bbn/bbn 1.0.177 → 1.0.179
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/dist/bbn.js +215 -177
- package/dist/bbn.js.map +1 -1
- package/dist/fn/html/isInViewport.d.ts +2 -0
- package/dist/fn/html/isInViewport.js +17 -0
- package/dist/fn.d.ts +2 -0
- package/dist/fn.js +4 -0
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -183,6 +184,7 @@ declare const fn: {
|
|
|
183
184
|
money: (val: number, kilo?: boolean, currency?: string, novalue?: string | false, decimal?: string, thousands?: string, precision?: number) => string;
|
|
184
185
|
move: (arr: any[], fromIndex: number, toIndex: number) => any[];
|
|
185
186
|
multiorder: (arr: object[], orders: any) => object[];
|
|
187
|
+
mutateArray: any;
|
|
186
188
|
nl2br: (st: any, keepNl: any) => string;
|
|
187
189
|
numProperties: (obj: object) => number;
|
|
188
190
|
objectToFormData: (obj: any, key?: string, ignoreList?: any) => FormData;
|
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';
|
|
@@ -168,6 +169,7 @@ import { md5 } from './fn/string/md5.js';
|
|
|
168
169
|
import { money } from './fn/misc/money.js';
|
|
169
170
|
import { move } from './fn/object/move.js';
|
|
170
171
|
import { multiorder } from './fn/object/multiorder.js';
|
|
172
|
+
import { mutateArray } from './fn/object/mutateArray.js';
|
|
171
173
|
import { nl2br } from './fn/string/nl2br.js';
|
|
172
174
|
import { numProperties } from './fn/object/numProperties.js';
|
|
173
175
|
import { objectToFormData } from './fn/form/objectToFormData.js';
|
|
@@ -365,6 +367,7 @@ var fn = {
|
|
|
365
367
|
isHostname: isHostname,
|
|
366
368
|
isInside: isInside,
|
|
367
369
|
isInt: isInt,
|
|
370
|
+
isInViewport: isInViewport,
|
|
368
371
|
isIP: isIP,
|
|
369
372
|
isIterable: isIterable,
|
|
370
373
|
isMobile: isMobile,
|
|
@@ -396,6 +399,7 @@ var fn = {
|
|
|
396
399
|
money: money,
|
|
397
400
|
move: move,
|
|
398
401
|
multiorder: multiorder,
|
|
402
|
+
mutateArray: mutateArray,
|
|
399
403
|
nl2br: nl2br,
|
|
400
404
|
numProperties: numProperties,
|
|
401
405
|
objectToFormData: objectToFormData,
|