@react-native-ohos/react-native-blurhash 2.0.4-rc.2 → 2.0.4-rc.4
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/harmony/blurhash/index.ets +2 -0
- package/harmony/blurhash/oh-package.json5 +1 -1
- package/harmony/blurhash/src/main/cpp/Blurhash.cpp +172 -78
- package/harmony/blurhash/src/main/cpp/{Blurhash.hpp → Blurhash.h} +6 -3
- package/harmony/blurhash/src/main/cpp/BlurhashNode.cpp +18 -12
- package/harmony/blurhash/src/main/cpp/BlurhashNode.h +3 -2
- package/harmony/blurhash/src/main/cpp/BlurhashPackage.h +23 -12
- package/harmony/blurhash/src/main/cpp/BlurhashViewComponentInstance.cpp +56 -82
- package/harmony/blurhash/src/main/cpp/BlurhashViewComponentInstance.h +8 -5
- package/harmony/blurhash/src/main/cpp/BlurhashViewJSIBinder.h +11 -7
- package/harmony/blurhash/src/main/cpp/ComponentDescriptors.h +4 -2
- package/harmony/blurhash/src/main/cpp/EventEmitters.cpp +9 -8
- package/harmony/blurhash/src/main/cpp/EventEmitters.h +4 -4
- package/harmony/blurhash/src/main/cpp/Props.cpp +11 -10
- package/harmony/blurhash/src/main/cpp/Props.h +19 -13
- package/harmony/blurhash/src/main/cpp/RNBlurhashTurboModule.cpp +16 -10
- package/harmony/blurhash/src/main/cpp/RNBlurhashTurboModule.h +3 -3
- package/harmony/blurhash/src/main/cpp/ShadowNodes.cpp +1 -2
- package/harmony/blurhash/src/main/cpp/ShadowNodes.h +5 -5
- package/harmony/blurhash/src/main/cpp/SparseArray.cpp +7 -4
- package/harmony/blurhash/src/main/cpp/SparseArray.h +2 -2
- package/harmony/blurhash/src/main/cpp/napi_init.cpp +5 -6
- package/harmony/blurhash/src/main/cpp/types/libblurhash/Index.d.ts +1 -1
- package/harmony/blurhash/src/main/ets/{BlurhashPackage.ts → BlurhashPackage.ets} +3 -2
- package/harmony/blurhash/src/main/ets/BlurhashTurboModule.ts +1 -2
- package/harmony/blurhash/{ts.ts → ts.ets} +1 -1
- package/harmony/blurhash.har +0 -0
- package/lib/commonjs/blurhash/hvigorfile.js +13 -0
- package/lib/commonjs/blurhash/hvigorfile.js.map +1 -0
- package/lib/commonjs/blurhash/oh-package.json5 +13 -0
- package/lib/commonjs/blurhash/src/main/ets/BlurhashTurboModule.js +49 -0
- package/lib/commonjs/blurhash/src/main/ets/BlurhashTurboModule.js.map +1 -0
- package/lib/commonjs/blurhash/src/main/ets/Logger.js +66 -0
- package/lib/commonjs/blurhash/src/main/ets/Logger.js.map +1 -0
- package/lib/commonjs/blurhash/src/main/ets/RNCBlurhashView.js +111 -0
- package/lib/commonjs/blurhash/src/main/ets/RNCBlurhashView.js.map +1 -0
- package/lib/commonjs/blurhash/src/main/ets/RNCSpecs.js +117 -0
- package/lib/commonjs/blurhash/src/main/ets/RNCSpecs.js.map +1 -0
- package/lib/commonjs/blurhash/src/main/ets/TMSpecs.js +34 -0
- package/lib/commonjs/blurhash/src/main/ets/TMSpecs.js.map +1 -0
- package/lib/commonjs/blurhash/ts.ets +26 -0
- package/lib/commonjs/blurhash.har +0 -0
- package/package.json +12 -5
- package/harmony/blurhash/BuildProfile.ets +0 -17
- package/lib/commonjs/index.js +0 -95
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/specs/NativeBlurhashModule.js +0 -9
- package/lib/commonjs/specs/NativeBlurhashModule.js.map +0 -1
- package/lib/commonjs/specs/NativeBlurhashView.js +0 -10
- package/lib/commonjs/specs/NativeBlurhashView.js.map +0 -1
- package/lib/commonjs/utils.js +0 -56
- package/lib/commonjs/utils.js.map +0 -1
- package/lib/module/index.js +0 -85
- package/lib/module/index.js.map +0 -1
- package/lib/module/specs/NativeBlurhashModule.js +0 -3
- package/lib/module/specs/NativeBlurhashModule.js.map +0 -1
- package/lib/module/specs/NativeBlurhashView.js +0 -3
- package/lib/module/specs/NativeBlurhashView.js.map +0 -1
- package/lib/module/utils.js +0 -48
- package/lib/module/utils.js.map +0 -1
- package/lib/typescript/index.d.ts +0 -90
- package/lib/typescript/specs/NativeBlurhashModule.d.ts +0 -9
- package/lib/typescript/specs/NativeBlurhashView.d.ts +0 -19
- package/lib/typescript/utils.d.ts +0 -22
package/harmony/blurhash.har
CHANGED
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "harTasks", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _hvigorOhosPlugin.harTasks;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _hvigorOhosPlugin = require("@ohos/hvigor-ohos-plugin");
|
|
13
|
+
//# sourceMappingURL=hvigorfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_hvigorOhosPlugin","require"],"sources":["hvigorfile.ts"],"sourcesContent":["// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.\r\nexport { harTasks } from '@ohos/hvigor-ohos-plugin';"],"mappings":";;;;;;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
license: 'ISC',
|
|
3
|
+
types: '',
|
|
4
|
+
name: '@react-native-ohos/react-native-blurhash',
|
|
5
|
+
description: '',
|
|
6
|
+
main: 'index.ets',
|
|
7
|
+
type: 'module',
|
|
8
|
+
version: '2.0.4-rc.4',
|
|
9
|
+
dependencies: {
|
|
10
|
+
"@rnoh/react-native-openharmony": 'file:../react_native_openharmony',
|
|
11
|
+
"librnoh_blurhash.so": "file:./src/main/cpp/types/libblurhash"
|
|
12
|
+
},
|
|
13
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RNBlurhashModule = void 0;
|
|
7
|
+
var _ts = require("@rnoh/react-native-openharmony/ts");
|
|
8
|
+
var _Logger = _interopRequireDefault(require("./Logger"));
|
|
9
|
+
var _librnoh_blurhash = _interopRequireDefault(require("librnoh_blurhash.so"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
/**
|
|
12
|
+
* MIT License
|
|
13
|
+
*
|
|
14
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
15
|
+
*
|
|
16
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
17
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
18
|
+
* in the Software without restriction, including without limitation the rights
|
|
19
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
21
|
+
* furnished to do so, subject to the following conditions:
|
|
22
|
+
*
|
|
23
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
24
|
+
* copies or substantial portions of the Software.
|
|
25
|
+
*
|
|
26
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
27
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
28
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
29
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
30
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
32
|
+
* SOFTWARE.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
class RNBlurhashModule extends _ts.TurboModule {
|
|
36
|
+
clearCosineCache() {
|
|
37
|
+
_Logger.default.debug('[RNOH]:BlurhashModule call clearCosineCache');
|
|
38
|
+
}
|
|
39
|
+
async createBlurhashFromImage(imageUri, componentsX, componentsY) {
|
|
40
|
+
const imageLoader = this.ctx.rnInstance.getTurboModule("ImageLoader");
|
|
41
|
+
const RemoteImageLoader = this.ctx.rnInstance.getTurboModule("ImageLoader");
|
|
42
|
+
await imageLoader.prefetchImage(imageUri);
|
|
43
|
+
const filePath = RemoteImageLoader.getPrefetchResult(imageUri);
|
|
44
|
+
const blurhashcode = _librnoh_blurhash.default.getEncode(filePath.replace('file://', ''), componentsX, componentsY);
|
|
45
|
+
return blurhashcode;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.RNBlurhashModule = RNBlurhashModule;
|
|
49
|
+
//# sourceMappingURL=BlurhashTurboModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ts","require","_Logger","_interopRequireDefault","_librnoh_blurhash","e","__esModule","default","RNBlurhashModule","TurboModule","clearCosineCache","Logger","debug","createBlurhashFromImage","imageUri","componentsX","componentsY","imageLoader","ctx","rnInstance","getTurboModule","RemoteImageLoader","prefetchImage","filePath","getPrefetchResult","blurhashcode","rnKeysCPPLib","getEncode","replace","exports"],"sources":["BlurhashTurboModule.ts"],"sourcesContent":["/**\r\n * MIT License\r\n *\r\n * Copyright (C) 2024 Huawei Device Co., Ltd.\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in all\r\n * copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\r\n\r\nimport { TurboModule, RNOHError, Tag } from '@rnoh/react-native-openharmony/ts';\r\nimport Logger from './Logger'\r\nimport { BlurhashModule } from \"./TMSpecs\"\r\nimport { ImageLoaderTurboModule } from '@rnoh/react-native-openharmony/src/main/ets/RNOHCorePackage/turboModules';\r\nimport { RemoteImageLoader } from '@rnoh/react-native-openharmony/src/main/ets/RemoteImageLoader';\r\n\r\nimport rnKeysCPPLib from 'librnoh_blurhash.so';\r\n\r\nexport class RNBlurhashModule extends TurboModule implements BlurhashModule.Spec {\r\n clearCosineCache(): void {\r\n Logger.debug('[RNOH]:BlurhashModule call clearCosineCache');\r\n }\r\n\r\n async createBlurhashFromImage(imageUri: string, componentsX: number, componentsY: number): Promise<string> {\r\n const imageLoader = this.ctx.rnInstance.getTurboModule<ImageLoaderTurboModule>(\"ImageLoader\");\r\n const RemoteImageLoader = this.ctx.rnInstance.getTurboModule<RemoteImageLoader>(\"ImageLoader\");\r\n await imageLoader.prefetchImage(imageUri)\r\n const filePath = RemoteImageLoader.getPrefetchResult(imageUri)\r\n const blurhashcode = rnKeysCPPLib.getEncode(filePath.replace('file://', ''),componentsX,componentsY)\r\n return (blurhashcode);\r\n }\r\n\r\n}\r\n\r\n"],"mappings":";;;;;;AAwBA,IAAAA,GAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAA+C,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA9B/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUO,MAAMG,gBAAgB,SAASC,eAAW,CAAgC;EAC/EC,gBAAgBA,CAAA,EAAS;IACvBC,eAAM,CAACC,KAAK,CAAC,6CAA6C,CAAC;EAC7D;EAEA,MAAMC,uBAAuBA,CAACC,QAAgB,EAAEC,WAAmB,EAAEC,WAAmB,EAAmB;IACzG,MAAMC,WAAW,GAAG,IAAI,CAACC,GAAG,CAACC,UAAU,CAACC,cAAc,CAAyB,aAAa,CAAC;IAC7F,MAAMC,iBAAiB,GAAG,IAAI,CAACH,GAAG,CAACC,UAAU,CAACC,cAAc,CAAoB,aAAa,CAAC;IAC9F,MAAMH,WAAW,CAACK,aAAa,CAACR,QAAQ,CAAC;IACzC,MAAMS,QAAQ,GAAGF,iBAAiB,CAACG,iBAAiB,CAACV,QAAQ,CAAC;IAC9D,MAAMW,YAAY,GAAGC,yBAAY,CAACC,SAAS,CAACJ,QAAQ,CAACK,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EAACb,WAAW,EAACC,WAAW,CAAC;IACpG,OAAQS,YAAY;EACtB;AAEF;AAACI,OAAA,CAAArB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _ohos = _interopRequireDefault(require("@ohos.hilog"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
10
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
11
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
|
12
|
+
* MIT License
|
|
13
|
+
*
|
|
14
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
15
|
+
*
|
|
16
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
17
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
18
|
+
* in the Software without restriction, including without limitation the rights
|
|
19
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
21
|
+
* furnished to do so, subject to the following conditions:
|
|
22
|
+
*
|
|
23
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
24
|
+
* copies or substantial portions of the Software.
|
|
25
|
+
*
|
|
26
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
27
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
28
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
29
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
30
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
32
|
+
* SOFTWARE.
|
|
33
|
+
*/
|
|
34
|
+
class Logger {
|
|
35
|
+
/**
|
|
36
|
+
* constructor.
|
|
37
|
+
*
|
|
38
|
+
* @param Prefix Identifies the log tag.
|
|
39
|
+
* @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
|
|
40
|
+
*/
|
|
41
|
+
constructor(prefix = 'MyApp', domain = 0xFF00, isDebug = false) {
|
|
42
|
+
_defineProperty(this, "domain", void 0);
|
|
43
|
+
_defineProperty(this, "prefix", void 0);
|
|
44
|
+
_defineProperty(this, "format", '%{public}s, %{public}s');
|
|
45
|
+
_defineProperty(this, "isDebug", void 0);
|
|
46
|
+
this.prefix = prefix;
|
|
47
|
+
this.domain = domain;
|
|
48
|
+
this.isDebug = isDebug;
|
|
49
|
+
}
|
|
50
|
+
debug(...args) {
|
|
51
|
+
if (this.isDebug) {
|
|
52
|
+
_ohos.default.debug(this.domain, this.prefix, this.format, args);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
info(...args) {
|
|
56
|
+
_ohos.default.info(this.domain, this.prefix, this.format, args);
|
|
57
|
+
}
|
|
58
|
+
warn(...args) {
|
|
59
|
+
_ohos.default.warn(this.domain, this.prefix, this.format, args);
|
|
60
|
+
}
|
|
61
|
+
error(...args) {
|
|
62
|
+
_ohos.default.error(this.domain, this.prefix, this.format, args);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
var _default = exports.default = new Logger('RNBlurhash', 0xFF00, false);
|
|
66
|
+
//# sourceMappingURL=Logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ohos","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Logger","constructor","prefix","domain","isDebug","debug","args","hilog","format","info","warn","error","_default","exports"],"sources":["Logger.ts"],"sourcesContent":["/**\r\n * MIT License\r\n *\r\n * Copyright (C) 2024 Huawei Device Co., Ltd.\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in all\r\n * copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\r\n\r\nimport hilog from '@ohos.hilog';\r\n\r\nclass Logger {\r\n private domain: number;\r\n private prefix: string;\r\n private format: string = '%{public}s, %{public}s';\r\n private isDebug: boolean;\r\n\r\n /**\r\n * constructor.\r\n *\r\n * @param Prefix Identifies the log tag.\r\n * @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.\r\n */\r\n constructor(prefix: string = 'MyApp', domain: number = 0xFF00, isDebug = false) {\r\n this.prefix = prefix;\r\n this.domain = domain;\r\n this.isDebug = isDebug;\r\n }\r\n\r\n debug(...args: string[]): void {\r\n if (this.isDebug) {\r\n hilog.debug(this.domain, this.prefix, this.format, args);\r\n }\r\n }\r\n\r\n info(...args: string[]): void {\r\n hilog.info(this.domain, this.prefix, this.format, args);\r\n }\r\n\r\n warn(...args: string[]): void {\r\n hilog.warn(this.domain, this.prefix, this.format, args);\r\n }\r\n\r\n error(...args: string[]): void {\r\n hilog.error(this.domain, this.prefix, this.format, args);\r\n }\r\n}\r\n\r\nexport default new Logger('RNBlurhash', 0xFF00, false)"],"mappings":";;;;;;AAwBA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAgC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA,KAxBhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,MAAMgB,MAAM,CAAC;EAMX;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAAC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
exports.RNCBlurhashView = void 0;
|
|
7
|
+
var _ts = require("@rnoh/react-native-openharmony/ts");
|
|
8
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
|
11
|
+
* MIT License
|
|
12
|
+
*
|
|
13
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
14
|
+
*
|
|
15
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
* in the Software without restriction, including without limitation the rights
|
|
18
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
* furnished to do so, subject to the following conditions:
|
|
21
|
+
*
|
|
22
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
* copies or substantial portions of the Software.
|
|
24
|
+
*
|
|
25
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
* SOFTWARE.
|
|
32
|
+
*/
|
|
33
|
+
let RNCBlurhashView = exports.RNCBlurhashView = void 0;
|
|
34
|
+
(function (_RNCBlurhashView) {
|
|
35
|
+
const NAME = _RNCBlurhashView.NAME = "RNCBlurhashView";
|
|
36
|
+
class PropsSelector extends _ts.ViewPropsSelector {
|
|
37
|
+
get blurhash() {
|
|
38
|
+
return this.rawProps.blurhash;
|
|
39
|
+
}
|
|
40
|
+
get decodeWidth() {
|
|
41
|
+
return this.rawProps.decodeWidth ?? 32;
|
|
42
|
+
}
|
|
43
|
+
get decodeHeight() {
|
|
44
|
+
return this.rawProps.decodeHeight ?? 32;
|
|
45
|
+
}
|
|
46
|
+
get decodePunch() {
|
|
47
|
+
return this.rawProps.decodePunch ?? 1;
|
|
48
|
+
}
|
|
49
|
+
get decodeAsync() {
|
|
50
|
+
return this.rawProps.decodeAsync ?? false;
|
|
51
|
+
}
|
|
52
|
+
get resizeMode() {
|
|
53
|
+
return this.rawProps.resizeMode ?? 'cover';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
_RNCBlurhashView.PropsSelector = PropsSelector;
|
|
57
|
+
class DescriptorWrapper extends _ts.ViewDescriptorWrapperBase {
|
|
58
|
+
createPropsSelector() {
|
|
59
|
+
return new PropsSelector(this.descriptor.props, this.descriptor.rawProps);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
_RNCBlurhashView.DescriptorWrapper = DescriptorWrapper;
|
|
63
|
+
class EventEmitter {
|
|
64
|
+
constructor(rnInstance, tag) {
|
|
65
|
+
this.rnInstance = rnInstance;
|
|
66
|
+
this.tag = tag;
|
|
67
|
+
}
|
|
68
|
+
emit(eventName, payload) {
|
|
69
|
+
this.rnInstance.emitComponentEvent(this.tag, eventName, payload);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
_RNCBlurhashView.EventEmitter = EventEmitter;
|
|
73
|
+
class CommandReceiver {
|
|
74
|
+
constructor(componentCommandReceiver, tag) {
|
|
75
|
+
this.componentCommandReceiver = componentCommandReceiver;
|
|
76
|
+
this.tag = tag;
|
|
77
|
+
_defineProperty(this, "listenersByCommandName", new Map());
|
|
78
|
+
_defineProperty(this, "cleanUp", undefined);
|
|
79
|
+
}
|
|
80
|
+
subscribe(commandName, listener) {
|
|
81
|
+
if (!this.listenersByCommandName.has(commandName)) {
|
|
82
|
+
this.listenersByCommandName.set(commandName, new Set());
|
|
83
|
+
}
|
|
84
|
+
this.listenersByCommandName.get(commandName).add(listener);
|
|
85
|
+
const hasRegisteredCommandReceiver = !!this.cleanUp;
|
|
86
|
+
if (!hasRegisteredCommandReceiver) {
|
|
87
|
+
this.cleanUp = this.componentCommandReceiver.registerCommandCallback(this.tag, (commandName, argv) => {
|
|
88
|
+
if (this.listenersByCommandName.has(commandName)) {
|
|
89
|
+
const listeners = this.listenersByCommandName.get(commandName);
|
|
90
|
+
listeners.forEach(listener => {
|
|
91
|
+
listener(argv);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return () => {
|
|
97
|
+
var _this$listenersByComm, _this$listenersByComm2;
|
|
98
|
+
(_this$listenersByComm = this.listenersByCommandName.get(commandName)) === null || _this$listenersByComm === void 0 || _this$listenersByComm.delete(listener);
|
|
99
|
+
if (((_this$listenersByComm2 = this.listenersByCommandName.get(commandName)) === null || _this$listenersByComm2 === void 0 ? void 0 : _this$listenersByComm2.size) ?? 0 === 0) {
|
|
100
|
+
this.listenersByCommandName.delete(commandName);
|
|
101
|
+
}
|
|
102
|
+
if (this.listenersByCommandName.size === 0) {
|
|
103
|
+
var _this$cleanUp;
|
|
104
|
+
(_this$cleanUp = this.cleanUp) === null || _this$cleanUp === void 0 || _this$cleanUp.call(this);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
_RNCBlurhashView.CommandReceiver = CommandReceiver;
|
|
110
|
+
})(RNCBlurhashView || (exports.RNCBlurhashView = RNCBlurhashView = {}));
|
|
111
|
+
//# sourceMappingURL=RNCBlurhashView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ts","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","RNCBlurhashView","exports","_RNCBlurhashView","NAME","PropsSelector","ViewPropsSelector","blurhash","rawProps","decodeWidth","decodeHeight","decodePunch","decodeAsync","resizeMode","DescriptorWrapper","ViewDescriptorWrapperBase","createPropsSelector","descriptor","props","EventEmitter","constructor","rnInstance","tag","emit","eventName","payload","emitComponentEvent","CommandReceiver","componentCommandReceiver","Map","undefined","subscribe","commandName","listener","listenersByCommandName","has","set","Set","get","add","hasRegisteredCommandReceiver","cleanUp","registerCommandCallback","argv","listeners","forEach","_this$listenersByComm","_this$listenersByComm2","delete","size","_this$cleanUp"],"sources":["RNCBlurhashView.ts"],"sourcesContent":["/**\r\n * MIT License\r\n *\r\n * Copyright (C) 2024 Huawei Device Co., Ltd.\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in all\r\n * copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\r\n\r\nimport {\r\n Descriptor as ComponentDescriptor,\r\n ViewBaseProps,\r\n ViewRawProps,\r\n ViewDescriptorWrapperBase,\r\n ColorValue,\r\n Color,\r\n RNInstance,\r\n Tag,\r\n RNComponentCommandReceiver,\r\n ViewPropsSelector,\r\n} from '@rnoh/react-native-openharmony/ts';\r\n\r\n\r\nexport namespace RNCBlurhashView {\r\n export const NAME = \"RNCBlurhashView\" as const\r\n\r\n export interface DirectRawProps {\r\n blurhash: string;\r\n decodeWidth?: number;\r\n decodeHeight?: number;\r\n decodePunch?: number;\r\n decodeAsync?: boolean;\r\n resizeMode?: 'cover' | 'contain' | 'stretch' | 'center';\r\n }\r\n \r\n export interface Props extends ViewBaseProps {}\r\n \r\n export interface State {}\r\n \r\n export interface RawProps extends ViewRawProps, DirectRawProps {}\r\n \r\n export class PropsSelector extends ViewPropsSelector<Props, RawProps> {\r\n get blurhash() {\r\n return this.rawProps.blurhash;\r\n }\r\n \r\n get decodeWidth() {\r\n return this.rawProps.decodeWidth ?? 32;\r\n }\r\n \r\n get decodeHeight() {\r\n return this.rawProps.decodeHeight ?? 32;\r\n }\r\n \r\n get decodePunch() {\r\n return this.rawProps.decodePunch ?? 1;\r\n }\r\n \r\n get decodeAsync() {\r\n return this.rawProps.decodeAsync ?? false;\r\n }\r\n \r\n get resizeMode() {\r\n return this.rawProps.resizeMode ?? 'cover';\r\n }\r\n \r\n \r\n }\r\n\r\n export type Descriptor = ComponentDescriptor<\r\n typeof NAME,\r\n Props,\r\n State,\r\n RawProps\r\n >;\r\n \r\n export class DescriptorWrapper extends ViewDescriptorWrapperBase<\r\n typeof NAME,\r\n Props,\r\n State,\r\n RawProps,\r\n PropsSelector\r\n > {\r\n protected createPropsSelector() {\r\n return new PropsSelector(this.descriptor.props, this.descriptor.rawProps)\r\n }\r\n }\r\n \r\n export interface EventPayloadByName {\r\n \"loadStart\": {}\r\n \"loadEnd\": {}\r\n \"loadError\": {message?: string}\r\n }\r\n \r\n export class EventEmitter {\r\n constructor(private rnInstance: RNInstance, private tag: Tag) {}\r\n \r\n emit<TEventName extends keyof EventPayloadByName>(eventName: TEventName, payload: EventPayloadByName[TEventName]) {\r\n this.rnInstance.emitComponentEvent(this.tag, eventName, payload)\r\n }\r\n }\r\n \r\n export interface CommandArgvByName {\r\n }\r\n \r\n export class CommandReceiver {\r\n private listenersByCommandName = new Map<string, Set<(...args: any[]) => void>>()\r\n private cleanUp: (() => void) | undefined = undefined\r\n \r\n constructor(private componentCommandReceiver: RNComponentCommandReceiver, private tag: Tag) {\r\n }\r\n \r\n subscribe<TCommandName extends keyof CommandArgvByName>(commandName: TCommandName, listener: (argv: CommandArgvByName[TCommandName]) => void) {\r\n if (!this.listenersByCommandName.has(commandName)) {\r\n this.listenersByCommandName.set(commandName, new Set())\r\n }\r\n this.listenersByCommandName.get(commandName)!.add(listener)\r\n const hasRegisteredCommandReceiver = !!this.cleanUp\r\n if (!hasRegisteredCommandReceiver) {\r\n this.cleanUp = this.componentCommandReceiver.registerCommandCallback(this.tag, (commandName: string, argv: any[]) => {\r\n if (this.listenersByCommandName.has(commandName)) {\r\n const listeners = this.listenersByCommandName.get(commandName)!\r\n listeners.forEach(listener => {\r\n listener(argv)\r\n })\r\n }\r\n })\r\n }\r\n \r\n return () => {\r\n this.listenersByCommandName.get(commandName)?.delete(listener)\r\n if (this.listenersByCommandName.get(commandName)?.size ?? 0 === 0) {\r\n this.listenersByCommandName.delete(commandName)\r\n }\r\n if (this.listenersByCommandName.size === 0) {\r\n this.cleanUp?.()\r\n }\r\n }\r\n }\r\n }\r\n\r\n}\r\n"],"mappings":";;;;;;AAwBA,IAAAA,GAAA,GAAAC,OAAA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AA;UAC1C,CAAAA,aAAA,OAAI,CAACT,OAAO,cAAAS,aAAA,eAAZA,aAAA,CAAArD,IAAA,KAAe,CAAC;QAClB;MACF,CAAC;IACH;EACF;EAACM,gBAAA,CAAAwB,eAAA,GAAAA,eAAA;AAAA,GApHc1B,eAAe,KAAAC,OAAA,CAAAD,eAAA,GAAfA,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BlurhashView = void 0;
|
|
7
|
+
var _ts = require("@rnoh/react-native-openharmony/ts");
|
|
8
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
|
11
|
+
* MIT License
|
|
12
|
+
*
|
|
13
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
14
|
+
*
|
|
15
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
* in the Software without restriction, including without limitation the rights
|
|
18
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
* furnished to do so, subject to the following conditions:
|
|
21
|
+
*
|
|
22
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
* copies or substantial portions of the Software.
|
|
24
|
+
*
|
|
25
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
* SOFTWARE.
|
|
32
|
+
*/
|
|
33
|
+
let BlurhashView = exports.BlurhashView = void 0;
|
|
34
|
+
(function (_BlurhashView) {
|
|
35
|
+
const NAME = _BlurhashView.NAME = "BlurhashView";
|
|
36
|
+
class PropsSelector extends _ts.ViewPropsSelector {
|
|
37
|
+
get blurhash() {
|
|
38
|
+
console.log(this.blurhash);
|
|
39
|
+
return this.blurhash;
|
|
40
|
+
}
|
|
41
|
+
get decodeWidth() {
|
|
42
|
+
console.log(this.decodeWidth);
|
|
43
|
+
return this.decodeWidth;
|
|
44
|
+
}
|
|
45
|
+
get decodeHeight() {
|
|
46
|
+
console.log(this.decodeHeight);
|
|
47
|
+
return this.decodeHeight;
|
|
48
|
+
}
|
|
49
|
+
get decodePunch() {
|
|
50
|
+
console.log(this.decodePunch);
|
|
51
|
+
return this.decodePunch;
|
|
52
|
+
}
|
|
53
|
+
get decodeAsync() {
|
|
54
|
+
console.log(this.decodeAsync);
|
|
55
|
+
return this.decodeAsync;
|
|
56
|
+
}
|
|
57
|
+
get resizeMode() {
|
|
58
|
+
console.log(this.resizeMode);
|
|
59
|
+
return this.rawProps.resizeMode ?? 'cover';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
_BlurhashView.PropsSelector = PropsSelector;
|
|
63
|
+
class DescriptorWrapper extends _ts.ViewDescriptorWrapperBase {
|
|
64
|
+
createPropsSelector() {
|
|
65
|
+
return new PropsSelector(this.descriptor.props, this.descriptor.rawProps);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
_BlurhashView.DescriptorWrapper = DescriptorWrapper;
|
|
69
|
+
class EventEmitter {
|
|
70
|
+
constructor(rnInstance, tag) {
|
|
71
|
+
this.rnInstance = rnInstance;
|
|
72
|
+
this.tag = tag;
|
|
73
|
+
}
|
|
74
|
+
emit(eventName, payload) {
|
|
75
|
+
this.rnInstance.emitComponentEvent(this.tag, eventName, payload);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
_BlurhashView.EventEmitter = EventEmitter;
|
|
79
|
+
class CommandReceiver {
|
|
80
|
+
constructor(componentCommandReceiver, tag) {
|
|
81
|
+
this.componentCommandReceiver = componentCommandReceiver;
|
|
82
|
+
this.tag = tag;
|
|
83
|
+
_defineProperty(this, "listenersByCommandName", new Map());
|
|
84
|
+
_defineProperty(this, "cleanUp", undefined);
|
|
85
|
+
}
|
|
86
|
+
subscribe(commandName, listener) {
|
|
87
|
+
if (!this.listenersByCommandName.has(commandName)) {
|
|
88
|
+
this.listenersByCommandName.set(commandName, new Set());
|
|
89
|
+
}
|
|
90
|
+
this.listenersByCommandName.get(commandName).add(listener);
|
|
91
|
+
const hasRegisteredCommandReceiver = !!this.cleanUp;
|
|
92
|
+
if (!hasRegisteredCommandReceiver) {
|
|
93
|
+
this.cleanUp = this.componentCommandReceiver.registerCommandCallback(this.tag, (commandName, argv) => {
|
|
94
|
+
if (this.listenersByCommandName.has(commandName)) {
|
|
95
|
+
const listeners = this.listenersByCommandName.get(commandName);
|
|
96
|
+
listeners.forEach(listener => {
|
|
97
|
+
listener(argv);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return () => {
|
|
103
|
+
var _this$listenersByComm, _this$listenersByComm2;
|
|
104
|
+
(_this$listenersByComm = this.listenersByCommandName.get(commandName)) === null || _this$listenersByComm === void 0 || _this$listenersByComm.delete(listener);
|
|
105
|
+
if (((_this$listenersByComm2 = this.listenersByCommandName.get(commandName)) === null || _this$listenersByComm2 === void 0 ? void 0 : _this$listenersByComm2.size) ?? 0 === 0) {
|
|
106
|
+
this.listenersByCommandName.delete(commandName);
|
|
107
|
+
}
|
|
108
|
+
if (this.listenersByCommandName.size === 0) {
|
|
109
|
+
var _this$cleanUp;
|
|
110
|
+
(_this$cleanUp = this.cleanUp) === null || _this$cleanUp === void 0 || _this$cleanUp.call(this);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
_BlurhashView.CommandReceiver = CommandReceiver;
|
|
116
|
+
})(BlurhashView || (exports.BlurhashView = BlurhashView = {}));
|
|
117
|
+
//# sourceMappingURL=RNCSpecs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ts","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","BlurhashView","exports","_BlurhashView","NAME","PropsSelector","ViewPropsSelector","blurhash","console","log","decodeWidth","decodeHeight","decodePunch","decodeAsync","resizeMode","rawProps","DescriptorWrapper","ViewDescriptorWrapperBase","createPropsSelector","descriptor","props","EventEmitter","constructor","rnInstance","tag","emit","eventName","payload","emitComponentEvent","CommandReceiver","componentCommandReceiver","Map","undefined","subscribe","commandName","listener","listenersByCommandName","has","set","Set","get","add","hasRegisteredCommandReceiver","cleanUp","registerCommandCallback","argv","listeners","forEach","_this$listenersByComm","_this$listenersByComm2","delete","size","_this$cleanUp"],"sources":["RNCSpecs.ts"],"sourcesContent":["/**\r\n * MIT License\r\n *\r\n * Copyright (C) 2024 Huawei Device Co., Ltd.\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in all\r\n * copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\r\n\r\nimport {\r\n Descriptor as ComponentDescriptor,\r\n ViewBaseProps,\r\n ViewRawProps,\r\n ViewDescriptorWrapperBase,\r\n RNInstance,\r\n Tag,\r\n RNComponentCommandReceiver,\r\n ViewPropsSelector,\r\n} from '@rnoh/react-native-openharmony/ts';\r\n\r\n\r\nexport namespace BlurhashView {\r\n export const NAME = \"BlurhashView\" as const\r\n\r\n export interface DirectRawProps {\r\n blurhash:string;\r\n decodeWidth?:number;\r\n decodeHeight?:number;\r\n decodePunch?:number;\r\n decodeAsync?:boolean;\r\n resizeMode?: 'contain' | 'cover' | 'stretch' | 'center';\r\n }\r\n\r\n export interface Props extends ViewBaseProps {}\r\n\r\n export interface State {}\r\n\r\n export interface RawProps extends ViewRawProps, DirectRawProps {}\r\n\r\n export class PropsSelector extends ViewPropsSelector<Props, RawProps> {\r\n\r\n get blurhash() {\r\n console.log(this.blurhash)\r\n return this.blurhash;\r\n }\r\n\r\n get decodeWidth() {\r\n console.log(this.decodeWidth)\r\n return this.decodeWidth;\r\n }\r\n\r\n get decodeHeight() {\r\n console.log(this.decodeHeight)\r\n return this.decodeHeight;\r\n }\r\n\r\n get decodePunch() {\r\n console.log(this.decodePunch)\r\n return this.decodePunch;\r\n }\r\n\r\n get decodeAsync() {\r\n console.log(this.decodeAsync)\r\n return this.decodeAsync;\r\n }\r\n\r\n get resizeMode() {\r\n console.log(this.resizeMode)\r\n return this.rawProps.resizeMode ?? 'cover';\r\n }\r\n\r\n }\r\n\r\n export type Descriptor = ComponentDescriptor<\r\n typeof NAME,\r\n Props,\r\n State,\r\n RawProps\r\n >;\r\n\r\n export class DescriptorWrapper extends ViewDescriptorWrapperBase<\r\n typeof NAME,\r\n Props,\r\n State,\r\n RawProps,\r\n PropsSelector\r\n > {\r\n protected createPropsSelector() {\r\n return new PropsSelector(this.descriptor.props, this.descriptor.rawProps)\r\n }\r\n }\r\n\r\n export interface EventPayloadByName {\r\n \"Error\": {}\r\n \"Load\": {width: number, height: number}\r\n \"LoadEnd\": {}\r\n \"LoadStart\": {}\r\n \"Progress\": {loaded: number, total: number}\r\n }\r\n\r\n export class EventEmitter {\r\n constructor(private rnInstance: RNInstance, private tag: Tag) {}\r\n\r\n emit<TEventName extends keyof EventPayloadByName>(eventName: TEventName, payload: EventPayloadByName[TEventName]) {\r\n this.rnInstance.emitComponentEvent(this.tag, eventName, payload)\r\n }\r\n }\r\n\r\n export interface CommandArgvByName {\r\n }\r\n\r\n export class CommandReceiver {\r\n private listenersByCommandName = new Map<string, Set<(...args: any[]) => void>>()\r\n private cleanUp: (() => void) | undefined = undefined\r\n\r\n constructor(private componentCommandReceiver: RNComponentCommandReceiver, private tag: Tag) {\r\n }\r\n\r\n subscribe<TCommandName extends keyof CommandArgvByName>(commandName: TCommandName, listener: (argv: CommandArgvByName[TCommandName]) => void) {\r\n if (!this.listenersByCommandName.has(commandName)) {\r\n this.listenersByCommandName.set(commandName, new Set())\r\n }\r\n this.listenersByCommandName.get(commandName)!.add(listener)\r\n const hasRegisteredCommandReceiver = !!this.cleanUp\r\n if (!hasRegisteredCommandReceiver) {\r\n this.cleanUp = this.componentCommandReceiver.registerCommandCallback(this.tag, (commandName: string, argv: any[]) => {\r\n if (this.listenersByCommandName.has(commandName)) {\r\n const listeners = this.listenersByCommandName.get(commandName)!\r\n listeners.forEach(listener => {\r\n listener(argv)\r\n })\r\n }\r\n })\r\n }\r\n\r\n return () => {\r\n this.listenersByCommandName.get(commandName)?.delete(listener)\r\n if (this.listenersByCommandName.get(commandName)?.size ?? 0 === 0) {\r\n this.listenersByCommandName.delete(commandName)\r\n }\r\n if (this.listenersByCommandName.size === 0) {\r\n this.cleanUp?.()\r\n }\r\n }\r\n }\r\n }\r\n\r\n}\r\n"],"mappings":";;;;;;AAwBA,IAAAA,GAAA,GAAAC,OAAA;AAS2C,SAAAC,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA,KAjC3C;AACA;AAC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AACT,sBAAsB,CAACC,GAAG,CAACH,WAAW,CAAC,EAAE;YAChD,MAAMY,SAAS,GAAG,IAAI,CAACV,sBAAsB,CAACI,GAAG,CAACN,WAAW,CAAE;YAC/DY,SAAS,CAACC,OAAO,CAACZ,QAAQ,IAAI;cAC5BA,QAAQ,CAACU,IAAI,CAAC;YAChB,CAAC,CAAC;UACJ;QACF,CAAC,CAAC;MACJ;MAEA,OAAO,MAAM;QAAA,IAAAG,qBAAA,EAAAC,sBAAA;QACX,CAAAD,qBAAA,OAAI,CAACZ,sBAAsB,CAACI,GAAG,CAACN,WAAW,CAAC,cAAAc,qBAAA,eAA5CA,qBAAA,CAA8CE,MAAM,CAACf,QAAQ,CAAC;QAC9D,IAAI,EAAAc,sBAAA,OAAI,CAACb,sBAAsB,CAACI,GAAG,CAACN,WAAW,CAAC,cAAAe,sBAAA,uBAA5CA,sBAAA,CAA8CE,IAAI,KAAI,CAAC,KAAK,CAAC,EAAE;UACjE,IAAI,CAACf,sBAAsB,CAACc,MAAM,CAAChB,WAAW,CAAC;QACjD;QACA,IAAI,IAAI,CAACE,sBAAsB,CAACe,IAAI,KAAK,CAAC,EAAE;UAAA,IAAAC,aAAA;UAC1C,CAAAA,aAAA,OAAI,CAACT,OAAO,cAAAS,aAAA,eAAZA,aAAA,CAAAvD,IAAA,KAAe,CAAC;QAClB;MACF,CAAC;IACH;EACF;EAACM,aAAA,CAAA0B,eAAA,GAAAA,eAAA;AAAA,GA5Hc5B,YAAY,KAAAC,OAAA,CAAAD,YAAA,GAAZA,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BlurhashModule = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* MIT License
|
|
9
|
+
*
|
|
10
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
let BlurhashModule = exports.BlurhashModule = void 0;
|
|
31
|
+
(function (_BlurhashModule) {
|
|
32
|
+
const NAME = _BlurhashModule.NAME = 'BlurhashModule';
|
|
33
|
+
})(BlurhashModule || (exports.BlurhashModule = BlurhashModule = {}));
|
|
34
|
+
//# sourceMappingURL=TMSpecs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BlurhashModule","exports","_BlurhashModule","NAME"],"sources":["TMSpecs.ts"],"sourcesContent":["/**\r\n * MIT License\r\n *\r\n * Copyright (C) 2024 Huawei Device Co., Ltd.\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in all\r\n * copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\r\n\r\nexport namespace BlurhashModule {\r\n export const NAME = 'BlurhashModule' as const\r\n\r\n export interface Spec {\r\n createBlurhashFromImage(imageUri: string, componentsX: number, componentsY: number): Promise<string>;\r\n\r\n clearCosineCache(): void;\r\n }\r\n}\r\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAtBA,IAwBiBA,cAAc,GAAAC,OAAA,CAAAD,cAAA;AAAA,WAAAE,eAAA;EACtB,MAAMC,IAAI,GAAAD,eAAA,CAAAC,IAAA,GAAG,gBAAyB;AAAA,GAD9BH,cAAc,KAAAC,OAAA,CAAAD,cAAA,GAAdA,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export * from "./src/main/ets/BlurhashPackage.ets"
|
|
26
|
+
export * from "./src/main/ets/BlurhashTurboModule"
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-ohos/react-native-blurhash",
|
|
3
3
|
"title": "React Native Blurhash",
|
|
4
|
-
"version": "2.0.4-rc.
|
|
4
|
+
"version": "2.0.4-rc.4",
|
|
5
5
|
"description": "🖼 Blurhash is a compact representation of a placeholder for an image. This is a Native UI Module for React Native to asynchronously wrap the Blurhash implementations and make them usable in React Native. Also supports encoding!",
|
|
6
6
|
"main": "lib/commonjs/index.js",
|
|
7
7
|
"types": "lib/typescript/index.d.ts",
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
"build": "bob build",
|
|
22
22
|
"release": "release-it"
|
|
23
23
|
},
|
|
24
|
-
"repository": "https://
|
|
24
|
+
"repository": "https://gitcode.com/openharmony-sig/rntpc_react-native-blurhash",
|
|
25
25
|
"publishConfig": {
|
|
26
|
-
"registry": "https://registry.npmjs.org/"
|
|
26
|
+
"registry": "https://registry.npmjs.org/",
|
|
27
|
+
"access": "public"
|
|
27
28
|
},
|
|
28
29
|
"keywords": [
|
|
29
30
|
"react-native",
|
|
@@ -106,8 +107,14 @@
|
|
|
106
107
|
"javaPackageName": "com.mrousavy.blurhash"
|
|
107
108
|
}
|
|
108
109
|
},
|
|
109
|
-
"harmony":{
|
|
110
|
-
"alias": "react-native-blurhash"
|
|
110
|
+
"harmony": {
|
|
111
|
+
"alias": "react-native-blurhash",
|
|
112
|
+
"autolinking": {
|
|
113
|
+
"etsPackageClassName": "BlurhashPackage",
|
|
114
|
+
"cppPackageClassName": "BlurhashPackage",
|
|
115
|
+
"cmakeLibraryTargetName": "rnoh_blurhash",
|
|
116
|
+
"ohPackageName": "@react-native-ohos/react-native-blurhash"
|
|
117
|
+
}
|
|
111
118
|
},
|
|
112
119
|
"packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"
|
|
113
120
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Use these variables when you tailor your ArkTS code. They must be of the const type.
|
|
3
|
-
*/
|
|
4
|
-
export const HAR_VERSION = '2.0.4-rc.2';
|
|
5
|
-
export const BUILD_MODE_NAME = 'debug';
|
|
6
|
-
export const DEBUG = true;
|
|
7
|
-
export const TARGET_NAME = 'default';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* BuildProfile Class is used only for compatibility purposes.
|
|
11
|
-
*/
|
|
12
|
-
export default class BuildProfile {
|
|
13
|
-
static readonly HAR_VERSION = HAR_VERSION;
|
|
14
|
-
static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
|
|
15
|
-
static readonly DEBUG = DEBUG;
|
|
16
|
-
static readonly TARGET_NAME = TARGET_NAME;
|
|
17
|
-
}
|