@nativescript-community/ui-image 4.3.18 → 4.3.20

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/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.3.20](https://github.com/nativescript-community/ui-image/compare/v4.3.19...v4.3.20) (2023-11-03)
7
+
8
+ **Note:** Version bump only for package @nativescript-community/ui-image
9
+
10
+
11
+
12
+
13
+
14
+ ## [4.3.19](https://github.com/nativescript-community/ui-image/compare/v4.3.18...v4.3.19) (2023-10-10)
15
+
16
+ ### Bug Fixes
17
+
18
+ * **android:** imageRotation fix for negative values ([45ebf54](https://github.com/nativescript-community/ui-image/commit/45ebf54ff472829f74a336bb8d6511ad53c453d7))
19
+
6
20
  ## [4.3.18](https://github.com/nativescript-community/ui-image/compare/v4.3.17...v4.3.18) (2023-10-09)
7
21
 
8
22
  **Note:** Version bump only for package @nativescript-community/ui-image
@@ -2,6 +2,6 @@ import * as i0 from "@angular/core";
2
2
  export declare class ImgDirective {
3
3
  constructor();
4
4
  static ɵfac: i0.ɵɵFactoryDeclaration<ImgDirective, never>;
5
- static ɵdir: i0.ɵɵDirectiveDeclaration<ImgDirective, "NSImg", never, {}, {}, never, never, false, never>;
5
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ImgDirective, "NSImg", never, {}, {}, never, never, false>;
6
6
  }
7
7
  export declare const NSIMG_DIRECTIVES: (typeof ImgDirective)[];
@@ -2,9 +2,9 @@ import { Directive } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
3
  export class ImgDirective {
4
4
  constructor() { }
5
- static ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
6
- static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
7
5
  }
6
+ ImgDirective.ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
7
+ ImgDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
8
8
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ImgDirective, [{
9
9
  type: Directive,
10
10
  args: [{
@@ -12,4 +12,4 @@ export class ImgDirective {
12
12
  }]
13
13
  }], function () { return []; }, null); })();
14
14
  export const NSIMG_DIRECTIVES = [ImgDirective];
15
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlyZWN0aXZlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9pbWFnZS9hbmd1bGFyL2RpcmVjdGl2ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFLMUMsTUFBTSxPQUFPLFlBQVk7SUFDckIsZ0JBQWUsQ0FBQztzRUFEUCxZQUFZOzZEQUFaLFlBQVk7O3VGQUFaLFlBQVk7Y0FIeEIsU0FBUztlQUFDO2dCQUNQLFFBQVEsRUFBRSxPQUFPO2FBQ3BCOztBQUlELE1BQU0sQ0FBQyxNQUFNLGdCQUFnQixHQUFHLENBQUMsWUFBWSxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBEaXJlY3RpdmUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuQERpcmVjdGl2ZSh7XG4gICAgc2VsZWN0b3I6ICdOU0ltZydcbn0pXG5leHBvcnQgY2xhc3MgSW1nRGlyZWN0aXZlIHtcbiAgICBjb25zdHJ1Y3RvcigpIHt9XG59XG5leHBvcnQgY29uc3QgTlNJTUdfRElSRUNUSVZFUyA9IFtJbWdEaXJlY3RpdmVdO1xuIl19
15
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlyZWN0aXZlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9pbWFnZS9hbmd1bGFyL2RpcmVjdGl2ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFLMUMsTUFBTSxPQUFPLFlBQVk7SUFDckIsZ0JBQWUsQ0FBQzs7d0VBRFAsWUFBWTsrREFBWixZQUFZO3VGQUFaLFlBQVk7Y0FIeEIsU0FBUztlQUFDO2dCQUNQLFFBQVEsRUFBRSxPQUFPO2FBQ3BCOztBQUlELE1BQU0sQ0FBQyxNQUFNLGdCQUFnQixHQUFHLENBQUMsWUFBWSxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBEaXJlY3RpdmUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuQERpcmVjdGl2ZSh7XG4gICAgc2VsZWN0b3I6ICdOU0ltZydcbn0pXG5leHBvcnQgY2xhc3MgSW1nRGlyZWN0aXZlIHtcbiAgICBjb25zdHJ1Y3RvcigpIHt9XG59XG5leHBvcnQgY29uc3QgTlNJTUdfRElSRUNUSVZFUyA9IFtJbWdEaXJlY3RpdmVdO1xuIl19
@@ -6,10 +6,10 @@ import * as i0 from "@angular/core";
6
6
  import * as i1 from "./directives";
7
7
  export { ImgDirective };
8
8
  export class TNSImageModule {
9
- static ɵfac = function TNSImageModule_Factory(t) { return new (t || TNSImageModule)(); };
10
- static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TNSImageModule });
11
- static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
12
9
  }
10
+ TNSImageModule.ɵfac = function TNSImageModule_Factory(t) { return new (t || TNSImageModule)(); };
11
+ TNSImageModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TNSImageModule });
12
+ TNSImageModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
13
13
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TNSImageModule, [{
14
14
  type: NgModule,
15
15
  args: [{
@@ -19,4 +19,4 @@ export class TNSImageModule {
19
19
  }], null, null); })();
20
20
  (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(TNSImageModule, { declarations: [i1.ImgDirective], exports: [i1.ImgDirective] }); })();
21
21
  registerElement('NSImg', () => Img);
22
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2ltYWdlL2FuZ3VsYXIvbW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDekMsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRXhELE9BQU8sRUFBRSxZQUFZLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFDOUQsT0FBTyxFQUFFLEdBQUcsRUFBRSxNQUFNLGtDQUFrQyxDQUFDOzs7QUFDdkQsT0FBTyxFQUFFLFlBQVksRUFBRSxDQUFDO0FBS3hCLE1BQU0sT0FBTyxjQUFjO3dFQUFkLGNBQWM7NERBQWQsY0FBYzs7O3VGQUFkLGNBQWM7Y0FKMUIsUUFBUTtlQUFDO2dCQUNOLFlBQVksRUFBRSxDQUFDLGdCQUFnQixDQUFDO2dCQUNoQyxPQUFPLEVBQUUsQ0FBQyxnQkFBZ0IsQ0FBQzthQUM5Qjs7d0ZBQ1ksY0FBYztBQUUzQixlQUFlLENBQUMsT0FBTyxFQUFFLEdBQUcsRUFBRSxDQUFDLEdBQUcsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiXG5pbXBvcnQgeyBOZ01vZHVsZSB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHsgcmVnaXN0ZXJFbGVtZW50IH0gZnJvbSAnQG5hdGl2ZXNjcmlwdC9hbmd1bGFyJztcblxuaW1wb3J0IHsgSW1nRGlyZWN0aXZlLCBOU0lNR19ESVJFQ1RJVkVTIH0gZnJvbSAnLi9kaXJlY3RpdmVzJztcbmltcG9ydCB7IEltZyB9IGZyb20gJ0BuYXRpdmVzY3JpcHQtY29tbXVuaXR5L3VpLWltYWdlJztcbmV4cG9ydCB7IEltZ0RpcmVjdGl2ZSB9O1xuQE5nTW9kdWxlKHtcbiAgICBkZWNsYXJhdGlvbnM6IFtOU0lNR19ESVJFQ1RJVkVTXSxcbiAgICBleHBvcnRzOiBbTlNJTUdfRElSRUNUSVZFU10sXG59KVxuZXhwb3J0IGNsYXNzIFROU0ltYWdlTW9kdWxlIHt9XG5cbnJlZ2lzdGVyRWxlbWVudCgnTlNJbWcnLCAoKSA9PiBJbWcpO1xuIl19
22
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2ltYWdlL2FuZ3VsYXIvbW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDekMsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRXhELE9BQU8sRUFBRSxZQUFZLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFDOUQsT0FBTyxFQUFFLEdBQUcsRUFBRSxNQUFNLGtDQUFrQyxDQUFDOzs7QUFDdkQsT0FBTyxFQUFFLFlBQVksRUFBRSxDQUFDO0FBS3hCLE1BQU0sT0FBTyxjQUFjOzs0RUFBZCxjQUFjO2dFQUFkLGNBQWM7O3VGQUFkLGNBQWM7Y0FKMUIsUUFBUTtlQUFDO2dCQUNOLFlBQVksRUFBRSxDQUFDLGdCQUFnQixDQUFDO2dCQUNoQyxPQUFPLEVBQUUsQ0FBQyxnQkFBZ0IsQ0FBQzthQUM5Qjs7d0ZBQ1ksY0FBYztBQUUzQixlQUFlLENBQUMsT0FBTyxFQUFFLEdBQUcsRUFBRSxDQUFDLEdBQUcsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiXG5pbXBvcnQgeyBOZ01vZHVsZSB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHsgcmVnaXN0ZXJFbGVtZW50IH0gZnJvbSAnQG5hdGl2ZXNjcmlwdC9hbmd1bGFyJztcblxuaW1wb3J0IHsgSW1nRGlyZWN0aXZlLCBOU0lNR19ESVJFQ1RJVkVTIH0gZnJvbSAnLi9kaXJlY3RpdmVzJztcbmltcG9ydCB7IEltZyB9IGZyb20gJ0BuYXRpdmVzY3JpcHQtY29tbXVuaXR5L3VpLWltYWdlJztcbmV4cG9ydCB7IEltZ0RpcmVjdGl2ZSB9O1xuQE5nTW9kdWxlKHtcbiAgICBkZWNsYXJhdGlvbnM6IFtOU0lNR19ESVJFQ1RJVkVTXSxcbiAgICBleHBvcnRzOiBbTlNJTUdfRElSRUNUSVZFU10sXG59KVxuZXhwb3J0IGNsYXNzIFROU0ltYWdlTW9kdWxlIHt9XG5cbnJlZ2lzdGVyRWxlbWVudCgnTlNJbWcnLCAoKSA9PiBJbWcpO1xuIl19
@@ -0,0 +1,43 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Directive, NgModule } from '@angular/core';
3
+ import { registerElement } from '@nativescript/angular';
4
+ import { Img } from '@nativescript-community/ui-image';
5
+
6
+ class ImgDirective {
7
+ constructor() { }
8
+ }
9
+ ImgDirective.ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
10
+ ImgDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
11
+ (function () {
12
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ImgDirective, [{
13
+ type: Directive,
14
+ args: [{
15
+ selector: 'NSImg'
16
+ }]
17
+ }], function () { return []; }, null);
18
+ })();
19
+ const NSIMG_DIRECTIVES = [ImgDirective];
20
+
21
+ class TNSImageModule {
22
+ }
23
+ TNSImageModule.ɵfac = function TNSImageModule_Factory(t) { return new (t || TNSImageModule)(); };
24
+ TNSImageModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TNSImageModule });
25
+ TNSImageModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
26
+ (function () {
27
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TNSImageModule, [{
28
+ type: NgModule,
29
+ args: [{
30
+ declarations: [NSIMG_DIRECTIVES],
31
+ exports: [NSIMG_DIRECTIVES],
32
+ }]
33
+ }], null, null);
34
+ })();
35
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(TNSImageModule, { declarations: [ImgDirective], exports: [ImgDirective] }); })();
36
+ registerElement('NSImg', () => Img);
37
+
38
+ /**
39
+ * Generated bundle index. Do not edit.
40
+ */
41
+
42
+ export { ImgDirective, TNSImageModule };
43
+ //# sourceMappingURL=nativescript-community-ui-image-angular.mjs.map
@@ -5,9 +5,9 @@ import { Img } from '@nativescript-community/ui-image';
5
5
 
6
6
  class ImgDirective {
7
7
  constructor() { }
8
- static ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
9
- static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
10
8
  }
9
+ ImgDirective.ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
10
+ ImgDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
11
11
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ImgDirective, [{
12
12
  type: Directive,
13
13
  args: [{
@@ -17,10 +17,10 @@ class ImgDirective {
17
17
  const NSIMG_DIRECTIVES = [ImgDirective];
18
18
 
19
19
  class TNSImageModule {
20
- static ɵfac = function TNSImageModule_Factory(t) { return new (t || TNSImageModule)(); };
21
- static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TNSImageModule });
22
- static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
23
20
  }
21
+ TNSImageModule.ɵfac = function TNSImageModule_Factory(t) { return new (t || TNSImageModule)(); };
22
+ TNSImageModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TNSImageModule });
23
+ TNSImageModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
24
24
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TNSImageModule, [{
25
25
  type: NgModule,
26
26
  args: [{
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-image-angular",
3
3
  "main": "index.js",
4
- "module": "fesm2022/nativescript-community-ui-image-angular.mjs",
4
+ "module": "fesm2015/nativescript-community-ui-image-angular.mjs",
5
+ "es2020": "fesm2020/nativescript-community-ui-image-angular.mjs",
6
+ "esm2020": "esm2020/nativescript-community-ui-image-angular.mjs",
7
+ "fesm2020": "fesm2020/nativescript-community-ui-image-angular.mjs",
8
+ "fesm2015": "fesm2015/nativescript-community-ui-image-angular.mjs",
5
9
  "typings": "index.d.ts",
6
10
  "exports": {
7
11
  "./package.json": {
@@ -9,9 +13,11 @@
9
13
  },
10
14
  ".": {
11
15
  "types": "./index.d.ts",
12
- "esm2022": "./esm2022/nativescript-community-ui-image-angular.mjs",
13
- "esm": "./esm2022/nativescript-community-ui-image-angular.mjs",
14
- "default": "./fesm2022/nativescript-community-ui-image-angular.mjs"
16
+ "esm2020": "./esm2020/nativescript-community-ui-image-angular.mjs",
17
+ "es2020": "./fesm2020/nativescript-community-ui-image-angular.mjs",
18
+ "es2015": "./fesm2015/nativescript-community-ui-image-angular.mjs",
19
+ "node": "./fesm2015/nativescript-community-ui-image-angular.mjs",
20
+ "default": "./fesm2020/nativescript-community-ui-image-angular.mjs"
15
21
  }
16
22
  },
17
23
  "sideEffects": false,
package/index-common.d.ts CHANGED
@@ -10,7 +10,7 @@ export declare enum CLogTypes {
10
10
  }
11
11
  export declare const ImageViewTraceCategory = "NativescriptImage";
12
12
  export declare const CLog: (type: CLogTypes, ...args: any[]) => void;
13
- export type Transition = 'fade' | 'curlUp';
13
+ export declare type Transition = 'fade' | 'curlUp';
14
14
  export declare enum ScaleType {
15
15
  None = "none",
16
16
  Fill = "fill",
@@ -52,7 +52,7 @@ export declare class EventData implements IEventData {
52
52
  get object(): any;
53
53
  set object(value: any);
54
54
  }
55
- export type Stretch = 'none' | 'fill' | 'aspectFill' | 'aspectFit';
55
+ export declare type Stretch = 'none' | 'fill' | 'aspectFill' | 'aspectFit';
56
56
  export declare const srcProperty: Property<ImageBase, string | ImageSource | ImageAsset>;
57
57
  export declare const lowerResSrcProperty: Property<ImageBase, string>;
58
58
  export declare const placeholderImageUriProperty: Property<ImageBase, string>;
@@ -83,7 +83,8 @@ export declare const roundBottomRightRadiusProperty: Property<ImageBase, CoreTyp
83
83
  export declare const loadModeProperty: Property<ImageBase, "sync" | "async">;
84
84
  export declare const clipToBoundsProperty: Property<ImageBase, boolean>;
85
85
  export declare const animatedImageViewProperty: Property<ImageBase, boolean>;
86
- export declare class ImageBase extends View {
86
+ export declare const needRequestImage: (target: any, propertyKey: string | Symbol, descriptor: PropertyDescriptor) => void;
87
+ export declare abstract class ImageBase extends View {
87
88
  static finalImageSetEvent: string;
88
89
  static failureEvent: string;
89
90
  static intermediateImageFailedEvent: string;
@@ -121,6 +122,10 @@ export declare class ImageBase extends View {
121
122
  tintColor: Color;
122
123
  readonly isLoading: boolean;
123
124
  get nativeImageViewProtected(): any;
125
+ mCanRequestImage: boolean;
126
+ mNeedRequestImage: boolean;
127
+ protected abstract initImage(): any;
128
+ onResumeNativeUpdates(): void;
124
129
  protected handleImageProgress(value: number, totalSize?: number): void;
125
130
  private static needsSizeAdjustment;
126
131
  computeScaleFactor(measureWidth: number, measureHeight: number, widthIsFinite: boolean, heightIsFinite: boolean, nativeWidth: number, nativeHeight: number, aspectRatio: number): {
package/index-common.js CHANGED
@@ -174,11 +174,36 @@ export const loadModeProperty = new Property({
174
174
  });
175
175
  export const clipToBoundsProperty = new Property({ name: 'clipToBounds', defaultValue: true, valueConverter: booleanConverter });
176
176
  export const animatedImageViewProperty = new Property({ name: 'animatedImageView', defaultValue: false, valueConverter: booleanConverter });
177
+ export const needRequestImage = function (target, propertyKey, descriptor) {
178
+ const originalMethod = descriptor.value;
179
+ descriptor.value = function (...args) {
180
+ if (!this.mCanRequestImage) {
181
+ this.mNeedRequestImage = true;
182
+ return;
183
+ }
184
+ return originalMethod.apply(this, args);
185
+ };
186
+ };
177
187
  export class ImageBase extends View {
188
+ constructor() {
189
+ super(...arguments);
190
+ this.mCanRequestImage = true;
191
+ this.mNeedRequestImage = false;
192
+ }
178
193
  // public static blendingModeProperty = new Property<ImageBase, string>({ name: 'blendingMode' });
179
194
  get nativeImageViewProtected() {
180
195
  return this.nativeViewProtected;
181
196
  }
197
+ onResumeNativeUpdates() {
198
+ // {N} suspends properties update on `_suspendNativeUpdates`. So we only need to do this in onResumeNativeUpdates
199
+ this.mCanRequestImage = false;
200
+ super.onResumeNativeUpdates();
201
+ this.mCanRequestImage = true;
202
+ if (this.mNeedRequestImage) {
203
+ this.mNeedRequestImage = false;
204
+ this.initImage();
205
+ }
206
+ }
182
207
  handleImageProgress(value, totalSize) { }
183
208
  static needsSizeAdjustment(scaleType) {
184
209
  if (scaleType === undefined) {
@@ -6,6 +6,7 @@ export declare function shutDown(): void;
6
6
  export declare class ImagePipeline {
7
7
  private _android;
8
8
  toUri(value: string | android.net.Uri): globalAndroid.net.Uri;
9
+ getCacheKey(uri: string, context: any): string;
9
10
  isInDiskCache(uri: string | android.net.Uri): boolean;
10
11
  isInBitmapMemoryCache(uri: string | android.net.Uri): boolean;
11
12
  evictFromMemoryCache(uri: string | android.net.Uri): void;
@@ -61,23 +62,20 @@ export declare class FailureEventData extends EventData {
61
62
  get error(): ImageError;
62
63
  set error(value: ImageError);
63
64
  }
64
- export declare const needRequestImage: (target: any, propertyKey: string | Symbol, descriptor: PropertyDescriptor) => void;
65
65
  export declare const needUpdateHierarchy: (target: any, propertyKey: string | Symbol, descriptor: PropertyDescriptor) => void;
66
66
  export declare class Img extends ImageBase {
67
67
  nativeViewProtected: com.nativescript.image.DraweeView;
68
68
  nativeImageViewProtected: com.nativescript.image.DraweeView;
69
69
  isLoading: boolean;
70
- _canRequestImage: boolean;
71
- _canUpdateHierarchy: boolean;
72
- _needUpdateHierarchy: boolean;
73
- _needRequestImage: boolean;
70
+ mCanUpdateHierarchy: boolean;
71
+ mNeedUpdateHierarchy: boolean;
74
72
  onResumeNativeUpdates(): void;
75
73
  createNativeView(): com.nativescript.image.DraweeView;
76
74
  updateViewSize(imageInfo: any): void;
77
75
  disposeNativeView(): void;
78
76
  updateImageUri(): void;
79
77
  controllerListener: com.facebook.drawee.controller.ControllerListener<com.facebook.imagepipeline.image.ImageInfo>;
80
- private initImage;
78
+ protected initImage(): Promise<void>;
81
79
  private updateHierarchy;
82
80
  private getDrawable;
83
81
  private getDrawableFromLocalFile;
package/index.android.js CHANGED
@@ -2,7 +2,7 @@ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2
2
  export * from './index-common';
3
3
  import { Application, Background, Color, ImageAsset, ImageSource, Trace, Utils, backgroundInternalProperty, knownFolders, path } from '@nativescript/core';
4
4
  import { isString } from '@nativescript/core/utils/types';
5
- import { CLog, CLogTypes, EventData, ImageBase, ScaleType, aspectRatioProperty, backgroundUriProperty, blurDownSamplingProperty, blurRadiusProperty, fadeDurationProperty, failureImageUriProperty, imageRotationProperty, lowerResSrcProperty, placeholderImageUriProperty, progressBarColorProperty, roundAsCircleProperty, roundBottomLeftRadiusProperty, roundBottomRightRadiusProperty, roundTopLeftRadiusProperty, roundTopRightRadiusProperty, showProgressBarProperty, srcProperty, stretchProperty, tintColorProperty } from './index-common';
5
+ import { CLog, CLogTypes, EventData, ImageBase, ScaleType, aspectRatioProperty, backgroundUriProperty, blurDownSamplingProperty, blurRadiusProperty, fadeDurationProperty, failureImageUriProperty, imageRotationProperty, lowerResSrcProperty, needRequestImage, placeholderImageUriProperty, progressBarColorProperty, roundAsCircleProperty, roundBottomLeftRadiusProperty, roundBottomRightRadiusProperty, roundTopLeftRadiusProperty, roundTopRightRadiusProperty, showProgressBarProperty, srcProperty, stretchProperty, tintColorProperty } from './index-common';
6
6
  let initialized = false;
7
7
  let initializeConfig;
8
8
  export function initialize(config) {
@@ -99,6 +99,10 @@ export class ImagePipeline {
99
99
  }
100
100
  return android.net.Uri.parse(value);
101
101
  }
102
+ getCacheKey(uri, context) {
103
+ // iOS only
104
+ return uri;
105
+ }
102
106
  isInDiskCache(uri) {
103
107
  return this._android.isInDiskCacheSync(this.toUri(uri));
104
108
  }
@@ -260,24 +264,11 @@ export class FailureEventData extends EventData {
260
264
  this._error = value;
261
265
  }
262
266
  }
263
- export const needRequestImage = function (target, propertyKey, descriptor) {
264
- const originalMethod = descriptor.value;
265
- descriptor.value = function (...args) {
266
- if (!this._canRequestImage) {
267
- this._needRequestImage = true;
268
- // we need to ensure a hierarchy is set or the default aspect ratio wont be set
269
- // because aspectFit is the default (wanted) but then we wont go into stretchProperty.setNative
270
- // this._needUpdateHierarchy = true;
271
- return;
272
- }
273
- return originalMethod.apply(this, args);
274
- };
275
- };
276
267
  export const needUpdateHierarchy = function (target, propertyKey, descriptor) {
277
268
  const originalMethod = descriptor.value;
278
269
  descriptor.value = function (...args) {
279
- if (!this._canUpdateHierarchy) {
280
- this._needUpdateHierarchy = true;
270
+ if (!this.mCanUpdateHierarchy) {
271
+ this.mNeedUpdateHierarchy = true;
281
272
  return;
282
273
  }
283
274
  return originalMethod.apply(this, args);
@@ -287,26 +278,18 @@ export class Img extends ImageBase {
287
278
  constructor() {
288
279
  super(...arguments);
289
280
  this.isLoading = false;
290
- this._canRequestImage = true;
291
- this._canUpdateHierarchy = true;
292
- this._needUpdateHierarchy = false;
293
- this._needRequestImage = false;
281
+ this.mCanUpdateHierarchy = true;
282
+ this.mNeedUpdateHierarchy = false;
294
283
  }
295
284
  onResumeNativeUpdates() {
296
285
  // {N} suspends properties update on `_suspendNativeUpdates`. So we only need to do this in onResumeNativeUpdates
297
- this._canRequestImage = false;
298
- this._canUpdateHierarchy = false;
286
+ this.mCanUpdateHierarchy = false;
299
287
  super.onResumeNativeUpdates();
300
- this._canUpdateHierarchy = true;
301
- this._canRequestImage = true;
302
- if (this._needUpdateHierarchy) {
303
- this._needUpdateHierarchy = false;
288
+ this.mCanUpdateHierarchy = true;
289
+ if (this.mNeedUpdateHierarchy) {
290
+ this.mNeedUpdateHierarchy = false;
304
291
  this.updateHierarchy();
305
292
  }
306
- if (this._needRequestImage) {
307
- this._needRequestImage = false;
308
- this.initImage();
309
- }
310
293
  }
311
294
  createNativeView() {
312
295
  if (!initialized) {
@@ -621,8 +604,8 @@ export class Img extends ImageBase {
621
604
  }
622
605
  }
623
606
  updateHierarchy() {
624
- if (!this._canUpdateHierarchy) {
625
- this._needUpdateHierarchy = true;
607
+ if (!this.mCanUpdateHierarchy) {
608
+ this.mNeedUpdateHierarchy = true;
626
609
  return;
627
610
  }
628
611
  if (this.nativeImageViewProtected) {
@@ -669,7 +652,7 @@ export class Img extends ImageBase {
669
652
  builder.setCornersRadii(topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius);
670
653
  }
671
654
  this.nativeImageViewProtected.setHierarchy(builder.build());
672
- if (!this._needRequestImage) {
655
+ if (!this.mNeedRequestImage) {
673
656
  this.nativeImageViewProtected.setController(this.nativeImageViewProtected.getController());
674
657
  }
675
658
  }
package/index.d.ts CHANGED
@@ -203,6 +203,10 @@ export class Img extends View {
203
203
  alwaysFade: boolean;
204
204
  noCache: boolean;
205
205
  tintColor: Color;
206
+
207
+ /**
208
+ * Android: custom imageRotation
209
+ */
206
210
  imageRotation: number;
207
211
  }
208
212
 
@@ -353,6 +357,12 @@ export class ImagePipeline {
353
357
  */
354
358
  isInBitmapMemoryCache(uri: string): boolean;
355
359
 
360
+ /**
361
+ * Returns the actual cache key for url + context
362
+ * this is an iOS feature because imageView properties are used for the cache key
363
+ */
364
+ getCacheKey(uri: string, context): string;
365
+
356
366
  /**
357
367
  * Returns whether the image is stored in the disk cache.
358
368
  */
package/index.ios.d.ts CHANGED
@@ -14,8 +14,9 @@ export interface FinalEventData extends EventData {
14
14
  export declare function initialize(config?: ImagePipelineConfigSetting): void;
15
15
  export declare function shutDown(): void;
16
16
  export declare class ImagePipeline {
17
- private _ios;
17
+ private mIos;
18
18
  constructor();
19
+ getCacheKey(uri: string, context: any): string;
19
20
  isInDiskCache(uri: string): boolean;
20
21
  isInBitmapMemoryCache(uri: string): boolean;
21
22
  evictFromMemoryCache(uri: string): void;
@@ -29,12 +30,14 @@ export declare class ImagePipeline {
29
30
  private prefetchToCacheType;
30
31
  get ios(): SDImageCache;
31
32
  }
33
+ export declare const needRequestImage: (target: any, propertyKey: string | Symbol, descriptor: PropertyDescriptor) => void;
32
34
  export declare function getImagePipeline(): ImagePipeline;
33
35
  export declare class Img extends ImageBase {
34
36
  nativeViewProtected: SDAnimatedImageView | UIImageView;
35
37
  nativeImageViewProtected: SDAnimatedImageView | UIImageView;
36
38
  isLoading: boolean;
37
- private _imageSourceAffectsLayout;
39
+ protected mImageSourceAffectsLayout: boolean;
40
+ protected mCIFilter: CIFilter;
38
41
  createNativeView(): UIImageView;
39
42
  _setNativeClipToBounds(): void;
40
43
  onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;
@@ -43,7 +46,7 @@ export declare class Img extends ImageBase {
43
46
  private handleImageLoaded;
44
47
  private onLoadProgress;
45
48
  private getUIImage;
46
- private initImage;
49
+ protected initImage(): Promise<void>;
47
50
  placeholderImage: UIImage;
48
51
  startAnimating(): void;
49
52
  stopAnimating(): void;
package/index.ios.js CHANGED
@@ -1,3 +1,4 @@
1
+ var _a, _b;
1
2
  export * from './index-common';
2
3
  import { ImageAsset, ImageSource, Screen, Trace, Utils, knownFolders, path } from '@nativescript/core';
3
4
  import { layout } from '@nativescript/core/utils/layout-helper';
@@ -74,32 +75,38 @@ export function initialize(config) {
74
75
  export function shutDown() { }
75
76
  export class ImagePipeline {
76
77
  constructor() {
77
- this._ios = SDImageCache.sharedImageCache;
78
+ this.mIos = SDImageCache.sharedImageCache;
79
+ }
80
+ getCacheKey(uri, context) {
81
+ return SDWebImageManager.sharedManager.cacheKeyForURLContext(NSURL.URLWithString(uri), context);
78
82
  }
79
83
  isInDiskCache(uri) {
80
- return this._ios.diskImageDataExistsWithKey(getUri(uri).absoluteString);
84
+ return this.mIos.diskImageDataExistsWithKey(getUri(uri).absoluteString);
81
85
  }
82
86
  isInBitmapMemoryCache(uri) {
83
- return this._ios.imageFromMemoryCacheForKey(getUri(uri).absoluteString) !== null;
87
+ return this.mIos.imageFromMemoryCacheForKey(getUri(uri).absoluteString) !== null;
84
88
  }
85
89
  evictFromMemoryCache(uri) {
86
- this._ios.removeImageFromMemoryForKey(getUri(uri).absoluteString);
90
+ this.mIos.removeImageFromMemoryForKey(getUri(uri).absoluteString);
87
91
  }
88
92
  evictFromDiskCache(uri) {
89
- this._ios.removeImageFromDiskForKey(getUri(uri).absoluteString);
93
+ this.mIos.removeImageFromDiskForKey(getUri(uri).absoluteString);
90
94
  }
91
95
  evictFromCache(uri) {
92
- this._ios.removeImageForKeyWithCompletion(getUri(uri).absoluteString, null);
96
+ const key = getUri(uri).absoluteString;
97
+ this.mIos.removeImageFromDiskForKey(key);
98
+ this.mIos.removeImageFromMemoryForKey(key);
99
+ // this.mIos.removeImageForKeyWithCompletion(getUri(uri).absoluteString, null);
93
100
  }
94
101
  clearCaches() {
95
- this._ios.clearMemory();
96
- this._ios.clearDiskOnCompletion(null);
102
+ this.mIos.clearMemory();
103
+ this.mIos.clearDiskOnCompletion(null);
97
104
  }
98
105
  clearMemoryCaches() {
99
- this._ios.clearMemory();
106
+ this.mIos.clearMemory();
100
107
  }
101
108
  clearDiskCaches() {
102
- this._ios.clearDiskOnCompletion(null);
109
+ this.mIos.clearDiskOnCompletion(null);
103
110
  }
104
111
  prefetchToDiskCache(uri) {
105
112
  return this.prefetchToCacheType(uri, 1 /* SDImageCacheType.Disk */);
@@ -123,9 +130,22 @@ export class ImagePipeline {
123
130
  });
124
131
  }
125
132
  get ios() {
126
- return this._ios;
133
+ return this.mIos;
127
134
  }
128
135
  }
136
+ export const needRequestImage = function (target, propertyKey, descriptor) {
137
+ const originalMethod = descriptor.value;
138
+ descriptor.value = function (...args) {
139
+ if (!this.mCanRequestImage) {
140
+ this.mNeedRequestImage = true;
141
+ // we need to ensure a hierarchy is set or the default aspect ratio wont be set
142
+ // because aspectFit is the default (wanted) but then we wont go into stretchProperty.setNative
143
+ // this.mNeedUpdateHierarchy = true;
144
+ return;
145
+ }
146
+ return originalMethod.apply(this, args);
147
+ };
148
+ };
129
149
  export function getImagePipeline() {
130
150
  const imagePineLine = new ImagePipeline();
131
151
  return imagePineLine;
@@ -165,7 +185,7 @@ export class Img extends ImageBase {
165
185
  constructor() {
166
186
  super(...arguments);
167
187
  this.isLoading = false;
168
- this._imageSourceAffectsLayout = true;
188
+ this.mImageSourceAffectsLayout = true;
169
189
  this.handleImageLoaded = (image, error, cacheType) => {
170
190
  this.isLoading = false;
171
191
  if (!this.nativeViewProtected) {
@@ -179,25 +199,21 @@ export class Img extends ImageBase {
179
199
  this.nativeImageViewProtected.stopAnimating();
180
200
  }
181
201
  if (error) {
182
- const args = {
202
+ this.notify({
183
203
  eventName: Img.failureEvent,
184
- object: this,
185
204
  error
186
- };
187
- this.notify(args);
205
+ });
188
206
  if (this.failureImageUri) {
189
207
  image = this.getUIImage(this.failureImageUri);
190
208
  this._setNativeImage(image, animate);
191
209
  }
192
210
  }
193
211
  else if (image) {
194
- const args = {
212
+ this.notify({
195
213
  eventName: ImageBase.finalImageSetEvent,
196
- object: this,
197
214
  imageInfo: new ImageInfo(image.size.width, image.size.height),
198
215
  ios: image
199
- };
200
- this.notify(args);
216
+ });
201
217
  }
202
218
  this.handleImageProgress(1);
203
219
  };
@@ -226,7 +242,7 @@ export class Img extends ImageBase {
226
242
  const image = this.nativeImageViewProtected.image;
227
243
  const finiteWidth = widthMode === layout.EXACTLY;
228
244
  const finiteHeight = heightMode === layout.EXACTLY;
229
- this._imageSourceAffectsLayout = !finiteWidth || !finiteHeight;
245
+ this.mImageSourceAffectsLayout = !finiteWidth || !finiteHeight;
230
246
  if (Trace.isEnabled()) {
231
247
  CLog(CLogTypes.info, 'onMeasure', this.src, widthMeasureSpec, heightMeasureSpec, width, height, this.aspectRatio, image && image.imageOrientation);
232
248
  }
@@ -262,7 +278,7 @@ export class Img extends ImageBase {
262
278
  this.src = src;
263
279
  }
264
280
  _setNativeImage(nativeImage, animated = true) {
265
- if (animated) {
281
+ if (animated && this.fadeDuration) {
266
282
  // switch (this.transition) {
267
283
  // case 'fade':
268
284
  this.nativeImageViewProtected.alpha = 0.0;
@@ -289,8 +305,8 @@ export class Img extends ImageBase {
289
305
  else {
290
306
  this.nativeImageViewProtected.image = nativeImage;
291
307
  }
292
- if (this._imageSourceAffectsLayout) {
293
- this._imageSourceAffectsLayout = false;
308
+ if (this.mImageSourceAffectsLayout) {
309
+ this.mImageSourceAffectsLayout = false;
294
310
  this.requestLayout();
295
311
  }
296
312
  }
@@ -316,10 +332,7 @@ export class Img extends ImageBase {
316
332
  else {
317
333
  image = imagePath;
318
334
  }
319
- if (image) {
320
- image = image.ios;
321
- }
322
- return image;
335
+ return image?.ios;
323
336
  }
324
337
  async initImage() {
325
338
  if (this.nativeViewProtected) {
@@ -347,16 +360,17 @@ export class Img extends ImageBase {
347
360
  }
348
361
  }
349
362
  const uri = getUri(src);
350
- if (this.noCache) {
351
- const key = uri.absoluteString;
352
- const imagePipeLine = getImagePipeline();
353
- const isInCache = imagePipeLine.isInBitmapMemoryCache(key);
354
- if (isInCache) {
355
- imagePipeLine.evictFromCache(key);
356
- }
357
- }
358
363
  this.isLoading = true;
359
364
  let options = 2048 /* SDWebImageOptions.ScaleDownLargeImages */ | 1024 /* SDWebImageOptions.AvoidAutoSetImage */;
365
+ if (this.noCache) {
366
+ // const key = uri.absoluteString;
367
+ // const imagePipeLine = getImagePipeline();
368
+ // const isInCache = imagePipeLine.isInBitmapMemoryCache(key);
369
+ // if (isInCache) {
370
+ // imagePipeLine.evictFromCache(key);
371
+ // }
372
+ options = options | 65536 /* SDWebImageOptions.FromLoaderOnly */;
373
+ }
360
374
  if (this.alwaysFade === true) {
361
375
  options |= 131072 /* SDWebImageOptions.ForceTransition */;
362
376
  }
@@ -365,7 +379,7 @@ export class Img extends ImageBase {
365
379
  if (this.progressiveRenderingEnabled === true) {
366
380
  options = options | 4 /* SDWebImageOptions.ProgressiveLoad */;
367
381
  }
368
- if (this.decodeWidth && this.decodeHeight) {
382
+ if (this.decodeWidth || this.decodeHeight) {
369
383
  //@ts-ignore
370
384
  transformers.push(NSImageDecodeSizeTransformer.transformerWithDecodeWidthDecodeHeight(this.decodeWidth, this.decodeHeight));
371
385
  }
@@ -384,6 +398,9 @@ export class Img extends ImageBase {
384
398
  //@ts-ignore
385
399
  NSImageRoundCornerTransformer.transformerWithTopLefRadiusTopRightRadiusBottomRightRadiusBottomLeftRadius(layout.toDeviceIndependentPixels(this.roundTopLeftRadius), layout.toDeviceIndependentPixels(this.roundTopRightRadius), layout.toDeviceIndependentPixels(this.roundBottomRightRadius), layout.toDeviceIndependentPixels(this.roundBottomLeftRadius)));
386
400
  }
401
+ if (this.mCIFilter) {
402
+ transformers.push(SDImageFilterTransformer.transformerWithFilter(this.mCIFilter));
403
+ }
387
404
  if (transformers.length > 0) {
388
405
  if (this.animatedImageView) {
389
406
  // as we use SDAnimatedImageView all images are loaded as SDAnimatedImage;
@@ -401,10 +418,10 @@ export class Img extends ImageBase {
401
418
  }
402
419
  }
403
420
  }
404
- [srcProperty.setNative](value) {
421
+ [_a = srcProperty.setNative](value) {
405
422
  this.initImage();
406
423
  }
407
- [placeholderImageUriProperty.setNative]() {
424
+ [_b = placeholderImageUriProperty.setNative]() {
408
425
  this.placeholderImage = this.getUIImage(this.placeholderImageUri);
409
426
  this.initImage();
410
427
  }
@@ -418,7 +435,6 @@ export class Img extends ImageBase {
418
435
  this.nativeImageViewProtected.contentMode = getUIImageScaleType(value);
419
436
  }
420
437
  // [ImageBase.blendingModeProperty.setNative](value: string) {
421
- // console.log('blendingModeProperty', value);
422
438
  // switch (value) {
423
439
  // case 'multiply':
424
440
  // this.nativeImageViewProtected.layer.compositingFilter = 'multiply';
@@ -438,4 +454,10 @@ export class Img extends ImageBase {
438
454
  this.nativeImageViewProtected.stopAnimating();
439
455
  }
440
456
  }
457
+ __decorate([
458
+ needRequestImage
459
+ ], Img.prototype, _a, null);
460
+ __decorate([
461
+ needRequestImage
462
+ ], Img.prototype, _b, null);
441
463
  //# sourceMappingURL=index.ios.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-image",
3
- "version": "4.3.18",
3
+ "version": "4.3.20",
4
4
  "description": "Advanced and efficient image display plugin which uses Fresco (Android) and SDWebImage (iOS) to implement caching, placeholders, image effects, and much more.",
5
5
  "main": "./index",
6
6
  "sideEffects": false,
@@ -44,5 +44,5 @@
44
44
  },
45
45
  "license": "Apache-2.0",
46
46
  "readmeFilename": "README.md",
47
- "gitHead": "e8ef097922e6a7729fc7c1c80602de6736fd4137"
47
+ "gitHead": "98af31eeaac7f0f4b2b28be8d667cc9909b00b36"
48
48
  }
@@ -144,7 +144,8 @@ public class ScalingUtils {
144
144
  float focusY) {
145
145
  float sX = (float) parentRect.width() / (float) childWidth;
146
146
  float sY = (float) parentRect.height() / (float) childHeight;
147
- float rotationDelta = (90 - (_imageRotation % 180))/90.0f;
147
+ // add 360 to ensure we get positive value
148
+ float rotationDelta = (90 - ((_imageRotation + 360) % 180))/90.0f;
148
149
  if (rotationDelta != 1) {
149
150
  float destSX = (float) parentRect.width() / (float) childHeight;
150
151
  float destSY = (float) parentRect.height() / (float) childWidth;
Binary file
package/references.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  /// <reference path="./typings/android.d.ts" />
2
2
  /// <reference path="./typings/ios.d.ts" />
3
3
  /// <reference path="./typings/objc!SDWebImagePhotosPlugin.d.ts" />
4
+ /// <reference path="../../node_modules/@nativescript/types-ios/lib/ios/objc-x86_64/objc!CoreImage.d.ts" />
package/vue/index.mjs ADDED
@@ -0,0 +1,8 @@
1
+ import { Img } from '../image';
2
+ const ImagePlugin = {
3
+ install(Vue) {
4
+ Vue.registerElement('NSImg', () => Img);
5
+ }
6
+ };
7
+ export default ImagePlugin;
8
+ //# sourceMappingURL=index.mjs.map
File without changes