Browse Source

Lodash-es

Aleksandr Aleksandrov 6 years ago
parent
commit
b0684cfeb9
3 changed files with 28 additions and 12 deletions
  1. 4 2
      package.json
  2. 6 6
      src/watch.ts
  3. 18 4
      yarn.lock

+ 4 - 2
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@ex-helpers/element",
-  "version": "0.1.8",
+  "version": "0.1.10",
   "description": "Several element wrapper helpers",
   "scripts": {
     "build": "exb",
@@ -9,7 +9,8 @@
   "author": "",
   "license": "ISC",
   "dependencies": {
-    "@ex-helpers/stack": "^0.1.9"
+    "@ex-helpers/stack": ">=0.1.10",
+    "lodash-es": "^4.17.11"
   },
   "peerDependencies": {
     "rxjs": "^6.0.0",
@@ -18,6 +19,7 @@
   "devDependencies": {
     "@angular/core": "^6.1.10",
     "@ex-helpers/build": "^0.1.18",
+    "@types/lodash-es": "^4.17.1",
     "rimraf": "^2.6.2",
     "typescript": "^2"
   }

+ 6 - 6
src/watch.ts

@@ -1,15 +1,15 @@
 import {ElementRef} from '@angular/core';
-import {getSize} from './size';
-import extend from 'lodash/extend';
+import extend from 'lodash-es/extend';
 import {IncrementalStackManager} from '@ex-helpers/stack';
+import {bounds} from './bounds';
 
 declare module '@angular/core' {
-    class ElementRef {
+    class ElementRef<T = any> {
         private _watchSizeCollection: any;
 
-        nativeElement: any;
+        nativeElement: T;
 
-        constructor(nativeElement: any);
+        constructor(nativeElement: T);
 
         watchSize: (callback: (height: number, width: number) => void,
                     options?: { attributes: boolean, childList: boolean, characterData: boolean },
@@ -53,7 +53,7 @@ ElementRef.prototype.watchSize = function
     let lastHeight: number;
     let lastWidth: number;
     const triggerCheck = () => {
-        const sizes = getSize(this.nativeElement);
+        const sizes = bounds(this.nativeElement).size;
         if (lastWidth === sizes.width && lastHeight === sizes.height) {
             return;
         }

+ 18 - 4
yarn.lock

@@ -16,13 +16,23 @@
     rimraf "^2.6.2"
     yargs "^12.0.2"
 
-"@ex-helpers/stack@^0.1.1":
-  version "0.1.9"
-  resolved "https://registry.desudesu.ru/@ex-helpers%2fstack/-/stack-0.1.9.tgz#69137983c7b0245c718c158b2b4a690402e77b8a"
+"@ex-helpers/stack@>=0.1.10":
+  version "0.1.10"
+  resolved "https://registry.desudesu.ru/@ex-helpers%2fstack/-/stack-0.1.10.tgz#4ccc554d8c55657778403ebfe00940e19dca64e1"
   dependencies:
-    lodash "^4.17.11"
+    lodash-es "^4.17.11"
     rxjs "^6"
 
+"@types/lodash-es@^4.17.1":
+  version "4.17.1"
+  resolved "https://registry.desudesu.ru/@types%2flodash-es/-/lodash-es-4.17.1.tgz#56745e5411558362aeca31def918f88f725dd29d"
+  dependencies:
+    "@types/lodash" "*"
+
+"@types/lodash@*":
+  version "4.14.120"
+  resolved "https://registry.desudesu.ru/@types%2flodash/-/lodash-4.14.120.tgz#cf265d06f6c7a710db087ed07523ab8c1a24047b"
+
 ansi-regex@^2.0.0:
   version "2.1.1"
   resolved "https://registry.desudesu.ru/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
@@ -165,6 +175,10 @@ locate-path@^3.0.0:
     p-locate "^3.0.0"
     path-exists "^3.0.0"
 
+lodash-es@^4.17.11:
+  version "4.17.11"
+  resolved "https://registry.desudesu.ru/lodash-es/-/lodash-es-4.17.11.tgz#145ab4a7ac5c5e52a3531fb4f310255a152b4be0"
+
 lodash@^4.17.11:
   version "4.17.11"
   resolved "https://registry.desudesu.ru/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"