@nativescript-community/ui-image 4.5.3 → 4.5.5
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 +10 -0
- package/angular/esm2022/directives.mjs +2 -2
- package/angular/esm2022/module.mjs +2 -2
- package/angular/fesm2022/nativescript-community-ui-image-angular.mjs +2 -2
- package/index.android.js +40 -10
- package/package.json +10 -2
- package/platforms/android/include.gradle +1 -1
- package/platforms/android/ui_image.aar +0 -0
- package/vue/index.mjs +0 -8
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,16 @@
|
|
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.5.5](https://github.com/nativescript-community/ui-image/compare/v4.5.4...v4.5.5) (2025-07-16)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
* **android:** updated fresco version ([d3d871d](https://github.com/nativescript-community/ui-image/commit/d3d871dabd7415bac5fd10197ff3a8e4ba23d68e))
|
11
|
+
|
12
|
+
## [4.5.4](https://github.com/nativescript-community/ui-image/compare/v4.5.3...v4.5.4) (2024-11-12)
|
13
|
+
|
14
|
+
**Note:** Version bump only for package @nativescript-community/ui-image
|
15
|
+
|
6
16
|
## [4.5.3](https://github.com/nativescript-community/ui-image/compare/v4.5.2...v4.5.3) (2024-09-11)
|
7
17
|
|
8
18
|
**Note:** Version bump only for package @nativescript-community/ui-image
|
@@ -2,7 +2,7 @@ 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(
|
5
|
+
static ɵfac = function ImgDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ImgDirective)(); };
|
6
6
|
static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
|
7
7
|
}
|
8
8
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ImgDirective, [{
|
@@ -12,4 +12,4 @@ export class ImgDirective {
|
|
12
12
|
}]
|
13
13
|
}], () => [], null); })();
|
14
14
|
export const NSIMG_DIRECTIVES = [ImgDirective];
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlyZWN0aXZlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9pbWFnZS9hbmd1bGFyL2RpcmVjdGl2ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFLMUMsTUFBTSxPQUFPLFlBQVk7SUFDckIsZ0JBQWUsQ0FBQztzR0FEUCxZQUFZOzZEQUFaLFlBQVk7O2lGQUFaLFlBQVk7Y0FIeEIsU0FBUztlQUFDO2dCQUNQLFFBQVEsRUFBRSxPQUFPO2FBQ3BCOztBQUlELE1BQU0sQ0FBQyxNQUFNLGdCQUFnQixHQUFHLENBQUMsWUFBWSxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBEaXJlY3RpdmUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuQERpcmVjdGl2ZSh7XG4gICAgc2VsZWN0b3I6ICdOU0ltZydcbn0pXG5leHBvcnQgY2xhc3MgSW1nRGlyZWN0aXZlIHtcbiAgICBjb25zdHJ1Y3RvcigpIHt9XG59XG5leHBvcnQgY29uc3QgTlNJTUdfRElSRUNUSVZFUyA9IFtJbWdEaXJlY3RpdmVdO1xuIl19
|
@@ -6,7 +6,7 @@ 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(
|
9
|
+
static ɵfac = function TNSImageModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TNSImageModule)(); };
|
10
10
|
static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TNSImageModule });
|
11
11
|
static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
12
12
|
}
|
@@ -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,
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2ltYWdlL2FuZ3VsYXIvbW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDekMsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRXhELE9BQU8sRUFBRSxZQUFZLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFDOUQsT0FBTyxFQUFFLEdBQUcsRUFBRSxNQUFNLGtDQUFrQyxDQUFDOzs7QUFDdkQsT0FBTyxFQUFFLFlBQVksRUFBRSxDQUFDO0FBS3hCLE1BQU0sT0FBTyxjQUFjO3dHQUFkLGNBQWM7NERBQWQsY0FBYzs7O2lGQUFkLGNBQWM7Y0FKMUIsUUFBUTtlQUFDO2dCQUNOLFlBQVksRUFBRSxDQUFDLGdCQUFnQixDQUFDO2dCQUNoQyxPQUFPLEVBQUUsQ0FBQyxnQkFBZ0IsQ0FBQzthQUM5Qjs7d0ZBQ1ksY0FBYztBQUUzQixlQUFlLENBQUMsT0FBTyxFQUFFLEdBQUcsRUFBRSxDQUFDLEdBQUcsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiXG5pbXBvcnQgeyBOZ01vZHVsZSB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHsgcmVnaXN0ZXJFbGVtZW50IH0gZnJvbSAnQG5hdGl2ZXNjcmlwdC9hbmd1bGFyJztcblxuaW1wb3J0IHsgSW1nRGlyZWN0aXZlLCBOU0lNR19ESVJFQ1RJVkVTIH0gZnJvbSAnLi9kaXJlY3RpdmVzJztcbmltcG9ydCB7IEltZyB9IGZyb20gJ0BuYXRpdmVzY3JpcHQtY29tbXVuaXR5L3VpLWltYWdlJztcbmV4cG9ydCB7IEltZ0RpcmVjdGl2ZSB9O1xuQE5nTW9kdWxlKHtcbiAgICBkZWNsYXJhdGlvbnM6IFtOU0lNR19ESVJFQ1RJVkVTXSxcbiAgICBleHBvcnRzOiBbTlNJTUdfRElSRUNUSVZFU10sXG59KVxuZXhwb3J0IGNsYXNzIFROU0ltYWdlTW9kdWxlIHt9XG5cbnJlZ2lzdGVyRWxlbWVudCgnTlNJbWcnLCAoKSA9PiBJbWcpO1xuIl19
|
@@ -5,7 +5,7 @@ import { Img } from '@nativescript-community/ui-image';
|
|
5
5
|
|
6
6
|
class ImgDirective {
|
7
7
|
constructor() { }
|
8
|
-
static ɵfac = function ImgDirective_Factory(
|
8
|
+
static ɵfac = function ImgDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ImgDirective)(); };
|
9
9
|
static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
|
10
10
|
}
|
11
11
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ImgDirective, [{
|
@@ -17,7 +17,7 @@ class ImgDirective {
|
|
17
17
|
const NSIMG_DIRECTIVES = [ImgDirective];
|
18
18
|
|
19
19
|
class TNSImageModule {
|
20
|
-
static ɵfac = function TNSImageModule_Factory(
|
20
|
+
static ɵfac = function TNSImageModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TNSImageModule)(); };
|
21
21
|
static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TNSImageModule });
|
22
22
|
static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
23
23
|
}
|
package/index.android.js
CHANGED
@@ -95,6 +95,27 @@ function getUri(src, asNative = true) {
|
|
95
95
|
}
|
96
96
|
return asNative ? android.net.Uri.parse(uri) : uri;
|
97
97
|
}
|
98
|
+
function isVectorDrawable(context, resId) {
|
99
|
+
const resources = context.getResources();
|
100
|
+
// VectorDrawable resources are usually stored as "drawable" in XML format
|
101
|
+
const value = new android.util.TypedValue();
|
102
|
+
resources.getValue(resId, value, true);
|
103
|
+
if (value.string.toString().endsWith('.xml')) {
|
104
|
+
// It's most likely a VectorDrawable
|
105
|
+
return true;
|
106
|
+
}
|
107
|
+
// If it's not a vector, it's probably a BitmapDrawable or another type
|
108
|
+
return false;
|
109
|
+
}
|
110
|
+
function getBitmapFromVectorDrawable(context, drawableId) {
|
111
|
+
const drawable = Utils.android.getApplicationContext().getDrawable(drawableId);
|
112
|
+
const bitmap = android.graphics.Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), android.graphics.Bitmap.Config.ARGB_8888);
|
113
|
+
const canvas = new android.graphics.Canvas(bitmap);
|
114
|
+
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
|
115
|
+
drawable.draw(canvas);
|
116
|
+
console.log('getBitmapFromVectorDrawable', bitmap, bitmap.getWidth(), bitmap.getHeight);
|
117
|
+
return new android.graphics.drawable.BitmapDrawable(context.getResources(), bitmap);
|
118
|
+
}
|
98
119
|
export class ImagePipeline {
|
99
120
|
toUri(value) {
|
100
121
|
if (value instanceof android.net.Uri) {
|
@@ -450,19 +471,28 @@ export class Img extends ImageBase {
|
|
450
471
|
}
|
451
472
|
if (src) {
|
452
473
|
let drawable;
|
453
|
-
if (src
|
474
|
+
if (typeof src === 'string') {
|
475
|
+
// disabled for now: loading vector drawables
|
476
|
+
// if (src.indexOf(Utils.RESOURCE_PREFIX) === 0) {
|
477
|
+
// const identifier = Utils.android.resources.getDrawableId(src.substring(Utils.RESOURCE_PREFIX.length));
|
478
|
+
// if (identifier >= 0 && isVectorDrawable(this._context, identifier)) {
|
479
|
+
// drawable = getBitmapFromVectorDrawable(this._context, identifier);
|
480
|
+
// }
|
481
|
+
// } else
|
482
|
+
if (Utils.isFontIconURI(src)) {
|
483
|
+
const fontIconCode = src.split('//')[1];
|
484
|
+
if (fontIconCode !== undefined) {
|
485
|
+
// support sync mode only
|
486
|
+
const font = this.style.fontInternal;
|
487
|
+
const color = this.style.color;
|
488
|
+
drawable = new android.graphics.drawable.BitmapDrawable(Utils.android.getApplicationContext().getResources(), ImageSource.fromFontIconCodeSync(fontIconCode, font, color).android);
|
489
|
+
}
|
490
|
+
}
|
491
|
+
}
|
492
|
+
else if (src instanceof ImageSource) {
|
454
493
|
drawable = new android.graphics.drawable.BitmapDrawable(Utils.android.getApplicationContext().getResources(), src.android);
|
455
494
|
this.updateViewSize(src.android);
|
456
495
|
}
|
457
|
-
else if (Utils.isFontIconURI(src)) {
|
458
|
-
const fontIconCode = src.split('//')[1];
|
459
|
-
if (fontIconCode !== undefined) {
|
460
|
-
// support sync mode only
|
461
|
-
const font = this.style.fontInternal;
|
462
|
-
const color = this.style.color;
|
463
|
-
drawable = new android.graphics.drawable.BitmapDrawable(Utils.android.getApplicationContext().getResources(), ImageSource.fromFontIconCodeSync(fontIconCode, font, color).android);
|
464
|
-
}
|
465
|
-
}
|
466
496
|
if (drawable) {
|
467
497
|
const hierarchy = this.nativeImageViewProtected.getHierarchy();
|
468
498
|
hierarchy.setImage(drawable, 1, hierarchy.getFadeDuration() === 0);
|
package/package.json
CHANGED
@@ -1,10 +1,18 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nativescript-community/ui-image",
|
3
|
-
"version": "4.5.
|
3
|
+
"version": "4.5.5",
|
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,
|
7
7
|
"typings": "./index.d.ts",
|
8
|
+
"scripts": {
|
9
|
+
"build": "npm run tsc && npm run readme",
|
10
|
+
"build.all": "npm run build && npm run build.angular",
|
11
|
+
"build.angular": "ng-packagr -p ../../src/image/angular/ng-package.json -c ../../src/image/angular/tsconfig.json && rm angular/.npmignore",
|
12
|
+
"readme": "readme generate -c ../../tools/readme/blueprint.json",
|
13
|
+
"tsc": "cpy '**/*.d.ts' '../../packages/image' --parents --cwd=../../src/image && tsc -skipLibCheck -d",
|
14
|
+
"clean": "rimraf ./*.d.ts ./*.js ./*.js.map"
|
15
|
+
},
|
8
16
|
"nativescript": {
|
9
17
|
"platforms": {
|
10
18
|
"android": "6.0.0",
|
@@ -36,5 +44,5 @@
|
|
36
44
|
},
|
37
45
|
"license": "Apache-2.0",
|
38
46
|
"readmeFilename": "README.md",
|
39
|
-
"gitHead": "
|
47
|
+
"gitHead": "519eb9e1f08dc2b691fc330fc39a1dd7f6acd6a8"
|
40
48
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import groovy.json.JsonSlurper
|
2
2
|
dependencies {
|
3
|
-
def frescoVersion = project.hasProperty("frescoVersion") ? project.frescoVersion : "3.
|
3
|
+
def frescoVersion = project.hasProperty("frescoVersion") ? project.frescoVersion : "3.4.0"
|
4
4
|
|
5
5
|
implementation("com.facebook.fresco:fresco:$frescoVersion") {
|
6
6
|
exclude group: 'com.facebook.soloader', module: 'soloader'
|
Binary file
|