diff --git a/.gitignore b/.gitignore index 32a9ae774052ac1503f4a573cca60bc5ca3bb4ef..9db736e855b15c598490239c594ef3900ce9d11e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,5 @@ -*.iml -.gradle +/node_modules /local.properties +/package-lock.json /.idea -.DS_Store -/build -/captures -.externalNativeBuild -/entry/.preview -.cxx -/node_modules +**/build \ No newline at end of file diff --git a/AppScope/app.json5 b/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..d8a8ba2782ecef219bfd8830d392374baf727fcf --- /dev/null +++ b/AppScope/app.json5 @@ -0,0 +1,11 @@ +{ + "app": { + "bundleName": "com.example.roundimageview", + "vendor": "example", + "versionCode": 1000002, + "versionName": "1.0.2", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true + } +} diff --git a/AppScope/resources/base/element/string.json b/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7dd326eaf7c4a636c66f1f23a083511cac5e5277 --- /dev/null +++ b/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "RoundImageView" + } + ] +} diff --git a/AppScope/resources/base/media/app_icon.png b/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/AppScope/resources/base/media/app_icon.png differ diff --git a/CHANGELOG.md b/CHANGELOG.md index 1917685a1c2c97844b6e91bfcbbbf9e2ae00d697..df9b62f2c87c40d99e1de960b391765241819377 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,35 @@ +## 1.0.2 -# 1.0.0(2022.4.6) -已实现功能 - 1、图片圆角设置。 - 2、图片椭圆。 - 3、用于重复绘制的 TileModes。 - 4、透明背景 \ No newline at end of file +- 实现功能(整体使用canvas绘制) + + 1. 支持图片显示为圆角矩形并带边框 + 2. 支持图片显示为椭圆并带边框 + 3. 支持Color类型显示并带边框 + 4. 支持Background类型显示并带边框 + 5. 支持svg图片显示 + 6. 支持设置ScaleType七种缩放类型 + 7. 支持设置TileMode三种背景平铺类型 + 8. 支持路径uri、media、本地rawfile、网络url等相关数据绘制 + +- 遗留问题 + + 裁剪destination-in在3.2上不生效,导致图片裁剪出问题,属系统bug + +## 1.0.1 + +- 实现功能 + + 1.api8升级到api9 + +## 1.0.0 + +- 实现功能 + + 1. 图片圆角设置 + 2. 图片椭圆 + 3. 用于重复绘制的TileModes + 4. 透明背景 + +- 遗留问题 + 1. 除开oval的模式,其他的模式都不支持圆角添加边框的能力(目前只能支持组件添加边框,内容图像裁剪) + 2. oval模式使用了canvas做,目前还没有做scaleType(图像和目标组件的显示适配和objectFit能力差不多)类型适配 \ No newline at end of file diff --git a/README.md b/README.md index c75aba47e014efce1501b2453e3b300000910ad4..176349d310e642d3f8eb79004521a968ee4575df 100644 --- a/README.md +++ b/README.md @@ -5,86 +5,95 @@ RoundedImageView支持圆角(和椭圆或圆形)的快速 ImageView。它支 ## 效果展示: - + + + + + + + ## 安装教程 1. 参考安装教程 [如何安装OpenHarmony npm包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_npm_usage.md) 2. 安装命令如下: ``` - npm install @ohos/RoundedImageView --save + npm install @ohos/roundedimageview --save ``` ## 使用说明 -提供多种PictureItem、BackgroundItem、OvalPictureItem实例用于构造数据,使用方法类似。 +1. 在page页面引入包 + + ``` + import { RoundedImageView, ScaleType, TileMode, SrcType, FileUtils } from '@ohos/roundedimageview/' + ``` + +2. 创建多种PictureItem实例用于构造数据,使用方法类似 -1、初始化:实例化dialogController和对应的RoundedImageView.Model 对象, 并添加numberarr类型成员以记录当前页下标。dialogController为构造的弹框下拉列表。 +3. 初始化:实例化dialogController和对应的RoundedImageView.Model对象,并添加typeArr类型以标记前页页面类型 ``` - @State datas: RoundedImageView.Model [] = [ + @State datas: RoundedImageView.Model [] = [ new RoundedImageView.Model(), new RoundedImageView.Model(), new RoundedImageView.Model(), new RoundedImageView.Model(), new RoundedImageView.Model(), new RoundedImageView.Model(), new RoundedImageView.Model(), new RoundedImageView.Model(), new RoundedImageView.Model(), new RoundedImageView.Model()]; dialogController: CustomDialogController = new CustomDialogController({ alignment: DialogAlignment.Top, - builder: CustomDialogExample({ - cancel: this.onCancel, - confirm: this.onAccept, - type_value: $type_value, - typeArr: this.typeArr - }), - cancel: this.existApp, + builder: TypeCustomDialog({ typeValue: $typeValue }), autoCancel: true }) ``` -2、属性设置:通过Model类对象设置UI属性来自定义所需风格,也可以添加所需的回调。 +4. 属性设置:通过Model类对象设置UI属性来自定义所需风格 ``` - private aboutToAppear() { - this.numberarr.forEach((val, idx) => { + private typeValueUpdated(): void { + this.pictureItems.forEach((val, idx) => { this.datas[idx] - .setImageURI(this.pictures[idx].src) - .setCornerRadius(25) - .setScaleType(this.pictures[idx].fit) - .setTileModeXY(this.pictures[idx].repeat) - .setHeight(200) - .setWidth(this.pictures[idx].picWidth) - .setMargin(this.pictures[idx].margin) + .setImageSrc(this.pictureItems[idx].src) + .setSrcType(this.pictureItems[idx].srcType) + .setIsSvg(this.pictureItems[idx].isSvg) + .setTypeValue(this.typeValue) + .setWidth(this.pictureItems[idx].picWidth) + .setHeight(this.pictureItems[idx].picHeight) + .setScaleType(this.pictureItems[idx].scaleType) + .setTileModeXY(this.pictureItems[idx].tileMode) + .setCornerRadius(this.pictureItems[idx].cornerRadius) + .setBorderWidth(this.pictureItems[idx].borderWidth) + .setBorderColor(this.pictureItems[idx].borderColor) + .setPadding(this.pictureItems[idx].padding) }); } ``` -3、界面绘制:界面顶部为类型选择内容。并监听type_value内容的变化,以重新构建Model -,通知给Model类。Scroll中使用list布局放置图片。 +5. 界面绘制:界面顶部为类型选择内容,并监听type_value内容的变化,以重新构建Model,通知给Model类,Scroll中使用list布局放置图片。 + ``` build() { Column() { Column() { - Text('select:' + this.type_value).fontSize(25) - Image($rawfile('down.png')).width(25).height(25).position({ x: 225, y: 10 }).onClick((event: ClickEvent) => { - this.typeArr = ['Bitmap', 'Ovals', 'Picasso', 'Color', 'Background'] + Image($r('app.media.down')).width(30).height(30).position({ x: -30, y: 5 }).onClick(() => { this.dialogController.open() }) + Text(' select:' + this.typeValue).fontSize(30) }.margin(15) Scroll(this.scroller) { List({ space: 10, initialIndex: 0 }) { - if (this.type_value.indexOf('Bitmap') == 0) { - ForEach(this.numberarr, (item) => { + if (this.typeValue == 'Bitmap') { + ForEach(this.picIdxArr, (item) => { ListItem() { Column({ space: 5 }) { RoundedImageView({ model: this.datas[item] }) - Text(this.pictures[item].primaryTitle).buildPrimaryTitle() - Text(this.pictures[item].secondTitle).buildSecondTitle() - Text(this.pictures[item].scaleType).buildScaleType() + Text(this.pictureItems[item].primaryTitle) + Text(this.pictureItems[item].secondTitle) + Text(this.pictureItems[item].scaleType) }.width('100%') - .direction(Direction.Rtl) + .direction(Direction.Ltr) }.editable(this.editFlag) }, item => item) - } ... ListItem() { @@ -96,20 +105,13 @@ RoundedImageView支持圆角(和椭圆或圆形)的快速 ImageView。它支 .direction(Direction.Ltr) }.editable(this.editFlag) } - .editMode(true) - .onItemDelete((index: number) => { - this.arr.splice(index - 1, 1) - this.editFlag = false - return true - }).width('90%') } .scrollable(ScrollDirection.Vertical).scrollBar(BarState.Off) } .width('100%') .height('100%') .backgroundColor(0xDCDCDC) - .padding({ top: 5 }) - .direction(Direction.Ltr) + .padding({ top: 20, bottom: 100 }) } ``` @@ -119,23 +121,27 @@ RoundedImageView支持圆角(和椭圆或圆形)的快速 ImageView。它支 `let data: RoundedImageView.Model = new RoundedImageView.Model();` 1. 设置图片路径 - `data.setImageURI(value: string)` -2. 设置角半径 - `data.setCornerRadius(value: number)` + `data.setImageSrc(src: string | Resource | ArrayBuffer)` +2. 设置图片类型 + `data.setSrcType(srcType: SrcType)` 3. 设置图片缩放类型 - `data.setScaleType(value: ImageFit)` + `data.setScaleType(scaleType: ScaleType)` 4. 设置图片的重复样式 - `data.setTileModeXY(value: ImageRepeat)` -5. 设置图片宽度 - `data.setWidth(value: number)` -6. 设置背景颜色 - `data.setBackgroundColor(value: number)` -7. 设置裁剪椭圆对象 - `data.setOval(value: number)` + `data.setTileModeXY(value: TileMode)` +5. 设置角半径 + `data.setCornerRadius(cornerRadius: number)` +6. 设置图片显示的宽度 + `data.setWidth(width: number)` +7. 设置图片显示的高度 + `data.setHeight(height: number)` +8. 设置边框线宽 + `data.setBorderWidth(borderWidth: number)` +9. 设置背景颜色 + `data.setBackgroundColor(value: string | CanvasGradient | CanvasPattern)` ## 兼容性 -支持OpenHarmony API version 8 及以上版本 +支持OpenHarmony API version 9 及以上版本 ## 目录结构 @@ -147,9 +153,15 @@ RoundedImageView支持圆角(和椭圆或圆形)的快速 ImageView。它支 | |---- main | |---- ets | |---- components -| |---- common -| |---- RoundedImageView.ets # 库的核心实现 -| |---- README.MD # 安装使用方法 +| |---- DownloadUtils.ts # 图片下载工具类 +| |---- FileUtils.ts # 文件操作工具类 +| |---- PixelMapUtils.ts # PixelMap工具类 +| |---- RoundedImageView.ets # 库的核心实现 +| |---- ScaleType.ts # ScaleType枚举 +| |---- SrcType.ts # SrcType枚举 +| |---- TileMode.ts # TileMode枚举 +| |---- SVGImageViewModel.ets # svg依赖模块 +| |---- README.md # 安装使用方法 ``` ## 贡献代码 @@ -160,3 +172,4 @@ RoundedImageView支持圆角(和椭圆或圆形)的快速 ImageView。它支 本项目基于 [Apache License 2.0](https://gitee.com/openharmony-sig/RoundedImageView/blob/master/LICENSE) ,请自由地享受和参与开源。 + diff --git a/RoundedImageView/.gitignore b/RoundedImageView/.gitignore index 4f9a973815d0b5e49bc8547681a6b4bc7a178d12..10cfd88107d54051db1ccf7e53816db12beea915 100644 --- a/RoundedImageView/.gitignore +++ b/RoundedImageView/.gitignore @@ -1,3 +1,4 @@ /node_modules /.preview -/build \ No newline at end of file +/build +/package-lock.json \ No newline at end of file diff --git a/RoundedImageView/build-profile.json5 b/RoundedImageView/build-profile.json5 index 107d8c761a767ae4bd6c3798021d9fad61751005..35dff6d53cb3a241f8de4fb68bd01d38ade0f108 100644 --- a/RoundedImageView/build-profile.json5 +++ b/RoundedImageView/build-profile.json5 @@ -1,5 +1,5 @@ { - "apiType": "faMode", + "apiType": "stageMode", "buildOption": { } } diff --git a/RoundedImageView/hvigorfile.js b/RoundedImageView/hvigorfile.js index 3a7c40cd644527fdf586c81b110e346329f38c9a..42ed4b4a54a873e2b53441556aae93fab24b794f 100644 --- a/RoundedImageView/hvigorfile.js +++ b/RoundedImageView/hvigorfile.js @@ -1,3 +1,3 @@ // Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. -module.exports = require('@ohos/hvigor-ohos-plugin').legacyHarTasks +module.exports = require('@ohos/hvigor-ohos-plugin').harTasks diff --git a/RoundedImageView/index.ets b/RoundedImageView/index.ets index 4a0a31fd8ea69309012859ee4685f21be9290821..50b4fa9dd6f44e31aae5a951f2ddc9e288cf6c53 100644 --- a/RoundedImageView/index.ets +++ b/RoundedImageView/index.ets @@ -12,4 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export { default as RoundedImageView } from './src/main/ets/components/common/RoundedImageView' + +export { default as RoundedImageView } from './src/main/ets/components/RoundedImageView' + +export { default as ScaleType } from './src/main/ets/components/ScaleType' + +export { default as TileMode } from './src/main/ets/components/TileMode' + +export { default as SrcType } from './src/main/ets/components/SrcType' + +export { default as FileUtils } from './src/main/ets/components/FileUtils' diff --git a/RoundedImageView/package-lock.json b/RoundedImageView/package-lock.json deleted file mode 100644 index 9b9fd1755aae596a8bea8f60f3f64ca621125bd2..0000000000000000000000000000000000000000 --- a/RoundedImageView/package-lock.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "RoundedImageView", - "version": "1.0.0", - "lockfileVersion": 1 -} \ No newline at end of file diff --git a/RoundedImageView/package.json b/RoundedImageView/package.json index 47caafd1034794caab952b662f8614b8768ad996..22a2fd328ae403fa68180a9391dcdaf383667221 100644 --- a/RoundedImageView/package.json +++ b/RoundedImageView/package.json @@ -1,13 +1,25 @@ { - "name": "@ohos/RoundedImageView", - "description": "a npm package which contains arkUI2.0 page", - "ohos": { - "org": "" - }, - "version": "1.0.0", - "main": "index.ets", - "types": "", - "repository": {}, - "license": "Apache License 2.0", - "dependencies": {} + "types": "", + "keywords": [ + "OpenHarmony", + "RoundedImage" + ], + "author": "hihope", + "description": "圆角图片设置组件", + "ohos": { + "org": "opensource" + }, + "main": "index", + "repository": "https://gitee.com/openharmony-sig/RoundedImageView", + "version": "1.0.2", + "tags": [ + "OpenHarmony", + "RoundedImage" + ], + "dependencies": { + "@ohos/svg": "1.0.2" + }, + "license": "Apache License 2.0", + "devDependencies": {}, + "name": "@ohos/roundedimageview" } diff --git a/RoundedImageView/src/main/config.json b/RoundedImageView/src/main/config.json deleted file mode 100644 index 7d2c81e72692ea5a8537fe287b8e0e18d2e06a94..0000000000000000000000000000000000000000 --- a/RoundedImageView/src/main/config.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "app": { - "bundleName": "cn.openharmony.ohos_app_roundedimageview", - "vendor": "example", - "version": { - "code": 1000000, - "name": "1.0.0" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.RoundedImageView", - "deviceType": [ - "phone", - "tablet" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "RoundedImageView", - "moduleType": "har" - }, - "uiSyntax": "ets" - } -} diff --git a/entry/src/main/ets/MainAbility/pages/OvalPictureItem.ets b/RoundedImageView/src/main/ets/components/DownloadUtils.ts similarity index 45% rename from entry/src/main/ets/MainAbility/pages/OvalPictureItem.ets rename to RoundedImageView/src/main/ets/components/DownloadUtils.ts index 26ee49d74da9aac9f432f12d6d53d73f52fd1ff6..fdd8fdb9cca94026c5b08df44c0e5f96f051f75f 100644 --- a/entry/src/main/ets/MainAbility/pages/OvalPictureItem.ets +++ b/RoundedImageView/src/main/ets/components/DownloadUtils.ts @@ -1,5 +1,3 @@ -// @ts-nocheck - /* * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,29 +13,28 @@ * limitations under the License. */ -export class OvalPictureItem { - src: string; - primaryTitle: string; - secondTitle: string; - scaleType: string; - picWidth: string; - height: number; - myellipse: Ellipse; - repeat: ImageRepeat; - fit: ImageFit; - margin: number; +import http from '@ohos.net.http'; - constructor(src: string, primaryTitle: string, secondTitle: string, scaleType: string, - picWidth: string, height: number, myellipse: Ellipse, repeat: ImageRepeat, fit: ImageFit, margin: number) { - this.src = src; - this.primaryTitle = primaryTitle; - this.secondTitle = secondTitle; - this.scaleType = scaleType; - this.picWidth = picWidth; - this.height = height; - this.myellipse = myellipse; - this.repeat = repeat; - this.fit = fit; - this.margin = margin; - } +class DownloadUtils { + loadData(url: string, callback: (arrayBuffer: ArrayBuffer, error?: Error) => void) { + let httpRequest = http.createHttp(); + httpRequest.request( + url, + { method: http.RequestMethod.GET, + connectTimeout: 10000, + readTimeout: 10000, + }, + (error, data) => { + if (error) { + httpRequest.destroy(); + console.error("DownloadUtils loadData error: " + error); + callback(null, error) + } else { + callback(data.result as any) + } + } + ); + } } + +export default DownloadUtils; \ No newline at end of file diff --git a/RoundedImageView/src/main/ets/components/FileUtils.ts b/RoundedImageView/src/main/ets/components/FileUtils.ts new file mode 100644 index 0000000000000000000000000000000000000000..080bbff871259ee5f8bfdd6dfd09091e0b800503 --- /dev/null +++ b/RoundedImageView/src/main/ets/components/FileUtils.ts @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import fileio from '@ohos.fileio'; + +class FileUtils { + private static sInstance: FileUtils; + + public static getInstance(): FileUtils{ + if (!this.sInstance) { + this.sInstance = new FileUtils(); + } + return this.sInstance; + } + + private constructor() { + } + + /** + * 新建文件 + */ + createFile(path: string): number{ + return fileio.openSync(path, 0o100, 0o666) + } + + /** + * 删除文件 + */ + deleteFile(path: string): void { + fileio.unlinkSync(path); + } + + /** + * 判断path文件是否存在 + */ + exist(path: string): boolean{ + try { + let stat = fileio.statSync(path) + return stat.isFile() + } catch (e) { + console.error("FileUtils exist error: " + e) + return false + } + } + + /** + * 创建文件夹 + */ + createFolder(path: string) { + //创建文件夹 + if (!this.existFolder(path)) { + fileio.mkdirSync(path) + } + } + + /** + * 判断文件夹是否存在 + */ + existFolder(path: string): boolean{ + try { + let stat = fileio.statSync(path) + return stat.isDirectory() + } catch (e) { + console.error("FileUtils existFolder error: " + e) + return false + } + } + + /** + * 读取路径path的文件 + */ + readFilePic(path: string): ArrayBuffer { + try { + let fd = fileio.openSync(path, 0o2); + let length = fileio.statSync(path).size + let buf = new ArrayBuffer(length); + fileio.readSync(fd, buf) + return buf + } catch (e) { + console.error("FileUtils readFilePic error: " + e) + return new ArrayBuffer(0) + } + } + + /** + * 向path写入数据 + */ + writePic(path: string, picData: ArrayBuffer) { + this.createFile(path) + try { + let fd = fileio.openSync(path, 0o102, 0o666) + fileio.writeSync(fd, picData) + fileio.closeSync(fd) + } catch (e) { + console.error("FileUtils writePic error: " + e) + } + } +} + +export default FileUtils; \ No newline at end of file diff --git a/RoundedImageView/src/main/ets/components/PixelMapUtils.ts b/RoundedImageView/src/main/ets/components/PixelMapUtils.ts new file mode 100644 index 0000000000000000000000000000000000000000..3487a71e122cf48f3b9c08580266e1b698d0ca9b --- /dev/null +++ b/RoundedImageView/src/main/ets/components/PixelMapUtils.ts @@ -0,0 +1,69 @@ +// @ts-nocheck +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import image from '@ohos.multimedia.image'; +import SrcType from './srctype'; +import DownloadUtils from './downloadutils'; + +class PixelMapUtils { + public static createPixelMap(src: string | Resource | ArrayBuffer, srcType: SrcType, callback: (pixelMap: image.PixelMap, width: number, height: number, error?: Error) => void): void{ + switch (srcType) { + case SrcType.MEDIA: //media相关数据 + globalThis.resourceManager.getMedia(src.id, (error, value) => { + this.callbackPixelMap(value.buffer, callback) + }) + break + case SrcType.RAWFILE: //本地rawfile相关数据 + globalThis.resourceManager.getRawFile(src, (error, value) => { + this.callbackPixelMap(value.buffer, callback) + }) + break + case SrcType.URI: //路径uri相关数据 + this.callbackPixelMap(src, callback) + break + case SrcType.URL: //url相关数据 + let that = this + new DownloadUtils().loadData(src, (arrayBuffer, error) => { + if (!error) { + that.callbackPixelMap(arrayBuffer, callback) + } + }) + break + case SrcType.ARRAYBUFFER: //ArrayBuffer相关数据 + this.callbackPixelMap(src, callback) + break + } + } + + private static callbackPixelMap(src: string | ArrayBuffer, callback: (pixelMap: image.PixelMap, width: number, height: number, error?: Error) => void): void{ + let imageSource = image.createImageSource(src as any); + imageSource.getImageInfo().then(imageInfo => { + let width = imageInfo.size.width + let height = imageInfo.size.height + imageSource.createPixelMap().then(pixelMap => { + callback(pixelMap, width, height); + }).catch(error => { + console.error("PixelMapUtils imageSource.createPixelMap error: " + error); + callback(null, 0, 0, error); + }) + }).catch(error => { + console.error("PixelMapUtils imageSource.getImageInfo error: " + error); + callback(null, 0, 0, error); + }) + } +} + +export default PixelMapUtils; \ No newline at end of file diff --git a/RoundedImageView/src/main/ets/components/RoundedImageView.ets b/RoundedImageView/src/main/ets/components/RoundedImageView.ets new file mode 100644 index 0000000000000000000000000000000000000000..93afa88b9f2c3e1469b0634de44ae9a47fa8d23c --- /dev/null +++ b/RoundedImageView/src/main/ets/components/RoundedImageView.ets @@ -0,0 +1,582 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import SVGImageViewModel from './svgimageviewmodel'; +import PixelMapUtils from './pixelmaputils'; +import ScaleType from './scaletype'; +import TileMode from './tilemode'; +import SrcType from './srctype'; + +@Component +struct RoundedImageView { + @State model: RoundedImageView.Model = new RoundedImageView.Model() + settings: RenderingContextSettings = new RenderingContextSettings(true) + context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + bottomLayerContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(px2vp(globalThis.deviceW), px2vp(globalThis.deviceH), this.settings) + img: PixelMap + srcWidth: number + srcHeight: number + minScale: number = 1 + scaleW: number + scaleH: number + @State svgImageViewModel: SVGImageViewModel = new SVGImageViewModel() + + public aboutToAppear() { + this.setSvgSrc() + } + + setSvgSrc() { + if (this.model.getIsSvg()) { + switch (this.model.srcType) { + case SrcType.MEDIA: + this.svgImageViewModel.setSvgMedia(this.model.src as any) + break + case SrcType.RAWFILE: + this.svgImageViewModel.setSvgRawfile(this.model.src as any) + break + } + } + } + + setImageCanvasTransform() { + switch (this.model.scaleType) { + case ScaleType.FIT_START: + case ScaleType.FIT_END: + case ScaleType.FIT_CENTER: + this.minScale = this.scaleW >= this.scaleH ? this.scaleH : this.scaleW + this.context.setTransform(this.minScale, 0, 0, this.minScale, 0, 0) + break + case ScaleType.CENTER: + break + case ScaleType.CENTER_CROP: + this.minScale = this.scaleW >= this.scaleH ? this.scaleW : this.scaleH + this.context.setTransform(this.minScale, 0, 0, this.minScale, 0, 0) + break + case ScaleType.FIT_XY: + this.context.setTransform(this.scaleW, 0, 0, this.scaleH, 0, 0) + break + case ScaleType.CENTER_INSIDE: + if (this.scaleW < 1 || this.scaleH < 1) { + this.minScale = this.scaleW >= this.scaleH ? this.scaleH : this.scaleW + } + this.context.setTransform(this.minScale, 0, 0, this.minScale, 0, 0) + break + } + } + + setImage() { + switch (this.model.scaleType) { + case ScaleType.FIT_START: + this.context.drawImage(this.img, 0, 0, this.srcWidth, this.srcHeight) + break + case ScaleType.FIT_END: + this.context.drawImage(this.img, (this.model.uiWidth - this.model.padding * 2 - this.srcWidth * this.minScale) / (this.minScale * 1), (this.model.uiHeight - this.model.padding * 2 - this.srcHeight * this.minScale) / (this.minScale * 1), this.srcWidth, this.srcHeight) + break + case ScaleType.FIT_CENTER: + this.context.drawImage(this.img, (this.model.uiWidth - this.model.padding * 2 - this.srcWidth * this.minScale) / (this.minScale * 2), (this.model.uiHeight - this.model.padding * 2 - this.srcHeight * this.minScale) / (this.minScale * 2), this.srcWidth, this.srcHeight) + break + case ScaleType.CENTER: + this.context.drawImage(this.img, (this.model.uiWidth - this.model.padding * 2 - this.srcWidth) / 2, (this.model.uiHeight - this.model.padding * 2 - this.srcHeight) / 2, this.srcWidth, this.srcHeight) + break + case ScaleType.CENTER_CROP: + this.context.drawImage(this.img, (this.model.uiWidth - this.model.padding * 2 - this.srcWidth * this.minScale) / (this.minScale * 2), (this.model.uiHeight - this.model.padding * 2 - this.srcHeight * this.minScale) / (this.minScale * 2), this.srcWidth, this.srcHeight) + break + case ScaleType.FIT_XY: + if (this.model.tileMode == TileMode.REPEAT || this.model.tileMode == TileMode.MIRROR) { + this.context.restore() + this.setTileMode() + } else { + this.context.drawImage(this.img, 0, 0, this.srcWidth, this.srcHeight) + } + break + case ScaleType.CENTER_INSIDE: + this.context.drawImage(this.img, (this.model.uiWidth - this.model.padding * 2 - this.srcWidth * this.minScale) / (this.minScale * 2), (this.model.uiHeight - this.model.padding * 2 - this.srcHeight * this.minScale) / (this.minScale * 2), this.srcWidth, this.srcHeight) + break + } + } + + setRect() { + switch (this.model.scaleType) { + case ScaleType.FIT_START: + this.roundRect(this.context, this.model.borderWidth / 2, this.model.borderWidth / 2, this.srcWidth * this.minScale - this.model.borderWidth, this.srcHeight * this.minScale - this.model.borderWidth, this.model.cornerRadius) + break + case ScaleType.FIT_END: + this.roundRect(this.context, this.model.uiWidth - this.model.padding * 2 - this.srcWidth * this.minScale + this.model.borderWidth / 2, this.model.uiHeight - this.model.padding * 2 - this.srcHeight * this.minScale + this.model.borderWidth / 2, this.srcWidth * this.minScale - this.model.borderWidth, this.srcHeight * this.minScale - this.model.borderWidth, this.model.cornerRadius) + break + case ScaleType.FIT_CENTER: + this.roundRect(this.context, (this.model.uiWidth - this.model.padding * 2 - this.srcWidth * this.minScale) / 2 + this.model.borderWidth / 2, (this.model.uiHeight - this.model.padding * 2 - this.srcHeight * this.minScale) / 2 + this.model.borderWidth / 2, this.srcWidth * this.minScale - this.model.borderWidth, this.srcHeight * this.minScale - this.model.borderWidth, this.model.cornerRadius) + break + case ScaleType.CENTER: + let x: number = this.model.uiWidth - this.model.padding * 2 - this.srcWidth >= 0 ? this.model.uiWidth - this.model.padding * 2 - this.srcWidth : 0 + let y: number = this.model.uiHeight - this.model.padding * 2 - this.srcHeight >= 0 ? this.model.uiHeight - this.model.padding * 2 - this.srcHeight : 0 + let w: number = this.model.uiWidth - this.model.padding * 2 - this.srcWidth >= 0 ? this.srcWidth - this.model.padding * 2 : this.model.uiWidth - this.model.padding * 2 + let h: number = this.model.uiHeight - this.model.padding * 2 - this.srcHeight >= 0 ? this.srcHeight - this.model.padding * 2 : this.model.uiHeight - this.model.padding * 2 + this.roundRect(this.context, x / 2 + this.model.borderWidth / 2, y / 2 + this.model.borderWidth / 2, w - this.model.borderWidth, h - this.model.borderWidth, this.model.cornerRadius) + break + case ScaleType.CENTER_CROP: + this.roundRect(this.context, this.model.borderWidth / 2, this.model.borderWidth / 2, this.model.uiWidth - this.model.padding * 2 - this.model.borderWidth, this.model.uiHeight - this.model.padding * 2 - this.model.borderWidth, this.model.cornerRadius) + break + case ScaleType.FIT_XY: + this.roundRect(this.context, this.model.borderWidth / 2, this.model.borderWidth / 2, this.srcWidth * this.scaleW - this.model.borderWidth, this.srcHeight * this.scaleH - this.model.borderWidth, this.model.cornerRadius) + break + case ScaleType.CENTER_INSIDE: + this.roundRect(this.context, (this.model.uiWidth - this.model.padding * 2 - this.srcWidth * this.minScale) / 2 + this.model.borderWidth / 2, (this.model.uiHeight - this.model.padding * 2 - this.srcHeight * this.minScale) / 2 + this.model.borderWidth / 2, this.srcWidth * this.minScale - this.model.borderWidth, this.srcHeight * this.minScale - this.model.borderWidth, this.model.cornerRadius) + break + } + } + + roundRect(context: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, r: number) { + if (w < 2 * r) { + r = w / 2; + } + if (h < 2 * r) { + r = h / 2; + } + context.beginPath(); + context.moveTo(x + r, y); + context.arcTo(x + w, y, x + w, y + h, r); + context.arcTo(x + w, y + h, x, y + h, r); + context.arcTo(x, y + h, x, y, r); + context.arcTo(x, y, x + w, y, r); + context.closePath(); + } + + setOval() { + switch (this.model.scaleType) { + case ScaleType.FIT_START: + this.context.ellipse(this.srcWidth * this.minScale / 2, this.srcHeight * this.minScale / 2, (this.srcWidth * this.minScale - this.model.borderWidth) / 2, (this.srcHeight * this.minScale - this.model.borderWidth) / 2, 0, 0, Math.PI * 2) + break + case ScaleType.FIT_END: + this.context.ellipse(this.model.uiWidth - this.srcWidth * this.minScale + this.srcWidth * this.minScale / 2, this.srcHeight * this.minScale / 2, (this.srcWidth * this.minScale - this.model.borderWidth) / 2, (this.srcHeight * this.minScale - this.model.borderWidth) / 2, 0, 0, Math.PI * 2) + break + case ScaleType.FIT_CENTER: + this.context.ellipse(this.model.uiWidth / 2, this.srcHeight * this.minScale / 2, (this.srcWidth * this.minScale - this.model.borderWidth) / 2, (this.srcHeight * this.minScale - this.model.borderWidth) / 2, 0, 0, Math.PI * 2) + break + case ScaleType.CENTER: + let x: number = this.model.uiWidth - this.srcWidth >= 0 ? this.model.uiWidth - this.srcWidth : 0 + let y: number = this.model.uiHeight - this.srcHeight >= 0 ? this.model.uiHeight - this.srcHeight : 0 + let w: number = this.model.uiWidth - this.srcWidth >= 0 ? this.srcWidth : this.model.uiWidth + let h: number = this.model.uiHeight - this.srcHeight >= 0 ? this.srcHeight : this.model.uiHeight + this.context.ellipse((x + w) / 2, (y + h) / 2, (w - this.model.borderWidth) / 2, (h - this.model.borderWidth) / 2, 0, 0, Math.PI * 2) + break + case ScaleType.CENTER_CROP: + this.context.ellipse(this.model.uiWidth / 2, this.model.uiHeight / 2, (this.model.uiWidth - this.model.borderWidth) / 2, (this.model.uiHeight - this.model.borderWidth) / 2, 0, 0, Math.PI * 2) + break + case ScaleType.FIT_XY: + this.context.ellipse(this.model.uiWidth / 2, this.model.uiHeight / 2, (this.srcWidth * this.scaleW - this.model.borderWidth) / 2, (this.srcHeight * this.scaleH - this.model.borderWidth) / 2, 0, 0, Math.PI * 2) + break + case ScaleType.CENTER_INSIDE: + this.context.ellipse(this.model.uiWidth / 2, this.model.uiHeight / 2, (this.srcWidth * this.minScale - this.model.borderWidth) / 2, (this.srcHeight * this.minScale - this.model.borderWidth) / 2, 0, 0, Math.PI * 2) + break + } + } + + setTileMode() { + this.context.save() + let countW: number = Math.ceil(this.model.uiWidth / this.srcWidth) + let countH: number = Math.ceil(this.model.uiHeight / this.srcHeight) + this.context.translate(-(countW * this.srcWidth - this.model.uiWidth) / 2, -(countH * this.srcHeight - this.model.uiHeight) / 2) + for (let indexW = 0; indexW < countW; indexW++) { + for (let indexH = 0; indexH < countH; indexH++) { + this.context.save() + if (this.model.tileMode == TileMode.MIRROR) { + if (indexW % 2 != 0 && indexH % 2 == 0) { + this.context.translate(this.srcWidth + indexW * this.srcWidth * 2, 0) + this.context.scale(-1, 1) + } else if (indexW % 2 == 0 && indexH % 2 != 0) { + this.context.translate(0, this.srcHeight + indexH * this.srcHeight * 2) + this.context.scale(1, -1) + } else if (indexW % 2 != 0 && indexH % 2 != 0) { + this.context.translate(this.srcWidth + indexW * this.srcWidth * 2, this.srcHeight + indexH * this.srcHeight * 2) + this.context.scale(-1, -1) + } + } + this.context.drawImage(this.img, indexW * this.srcWidth, indexH * this.srcHeight, this.srcWidth, this.srcHeight) + this.context.restore() + } + } + this.context.restore() + } + + private drawBitmap() { + let that = this; + if (that.model.getIsSvg()) { + that.img = that.svgImageViewModel.getSVGPixelMap(that.offContext) + that.srcWidth = that.svgImageViewModel.svg.viewBoxWidth + that.srcHeight = that.svgImageViewModel.svg.viewBoxHeight + that.scaleW = (that.model.uiWidth - that.model.padding * 2) / that.srcWidth + that.scaleH = (that.model.uiHeight - that.model.padding * 2) / that.srcHeight + that.context.strokeStyle = that.model.borderColor + that.context.lineWidth = that.model.borderWidth + that.context.save() + that.setImageCanvasTransform() + that.setImage() + that.context.restore() + that.context.globalCompositeOperation = 'destination-in' + that.setRect() + that.context.fill() + that.context.globalCompositeOperation = 'source-over' + that.setRect() + that.context.stroke() + return + } + PixelMapUtils.createPixelMap(that.model.src, this.model.srcType, (pixelMap, width, height, error) => { + if (!error) { + that.img = pixelMap + that.srcWidth = width + that.srcHeight = height + that.scaleW = (that.model.uiWidth - that.model.padding * 2) / that.srcWidth + that.scaleH = (that.model.uiHeight - that.model.padding * 2) / that.srcHeight + that.context.strokeStyle = that.model.borderColor + that.context.lineWidth = that.model.borderWidth + that.context.save() + that.setImageCanvasTransform() + that.setImage() + that.context.restore() + that.context.globalCompositeOperation = 'destination-in' + that.setRect() + that.context.fill() + that.context.globalCompositeOperation = 'source-over' + that.setRect() + that.context.stroke() + } + }) + } + + private drawOvals() { + let that = this; + if (that.model.getIsSvg()) { + that.img = that.svgImageViewModel.getSVGPixelMap(that.offContext) + this.srcWidth = that.svgImageViewModel.svg.viewBoxWidth + that.srcHeight = that.svgImageViewModel.svg.viewBoxHeight + that.scaleW = (that.model.uiWidth - that.model.padding * 2) / this.srcWidth + that.scaleH = (that.model.uiHeight - that.model.padding * 2) / that.srcHeight + that.context.strokeStyle = that.model.borderColor + that.context.lineWidth = that.model.borderWidth + that.context.save() + that.setImageCanvasTransform() + that.setImage() + that.context.restore() + that.context.globalCompositeOperation = 'destination-in' + that.setOval() + that.context.fill() + that.context.globalCompositeOperation = 'source-over' + that.setOval() + that.context.stroke() + return + } + PixelMapUtils.createPixelMap(that.model.src, this.model.srcType, (pixelMap, width, height, error) => { + if (!error) { + that.img = pixelMap + this.srcWidth = width + that.srcHeight = height + that.scaleW = (that.model.uiWidth - that.model.padding * 2) / this.srcWidth + that.scaleH = (that.model.uiHeight - that.model.padding * 2) / that.srcHeight + that.context.strokeStyle = that.model.borderColor + that.context.lineWidth = that.model.borderWidth + that.context.save() + that.setImageCanvasTransform() + that.setImage() + that.context.restore() + that.context.globalCompositeOperation = 'destination-in' + that.setOval() + that.context.fill() + that.context.globalCompositeOperation = 'source-over' + that.setOval() + that.context.stroke() + } + }) + } + + private drawColors() { + this.scaleW = this.model.uiWidth / this.model.colorWidth + this.scaleH = this.model.uiHeight / this.model.colorHeight + this.minScale = this.scaleW >= this.scaleH ? this.scaleH : this.scaleW + this.context.fillStyle = this.model.backgroundColor + this.context.strokeStyle = this.model.borderColor + this.context.lineWidth = this.model.borderWidth + + switch (this.model.scaleType) { + case ScaleType.FIT_START: + this.context.fillRect(0, 0, this.model.colorWidth * this.minScale, this.model.colorHeight * this.minScale) + this.context.globalCompositeOperation = 'destination-in' + this.roundRect(this.context, this.model.borderWidth / 2, this.model.borderWidth / 2, this.model.colorWidth * this.minScale - this.model.borderWidth, this.model.colorHeight * this.minScale - this.model.borderWidth, this.model.cornerRadius) + this.context.fill() + this.context.globalCompositeOperation = 'source-over' + this.roundRect(this.context, this.model.borderWidth / 2, this.model.borderWidth / 2, this.model.colorWidth * this.minScale - this.model.borderWidth, this.model.colorHeight * this.minScale - this.model.borderWidth, this.model.cornerRadius) + this.context.stroke() + break + case ScaleType.FIT_END: + this.context.fillRect(this.model.uiWidth - this.model.colorWidth * this.minScale, this.model.uiHeight - this.model.colorHeight * this.minScale, this.model.colorWidth * this.minScale, this.model.colorHeight * this.minScale) + this.context.globalCompositeOperation = 'destination-in' + this.roundRect(this.context, this.model.uiWidth - this.model.colorWidth * this.minScale + this.model.borderWidth / 2, this.model.uiHeight - this.model.colorHeight * this.minScale + this.model.borderWidth / 2, this.model.colorWidth * this.minScale - this.model.borderWidth, this.model.colorHeight * this.minScale - this.model.borderWidth, this.model.cornerRadius) + this.context.fill() + this.context.globalCompositeOperation = 'source-over' + this.roundRect(this.context, this.model.uiWidth - this.model.colorWidth * this.minScale + this.model.borderWidth / 2, this.model.uiHeight - this.model.colorHeight * this.minScale + this.model.borderWidth / 2, this.model.colorWidth * this.minScale - this.model.borderWidth, this.model.colorHeight * this.minScale - this.model.borderWidth, this.model.cornerRadius) + this.context.stroke() + break + case ScaleType.FIT_CENTER: + this.context.fillRect((this.model.uiWidth - this.model.colorWidth * this.minScale) / 2, (this.model.uiHeight - this.model.colorHeight * this.minScale) / 2, this.model.colorWidth * this.minScale, this.model.colorHeight * this.minScale) + this.context.globalCompositeOperation = 'destination-in' + this.roundRect(this.context, (this.model.uiWidth - this.model.colorWidth * this.minScale) / 2 + this.model.borderWidth / 2, (this.model.uiHeight - this.model.colorHeight * this.minScale) / 2 + this.model.borderWidth / 2, this.model.colorWidth * this.minScale - this.model.borderWidth, this.model.colorHeight * this.minScale - this.model.borderWidth, this.model.cornerRadius) + this.context.fill() + this.context.globalCompositeOperation = 'source-over' + this.roundRect(this.context, (this.model.uiWidth - this.model.colorWidth * this.minScale) / 2 + this.model.borderWidth / 2, (this.model.uiHeight - this.model.colorHeight * this.minScale) / 2 + this.model.borderWidth / 2, this.model.colorWidth * this.minScale - this.model.borderWidth, this.model.colorHeight * this.minScale - this.model.borderWidth, this.model.cornerRadius) + this.context.stroke() + break + case ScaleType.CENTER: + case ScaleType.CENTER_CROP: + case ScaleType.FIT_XY: + case ScaleType.CENTER_INSIDE: + this.context.fillRect(0, 0, this.model.uiWidth, this.model.uiHeight) + this.context.globalCompositeOperation = 'destination-in' + this.roundRect(this.context, this.model.borderWidth / 2, this.model.borderWidth / 2, this.model.uiWidth - this.model.borderWidth, this.model.uiHeight - this.model.borderWidth, this.model.cornerRadius) + this.context.fill() + this.context.globalCompositeOperation = 'source-over' + this.roundRect(this.context, this.model.borderWidth / 2, this.model.borderWidth / 2, this.model.uiWidth - this.model.borderWidth, this.model.uiHeight - this.model.borderWidth, this.model.cornerRadius) + this.context.stroke() + break + } + this.context.stroke() + } + + private drawBackground() { + this.bottomLayerContext.fillStyle = this.model.backgroundColor + this.bottomLayerContext.strokeStyle = this.model.borderColor + this.bottomLayerContext.lineWidth = this.model.borderWidth + this.bottomLayerContext.fillRect(0, 0, this.model.uiWidth, this.model.uiHeight) + this.bottomLayerContext.globalCompositeOperation = 'destination-in' + this.roundRect(this.bottomLayerContext, this.model.borderWidth / 2, this.model.borderWidth / 2, this.model.uiWidth - this.model.borderWidth, this.model.uiHeight - this.model.borderWidth, this.model.cornerRadius) + this.bottomLayerContext.fill() + this.bottomLayerContext.globalCompositeOperation = 'source-over' + this.roundRect(this.bottomLayerContext, this.model.borderWidth / 2, this.model.borderWidth / 2, this.model.uiWidth - this.model.borderWidth, this.model.uiHeight - this.model.borderWidth, this.model.cornerRadius) + this.bottomLayerContext.stroke() + } + + build() { + Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + if (this.model.typeValue == 'Bitmap') { + Canvas(this.context) + .width(this.model.uiWidth) + .height(this.model.uiHeight) + .onReady(() => { + this.drawBitmap() + }) + } else if (this.model.typeValue == 'Ovals') { + Canvas(this.context) + .width(this.model.uiWidth) + .height(this.model.uiHeight) + .onReady(() => { + this.drawOvals() + }) + } else if (this.model.typeValue == 'Color') { + Canvas(this.context) + .width(this.model.uiWidth) + .height(this.model.uiHeight) + .onReady(() => { + this.drawColors() + }) + } else if (this.model.typeValue == 'Background') { + Stack() { + Canvas(this.bottomLayerContext) + .onReady(() => { + this.drawBackground() + }) + Stack() { + Canvas(this.context) + .onReady(() => { + this.drawBitmap() + }) + } + .padding(this.model.padding) + } + .width(this.model.uiWidth) + .height(this.model.uiHeight) + } else if (this.model.typeValue == 'SVG') { + Canvas(this.context) + .width(this.model.uiWidth) + .height(this.model.uiHeight) + .onReady(() => { + let that = this + let timeoutID = setTimeout(function () { + that.drawBitmap() + clearTimeout(timeoutID) + }, 100); + }) + } + } + } +} + +namespace RoundedImageView { + export class Model { + src: string | Resource | ArrayBuffer; + srcType: SrcType + isSvg: boolean + typeValue: string + uiWidth: number + uiHeight: number + backgroundColor: string | CanvasGradient | CanvasPattern + tileMode: TileMode + scaleType: ScaleType + cornerRadius: number + borderWidth: number + borderColor: string | CanvasGradient | CanvasPattern + padding: number + colorWidth: number + colorHeight: number + + constructor() { + } + + setImageSrc(src: string | Resource | ArrayBuffer): Model { + this.src = src; + return this; + } + + getImageSrc(): string | Resource | ArrayBuffer { + return this.src; + } + + setSrcType(srcType: SrcType): Model { + this.srcType = srcType; + return this; + } + + getSrcType(): SrcType { + return this.srcType; + } + + setIsSvg(isSvg: boolean): Model { + this.isSvg = isSvg; + return this; + } + + getIsSvg(): boolean { + return this.isSvg; + } + + setTypeValue(typeValue: string): Model { + this.typeValue = typeValue; + return this; + } + + getTypeValue(): string { + return this.typeValue; + } + + setUiWidth(uiWidth: number): Model { + this.uiWidth = uiWidth; + return this; + } + + getUiWidth(): number { + return this.uiWidth; + } + + setUiHeight(uiHeight: number): Model { + this.uiHeight = uiHeight; + return this; + } + + getUiHeight(): number { + return this.uiHeight; + } + + setScaleType(scaleType: ScaleType): Model { + this.scaleType = scaleType; + return this; + } + + getScaleType(): ScaleType { + return this.scaleType; + } + + setTileModeXY(tileMode: TileMode): Model { + this.tileMode = tileMode; + return this; + } + + getTileModeXY(): TileMode { + return this.tileMode; + } + + setBackgroundColor(backgroundColor: string | CanvasGradient | CanvasPattern): Model { + this.backgroundColor = backgroundColor; + return this; + } + + getBackgroundColor(): string | CanvasGradient | CanvasPattern { + return this.backgroundColor; + } + + setCornerRadius(cornerRadius: number): Model { + this.cornerRadius = cornerRadius; + return this; + } + + getCornerRadius(): number { + return this.cornerRadius; + } + + setBorderWidth(borderWidth: number): Model{ + this.borderWidth = borderWidth; + return this; + } + + getBorderWidth(): number { + return this.borderWidth; + } + + setBorderColor(borderColor: string | CanvasGradient | CanvasPattern): Model{ + this.borderColor = borderColor; + return this; + } + + getBorderColor(): string | CanvasGradient | CanvasPattern { + return this.borderColor; + } + + setPadding(padding: number): Model { + this.padding = padding; + return this; + } + + getPadding(): number { + return this.padding; + } + + setColorWidth(colorWidth: number): Model { + this.colorWidth = colorWidth; + return this; + } + + getColorWidth(): number { + return this.colorWidth; + } + + setColorHeight(colorHeight: number): Model { + this.colorHeight = colorHeight; + return this; + } + + getColorHeight(): number { + return this.colorHeight; + } + } +} + +export default RoundedImageView; diff --git a/RoundedImageView/src/main/ets/components/SVGImageViewModel.ets b/RoundedImageView/src/main/ets/components/SVGImageViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0b20d99bf41233ede8ff6f77d46dc1ebef85c6e --- /dev/null +++ b/RoundedImageView/src/main/ets/components/SVGImageViewModel.ets @@ -0,0 +1,1068 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import image from '@ohos.multimedia.image' +import configuration from '@system.configuration'; +import { + SVG, + PathView, + ImageSvg, + CircleView, + EllipseView, + LineView, + PolyLineView, + PolygonView, + RectView, + Group, + Switch, + TextView, + Use, + SVGXMLConstants, + SVGAttrConstants, + SVGManager, + SVGXMLChecker +} from '@ohos/svg'; + +export default class SVGImageViewModel { + private svgString: string = ""; + private rawfileName: string = ""; + private media: Resource; + svgs: SVG[] = [] + svg: SVG = new SVG(); + isPx: boolean = false; + private context: OffscreenCanvasRenderingContext2D + private svgManager: SVGManager = SVGManager.getInstance(); + + /** + * 设置svg的字符串 + * @param svgString svg字符串 + */ + public setSvgString(svgString: string) { + this.svgString = svgString; + this.parseSvgFromString(); + } + + /** + * 设置rawfile下的svg + * @param svgRawfile rawfile下的svg文件名 + */ + public setSvgRawfile(svgRawfile: string) { + this.rawfileName = svgRawfile; + this.parseSvgFromRawfile(); + } + + /** + * 设置media下的svg + * @param media media下的svg文件 + */ + public setSvgMedia(media: Resource) { + this.media = media; + this.parseSvgFromMedia(); + } + + private parseSvgFromMedia() { + globalThis.resourceManager.getMedia(this.media.id, (error, value) => { + if (error != null) { + console.error("media get error:" + error) + throw new Error("未找到media下的svg") + } else { + this.svgString = this.unit8ArrayToString(value); + this.parseSvgFromString(); + } + }) + } + + private parseSvgFromRawfile() { + globalThis.resourceManager.getRawFile(this.rawfileName, (error, value) => { + if (error != null) { + console.error("rawfile get error:" + error) + throw new Error("未找到rawfile下的svg") + } else { + this.svgString = this.unit8ArrayToString(value); + this.parseSvgFromString(); + } + }) + } + + private unit8ArrayToString(fileData) { + var dataString = ""; + for (var i = 0; i < fileData.length; i++) { + dataString += String.fromCharCode(fileData[i]); + } + return dataString + } + + private parseSvgFromString() { + this.svgs.length = 0; + this.svgManager.parseString(this.svgString, (jsonString) => { + var reg = new RegExp("stroke-", "g") + jsonString = String(jsonString).replace(reg, "stroke_"); + reg = new RegExp("font-", "g") + jsonString = String(jsonString).replace(reg, "font_"); + reg = new RegExp("fill-", "g") + jsonString = String(jsonString).replace(reg, "fill_"); + var svgElements: any[] = JSON.parse(jsonString).elements; + if (!SVGXMLChecker.checkArrayEmpty(svgElements)) { + this.getSvgData(svgElements); + } + }) + } + + private getSvgData(data: any[], g?: SVG) { + for (let i = 0;i < data.length; i++) { + if (data[i].type == SVGAttrConstants.ATTR_VALUE_ELEMENT) { + switch (data[i].name) { + case SVGXMLConstants.SVG_SVG_TAG: + if (!SVGXMLChecker.checkObjectEmpty(data[i].attributes)) { + this.parseAttributesSVG(data[i].attributes); + } + if (!SVGXMLChecker.checkArrayEmpty(data[i].elements)) { + this.getSvgData(data[i].elements); + } + break; + } + this.setSvgArrayChild(data[i], this.svgs, g) + } + } + } + + private setSvgArrayChild(elements: any, svgs: SVG[], g?: SVG) { + switch (elements.name) { + case SVGXMLConstants.SVG_G_TAG: + if (!SVGXMLChecker.checkObjectEmpty(elements.attributes)) { + g = this.parseAttributesGroup(elements.attributes, g); + } + if (!SVGXMLChecker.checkArrayEmpty(elements.elements)) { + this.getSvgData(elements.elements, g); + } + break; + case SVGXMLConstants.SVG_CIRCLE_TAG: + if (!SVGXMLChecker.checkObjectEmpty(elements.attributes)) { + svgs.push(this.parseAttributesCircle(elements.attributes, g)) + } + break; + case SVGXMLConstants.SVG_ELLIPSE_TAG: + if (!SVGXMLChecker.checkObjectEmpty(elements.attributes)) { + svgs.push(this.parseAttributesEllipse(elements.attributes, g)) + } + break; + case SVGXMLConstants.SVG_LINE_TAG: + if (!SVGXMLChecker.checkObjectEmpty(elements.attributes)) { + svgs.push(this.parseAttributesLine(elements.attributes, g)) + } + break; + case SVGXMLConstants.SVG_POLYLINE_TAG: + if (!SVGXMLChecker.checkObjectEmpty(elements.attributes)) { + svgs.push(this.parseAttributesPolyLine(elements.attributes, g)) + } + break; + case SVGXMLConstants.SVG_POLYGON_TAG: + if (!SVGXMLChecker.checkObjectEmpty(elements.attributes)) { + svgs.push(this.parseAttributesPolygon(elements.attributes, g)); + } + break; + case SVGXMLConstants.SVG_PATH_TAG: + if (!SVGXMLChecker.checkObjectEmpty(elements.attributes)) { + svgs.push(this.parseAttributesPath(elements.attributes, g)); + } + break; + case SVGXMLConstants.SVG_RECT_TAG: + if (!SVGXMLChecker.checkObjectEmpty(elements.attributes)) { + svgs.push(this.parseAttributesRect(elements.attributes, g)); + } + break; + case SVGXMLConstants.SVG_IMAGE_TAG: + if (!SVGXMLChecker.checkObjectEmpty(elements.attributes)) { + svgs.push(this.parseAttributesImage(elements.attributes, g)); + } + break; + case SVGXMLConstants.SVG_STYLE_TAG: + if (!SVGXMLChecker.checkArrayEmpty(elements.elements)) { + } + break; + case SVGXMLConstants.SVG_USE_TAG: + if (!SVGXMLChecker.checkObjectEmpty(elements.attributes)) { + svgs.push(this.parseAttributesUse(elements.attributes, g)); + } + break; + case SVGXMLConstants.SVG_TEXT_TAG: + if (!SVGXMLChecker.checkObjectEmpty(elements.attributes)) { + svgs.push(this.parseAttributesText(elements.attributes, g, elements.elements[0].text)); + } + break; + case SVGXMLConstants.SVG_SWITCH_TAG: + if (!SVGXMLChecker.checkArrayEmpty(elements.elements)) { + svgs.push(this.parseAttributesSwitch(elements.attributes, elements.elements)); + } + break; + } + } + + private parseAttributesSVG(svg: any) { + if (!SVGXMLChecker.checkObjectEmpty(svg.id)) { + this.svg.setId(svg.id); + } + if (!SVGXMLChecker.checkObjectEmpty(svg.width)) { + this.svg.setWidth(svg.width); + } + if (!SVGXMLChecker.checkObjectEmpty(svg.height)) { + this.svg.setHeight(svg.height); + } + if (!SVGXMLChecker.checkObjectEmpty(svg.viewBox)) { + this.svg.setViewBox(svg.viewBox); + } + if (!SVGXMLChecker.checkObjectEmpty(svg.fill)) { + this.svg.setFill(svg.fill); + } + if (!SVGXMLChecker.checkObjectEmpty(svg.stroke)) { + this.svg.setStroke(svg.stroke); + } + if (!SVGXMLChecker.checkObjectEmpty(svg.stroke_width)) { + this.svg.setStrokeWidth(svg.stroke_width); + } + if (this.svg.width == '100%') { + this.svg.setWidth(this.svg.viewBoxWidth) + } + if (this.svg.height == '100%') { + this.svg.setHeight(this.svg.viewBoxHeight) + } + } + + private parseAttributesGroup(g: any, lastGroup?: SVG): SVG { + var newGroup: SVG = SVGXMLChecker.checkObjectEmpty(lastGroup) ? new SVG() : lastGroup + if (!SVGXMLChecker.checkObjectEmpty(g.id)) { + newGroup.setId(g.id); + } + if (!SVGXMLChecker.checkObjectEmpty(g.class)) { + newGroup.setClass(g.class); + } + if (!SVGXMLChecker.checkObjectEmpty(g.fill)) { + newGroup.setFill(g.fill); + } else { + newGroup.setFill(newGroup.fill); + } + if (!SVGXMLChecker.checkObjectEmpty(g.fill_opacity)) { + newGroup.setFillOpacity(g.fill_opacity); + } + if (!SVGXMLChecker.checkObjectEmpty(g.stroke)) { + newGroup.setStroke(g.stroke); + } else { + newGroup.setStroke(newGroup.stroke); + } + if (!SVGXMLChecker.checkObjectEmpty(g.stroke_width)) { + newGroup.setStrokeWidth(g.stroke_width); + } else { + newGroup.setStrokeWidth(newGroup.strokeWidth); + } + if (!SVGXMLChecker.checkObjectEmpty(g.stroke_miterlimit)) { + newGroup.setStrokeMiterLimit(g.stroke_miterlimit); + } + if (!SVGXMLChecker.checkObjectEmpty(g.style)) { + newGroup.setStyle(g.style); + } + if (!SVGXMLChecker.checkObjectEmpty(g.transform)) { + newGroup.setTransform(g.transform, this.svg.viewBoxWidth, this.svg.viewBoxHeight, true); + } + if (!SVGXMLChecker.checkObjectEmpty(g.systemLanguage)) { + newGroup.setSystemLanguage(g.systemLanguage); + } + return newGroup; + } + + private parseAttributesCircle(circle: any, g: SVG): CircleView { + var newCircle: CircleView = new CircleView(); + if (SVGXMLChecker.checkObjectEmpty(g)) { + g = new Group(); + } + if (!SVGXMLChecker.checkObjectEmpty(circle.id)) { + newCircle.setId(circle.id); + } + if (!SVGXMLChecker.checkObjectEmpty(circle.class)) { + newCircle.setClass(circle.class); + } + if (!SVGXMLChecker.checkObjectEmpty(circle.r)) { + newCircle.setWidth(circle.r); + newCircle.setHeight(circle.r); + } + if (!SVGXMLChecker.checkObjectEmpty(circle.cx)) { + newCircle.setX(circle.cx); + } + if (!SVGXMLChecker.checkObjectEmpty(circle.cy)) { + newCircle.setY(circle.cy); + } + if (!SVGXMLChecker.checkObjectEmpty(circle.transform)) { + newCircle.copyTransform(g); + newCircle.setTransform(circle.transform, this.svg.viewBoxWidth, this.svg.viewBoxHeight, false); + } + if (!SVGXMLChecker.checkObjectEmpty(circle.fill)) { + newCircle.setFill(circle.fill); + } else { + newCircle.setFill(g.fill); + } + if (!SVGXMLChecker.checkObjectEmpty(circle.fill_opacity)) { + newCircle.setFillOpacity(circle.fill_opacity); + } + if (!SVGXMLChecker.checkObjectEmpty(circle.stroke)) { + newCircle.setStroke(circle.stroke); + } else { + newCircle.setStroke(g.stroke); + } + if (!SVGXMLChecker.checkObjectEmpty(circle.stroke_width)) { + newCircle.setStrokeWidth(circle.stroke_width); + } else { + newCircle.setStrokeWidth(g.strokeWidth); + } + if (!SVGXMLChecker.checkObjectEmpty(circle.stroke_miterlimit)) { + newCircle.setStrokeMiterLimit(circle.stroke_miterlimit); + } + if (!SVGXMLChecker.checkObjectEmpty(circle.style)) { + newCircle.setStyle(circle.style); + } + return newCircle; + } + + private parseAttributesEllipse(ellipse: any, g: SVG): EllipseView { + var newEllipse: EllipseView = new EllipseView(); + if (SVGXMLChecker.checkObjectEmpty(g)) { + g = new Group(); + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.id)) { + newEllipse.setId(ellipse.id); + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.class)) { + newEllipse.setClass(ellipse.class); + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.cx)) { + newEllipse.setX(ellipse.cx) + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.cy)) { + newEllipse.setY(ellipse.cy) + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.rx)) { + newEllipse.setWidth(Number(ellipse.rx) * 2); + // newEllipse.setX(-Number(ellipse.rx)) + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.ry)) { + newEllipse.setHeight(Number(ellipse.ry) * 2); + // newEllipse.setY(-Number(ellipse.ry)) + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.x)) { + newEllipse.setX(ellipse.x); + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.y)) { + newEllipse.setY(ellipse.y); + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.transform)) { + newEllipse.copyTransform(g); + newEllipse.setTransform(ellipse.transform, this.svg.viewBoxWidth, this.svg.viewBoxHeight, false); + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.fill)) { + newEllipse.setFill(ellipse.fill); + } else { + newEllipse.setFill(g.fill); + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.fill_opacity)) { + newEllipse.setFillOpacity(ellipse.fill_opacity); + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.stroke)) { + newEllipse.setStroke(ellipse.stroke); + } else { + newEllipse.setStroke(g.stroke); + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.stroke_width)) { + newEllipse.setStrokeWidth(ellipse.stroke_width); + } else { + newEllipse.setStrokeWidth(g.strokeWidth); + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.stroke_miterlimit)) { + newEllipse.setStrokeMiterLimit(ellipse.stroke_miterlimit); + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.style)) { + newEllipse.setStyle(ellipse.style); + } + + if (newEllipse.cx > 0 && newEllipse.cy > 0) { + newEllipse.setX(Number(newEllipse.x) + Number(newEllipse.cx)) + newEllipse.setY(Number(newEllipse.y) + Number(newEllipse.cy)) + } + if (!SVGXMLChecker.checkObjectEmpty(ellipse.systemLanguage)) { + newEllipse.setSystemLanguage(ellipse.systemLanguage); + } + return newEllipse; + } + + private parseAttributesLine(line: any, g: SVG): LineView { + var newLine: LineView = new LineView(); + if (SVGXMLChecker.checkObjectEmpty(g)) { + g = new Group(); + } + if (!SVGXMLChecker.checkObjectEmpty(line.id)) { + newLine.setId(line.id); + } + if (!SVGXMLChecker.checkObjectEmpty(line.class)) { + newLine.setClass(line.class); + } + if (!SVGXMLChecker.checkObjectEmpty(line.x1)) { + newLine.setStartX(line.x1); + } + if (!SVGXMLChecker.checkObjectEmpty(line.y1)) { + newLine.setStartY(line.y1); + } + if (!SVGXMLChecker.checkObjectEmpty(line.x2)) { + newLine.setEndX(line.x2); + } + if (!SVGXMLChecker.checkObjectEmpty(line.y2)) { + newLine.setEndY(line.y2); + } + if (!SVGXMLChecker.checkObjectEmpty(line.x)) { + newLine.setX(line.x); + } + if (!SVGXMLChecker.checkObjectEmpty(line.y)) { + newLine.setY(line.y); + } + if (!SVGXMLChecker.checkObjectEmpty(line.transform)) { + newLine.copyTransform(g); + newLine.setTransform(line.transform, this.svg.viewBoxWidth, this.svg.viewBoxHeight, false); + } + if (!SVGXMLChecker.checkObjectEmpty(line.fill)) { + newLine.setFill(line.fill); + } else { + newLine.setFill(g.fill); + } + if (!SVGXMLChecker.checkObjectEmpty(line.fill_opacity)) { + newLine.setFillOpacity(line.fill_opacity); + } + if (!SVGXMLChecker.checkObjectEmpty(line.stroke)) { + newLine.setStroke(line.stroke); + } else { + newLine.setStroke(g.stroke); + } + if (!SVGXMLChecker.checkObjectEmpty(line.stroke_width)) { + newLine.setStrokeWidth(line.stroke_width); + } else { + newLine.setStrokeWidth(g.strokeWidth); + } + if (!SVGXMLChecker.checkObjectEmpty(line.stroke_miterlimit)) { + newLine.setStrokeMiterLimit(line.stroke_miterlimit); + } + if (!SVGXMLChecker.checkObjectEmpty(line.style)) { + newLine.setStyle(line.style); + } + if (!SVGXMLChecker.checkObjectEmpty(line.systemLanguage)) { + newLine.setSystemLanguage(line.systemLanguage); + } + + return newLine; + } + + private parseAttributesPolyLine(polyLine: any, g: SVG): PolyLineView { + var newPolyLine = new PolyLineView(); + if (SVGXMLChecker.checkObjectEmpty(g)) { + g = new Group(); + } + if (!SVGXMLChecker.checkObjectEmpty(polyLine.id)) { + newPolyLine.setId(polyLine.id); + } + if (!SVGXMLChecker.checkObjectEmpty(polyLine.class)) { + newPolyLine.setClass(polyLine.class); + } + if (!SVGXMLChecker.checkObjectEmpty(polyLine.points)) { + let pointsArray: string[] = String(polyLine.points).split(" "); + let pointsResult: Array<[number, number]> = new Array<[number, number]>(); + for (let i = 0;i < pointsArray.length; i++) { + let pointsItem = pointsArray[i].split(",") + pointsResult.push([Number(pointsItem[0]), Number(pointsItem[1])]) + } + newPolyLine.setPointsResult(pointsResult); + } + if (!SVGXMLChecker.checkObjectEmpty(polyLine.x)) { + newPolyLine.setX(polyLine.x); + } + if (!SVGXMLChecker.checkObjectEmpty(polyLine.y)) { + newPolyLine.setY(polyLine.y); + } + if (!SVGXMLChecker.checkObjectEmpty(polyLine.transform)) { + newPolyLine.copyTransform(g); + newPolyLine.setTransform(polyLine.transform, this.svg.viewBoxWidth, this.svg.viewBoxHeight, false); + } + if (!SVGXMLChecker.checkObjectEmpty(polyLine.fill)) { + newPolyLine.setFill(polyLine.fill); + } else { + newPolyLine.setFill(g.fill); + } + if (!SVGXMLChecker.checkObjectEmpty(polyLine.fill_opacity)) { + newPolyLine.setFillOpacity(polyLine.fill_opacity); + } + if (!SVGXMLChecker.checkObjectEmpty(polyLine.stroke)) { + newPolyLine.setStroke(polyLine.stroke); + } else { + newPolyLine.setStroke(g.stroke); + } + if (!SVGXMLChecker.checkObjectEmpty(polyLine.stroke_width)) { + newPolyLine.setStrokeWidth(polyLine.stroke_width); + } else { + newPolyLine.setStrokeWidth(g.strokeWidth); + } + if (!SVGXMLChecker.checkObjectEmpty(polyLine.stroke_miterlimit)) { + newPolyLine.setStrokeMiterLimit(polyLine.stroke_miterlimit); + } + if (!SVGXMLChecker.checkObjectEmpty(polyLine.style)) { + newPolyLine.setStyle(polyLine.style); + } + if (!SVGXMLChecker.checkObjectEmpty(polyLine.systemLanguage)) { + newPolyLine.setSystemLanguage(polyLine.systemLanguage); + } + + return newPolyLine; + } + + private parseAttributesPolygon(polygon: any, g: SVG): PolygonView { + var newPolygon = new PolygonView(); + if (SVGXMLChecker.checkObjectEmpty(g)) { + g = new Group(); + } + if (!SVGXMLChecker.checkObjectEmpty(polygon.id)) { + newPolygon.setId(polygon.id); + } + if (!SVGXMLChecker.checkObjectEmpty(polygon.class)) { + newPolygon.setClass(polygon.class); + } + if (!SVGXMLChecker.checkObjectEmpty(polygon.points)) { + let pointsArray: string[] = String(polygon.points).split(" "); + let pointsResult: Array<[number, number]> = new Array<[number, number]>(); + for (let i = 0;i < pointsArray.length; i++) { + let pointsItem = pointsArray[i].split(",") + pointsResult.push([Number(pointsItem[0]), Number(pointsItem[1])]) + } + newPolygon.setPointsResult(pointsResult); + } + if (!SVGXMLChecker.checkObjectEmpty(polygon.x)) { + newPolygon.setX(polygon.x); + } + if (!SVGXMLChecker.checkObjectEmpty(polygon.y)) { + newPolygon.setY(polygon.y); + } + if (!SVGXMLChecker.checkObjectEmpty(polygon.transform)) { + newPolygon.copyTransform(g); + newPolygon.setTransform(polygon.transform, this.svg.viewBoxWidth, this.svg.viewBoxHeight, false); + } + if (!SVGXMLChecker.checkObjectEmpty(polygon.fill)) { + newPolygon.setFill(polygon.fill); + } else { + newPolygon.setFill(g.fill); + } + if (!SVGXMLChecker.checkObjectEmpty(polygon.fill_opacity)) { + newPolygon.setFillOpacity(polygon.fill_opacity); + } + if (!SVGXMLChecker.checkObjectEmpty(polygon.stroke)) { + newPolygon.setStroke(polygon.stroke); + } else { + newPolygon.setStroke(g.stroke); + } + if (!SVGXMLChecker.checkObjectEmpty(polygon.stroke_width)) { + newPolygon.setStrokeWidth(polygon.stroke_width); + } else { + newPolygon.setStrokeWidth(g.strokeWidth); + } + if (!SVGXMLChecker.checkObjectEmpty(polygon.stroke_miterlimit)) { + newPolygon.setStrokeMiterLimit(polygon.stroke_miterlimit); + } + if (!SVGXMLChecker.checkObjectEmpty(polygon.style)) { + newPolygon.setStyle(polygon.style); + } + if (!SVGXMLChecker.checkObjectEmpty(polygon.systemLanguage)) { + newPolygon.setSystemLanguage(polygon.systemLanguage); + } + + return newPolygon; + } + + private parseAttributesPath(path: any, g: SVG): PathView { + var newPath = new PathView(); + if (SVGXMLChecker.checkObjectEmpty(g)) { + g = new Group(); + } + if (!SVGXMLChecker.checkObjectEmpty(path.id)) { + newPath.setId(path.id); + } + if (!SVGXMLChecker.checkObjectEmpty(path.class)) { + newPath.setClass(path.class); + } + if (!SVGXMLChecker.checkObjectEmpty(path.d)) { + newPath.setCommands(path.d); + } + if (!SVGXMLChecker.checkObjectEmpty(path.x)) { + newPath.setX(path.x); + } + if (!SVGXMLChecker.checkObjectEmpty(path.y)) { + newPath.setY(path.y); + } + if (!SVGXMLChecker.checkObjectEmpty(path.transform)) { + newPath.copyTransform(g); + newPath.setTransform(path.transform, this.svg.viewBoxWidth, this.svg.viewBoxHeight, false); + } + if (!SVGXMLChecker.checkObjectEmpty(path.fill)) { + newPath.setFill(path.fill); + } else { + newPath.setFill(g.fill); + } + if (!SVGXMLChecker.checkObjectEmpty(path.fill_opacity)) { + newPath.setFillOpacity(path.fill_opacity); + } + if (!SVGXMLChecker.checkObjectEmpty(path.stroke)) { + newPath.setStroke(path.stroke); + } else { + newPath.setStroke(g.stroke); + } + if (!SVGXMLChecker.checkObjectEmpty(path.stroke_width)) { + newPath.setStrokeWidth(path.stroke_width); + } else { + newPath.setStrokeWidth(g.strokeWidth); + } + if (!SVGXMLChecker.checkObjectEmpty(path.stroke_miterlimit)) { + newPath.setStrokeMiterLimit(path.stroke_miterlimit); + } + if (!SVGXMLChecker.checkObjectEmpty(path.style)) { + newPath.setStyle(path.style); + } + if (!SVGXMLChecker.checkObjectEmpty(path.systemLanguage)) { + newPath.setSystemLanguage(path.systemLanguage); + } + + return newPath; + } + + private parseAttributesRect(rect: any, g: SVG): RectView { + var newRect = new RectView(); + if (SVGXMLChecker.checkObjectEmpty(g)) { + g = new Group(); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.id)) { + newRect.setId(rect.id); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.class)) { + newRect.setClass(g._class + " " + rect.class); + } else { + newRect.setClass(g._class); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.width)) { + newRect.setWidth(rect.width); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.height)) { + newRect.setHeight(rect.height); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.rx)) { + newRect.setRx(rect.rx); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.ry)) { + newRect.setRy(rect.ry); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.x)) { + newRect.setX(rect.x); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.y)) { + newRect.setY(rect.y); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.transform)) { + newRect.copyTransform(g); + newRect.setTransform(rect.transform, this.svg.viewBoxWidth, this.svg.viewBoxHeight, false); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.fill)) { + newRect.setFill(!SVGXMLChecker.checkObjectEmpty(rect.fill) ? rect.fill : g.fill); + } else { + newRect.setFill(g.fill); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.fill_opacity)) { + newRect.setFillOpacity(rect.fill_opacity); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.stroke)) { + newRect.setStroke(rect.stroke); + } else { + newRect.setStroke(g.stroke); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.stroke_width)) { + newRect.setStrokeWidth(rect.stroke_width); + } else { + newRect.setStrokeWidth(g.strokeWidth); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.stroke_miterlimit)) { + newRect.setStrokeMiterLimit(rect.stroke_miterlimit); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.style)) { + newRect.setStyle(rect.style); + } + if (!SVGXMLChecker.checkObjectEmpty(rect.systemLanguage)) { + newRect.setSystemLanguage(rect.systemLanguage); + } + + return newRect; + } + + private parseAttributesImage(image: any, g: SVG): ImageSvg { + var newImage = new ImageSvg(); + if (SVGXMLChecker.checkObjectEmpty(g)) { + g = new Group(); + } + if (!SVGXMLChecker.checkObjectEmpty(image.id)) { + newImage.setId(image.id); + } + if (!SVGXMLChecker.checkObjectEmpty(image.class)) { + newImage.setClass(image.class); + } + if (!SVGXMLChecker.checkObjectEmpty(image.width)) { + newImage.setWidth(image.width); + } + if (!SVGXMLChecker.checkObjectEmpty(image.height)) { + newImage.setHeight(image.height); + } + if (!SVGXMLChecker.checkObjectEmpty(image.opacity)) { + newImage.setOpacity(Number(image.opacity)); + } + if (!SVGXMLChecker.checkObjectEmpty(image.href)) { + newImage.setHref(image.href); + } + if (!SVGXMLChecker.checkObjectEmpty(image.transform)) { + newImage.copyTransform(g); + newImage.setTransform(image.transform, this.svg.viewBoxWidth, this.svg.viewBoxHeight, false); + } + if (!SVGXMLChecker.checkObjectEmpty(image.systemLanguage)) { + newImage.setSystemLanguage(image.systemLanguage); + } + + return newImage; + } + + private parseAttributesUse(use: any, g: SVG): Use { + var newUse = new Use(); + if (SVGXMLChecker.checkObjectEmpty(g)) { + g = new Group(); + } + if (!SVGXMLChecker.checkObjectEmpty(use.id)) { + newUse.setId(use.id); + } + if (!SVGXMLChecker.checkObjectEmpty(use.x)) { + newUse.setX(use.x); + } + if (!SVGXMLChecker.checkObjectEmpty(use.y)) { + newUse.setY(use.y); + } + if (!SVGXMLChecker.checkObjectEmpty(use.width)) { + newUse.setWidth(use.width); + } + if (!SVGXMLChecker.checkObjectEmpty(use.height)) { + newUse.setHeight(use.height); + } + if (!SVGXMLChecker.checkObjectEmpty(use.href)) { + newUse.setHref(use.href); + } + if (!SVGXMLChecker.checkObjectEmpty(use.transform)) { + newUse.copyTransform(g); + newUse.setTransform(use.transform, this.svg.viewBoxWidth, this.svg.viewBoxHeight, false); + } + if (!SVGXMLChecker.checkObjectEmpty(use.systemLanguage)) { + newUse.setSystemLanguage(use.systemLanguage); + } + + return newUse; + } + + private parseAttributesText(text: any, g: SVG, str: string): TextView { + var newText = new TextView(); + if (SVGXMLChecker.checkObjectEmpty(g)) { + g = new Group(); + } + if (!SVGXMLChecker.checkObjectEmpty(text.id)) { + newText.setId(text.id); + } + if (!SVGXMLChecker.checkObjectEmpty(text.x)) { + newText.setX(text.x); + } + if (!SVGXMLChecker.checkObjectEmpty(text.y)) { + newText.setY(text.y); + } + if (!SVGXMLChecker.checkObjectEmpty(text.dx)) { + newText.setDx(text.dx); + } + if (!SVGXMLChecker.checkObjectEmpty(text.dy)) { + newText.setDy(text.dy); + } + if (!SVGXMLChecker.checkObjectEmpty(str)) { + newText.setText(str); + } + if (!SVGXMLChecker.checkObjectEmpty(text.font_size)) { + newText.setFontSize(text.font_size); + } + if (!SVGXMLChecker.checkObjectEmpty(text.transform)) { + newText.copyTransform(g); + newText.setTransform(text.transform, this.svg.viewBoxWidth, this.svg.viewBoxHeight, false); + } + if (!SVGXMLChecker.checkObjectEmpty(text.fill)) { + newText.setFill(!SVGXMLChecker.checkObjectEmpty(text.fill) ? text.fill : g.fill); + } else { + newText.setFill(g.fill); + } + if (!SVGXMLChecker.checkObjectEmpty(text.fill_opacity)) { + newText.setFillOpacity(text.fill_opacity); + } + if (!SVGXMLChecker.checkObjectEmpty(text.stroke)) { + newText.setStroke(text.stroke); + } else { + newText.setStroke(g.stroke); + } + if (!SVGXMLChecker.checkObjectEmpty(text.stroke_width)) { + newText.setStrokeWidth(text.stroke_width); + } else { + newText.setStrokeWidth(g.strokeWidth); + } + if (!SVGXMLChecker.checkObjectEmpty(text.stroke_miterlimit)) { + newText.setStrokeMiterLimit(text.stroke_miterlimit); + } + if (!SVGXMLChecker.checkObjectEmpty(text.style)) { + newText.setStyle(text.style); + } + if (!SVGXMLChecker.checkObjectEmpty(text.systemLanguage)) { + newText.setSystemLanguage(text.systemLanguage); + } + + return newText; + } + + private parseAttributesSwitch(g: any, elements: any): Switch { + var newSwitch: Switch = new Switch(); + if (g != undefined) { + if (!SVGXMLChecker.checkObjectEmpty(g.id)) { + newSwitch.setId(g.id); + } + if (!SVGXMLChecker.checkObjectEmpty(g.class)) { + newSwitch.setClass(g.class); + } + if (!SVGXMLChecker.checkObjectEmpty(g.fill)) { + newSwitch.setFill(g.fill); + } else { + newSwitch.setFill(newSwitch.fill); + } + if (!SVGXMLChecker.checkObjectEmpty(g.fill_opacity)) { + newSwitch.setFillOpacity(g.fill_opacity); + } + if (!SVGXMLChecker.checkObjectEmpty(g.stroke)) { + newSwitch.setStroke(g.stroke); + } else { + newSwitch.setStroke(newSwitch.stroke); + } + if (!SVGXMLChecker.checkObjectEmpty(g.stroke_width)) { + newSwitch.setStrokeWidth(g.stroke_width); + } else { + newSwitch.setStrokeWidth(newSwitch.strokeWidth); + } + if (!SVGXMLChecker.checkObjectEmpty(g.stroke_miterlimit)) { + newSwitch.setStrokeMiterLimit(g.stroke_miterlimit); + } + if (!SVGXMLChecker.checkObjectEmpty(g.style)) { + newSwitch.setStyle(g.style); + } + if (!SVGXMLChecker.checkObjectEmpty(g.transform)) { + newSwitch.setTransform(g.transform, this.svg.viewBoxWidth, this.svg.viewBoxHeight, true); + } + if (!SVGXMLChecker.checkObjectEmpty(g.systemLanguage)) { + newSwitch.setSystemLanguage(g.systemLanguage); + } + } + for (let i = 0;i < elements.length; i++) { + this.setSvgArrayChild(elements[i], newSwitch.child, newSwitch); + } + return newSwitch; + } + + private addSvgToArray(svg: SVG) { + this.svgs.push(svg) + } + + public copy(val: SVG): SVG{ + let copySvg = null; + if (val instanceof ImageSvg) { + copySvg = new ImageSvg(); + copySvg.href = val.href; + } else if (val instanceof CircleView) { + copySvg = new CircleView(); + } else if (val instanceof EllipseView) { + copySvg = new EllipseView(); + } else if (val instanceof LineView) { + copySvg = new LineView(); + copySvg.startX = val.startX; + copySvg.startY = val.startY; + copySvg.endX = val.endX; + copySvg.endY = val.endY; + } else if (val instanceof PolyLineView) { + copySvg = new PolyLineView(); + copySvg.pointsResult = val.pointsResult; + } else if (val instanceof PolygonView) { + copySvg = new PolygonView(); + copySvg.pointsResult = val.pointsResult; + } else if (val instanceof RectView) { + copySvg = new RectView(); + copySvg.rx = val.rx; + copySvg.ry = val.ry; + } else if (val instanceof Use) { + copySvg = new Use(); + copySvg.href = val.href; + } + copySvg.id = val.id; + copySvg._class = val._class; + copySvg.x = val.x; + copySvg.y = val.y; + copySvg.width = val.width; + copySvg.height = val.height; + copySvg.fill = val.fill; + copySvg.opacity = val.opacity; + copySvg.fillOpacity = val.fillOpacity; + copySvg.stroke = val.stroke; + copySvg.strokeDashArray = val.strokeDashArray; + copySvg.strokeDashOffset = val.strokeDashOffset; + copySvg.strokeLineCap = val.strokeLineCap; + copySvg.strokeLineJoin = val.strokeLineJoin; + copySvg.strokeMiterLimit = val.strokeMiterLimit; + copySvg.strokeOpacity = val.strokeOpacity; + copySvg.strokeWidth = val.strokeWidth; + copySvg.translateX = val.translateX; + copySvg.translateY = val.translateY; + copySvg.rotateX = val.rotateX; + copySvg.rotateY = val.rotateY; + copySvg.rotateZ = val.rotateZ; + copySvg.rotateAngle = val.rotateAngle; + copySvg.scaleX = val.scaleX; + copySvg.scaleY = val.scaleY; + return copySvg; + } + + private drawSvg(val: any) { + if (val instanceof ImageSvg) { + let img: ImageBitmap = new ImageBitmap("../../../resources/rawfile/" + val.href); + this.context.drawImage(img, px2vp(val.x), px2vp(val.y), px2vp(Number(val.width)), px2vp(Number(val.height))) + } else if (val instanceof CircleView) { + this.context.beginPath() + this.context.ellipse(px2vp(val.x), px2vp(val.y), px2vp(Number(val.width)), px2vp(Number(val.height)), 0, 0, Math.PI * 2) + } else if (val instanceof EllipseView) { + this.context.beginPath() + this.context.ellipse(px2vp(val.x), px2vp(val.y), px2vp(Number(val.width) / 2), px2vp(Number(val.height) / 2), 0, 0, Math.PI * 2) + } else if (val instanceof LineView) { + this.context.beginPath(); + this.context.moveTo(px2vp(Number(val.startX)), px2vp(Number(val.startY))); + this.context.lineTo(px2vp(Number(val.endX)), px2vp(Number(val.endY))) + } else if (val instanceof PolyLineView) { + this.context.beginPath(); + this.context.moveTo(px2vp(val.pointsResult[0][0]), px2vp(val.pointsResult[0][1])) + val.pointsResult.forEach((val, idx) => { + if (idx > 0) { + this.context.lineTo(px2vp(val[0]), px2vp(val[1])) + } + }) + } else if (val instanceof PolygonView) { + this.context.beginPath(); + this.context.moveTo(px2vp(val.pointsResult[0][0]), px2vp(val.pointsResult[0][1])) + val.pointsResult.forEach((val, idx) => { + if (idx > 0) { + this.context.lineTo(px2vp(val[0]), px2vp(val[1])) + } + }) + } else if (val instanceof RectView) { + this.context.beginPath() + this.context.rect(px2vp(val.x), px2vp(val.y), px2vp(Number(val.width)), px2vp(Number(val.height))) + } else if (val instanceof Use) { + for (let i = 0;i < this.svgs.length; i++) { + if (this.svgs[i].id.trim().indexOf(val.href.replace("#", "").trim()) > -1) { + let svg = this.copy(this.svgs[i]) + if (val.x) { + svg.x = Number(this.svgs[i].x) + Number(val.x) + } + if (val.y) { + svg.y = Number(this.svgs[i].y) + Number(val.y) + } + this.drawSvg(svg) + break + } + } + } else if (val instanceof TextView) { + this.context.font = val.fontSize + " sans-serif"; + } else if (val instanceof Switch) { + let language = configuration.getLocale().language; + for (let i = 0;i < val.child.length; i++) { + if (val.child[i].systemLanguage.trim() == language.trim()) { + this.drawSvg(val.child[i]) + break + } + } + } + + this.context.save(); + if (val.strokeMiterLimit != null) { + this.context.miterLimit = val.strokeMiterLimit; + } + if (val.strokeDashOffset != 0) { + this.context.lineDashOffset = Number(val.strokeDashOffset); + } + if (val.translateX != 0 || val.translateY != 0) { + this.context.translate(px2vp(val.translateX), px2vp(val.translateY)) + } + if (val.scaleX != 1 || val.scaleY != 1) { + this.context.scale(val.scaleX, val.scaleY); + } + if (val.rotateAngle != 0) { + this.context.rotate(val.rotateAngle) + } + if (val.strokeWidth != null && Number(val.strokeWidth.toString().replace("px", "")) > 0) { + this.context.strokeStyle = val.stroke; + this.context.lineWidth = Number(val.strokeWidth.toString().replace("px", "")); + if (val instanceof PathView) { + let path2D: Path2D = new Path2D(val.commands); + this.context.stroke(path2D) + } else if (val instanceof TextView) { + this.context.strokeText(val.text, Number(val.x) + Number(val.dx), Number(val.y) + Number(val.dy)) + } else { + this.context.stroke(); + } + } + if (val.fill != null) { + this.context.fillStyle = val.fill; + if (val instanceof PathView) { + let path2D: Path2D = new Path2D(val.commands); + this.context.fill(path2D); + } else if (val instanceof TextView) { + this.context.fillText(val.text, Number(val.x) + Number(val.dx), Number(val.y) + Number(val.dy)) + } else { + this.context.fill(); + } + } + this.context.restore(); + } + + public getSVGPixelMap(context: OffscreenCanvasRenderingContext2D): PixelMap{ + image.createImageSource(null) + this.context = context + this.svgs.forEach((val, idx, array) => { + this.drawSvg(val) + }) + let pix = this.context.getPixelMap(0, 0, this.getMinShowWidth(), this.getMinShowHeight()) + this.context.clearRect(0, 0, this.svg.viewBoxWidth, this.svg.viewBoxHeight) + return pix + } + + getMinShowWidth(): number{ + return px2vp(this.svg.viewBoxWidth < globalThis.deviceW ? this.svg.viewBoxWidth : globalThis.deviceW) + } + + getMinShowHeight(): number{ + return px2vp(this.svg.viewBoxHeight < globalThis.deviceH ? this.svg.viewBoxHeight : globalThis.deviceH) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/MainAbility/pages/BackgroundItem.ets b/RoundedImageView/src/main/ets/components/ScaleType.ts similarity index 55% rename from entry/src/main/ets/MainAbility/pages/BackgroundItem.ets rename to RoundedImageView/src/main/ets/components/ScaleType.ts index 1b6ca36848374459f82a005264d8e2c6a2cc8a51..f76bf893aa623858847a40d5cbcd34b55d04e3b1 100644 --- a/entry/src/main/ets/MainAbility/pages/BackgroundItem.ets +++ b/RoundedImageView/src/main/ets/components/ScaleType.ts @@ -13,20 +13,14 @@ * limitations under the License. */ -export class BackgroundItem { - colornumber: number; - primaryTitle: string; - secondTitle: string; - scaleType: string; - picWidth: string; - margin: number; - - constructor(colornumber: number, primaryTitle: string, secondTitle: string, scaleType: string, picWidth: string, margin: number) { - this.colornumber = colornumber; - this.primaryTitle = primaryTitle; - this.secondTitle = secondTitle; - this.scaleType = scaleType; - this.picWidth = picWidth; - this.margin = margin; - } +enum ScaleType { + FIT_START = 0, + FIT_END = 1, + FIT_CENTER = 2, + CENTER = 3, + CENTER_CROP = 4, + FIT_XY = 5, + CENTER_INSIDE = 6 } + +export default ScaleType; \ No newline at end of file diff --git a/entry/src/main/ets/MainAbility/app.ets b/RoundedImageView/src/main/ets/components/SrcType.ts similarity index 81% rename from entry/src/main/ets/MainAbility/app.ets rename to RoundedImageView/src/main/ets/components/SrcType.ts index eef2fff6d169b8c305daa2acd8db6eb913b31f4e..260d62715d18f57be639cba9c1c7124c3aa52bc9 100644 --- a/entry/src/main/ets/MainAbility/app.ets +++ b/RoundedImageView/src/main/ets/components/SrcType.ts @@ -12,11 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export default { - onCreate() { - console.info('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, -} \ No newline at end of file + +enum SrcType { + MEDIA = 0, + RAWFILE = 1, + URI = 2, + URL = 3, + ARRAYBUFFER = 4 +} + +export default SrcType; \ No newline at end of file diff --git a/RoundedImageView/src/main/ets/components/TileMode.ts b/RoundedImageView/src/main/ets/components/TileMode.ts new file mode 100644 index 0000000000000000000000000000000000000000..82de68f3389169ce4787497f2ad38c4dea6b3b98 --- /dev/null +++ b/RoundedImageView/src/main/ets/components/TileMode.ts @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +enum TileMode { + CLAMP = 0, + REPEAT = 1, + MIRROR = 2 +} + +export default TileMode; \ No newline at end of file diff --git a/RoundedImageView/src/main/ets/components/common/RoundedImageView.ets b/RoundedImageView/src/main/ets/components/common/RoundedImageView.ets deleted file mode 100644 index cfed8d3732d5c07e8c8510b9d93dabbe92928d6e..0000000000000000000000000000000000000000 --- a/RoundedImageView/src/main/ets/components/common/RoundedImageView.ets +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -@Component -struct RoundedImageView { - @State model: RoundedImageView.Model = new RoundedImageView.Model(); - - build() { - Column({ space: 5 }) { - Image($rawfile(this.model.src)) - .borderRadius(this.model.cornerRadius) - .objectRepeat(this.model.tileMode) - .objectFit(this.model.scaleType) - .width(this.model.width) - .height(this.model.height) - .padding(this.model.pad) - .clip(this.model.oval) - .backgroundColor(this.model.colorNumber) - .margin({ left: this.model.margin }) - } - } -} - -namespace RoundedImageView { - export class Model { - height: string = '' - width: string = '' - cornerRadius: number = 0 - pad: number = 0 - colorNumber: number - margin: number - src: string = ''; - tileMode: ImageRepeat = null - oval: Ellipse = null - scaleType: ImageFit = null - - constructor(src ?: string) { - this.src = src; - } - - setImageURI(src: string): Model { - this.src = src; - return this; - } - - getImageURI(): string { - return this.src; - } - - setHeight(height: string): Model { - this.height = height; - return this; - } - - getHeight(): string { - return this.height; - } - - setWidth(width: string): Model { - this.width = width; - return this; - } - - getWidth(): string { - return this.width; - } - - setCornerRadius(cornerRadius: number): Model { - this.cornerRadius = cornerRadius; - return this; - } - - getCornerRadius(): number { - return this.cornerRadius; - } - - setScaleType(scaleType: ImageFit): Model { - this.scaleType = scaleType; - return this; - } - - getScaleType(): ImageFit { - return this.scaleType; - } - - setTileModeXY(tileMode: ImageRepeat): Model { - this.tileMode = tileMode; - return this; - } - - getTileModeXY(): ImageRepeat { - return this.tileMode; - } - - setOval(oval: Ellipse): Model { - this.oval = oval; - return this; - } - - getOval(): Ellipse { - return this.oval; - } - - setBackgroundColor(colorNumber: number): Model { - this.colorNumber = colorNumber; - return this; - } - - getBackgroundColor(): number { - return this.colorNumber; - } - - setMargin(margin: number): Model { - this.margin = margin; - return this; - } - - getMargin(): number { - return this.margin; - } - - setPadding(pad: number): Model { - this.pad = pad; - return this; - } - - getPadding(): number { - return this.pad; - } - } -} - -export default RoundedImageView; diff --git a/RoundedImageView/src/main/module.json5 b/RoundedImageView/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..1b54cfe8c332e1b01530153299bb56119b0fcbf0 --- /dev/null +++ b/RoundedImageView/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "RoundedImageView", + "type": "har", + "deviceTypes": [ + "default", + "tablet" + ], + "uiSyntax": "ets" + } +} diff --git a/build-profile.json5 b/build-profile.json5 index 7025c18da8c1bd5d3589296b390d0b36488b034c..c0404776890bcefcaa793f3e43d75b62f3c7107b 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -1,8 +1,8 @@ { "app": { "signingConfigs": [], - "compileSdkVersion": 8, - "compatibleSdkVersion": 8, + "compileSdkVersion": 9, + "compatibleSdkVersion": 9, "products": [ { "name": "default", diff --git a/entry/.gitignore b/entry/.gitignore index 4f9a973815d0b5e49bc8547681a6b4bc7a178d12..db260216fa9df50899751f1610564021c4cecc6d 100644 --- a/entry/.gitignore +++ b/entry/.gitignore @@ -1,3 +1,4 @@ /node_modules /.preview -/build \ No newline at end of file +/build +package-lock.json \ No newline at end of file diff --git a/entry/build-profile.json5 b/entry/build-profile.json5 index ae58d1d0a70c602c9cfe1909b00dfec899ba1944..7dc37bb919dada5132609c409200db266559004f 100644 --- a/entry/build-profile.json5 +++ b/entry/build-profile.json5 @@ -1,5 +1,5 @@ { - "apiType": 'faMode', + "apiType": 'stageMode', "buildOption": { }, "targets": [ diff --git a/entry/hvigorfile.js b/entry/hvigorfile.js index bcec4c99653062cbf17702c40a2dd2a7b809b81a..d7720ee6a7aad5c617d1fd2f6fc8c87067bfa32c 100644 --- a/entry/hvigorfile.js +++ b/entry/hvigorfile.js @@ -1,2 +1,2 @@ // Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. -module.exports = require('@ohos/hvigor-ohos-plugin').legacyHapTasks +module.exports = require('@ohos/hvigor-ohos-plugin').hapTasks diff --git a/entry/package-lock.json b/entry/package-lock.json deleted file mode 100644 index 08669a03939b2cec049dc697203aefba47497413..0000000000000000000000000000000000000000 --- a/entry/package-lock.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "entry", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@ohos/RoundedImageView": { - "version": "file:../RoundedImageView" - } - } -} diff --git a/entry/package.json b/entry/package.json index 84bd14dc8a0724c1cf5fcb2f76ded12f1c8ff68d..18d360a9cb0b05eab532c40173b71ca78dc45231 100644 --- a/entry/package.json +++ b/entry/package.json @@ -1,15 +1,16 @@ { - "name": "entry", - "version": "1.0.0", - "ohos": { - "org": "huawei", - "buildTool": "hvigor", - "directoryLevel": "module" - }, - "description": "example description", - "repository": {}, - "license": "Apache License 2.0", - "dependencies": { - "@ohos/RoundedImageView": "file:../RoundedImageView" - } + "license": "Apache License 2.0", + "devDependencies": {}, + "name": "entry", + "ohos": { + "org": "huawei", + "directoryLevel": "module", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.2", + "dependencies": { + "@ohos/roundedimageview": "file:../Roundedimageview" + } } diff --git a/entry/src/main/config.json b/entry/src/main/config.json deleted file mode 100644 index 91171a673ddf14315f155dba4e8c9e56d0164067..0000000000000000000000000000000000000000 --- a/entry/src/main/config.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "app": { - "vendor": "example", - "bundleName": "cn.openharmony.ohos_app_roundedimageview", - "version": { - "code": 1000000, - "name": "1.0.0" - } - }, - "deviceConfig": {}, - "module": { - "mainAbility": ".MainAbility", - "deviceType": [ - "phone", - "tablet" - ], - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "formsEnabled": false, - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "distro": { - "moduleType": "entry", - "installationFree": false, - "deliveryWithInstall": true, - "moduleName": "entry" - }, - "package": "com.example.entry", - "srcPath": "", - "name": ".entry", - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/TestAbility/app.ets b/entry/src/main/ets/Application/AbilityStage.ts similarity index 49% rename from entry/src/ohosTest/ets/TestAbility/app.ets rename to entry/src/main/ets/Application/AbilityStage.ts index 1405dd359f629939894b86e2b285cb2cc1b37aa6..ab2682985f2ed3ade10aefeecb9501a67eb05fbc 100644 --- a/entry/src/ohosTest/ets/TestAbility/app.ets +++ b/entry/src/main/ets/Application/AbilityStage.ts @@ -12,21 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' + +import AbilityStage from "@ohos.application.AbilityStage" -export default { - onCreate() { - console.info('Application onCreate') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - }, - onDestroy() { - console.info('Application onDestroy') - }, +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } } \ No newline at end of file diff --git a/entry/src/main/ets/MainAbility/MainAbility.ts b/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..28d517354809fc8d6d732ebe7a401cd8d298640c --- /dev/null +++ b/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from '@ohos.application.Ability' +import display from '@ohos.display'; + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + globalThis.globalFilesDir = this.context.filesDir + let displayWH = display.getDefaultDisplaySync() + globalThis.deviceW = displayWH.width; + globalThis.deviceH = displayWH.height; + globalThis.resourceManager = this.context.resourceManager; + globalThis.context = this.context + } + + // requestPermission() { + // let array: Array = ["ohos.permission.READ_MEDIA", "ohos.permission.WRITE_MEDIA"]; + // this.context.requestPermissionsFromUser(array).then(function (data) { + // console.log("data permissions:" + data.permissions); + // console.log("data result:" + data.authResults); + // }, (err) => { + // console.error('Failed to start ability', err.code); + // }); + // } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +} diff --git a/entry/src/main/ets/MainAbility/pages/index.ets b/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 520493b2e8bd451a0a84850ab811f28761660278..0000000000000000000000000000000000000000 --- a/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,334 +0,0 @@ -// @ts-nocheck - -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {PictureItem} from './PictureItem' -import {OvalPictureItem} from './OvalPictureItem' -import {BackgroundItem} from './BackgroundItem' -import { RoundedImageView } from '@ohos/RoundedImageView/' - -@CustomDialog -struct CustomDialogExample { - controller: CustomDialogController - private typeArr: string[] = [] - @Link type_value: string - - build() { - Row() { - Scroll() { - List({ space: 10, initialIndex: 0 }) { - ForEach(this.typeArr, (item) => { - ListItem() { - Text(item) - .width('100%') - .height(20) - .fontSize(20) - .textAlign(TextAlign.Start) - .backgroundColor(0xFFFFFF) - .onClick(() => { - if (item == 'Bitmap') { - this.type_value = 'Bitmap' - } else if (item == 'Ovals') { - this.type_value = 'Ovals' - } else if (item == 'Picasso') { - this.type_value = 'Picasso' - } else if (item == 'Color') { - this.type_value = 'Color' - } else if (item == 'Background') { - this.type_value = 'Background' - } - this.controller.close(); - }) - } - }, item => item) - }.backgroundColor(Color.White).width(250).height(180).padding(10) - } - }.padding(5) - } -} - -@Entry -@Component -struct Index { - private arr: string[] = ['photo1.jpg', 'photo2.jpg', 'photo3.jpg', 'photo4.jpg', 'photo5.jpg', 'photo6.jpg', 'photo7.jpg'] - private numberarr: number [] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - private colornumbers: number [] = [0, 1, 2, 3, 4, 5, 6] - private netWorkSrc: string = 'https://file03.16sucai.com/2017/1100/16sucai_P591F3A055.JPG' - private colorarr: number[] = [0xAAAAAA, 0xFF8800, 0xFAFAFA, 0x669900, 0xCC0000, 0xAA66CC, 0xFFFFFF] - private pictures: PictureItem [] = [ - new PictureItem('photo1.jpg', 'Tufa at night', 'Mono Lake, CA', 'CENTER', '100%', null, ImageFit.Contain, 0), - new PictureItem('photo2.jpg', 'Starry night', 'Lake Powell, AZ', 'CENTER_CROP', '100%', null, ImageFit.Contain, 0), - new PictureItem('photo3.jpg', 'Racetrack playa', 'Death Valley, CA', 'CENTER_INSIDE', '70%', null, ImageFit.ScaleDown, 0), - new PictureItem('photo4.jpg', 'Napali coast', 'Kauai, HI', 'FIT_CENTER', '70%', null, ImageFit.ScaleDown, 0), - new PictureItem('photo5.jpg', 'Delicate Arch', 'Arches, UT', 'FIT_END', '70%', null, ImageFit.Contain, 80), - new PictureItem('photo6.jpg', 'Sierra sunset', 'Lone Pine, CA', 'FIT_START', '70%', null, ImageFit.Contain, -50), - new PictureItem('photo7.jpg', 'Majestic', 'Grand Teton, WY', 'FIT_XY', '100%', null, ImageFit.Contain, 0), - new PictureItem('black_white_tile.jpg', 'TileMode', 'REPEAT', 'FIT_XY', '100%', ImageRepeat.XY, ImageFit.ScaleDown, 0), - new PictureItem('black_white_tile.jpg', 'TileMode', 'CLAMP', 'FIT_XY', '100%', null, ImageFit.Cover, 0), - new PictureItem('black_white_tile.jpg', 'TileMode', 'MIRROR', 'FIT_XY', '100%', ImageRepeat.XY, ImageFit.Contain, 0) - ] - private backs: BackgroundItem [] = [new BackgroundItem(0xAAAAAA, 'Tufa at night', 'Mono Lake, CA', 'CENTER', '95%', 0), - new BackgroundItem(0xFF8800, 'Starry night', 'Lake Powell, AZ', 'CENTER_CROP', '95%', 0), - new BackgroundItem(0xFAFAFA, 'Racetrack playa', 'Death Valley, CA', 'CENTER_INSIDE', '95%', 0), - new BackgroundItem(0x669900, 'Napali coast', 'Kauai, HI', 'FIT_CENTER', '60%', 70), - new BackgroundItem(0xCC0000, 'Delicate Arch', 'Arches, UT', 'FIT_END', '60%', 125), - new BackgroundItem(0xAA66CC, 'Sierra sunset', 'Lone Pine, CA', 'FIT_START', '60%', -150), - new BackgroundItem(0xFFFFFF, 'Majestic', 'Grand Teton, WY', 'FIT_XY', '95%', 0)] - private ovalPictures: OvalPictureItem [] = [ - new OvalPictureItem('photo1.jpg', 'Tufa at night', 'Mono Lake, CA', 'CENTER', '90%', null, new Ellipse({ - width: 290, - height: 150 - }), null, ImageFit.Contain, 0), - new OvalPictureItem('photo2.jpg', 'Starry night', 'Lake Powell, AZ', 'CENTER_CROP', '90%', null, new Ellipse({ - width: 290, - height: 150 - }), null, ImageFit.Contain, 0), - new OvalPictureItem('photo3.jpg', 'Racetrack playa', 'Death Valley, CA', 'CENTER_INSIDE', '80%', null, new Ellipse({ - width: 260, - height: 150 - }), null, ImageFit.Contain, 0), - new OvalPictureItem('photo4.jpg', 'Napali coast', 'Kauai, HI', 'FIT_CENTER', '80%', null, new Ellipse({ - width: 260, - height: 150 - }), null, ImageFit.Contain, 0), - new OvalPictureItem('photo5.jpg', 'Delicate Arch', 'Arches, UT', 'FIT_END', '80%', null, new Ellipse({ - width: 260, - height: 150 - }), null, ImageFit.Contain, 60), - new OvalPictureItem('photo6.jpg', 'Sierra sunset', 'Lone Pine, CA', 'FIT_START', '80%', null, new Ellipse({ - width: 260, - height: 150 - }), null, ImageFit.Contain, -20), - new OvalPictureItem('photo7.jpg', 'Majestic', 'Grand Teton, WY', 'FIT_XY', '90%', null, new Ellipse({ - width: 290, - height: 150 - }), null, ImageFit.Contain, 0), - new OvalPictureItem('black_white_tile.jpg', 'TileMode', 'REPEAT', 'FIT_XY', '90%', 200, new Ellipse({ - width: 290, - height: 150 - }), ImageRepeat.XY, ImageFit.ScaleDown, 0), - new OvalPictureItem('black_white_tile.jpg', 'TileMode', 'CLAMP', 'FIT_XY', '100%', 200, new Ellipse({ - width: 290, - height: 150 - }), null, ImageFit.Cover, 0), - new OvalPictureItem('black_white_tile.jpg', 'TileMode', 'MIRROR', 'FIT_XY', '90%', 200, new Ellipse({ - width: 290, - height: 150 - }), ImageRepeat.XY, ImageFit.Contain, 0) - ] - private typeArr: string[] = [] - @State editFlag: boolean = false - @State @Watch("typeValueUpdated") type_value: string = 'Bitmap' - scroller: Scroller = new Scroller() - - typeValueUpdated(value: any): void { - if (this.type_value == 'Bitmap') { - this.numberarr.forEach((val, idx) => { - this.datas[idx] - .setImageURI(this.pictures[idx].src) - .setCornerRadius(25) - .setScaleType(this.pictures[idx].fit) - .setTileModeXY(this.pictures[idx].repeat) - .setOval(null) - .setHeight(200) - .setWidth(this.pictures[idx].picWidth) - .setPadding(0) - .setBackgroundColor(null) - .setMargin(this.pictures[idx].margin) - }); - } else if (this.type_value == 'Ovals') { - this.numberarr.forEach((val, idx) => { - this.datas[idx] - .setImageURI(this.ovalPictures[idx].src) - .setScaleType(this.ovalPictures[idx].fit) - .setTileModeXY(this.ovalPictures[idx].repeat) - .setWidth(this.ovalPictures[idx].picWidth) - .setOval(this.ovalPictures[idx].myellipse) - .setPadding(0) - .setBackgroundColor(null) - .setHeight(this.ovalPictures[idx].height) - .setMargin(this.ovalPictures[idx].margin) - }); - } else if (this.type_value == 'Picasso') { - this.type_value = 'Picasso' - } else if (this.type_value == 'Color') { - this.type_value = 'Color' - } else if (this.type_value == 'Background') { - this.numberarr.forEach((val, idx) => { - this.datas[idx] - .setImageURI(this.pictures[idx].src) - .setCornerRadius(25) - .setScaleType(this.pictures[idx].fit) - .setTileModeXY(this.pictures[idx].repeat) - .setWidth(this.pictures[idx].picWidth) - .setBackgroundColor(0x55AA66) - .setPadding(10) - .setOval(null) - .setHeight(200) - .setMargin(this.pictures[idx].margin) - }); - } - this.scroller.scrollTo({ xOffset: 0, yOffset: 0, animation: { duration: 2000, curve: Curve.Ease } }) - } - - @State datas: RoundedImageView.Model [] = [ - new RoundedImageView.Model(), new RoundedImageView.Model(), new RoundedImageView.Model(), - new RoundedImageView.Model(), new RoundedImageView.Model(), new RoundedImageView.Model(), - new RoundedImageView.Model(), new RoundedImageView.Model(), new RoundedImageView.Model(), - new RoundedImageView.Model()]; - dialogController: CustomDialogController = new CustomDialogController({ - alignment: DialogAlignment.Top, - builder: CustomDialogExample({ - cancel: this.onCancel, - confirm: this.onAccept, - type_value: $type_value, - typeArr: this.typeArr - }), - cancel: this.existApp, - autoCancel: true - }) - - private aboutToAppear() { - this.numberarr.forEach((val, idx) => { - this.datas[idx] - .setImageURI(this.pictures[idx].src) - .setCornerRadius(25) - .setScaleType(this.pictures[idx].fit) - .setTileModeXY(this.pictures[idx].repeat) - .setHeight(200) - .setWidth(this.pictures[idx].picWidth) - .setMargin(this.pictures[idx].margin) - }); - } - - build() { - Column() { - Column() { - Image($rawfile('down.png')).width(30).height(30).position({ x: -30, y: 5 }).onClick((event: ClickEvent) => { - this.typeArr = ['Bitmap', 'Ovals', 'Picasso', 'Color', 'Background'] - this.dialogController.open() - }) - Text(' select:' + this.type_value).fontSize(30) - }.margin(15) - - Scroll(this.scroller) { - List({ space: 10, initialIndex: 0 }) { - if (this.type_value.indexOf('Bitmap') == 0) { - ForEach(this.numberarr, (item) => { - ListItem() { - Column({ space: 5 }) { - RoundedImageView({ model: this.datas[item] }) - Text(this.pictures[item].primaryTitle).size({ height: 35 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(18).position({ x: 20, y: 40 }) - Text(this.pictures[item].secondTitle).size({ height: 20 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(16).position({ x: 20, y: 90 }) - Text(this.pictures[item].scaleType).size({ height: 20 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(14).position({ x: 20, y: 120 }) - }.width('100%') - .direction(Direction.Rtl) - }.editable(this.editFlag) - }, item => item) - - } else if (this.type_value.indexOf('Ovals') == 0) { - ForEach(this.numberarr, (item) => { - ListItem() { - Column({ space: 5 }) { - RoundedImageView({ model: this.datas[item] }) - Text(this.ovalPictures[item].primaryTitle).size({ height: 35 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(18).position({ x: 20, y: 40 }) - Text(this.ovalPictures[item].secondTitle).size({ height: 20 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(16).position({ x: 20, y: 90 }) - Text(this.ovalPictures[item].scaleType).size({ height: 20 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(14).position({ x: 20, y: 120 }) - }.width('100%') - .direction(Direction.Ltr) - }.editable(this.editFlag) - }, item => item) - - } else if (this.type_value.indexOf('Picasso') == 0) { - ForEach(this.colornumbers, (item) => { - ListItem() { - Column({ space: 5 }) { - Image(this.netWorkSrc).objectFit(ImageFit.Contain).borderRadius(25) - Text(this.backs[item].primaryTitle).size({ height: 35 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(18).position({ x: 20, y: 40 }) - Text(this.backs[item].secondTitle).size({ height: 20 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(16).position({ x: 20, y: 90 }) - Text(this.backs[item].scaleType).size({ height: 20 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(14).position({ x: 20, y: 120 }) - }.width('100%') - .direction(Direction.Ltr) - }.editable(this.editFlag) - }, item => item) - - } else if (this.type_value.indexOf('Color') == 0) { - ForEach(this.colornumbers, (item) => { - ListItem() { - Column({ space: 5 }) { - Row() - .translate({ x: 5, y: 5 }) - .width(this.backs[item].picWidth) - .height(200) - .backgroundColor(this.backs[item].colornumber) - .margin({ left: this.backs[item].margin }) - .borderRadius(25) - Text(this.backs[item].primaryTitle).size({ height: 35 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(18).position({ x: 20, y: 40 }) - Text(this.backs[item].secondTitle).size({ height: 20 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(16).position({ x: 20, y: 90 }) - Text(this.backs[item].scaleType).size({ height: 20 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(14).position({ x: 20, y: 120 }) - } - .direction(Direction.Ltr) - }.editable(this.editFlag) - }, item => item) - } else { - ForEach(this.numberarr, (item) => { - ListItem() { - Column({ space: 5 }) { - RoundedImageView({ model: this.datas[item] }) - Text(this.pictures[item].primaryTitle).size({ height: 35 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(18).position({ x: 20, y: 40 }) - Text(this.pictures[item].secondTitle).size({ height: 20 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(16).position({ x: 20, y: 90 }) - Text(this.pictures[item].scaleType).size({ height: 20 }).fontColor(0xFAFAFA).backgroundColor(0x7f000000).fontSize(14).position({ x: 20, y: 120 }) - }.width('100%') - .direction(Direction.Ltr) - }.editable(this.editFlag) - }, item => item) - } - ListItem() { - Column({ space: 5 }) { - Column() { - Text(' ').fontSize(30) - }.margin(15) - }.width('100%') - .direction(Direction.Ltr) - }.editable(this.editFlag) - } - .editMode(true) - .onItemDelete((index: number) => { - this.arr.splice(index - 1, 1) - this.editFlag = false - return true - }).width('90%') - } - .scrollable(ScrollDirection.Vertical).scrollBar(BarState.Off) - } - .width('100%') - .height('100%') - .backgroundColor(0xDCDCDC) - .padding({ top: 5 }) - .direction(Direction.Ltr) - } -} - - - - - - - - - - - diff --git a/entry/src/main/ets/MainAbility/pages/PictureItem.ets b/entry/src/main/ets/pages/PictureItem.ets similarity index 51% rename from entry/src/main/ets/MainAbility/pages/PictureItem.ets rename to entry/src/main/ets/pages/PictureItem.ets index f36464837b167ad5c34d248de75264d273735ae3..c2bf923368886d6f9c2b8acbc1f3a99afd5eed1f 100644 --- a/entry/src/main/ets/MainAbility/pages/PictureItem.ets +++ b/entry/src/main/ets/pages/PictureItem.ets @@ -13,24 +13,23 @@ * limitations under the License. */ -export class PictureItem { - src: string; - primaryTitle: string; - secondTitle: string; - scaleType: string; - picWidth: string; - repeat: ImageRepeat; - fit: ImageFit; - margin: number; +import { ScaleType, TileMode, SrcType } from '@ohos/roundedimageview/' - constructor(src: string, primaryTitle: string, secondTitle: string, scaleType: string, picWidth: string, repeat: ImageRepeat, fit: ImageFit, margin: number) { - this.src = src; - this.primaryTitle = primaryTitle; - this.secondTitle = secondTitle; - this.scaleType = scaleType; - this.picWidth = picWidth; - this.repeat = repeat; - this.fit = fit; - this.margin = margin; - } + +export interface PictureItem { + src: string | Resource | ArrayBuffer + srcType: SrcType + isSvg: boolean + primaryTitle: string + secondTitle: string + scaleTypeName: string + scaleType: ScaleType + tileMode: TileMode + uiWidth: number + uiHeight: number + backgroundColor: string | CanvasGradient | CanvasPattern + cornerRadius: number + borderWidth: number + borderColor: string | CanvasGradient | CanvasPattern + padding: number } diff --git a/entry/src/main/ets/pages/TypeCustomDialog.ets b/entry/src/main/ets/pages/TypeCustomDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..3b2fd3bb8b3004184f2cccfe4b1043dc1cc70c24 --- /dev/null +++ b/entry/src/main/ets/pages/TypeCustomDialog.ets @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@CustomDialog +export struct TypeCustomDialog { + private controller: CustomDialogController + private typeArr: string[] = ['Bitmap', 'Ovals', 'Color', 'Background', 'SVG'] + @Link private typeValue: string + + build() { + Row() { + Scroll() { + List({ space: 10, initialIndex: 0 }) { + ForEach(this.typeArr, (item) => { + ListItem() { + Text(item) + .width('100%') + .height(20) + .fontSize(20) + .textAlign(TextAlign.Start) + .backgroundColor(0xFFFFFF) + .onClick(() => { + this.typeValue = item + this.controller.close(); + }) + } + }, item => item) + }.backgroundColor(Color.White).width(200).padding(20) + } + } + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/index.ets b/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..23f527164215720933353d0feec76d056c340517 --- /dev/null +++ b/entry/src/main/ets/pages/index.ets @@ -0,0 +1,1070 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { PictureItem } from './PictureItem' +import { TypeCustomDialog } from './TypeCustomDialog' +import { RoundedImageView, ScaleType, TileMode, SrcType, FileUtils } from '@ohos/roundedimageview' + +@Entry +@Component +struct Index { + private picIdxArr: number [] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + private colorIdxArr: number [] = [0, 1, 2, 3, 4, 5, 6] + private uiWidth: number = px2vp(globalThis.deviceW * 0.9) + private uiHeight: number = px2vp(300) + private uriFolder: string = globalThis.globalFilesDir + "/" + "uriFolder" + private uriFile: string = this.uriFolder + "/" + "photo1.jpg" + private rectPictureItems: PictureItem [] = [ + { + src: $r('app.media.photo1'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'Tufa at night', + secondTitle: 'Mono Lake, CA', + scaleTypeName: 'CENTER', + scaleType: ScaleType.CENTER, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: $r('app.media.photo2'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'Starry night', + secondTitle: 'Lake Powell, AZ', + scaleTypeName: 'CENTER_CROP', + scaleType: ScaleType.CENTER_CROP, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: $r('app.media.photo3'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'Racetrack playa', + secondTitle: 'Death Valley, CA', + scaleTypeName: 'CENTER_INSIDE', + scaleType: ScaleType.CENTER_INSIDE, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: $r('app.media.photo4'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'Napali coast', + secondTitle: 'Kauai, HI', + scaleTypeName: 'FIT_CENTER', + scaleType: ScaleType.FIT_CENTER, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: $r('app.media.photo5'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'Delicate Arch', + secondTitle: 'Arches, UT', + scaleTypeName: 'FIT_END', + scaleType: ScaleType.FIT_END, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: $r('app.media.photo6'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'Sierra sunset', + secondTitle: 'Lone Pine, CA', + scaleTypeName: 'FIT_START', + scaleType: ScaleType.FIT_START, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: $r('app.media.photo7'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'Majestic', + secondTitle: 'Grand Teton, WY', + scaleTypeName: 'FIT_XY', + scaleType: ScaleType.FIT_XY, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: $r('app.media.black_white_tile'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'TileMode', + secondTitle: 'REPEAT', + scaleTypeName: 'FIT_XY', + scaleType: ScaleType.FIT_XY, + tileMode: TileMode.REPEAT, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: $r('app.media.black_white_tile'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'TileMode', + secondTitle: 'CLAMP', + scaleTypeName: 'FIT_XY', + scaleType: ScaleType.FIT_XY, + tileMode: TileMode.CLAMP, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: $r('app.media.black_white_tile'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'TileMode', + secondTitle: 'MIRROR', + scaleTypeName: 'FIT_XY', + scaleType: ScaleType.FIT_XY, + tileMode: TileMode.MIRROR, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + } + ] + private ovalPictureItems: PictureItem [] = [ + { + src: 'photo1.jpg', + srcType: SrcType.RAWFILE, + isSvg: false, + primaryTitle: 'Tufa at night', + secondTitle: 'Mono Lake, CA', + scaleTypeName: 'CENTER', + scaleType: ScaleType.CENTER, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 0, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: 'photo2.jpg', + srcType: SrcType.RAWFILE, + isSvg: false, + primaryTitle: 'Starry night', + secondTitle: 'Lake Powell, AZ', + scaleTypeName: 'CENTER_CROP', + scaleType: ScaleType.CENTER_CROP, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 0, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: 'photo3.jpg', + srcType: SrcType.RAWFILE, + isSvg: false, + primaryTitle: 'Racetrack playa', + secondTitle: 'Death Valley, CA', + scaleTypeName: 'CENTER_INSIDE', + scaleType: ScaleType.CENTER_INSIDE, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 0, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: 'photo4.jpg', + srcType: SrcType.RAWFILE, + isSvg: false, + primaryTitle: 'Napali coast', + secondTitle: 'Kauai, HI', + scaleTypeName: 'FIT_CENTER', + scaleType: ScaleType.FIT_CENTER, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 0, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: 'photo5.jpg', + srcType: SrcType.RAWFILE, + isSvg: false, + primaryTitle: 'Delicate Arch', + secondTitle: 'Arches, UT', + scaleTypeName: 'FIT_END', + scaleType: ScaleType.FIT_END, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 0, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: 'photo6.jpg', + srcType: SrcType.RAWFILE, + isSvg: false, + primaryTitle: 'Sierra sunset', + secondTitle: 'Lone Pine, CA', + scaleTypeName: 'FIT_START', + scaleType: ScaleType.FIT_START, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 0, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: 'photo7.jpg', + srcType: SrcType.RAWFILE, + isSvg: false, + primaryTitle: 'Majestic', + secondTitle: 'Grand Teton, WY', + scaleTypeName: 'FIT_XY', + scaleType: ScaleType.FIT_XY, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 0, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: 'black_white_tile.jpg', + srcType: SrcType.RAWFILE, + isSvg: false, + primaryTitle: 'TileMode', + secondTitle: 'REPEAT', + scaleTypeName: 'FIT_XY', + scaleType: ScaleType.FIT_XY, + tileMode: TileMode.REPEAT, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 0, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: 'black_white_tile.jpg', + srcType: SrcType.RAWFILE, + isSvg: false, + primaryTitle: 'TileMode', + secondTitle: 'CLAMP', + scaleTypeName: 'FIT_XY', + scaleType: ScaleType.FIT_XY, + tileMode: TileMode.CLAMP, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 0, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: 'black_white_tile.jpg', + srcType: SrcType.RAWFILE, + isSvg: false, + primaryTitle: 'TileMode', + secondTitle: 'MIRROR', + scaleTypeName: 'FIT_XY', + scaleType: ScaleType.FIT_XY, + tileMode: TileMode.MIRROR, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 0, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + } + ] + private colorItems: PictureItem [] = [ + { + src: null, + srcType: null, + isSvg: false, + primaryTitle: 'Color', + secondTitle: '', + scaleTypeName: 'CENTER', + scaleType: ScaleType.CENTER, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#AAAAAA', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: null, + srcType: null, + isSvg: false, + primaryTitle: 'Color', + secondTitle: '', + scaleTypeName: 'CENTER_CROP', + scaleType: ScaleType.CENTER_CROP, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#FF8800', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: null, + srcType: null, + isSvg: false, + primaryTitle: 'Color', + secondTitle: '', + scaleTypeName: 'CENTER_INSIDE', + scaleType: ScaleType.CENTER_INSIDE, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#FAFAFA', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: null, + srcType: null, + isSvg: false, + primaryTitle: 'Color', + secondTitle: '', + scaleTypeName: 'FIT_CENTER', + scaleType: ScaleType.FIT_CENTER, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#669900', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: null, + srcType: null, + isSvg: false, + primaryTitle: 'Color', + secondTitle: '', + scaleTypeName: 'FIT_END', + scaleType: ScaleType.FIT_END, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#CC0000', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: null, + srcType: null, + isSvg: false, + primaryTitle: 'Color', + secondTitle: '', + scaleTypeName: 'FIT_START', + scaleType: ScaleType.FIT_START, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#AA66CC', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: null, + srcType: null, + isSvg: false, + primaryTitle: 'Color', + secondTitle: '', + scaleTypeName: 'FIT_XY', + scaleType: ScaleType.FIT_XY, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#FFFFFF', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + ] + private backgroundColorItems: PictureItem [] = [ + { + src: 'https://hbimg.huabanimg.com/0ef60041445edcfd6b38d20e19024b2cd9281dcc3525a4-Vy8fYO_fw658/format/webp', + srcType: SrcType.URL, + isSvg: false, + primaryTitle: 'Tufa at night', + secondTitle: 'Mono Lake, CA', + scaleTypeName: 'CENTER', + scaleType: ScaleType.CENTER, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#55AA66', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 30 + }, + { + src: 'https://hbimg.huabanimg.com/0ef60041445edcfd6b38d20e19024b2cd9281dcc3525a4-Vy8fYO_fw658/format/webp', + srcType: SrcType.URL, + isSvg: false, + primaryTitle: 'Starry night', + secondTitle: 'Lake Powell, AZ', + scaleTypeName: 'CENTER_CROP', + scaleType: ScaleType.CENTER_CROP, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#55AA66', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 30 + }, + { + src: this.uriFile, + srcType: SrcType.URI, + isSvg: false, + primaryTitle: 'Racetrack playa', + secondTitle: 'Death Valley, CA', + scaleTypeName: 'CENTER_INSIDE', + scaleType: ScaleType.CENTER_INSIDE, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#55AA66', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 30 + }, + { + src: this.uriFile, + srcType: SrcType.URI, + isSvg: false, + primaryTitle: 'Napali coast', + secondTitle: 'Kauai, HI', + scaleTypeName: 'FIT_CENTER', + scaleType: ScaleType.FIT_CENTER, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#55AA66', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 30 + }, + { + src: $r('app.media.photo5'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'Delicate Arch', + secondTitle: 'Arches, UT', + scaleTypeName: 'FIT_END', + scaleType: ScaleType.FIT_END, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#55AA66', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 30 + }, + { + src: $r('app.media.photo6'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'Sierra sunset', + secondTitle: 'Lone Pine, CA', + scaleTypeName: 'FIT_START', + scaleType: ScaleType.FIT_START, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#55AA66', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 30 + }, + { + src: $r('app.media.photo7'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'Majestic', + secondTitle: 'Grand Teton, WY', + scaleTypeName: 'FIT_XY', + scaleType: ScaleType.FIT_XY, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#55AA66', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 30 + }, + { + src: $r('app.media.black_white_tile'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'TileMode', + secondTitle: 'REPEAT', + scaleTypeName: 'FIT_XY', + scaleType: ScaleType.FIT_XY, + tileMode: TileMode.REPEAT, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#55AA66', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 30 + }, + { + src: $r('app.media.black_white_tile'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'TileMode', + secondTitle: 'CLAMP', + scaleTypeName: 'FIT_XY', + scaleType: ScaleType.FIT_XY, + tileMode: TileMode.CLAMP, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#55AA66', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 30 + }, + { + src: $r('app.media.black_white_tile'), + srcType: SrcType.MEDIA, + isSvg: false, + primaryTitle: 'TileMode', + secondTitle: 'MIRROR', + scaleTypeName: 'FIT_XY', + scaleType: ScaleType.FIT_XY, + tileMode: TileMode.MIRROR, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: '#55AA66', + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 30 + } + ] + private svgItems: PictureItem [] = [ + { + src: $r('app.media.ic_svg'), + srcType: SrcType.MEDIA, + isSvg: true, + primaryTitle: 'SVG', + secondTitle: '', + scaleTypeName: 'CENTER', + scaleType: ScaleType.CENTER, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: $r('app.media.ic_svg'), + srcType: SrcType.MEDIA, + isSvg: true, + primaryTitle: 'SVG', + secondTitle: '', + scaleTypeName: 'CENTER_CROP', + scaleType: ScaleType.CENTER_CROP, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: $r('app.media.ic_svg'), + srcType: SrcType.MEDIA, + isSvg: true, + primaryTitle: 'SVG', + secondTitle: '', + scaleTypeName: 'CENTER_INSIDE', + scaleType: ScaleType.CENTER_INSIDE, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: 'ic_svg.svg', + srcType: SrcType.RAWFILE, + isSvg: true, + primaryTitle: 'SVG', + secondTitle: '', + scaleTypeName: 'FIT_CENTER', + scaleType: ScaleType.FIT_CENTER, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: 'ic_svg.svg', + srcType: SrcType.RAWFILE, + isSvg: true, + primaryTitle: 'SVG', + secondTitle: '', + scaleTypeName: 'FIT_END', + scaleType: ScaleType.FIT_END, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: 'ic_svg.svg', + srcType: SrcType.RAWFILE, + isSvg: true, + primaryTitle: 'SVG', + secondTitle: '', + scaleTypeName: 'FIT_START', + scaleType: ScaleType.FIT_START, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + { + src: 'ic_svg.svg', + srcType: SrcType.RAWFILE, + isSvg: true, + primaryTitle: 'SVG', + secondTitle: '', + scaleTypeName: 'FIT_XY', + scaleType: ScaleType.FIT_XY, + tileMode: null, + uiWidth: this.uiWidth, + uiHeight: this.uiHeight, + backgroundColor: null, + cornerRadius: 25, + borderWidth: 10, + borderColor: '#317AF7', + padding: 0 + }, + ] + @State editFlag: boolean = false + @State @Watch("typeValueUpdated") typeValue: string = 'Bitmap' + private scroller: Scroller = new Scroller() + + private typeValueUpdated(): void { + if (this.typeValue == 'Bitmap') { + this.rectPictureItems.forEach((val, idx) => { + this.datas[idx] + .setImageSrc(this.rectPictureItems[idx].src) + .setSrcType(this.rectPictureItems[idx].srcType) + .setIsSvg(this.rectPictureItems[idx].isSvg) + .setTypeValue(this.typeValue) + .setUiWidth(this.rectPictureItems[idx].uiWidth) + .setUiHeight(this.rectPictureItems[idx].uiHeight) + .setScaleType(this.rectPictureItems[idx].scaleType) + .setTileModeXY(this.rectPictureItems[idx].tileMode) + .setCornerRadius(this.rectPictureItems[idx].cornerRadius) + .setBorderWidth(this.rectPictureItems[idx].borderWidth) + .setBorderColor(this.rectPictureItems[idx].borderColor) + .setPadding(this.rectPictureItems[idx].padding) + }); + } else if (this.typeValue == 'Ovals') { + this.ovalPictureItems.forEach((val, idx) => { + this.datas[idx] + .setImageSrc(this.ovalPictureItems[idx].src) + .setSrcType(this.ovalPictureItems[idx].srcType) + .setIsSvg(this.ovalPictureItems[idx].isSvg) + .setTypeValue(this.typeValue) + .setUiWidth(this.ovalPictureItems[idx].uiWidth) + .setUiHeight(this.ovalPictureItems[idx].uiHeight) + .setScaleType(this.ovalPictureItems[idx].scaleType) + .setTileModeXY(this.ovalPictureItems[idx].tileMode) + .setBorderWidth(this.ovalPictureItems[idx].borderWidth) + .setBorderColor(this.ovalPictureItems[idx].borderColor) + .setPadding(this.ovalPictureItems[idx].padding) + }); + } else if (this.typeValue == 'Color') { + this.colorItems.forEach((val, idx) => { + this.datas[idx].setBackgroundColor(this.colorItems[idx].backgroundColor) + .setIsSvg(this.colorItems[idx].isSvg) + .setTypeValue(this.typeValue) + .setUiWidth(this.colorItems[idx].uiWidth) + .setUiHeight(this.colorItems[idx].uiHeight) + .setScaleType(this.colorItems[idx].scaleType) + .setCornerRadius(this.colorItems[idx].cornerRadius) + .setBorderWidth(this.colorItems[idx].borderWidth) + .setBorderColor(this.colorItems[idx].borderColor) + .setPadding(this.colorItems[idx].padding) + .setColorWidth(this.uiHeight) + .setColorHeight(this.uiHeight) + }); + } else if (this.typeValue == 'Background') { + this.backgroundColorItems.forEach((val, idx) => { + this.datas[idx] + .setImageSrc(this.backgroundColorItems[idx].src) + .setSrcType(this.backgroundColorItems[idx].srcType) + .setIsSvg(this.backgroundColorItems[idx].isSvg) + .setBackgroundColor(this.backgroundColorItems[idx].backgroundColor) + .setTypeValue(this.typeValue) + .setUiWidth(this.backgroundColorItems[idx].uiWidth) + .setUiHeight(this.backgroundColorItems[idx].uiHeight) + .setScaleType(this.backgroundColorItems[idx].scaleType) + .setTileModeXY(this.backgroundColorItems[idx].tileMode) + .setCornerRadius(this.backgroundColorItems[idx].cornerRadius) + .setBorderWidth(this.backgroundColorItems[idx].borderWidth) + .setBorderColor(this.backgroundColorItems[idx].borderColor) + .setPadding(this.backgroundColorItems[idx].padding) + }); + } else if (this.typeValue == 'SVG') { + this.svgItems.forEach((val, idx) => { + this.datas[idx] + .setImageSrc(this.svgItems[idx].src) + .setSrcType(this.svgItems[idx].srcType) + .setIsSvg(this.svgItems[idx].isSvg) + .setTypeValue(this.typeValue) + .setUiWidth(this.svgItems[idx].uiWidth) + .setUiHeight(this.svgItems[idx].uiHeight) + .setScaleType(this.svgItems[idx].scaleType) + .setTileModeXY(this.svgItems[idx].tileMode) + .setCornerRadius(this.svgItems[idx].cornerRadius) + .setBorderWidth(this.svgItems[idx].borderWidth) + .setBorderColor(this.svgItems[idx].borderColor) + .setPadding(this.svgItems[idx].padding) + }); + } + this.scroller.scrollTo({ xOffset: 0, yOffset: 0, animation: { duration: 2000, curve: Curve.Ease } }) + } + + @State datas: RoundedImageView.Model [] = [ + new RoundedImageView.Model(), new RoundedImageView.Model(), new RoundedImageView.Model(), + new RoundedImageView.Model(), new RoundedImageView.Model(), new RoundedImageView.Model(), + new RoundedImageView.Model(), new RoundedImageView.Model(), new RoundedImageView.Model(), + new RoundedImageView.Model() + ]; + private dialogController: CustomDialogController = new CustomDialogController({ + alignment: DialogAlignment.Top, + builder: TypeCustomDialog({ typeValue: $typeValue }), + autoCancel: true + }) + + aboutToAppear() { + this.typeValueUpdated() + this.initUri() + } + + private initUri() { + FileUtils.getInstance().createFolder(this.uriFolder) + globalThis.resourceManager.getMedia($r('app.media.photo1').id, (error, value) => { + FileUtils.getInstance().writePic(this.uriFile, value.buffer) + }) + } + + @State showPromptInformation: boolean = false + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + if (!this.showPromptInformation) { + Column() { + Column() { + Image($r('app.media.down')).width(30).height(30).position({ x: -30, y: 5 }).onClick(() => { + this.dialogController.open() + }) + Text(' select:' + this.typeValue).fontSize(30) + }.margin(15) + + Scroll(this.scroller) { + List({ space: 10, initialIndex: 0 }) { + if (this.typeValue == 'Bitmap') { + ForEach(this.picIdxArr, (item) => { + ListItem() { + Column({ space: 5 }) { + RoundedImageView({ model: this.datas[item] }) + Text(this.rectPictureItems[item].primaryTitle) + .size({ height: 35 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(18) + .position({ x: 20, y: 40 }) + Text(this.rectPictureItems[item].secondTitle) + .size({ height: 20 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(16) + .position({ x: 20, y: 90 }) + Text(this.rectPictureItems[item].scaleTypeName) + .size({ height: 20 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(14) + .position({ x: 20, y: 120 }) + }.width('100%') + .direction(Direction.Rtl) + }.editable(false) + }, item => item) + + } else if (this.typeValue == 'Ovals') { + ForEach(this.picIdxArr, (item) => { + ListItem() { + Column({ space: 5 }) { + RoundedImageView({ model: this.datas[item] }) + Text(this.ovalPictureItems[item].primaryTitle) + .size({ height: 35 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(18) + .position({ x: 20, y: 40 }) + Text(this.ovalPictureItems[item].secondTitle) + .size({ height: 20 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(16) + .position({ x: 20, y: 90 }) + Text(this.ovalPictureItems[item].scaleTypeName) + .size({ height: 20 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(14) + .position({ x: 20, y: 120 }) + }.width('100%') + .direction(Direction.Ltr) + }.editable(false) + }, item => item) + + } else if (this.typeValue == 'Color') { + ForEach(this.colorIdxArr, (item) => { + ListItem() { + Column({ space: 5 }) { + RoundedImageView({ model: this.datas[item] }) + Text(this.colorItems[item].primaryTitle) + .size({ height: 35 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(18) + .position({ x: 20, y: 40 }) + Text(this.colorItems[item].secondTitle) + .size({ height: 20 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(16) + .position({ x: 20, y: 90 }) + Text(this.colorItems[item].scaleTypeName) + .size({ height: 20 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(14) + .position({ x: 20, y: 120 }) + } + .direction(Direction.Ltr) + }.editable(false) + }, item => item) + } else if (this.typeValue == 'Background') { + ForEach(this.picIdxArr, (item) => { + ListItem() { + Column({ space: 5 }) { + RoundedImageView({ model: this.datas[item] }) + Text(this.backgroundColorItems[item].primaryTitle) + .size({ height: 35 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(18) + .position({ x: 20, y: 40 }) + Text(this.backgroundColorItems[item].secondTitle) + .size({ height: 20 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(16) + .position({ x: 20, y: 90 }) + Text(this.backgroundColorItems[item].scaleTypeName) + .size({ height: 20 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(14) + .position({ x: 20, y: 120 }) + }.width('100%') + .direction(Direction.Ltr) + }.editable(false) + }, item => item) + } else if (this.typeValue == 'SVG') { + ForEach(this.colorIdxArr, (item) => { + ListItem() { + Column({ space: 5 }) { + RoundedImageView({ model: this.datas[item] }) + Text(this.svgItems[item].primaryTitle) + .size({ height: 35 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(18) + .position({ x: 20, y: 40 }) + Text(this.svgItems[item].secondTitle) + .size({ height: 20 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(16) + .position({ x: 20, y: 90 }) + Text(this.svgItems[item].scaleTypeName) + .size({ height: 20 }) + .fontColor(0xFAFAFA) + .backgroundColor(0x7f000000) + .fontSize(14) + .position({ x: 20, y: 120 }) + }.width('100%') + .direction(Direction.Ltr) + }.editable(false) + }, item => item) + } + } + } + .scrollable(ScrollDirection.Vertical).scrollBar(BarState.Off) + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 20, bottom: 100 }) + } else { + Column() { + Text("请点击确认按钮,展示效果").margin(30) + Button("确认").onClick(() => { + this.showPromptInformation = true + }).fontSize(30).margin(30) + } + } + } + } +} diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..2a6aeebce06c0ca032957c485bc115a32045da29 --- /dev/null +++ b/entry/src/main/module.json5 @@ -0,0 +1,50 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "requestPermissions": [ + { + "name": "ohos.permission.INTERNET" + }, + // { + // "name": "ohos.permission.READ_MEDIA" + // }, + // { + // "name": "ohos.permission.WRITE_MEDIA" + // } + ], + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/color.json b/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbc9aa9617e97c45440e1d3d66afc1154837012 --- /dev/null +++ b/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index b93f540e29265a34f883a977c442fa85349b94ca..490210a3908f47722dc942d49dacc98b97669a5f 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -1,12 +1,16 @@ { "string": [ { - "name": "entry_MainAbility", - "value": "entry_MainAbility" + "name": "entry_desc", + "value": "description" }, { - "name": "description_mainability", - "value": "eTS_Empty Ability" + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/base/media/black_white_tile.jpg b/entry/src/main/resources/base/media/black_white_tile.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9628a1566a0576e601e17ae5b492a5c000233b2d Binary files /dev/null and b/entry/src/main/resources/base/media/black_white_tile.jpg differ diff --git a/entry/src/main/resources/rawfile/down.png b/entry/src/main/resources/base/media/down.png similarity index 100% rename from entry/src/main/resources/rawfile/down.png rename to entry/src/main/resources/base/media/down.png diff --git a/entry/src/main/resources/base/media/ic_svg.svg b/entry/src/main/resources/base/media/ic_svg.svg new file mode 100644 index 0000000000000000000000000000000000000000..a82bbdf1df215c815bd78c63dea1d36bfceb4aa0 --- /dev/null +++ b/entry/src/main/resources/base/media/ic_svg.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/entry/src/main/resources/base/media/photo1.jpg b/entry/src/main/resources/base/media/photo1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..407d55c451f47507bb8a468871cfb9535f4d7d0c Binary files /dev/null and b/entry/src/main/resources/base/media/photo1.jpg differ diff --git a/entry/src/main/resources/base/media/photo2.jpg b/entry/src/main/resources/base/media/photo2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4ab6485132ba728d756641846cea9486f7d731c9 Binary files /dev/null and b/entry/src/main/resources/base/media/photo2.jpg differ diff --git a/entry/src/main/resources/base/media/photo3.jpg b/entry/src/main/resources/base/media/photo3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c259fddf09fa4a27955b2a69b1cab632a857a2c9 Binary files /dev/null and b/entry/src/main/resources/base/media/photo3.jpg differ diff --git a/entry/src/main/resources/base/media/photo4.jpg b/entry/src/main/resources/base/media/photo4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c3a086e591cde291b215cc360bab86fd25122f7a Binary files /dev/null and b/entry/src/main/resources/base/media/photo4.jpg differ diff --git a/entry/src/main/resources/base/media/photo5.jpg b/entry/src/main/resources/base/media/photo5.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7eb134e01be4f5475e115c0f7b024efb3b71e5b3 Binary files /dev/null and b/entry/src/main/resources/base/media/photo5.jpg differ diff --git a/entry/src/main/resources/base/media/photo6.jpg b/entry/src/main/resources/base/media/photo6.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a8c859d095e79bf96cfea09066659143259fe82e Binary files /dev/null and b/entry/src/main/resources/base/media/photo6.jpg differ diff --git a/entry/src/main/resources/base/media/photo7.jpg b/entry/src/main/resources/base/media/photo7.jpg new file mode 100644 index 0000000000000000000000000000000000000000..47cfe1c856ce0b9b9f7fbe9ae236d528e21337a3 Binary files /dev/null and b/entry/src/main/resources/base/media/photo7.jpg differ diff --git a/entry/src/main/resources/base/profile/main_pages.json b/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..feec276e105eeb8d621c20aaf838f318b0a94150 --- /dev/null +++ b/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} diff --git a/entry/src/main/resources/rawfile/black_white_tile.jpg b/entry/src/main/resources/rawfile/black_white_tile.jpg index 0da971062df85256e22ea27d501d2183918ae600..9628a1566a0576e601e17ae5b492a5c000233b2d 100644 Binary files a/entry/src/main/resources/rawfile/black_white_tile.jpg and b/entry/src/main/resources/rawfile/black_white_tile.jpg differ diff --git a/entry/src/main/resources/rawfile/ic_svg.svg b/entry/src/main/resources/rawfile/ic_svg.svg new file mode 100644 index 0000000000000000000000000000000000000000..a82bbdf1df215c815bd78c63dea1d36bfceb4aa0 --- /dev/null +++ b/entry/src/main/resources/rawfile/ic_svg.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/entry/src/main/resources/rawfile/photo1.jpg b/entry/src/main/resources/rawfile/photo1.jpg index 3c4d15019818640cd309b38ec22e30bf02060cee..407d55c451f47507bb8a468871cfb9535f4d7d0c 100644 Binary files a/entry/src/main/resources/rawfile/photo1.jpg and b/entry/src/main/resources/rawfile/photo1.jpg differ diff --git a/entry/src/main/resources/rawfile/photo2.jpg b/entry/src/main/resources/rawfile/photo2.jpg index 0485934abe4b87cebd71fa128b7843e12e7c2dbe..4ab6485132ba728d756641846cea9486f7d731c9 100644 Binary files a/entry/src/main/resources/rawfile/photo2.jpg and b/entry/src/main/resources/rawfile/photo2.jpg differ diff --git a/entry/src/main/resources/rawfile/photo3.jpg b/entry/src/main/resources/rawfile/photo3.jpg index d25688b1ca6fbe60728be664efe2742836efdb76..c259fddf09fa4a27955b2a69b1cab632a857a2c9 100644 Binary files a/entry/src/main/resources/rawfile/photo3.jpg and b/entry/src/main/resources/rawfile/photo3.jpg differ diff --git a/entry/src/main/resources/rawfile/photo4.jpg b/entry/src/main/resources/rawfile/photo4.jpg index d5ff654cdd55d4b3056a55521a6ea429a16e4ee6..c3a086e591cde291b215cc360bab86fd25122f7a 100644 Binary files a/entry/src/main/resources/rawfile/photo4.jpg and b/entry/src/main/resources/rawfile/photo4.jpg differ diff --git a/entry/src/main/resources/rawfile/photo5.jpg b/entry/src/main/resources/rawfile/photo5.jpg index ccf589d97cba95cffb89807f1585425c16928542..7eb134e01be4f5475e115c0f7b024efb3b71e5b3 100644 Binary files a/entry/src/main/resources/rawfile/photo5.jpg and b/entry/src/main/resources/rawfile/photo5.jpg differ diff --git a/entry/src/main/resources/rawfile/photo6.jpg b/entry/src/main/resources/rawfile/photo6.jpg index aed456f5d46a173c6b375a1b56e1b36e6cbffe40..a8c859d095e79bf96cfea09066659143259fe82e 100644 Binary files a/entry/src/main/resources/rawfile/photo6.jpg and b/entry/src/main/resources/rawfile/photo6.jpg differ diff --git a/entry/src/main/resources/rawfile/photo7.jpg b/entry/src/main/resources/rawfile/photo7.jpg index 486999dba5bfb0e731785cecff16b9e042e3c6bb..47cfe1c856ce0b9b9f7fbe9ae236d528e21337a3 100644 Binary files a/entry/src/main/resources/rawfile/photo7.jpg and b/entry/src/main/resources/rawfile/photo7.jpg differ diff --git a/entry/src/ohosTest/config.json b/entry/src/ohosTest/config.json deleted file mode 100644 index 913cd4747bbcb2dfaf8d4493d8a119fc8f8e0a08..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/config.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "app": { - "bundleName": "cn.openharmony.ohos_app_roundedimageview", - "vendor": "example", - "version": { - "code": 1000000, - "name": "1.0.0" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.entry_test", - "name": ".entry_test", - "mainAbility": ".TestAbility", - "srcPath": "", - "deviceType": [ - "phone", - "tablet" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry_test", - "moduleType": "feature", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "TestAbility", - "name": ".TestAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_TestAbility", - "formsEnabled": false, - "label": "$string:entry_TestAbility", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".TestAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/TestAbility/TestAbility.ts b/entry/src/ohosTest/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..28023e29fdf6c17cbd87bb5d1ac788040e1ac0e7 --- /dev/null +++ b/entry/src/ohosTest/ets/TestAbility/TestAbility.ts @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'TestAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/TestAbility/pages/index.ets b/entry/src/ohosTest/ets/TestAbility/pages/index.ets index 52663437cb619d4598126cf403d3689cb31ba131..e01cde44cf860f6e5431fcc321bfc926265d4873 100644 --- a/entry/src/ohosTest/ets/TestAbility/pages/index.ets +++ b/entry/src/ohosTest/ets/TestAbility/pages/index.ets @@ -12,7 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import router from '@system.router'; + +import router from '@ohos.router'; @Entry @Component @@ -20,7 +21,6 @@ struct Index { aboutToAppear() { console.info('TestAbility index aboutToAppear') } - @State message: string = 'Hello World' build() { Row() { @@ -46,4 +46,4 @@ struct Index { } .height('100%') } - } \ No newline at end of file + } diff --git a/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts b/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..907a53f7a23674efec30e86bbf1eb56755d3403f --- /dev/null +++ b/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/test/Ability.test.ets b/entry/src/ohosTest/ets/test/Ability.test.ets index 22f7b08fb5975c818bc182321d1287e2ec078084..1e849d6ced186c595212cd883de3a7e59e680a41 100644 --- a/entry/src/ohosTest/ets/test/Ability.test.ets +++ b/entry/src/ohosTest/ets/test/Ability.test.ets @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' export default function abilityTest() { @@ -24,4 +25,4 @@ export default function abilityTest() { expect(a).assertEqual(a) }) }) -} \ No newline at end of file +} diff --git a/entry/src/ohosTest/ets/test/List.test.ets b/entry/src/ohosTest/ets/test/List.test.ets index d3c6829736da03b72073961f894ed5bb257b4ab7..c1b0510a9b605992ea50b8d352d337d1dac792a2 100644 --- a/entry/src/ohosTest/ets/test/List.test.ets +++ b/entry/src/ohosTest/ets/test/List.test.ets @@ -12,8 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import abilityTest from './Ability.test' export default function testsuite() { abilityTest() -} \ No newline at end of file +} diff --git a/entry/src/ohosTest/module.json5 b/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4cf8a1f0548b082176ac5a275e2db782d0bb0e5d --- /dev/null +++ b/entry/src/ohosTest/module.json5 @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry_test", + "type": "feature", + "srcEntrance": "./ets/TestAbility/TestAbility.ts", + "description": "$string:entry_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "TestAbility", + "srcEntrance": "./ets/TestAbility/TestAbility.ts", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "visible": true, + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/entry/src/ohosTest/resources/base/element/string.json b/entry/src/ohosTest/resources/base/element/string.json index a0901cfced5abc1cb836b55896884b769adc7175..8407800739f589b2e0620ae2cd1601f8a338721a 100644 --- a/entry/src/ohosTest/resources/base/element/string.json +++ b/entry/src/ohosTest/resources/base/element/string.json @@ -1,12 +1,16 @@ { "string": [ { - "name": "description_TestAbility", - "value": "eTS_Empty Ability" + "name": "entry_test_desc", + "value": "i am an entry for tv" }, { - "name": "entry_TestAbility", - "value": "entry_TestAbility" + "name": "TestAbility_desc", + "value": "the tv entry test ability" + }, + { + "name": "TestAbility_label", + "value": "tvBase" } ] } \ No newline at end of file diff --git a/entry/src/ohosTest/resources/base/profile/test_pages.json b/entry/src/ohosTest/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..fcef82b4dfc18e28106ff9ecd1c8b48ec74d18a4 --- /dev/null +++ b/entry/src/ohosTest/resources/base/profile/test_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "TestAbility/pages/index" + ] +} diff --git a/hvigorfile.js b/hvigorfile.js index cff9f0dfcf8cb00cca34e7f50d61380cf5496868..5f2735e3deeaf655828407544bbed9365c258278 100644 --- a/hvigorfile.js +++ b/hvigorfile.js @@ -1,2 +1,2 @@ // Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. -module.exports = require('@ohos/hvigor-ohos-plugin').legacyAppTasks \ No newline at end of file +module.exports = require('@ohos/hvigor-ohos-plugin').appTasks \ No newline at end of file diff --git a/image/image_background.png b/image/image_background.png new file mode 100644 index 0000000000000000000000000000000000000000..8f6bbce0079c8f1cac7ef6f3842be977b77e5b24 Binary files /dev/null and b/image/image_background.png differ diff --git a/image/image_bitmap.png b/image/image_bitmap.png new file mode 100644 index 0000000000000000000000000000000000000000..14b2ebedaa017f735e98242105fb332d5d723b6a Binary files /dev/null and b/image/image_bitmap.png differ diff --git a/image/image_color.png b/image/image_color.png new file mode 100644 index 0000000000000000000000000000000000000000..4a259bbad50100453708ddc3c37eac68a26693ee Binary files /dev/null and b/image/image_color.png differ diff --git a/image/image_ovals.png b/image/image_ovals.png new file mode 100644 index 0000000000000000000000000000000000000000..05b34dc52472de64571263c70a8073a33438392b Binary files /dev/null and b/image/image_ovals.png differ diff --git a/image/imageview.gif b/image/imageview.gif deleted file mode 100644 index df7ca391250bfbeaa0c5ac456ba133bc844f9865..0000000000000000000000000000000000000000 Binary files a/image/imageview.gif and /dev/null differ diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 51a7a038b250f2a0588e2307f657b9d122d9ea4c..0000000000000000000000000000000000000000 --- a/package-lock.json +++ /dev/null @@ -1,1643 +0,0 @@ -{ - "name": "ohos_app_roundedimageview", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@ohos/hvigor": { - "version": "1.0.6", - "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor/-/@ohos/hvigor-1.0.6.tgz", - "integrity": "sha512-jjp7vpvUOMW1Nf7TdyhOtonwWHoSyBJLUiZTQqIx/GJV4UJyIqsiURUOqFwncQ4L7PDdeHuWly4uEelknYeWhg==", - "requires": { - "@ohos/hvigor-base": "1.0.6", - "interpret": "1.4.0", - "liftoff": "4.0.0", - "mute-stdout": "1.0.0", - "pretty-hrtime": "1.0.0", - "v8flags": "3.2.0", - "yargs": "7.1.0" - } - }, - "@ohos/hvigor-base": { - "version": "1.0.6", - "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor-base/-/@ohos/hvigor-base-1.0.6.tgz", - "integrity": "sha512-cRDnWICTxmpNiFb9clIioqP5Oik1seLCICztXVhZqultrHuxwTheCRUZrHwlpyWdkSB2Al+FFBqmSwzIgZX4IQ==", - "requires": { - "json5": "2.2.0", - "log4js": "6.4.1", - "undertaker": "1.2.1" - } - }, - "@ohos/hvigor-ohos-plugin": { - "version": "1.0.6", - "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor-ohos-plugin/-/@ohos/hvigor-ohos-plugin-1.0.6.tgz", - "integrity": "sha512-MAAi8uJxMzODUoSSNfBr+fU4HQ20dfQtkje9I+X4asc7qY2kAplW/q9f5XS8IOvv8zhC8OcSgsAXOAJuLMstOQ==", - "requires": { - "@ohos/hvigor-base": "1.0.6", - "@ohos/sdkmanager-common": "1.1.3", - "ajv": "8.10.0", - "archiver": "5.3.0", - "execa": "5.1.1", - "fs-extra": "10.0.0", - "glob": "7.2.0", - "iconv-lite": "0.6.3", - "json5": "2.2.0", - "lodash": "4.17.21", - "pretty-hrtime": "1.0.3", - "resolve-package-path": "4.0.3" - }, - "dependencies": { - "fs-extra": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", - "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, - "pretty-hrtime": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", - "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=" - } - } - }, - "@ohos/sdkmanager-common": { - "version": "1.1.3", - "resolved": "https://repo.harmonyos.com/npm/@ohos/sdkmanager-common/-/@ohos/sdkmanager-common-1.1.3.tgz", - "integrity": "sha512-d2uhVauDDJZIUvyyaWWoavG4N/jLyfF5IH5kEXKV6R8HNf3606H1zDQzA+UZtOfwwJFXhD9djRjnVFNB8xc7aw==" - }, - "ajv": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz", - "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "archiver": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/archiver/-/archiver-5.3.0.tgz", - "integrity": "sha512-iUw+oDwK0fgNpvveEsdQ0Ase6IIKztBJU2U0E9MzszMfmVVUyv1QJhS2ITW9ZCqx8dktAxVAjWWkKehuZE8OPg==", - "requires": { - "archiver-utils": "^2.1.0", - "async": "^3.2.0", - "buffer-crc32": "^0.2.1", - "readable-stream": "^3.6.0", - "readdir-glob": "^1.0.0", - "tar-stream": "^2.2.0", - "zip-stream": "^4.1.0" - } - }, - "archiver-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-2.1.0.tgz", - "integrity": "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==", - "requires": { - "glob": "^7.1.4", - "graceful-fs": "^4.2.0", - "lazystream": "^1.0.0", - "lodash.defaults": "^4.2.0", - "lodash.difference": "^4.5.0", - "lodash.flatten": "^4.4.0", - "lodash.isplainobject": "^4.0.6", - "lodash.union": "^4.6.0", - "normalize-path": "^3.0.0", - "readable-stream": "^2.0.0" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - } - } - }, - "arr-filter": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/arr-filter/-/arr-filter-1.1.2.tgz", - "integrity": "sha1-Q/3d0JHo7xGqTEXZzcGOLf8XEe4=", - "requires": { - "make-iterator": "^1.0.0" - } - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" - }, - "arr-map": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/arr-map/-/arr-map-2.0.2.tgz", - "integrity": "sha1-Onc0X/wc814qkYJWAfnljy4kysQ=", - "requires": { - "make-iterator": "^1.0.0" - } - }, - "array-each": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", - "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=" - }, - "array-initial": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/array-initial/-/array-initial-1.1.0.tgz", - "integrity": "sha1-L6dLJnOTccOUe9enrcc74zSz15U=", - "requires": { - "array-slice": "^1.0.0", - "is-number": "^4.0.0" - } - }, - "array-last": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/array-last/-/array-last-1.3.0.tgz", - "integrity": "sha512-eOCut5rXlI6aCOS7Z7kCplKRKyiFQ6dHFBem4PwlwKeNFk2/XxTrhRh5T9PyaEWGy/NHTZWbY+nsZlNFJu9rYg==", - "requires": { - "is-number": "^4.0.0" - } - }, - "array-slice": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", - "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==" - }, - "async": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", - "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==" - }, - "async-done": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/async-done/-/async-done-1.3.2.tgz", - "integrity": "sha512-uYkTP8dw2og1tu1nmza1n1CMW0qb8gWWlwqMmLb7MhBVs4BXrFziT6HXUd+/RlRA/i4H9AkofYloUbs1fwMqlw==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.2", - "process-nextick-args": "^2.0.0", - "stream-exhaust": "^1.0.1" - } - }, - "async-settle": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-settle/-/async-settle-1.0.0.tgz", - "integrity": "sha1-HQqRS7Aldb7IqPOnTlCA9yssDGs=", - "requires": { - "async-done": "^1.2.2" - } - }, - "bach": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", - "integrity": "sha1-Szzpa/JxNPeaG0FKUcFONMO9mIA=", - "requires": { - "arr-filter": "^1.1.1", - "arr-flatten": "^1.0.1", - "arr-map": "^2.0.0", - "array-each": "^1.0.0", - "array-initial": "^1.0.0", - "array-last": "^1.1.1", - "async-done": "^1.2.2", - "async-settle": "^1.0.0", - "now-and-later": "^2.0.0" - } - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" - }, - "bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "requires": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "requires": { - "fill-range": "^7.0.1" - } - }, - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" - }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=" - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - } - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" - }, - "collection-map": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-map/-/collection-map-1.0.0.tgz", - "integrity": "sha1-rqDwb40mx4DCt1SUOFVEsiVa8Yw=", - "requires": { - "arr-map": "^2.0.2", - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" - } - }, - "compress-commons": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.1.tgz", - "integrity": "sha512-QLdDLCKNV2dtoTorqgxngQCMA+gWXkM/Nwu7FpeBhk/RdkzimqC3jueb/FDmaZeXh+uby1jkBqE3xArsLBE5wQ==", - "requires": { - "buffer-crc32": "^0.2.13", - "crc32-stream": "^4.0.2", - "normalize-path": "^3.0.0", - "readable-stream": "^3.6.0" - } - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" - }, - "crc-32": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", - "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==" - }, - "crc32-stream": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-4.0.2.tgz", - "integrity": "sha512-DxFZ/Hk473b/muq1VJ///PMNLj0ZMnzye9thBpmjpJKCc5eMgB95aK8zCGrGfQ90cWo561Te6HK9D+j4KPdM6w==", - "requires": { - "crc-32": "^1.2.0", - "readable-stream": "^3.4.0" - } - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "dependencies": { - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "d": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", - "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", - "requires": { - "es5-ext": "^0.10.50", - "type": "^1.0.1" - } - }, - "date-format": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.6.tgz", - "integrity": "sha512-B9vvg5rHuQ8cbUXE/RMWMyX2YA5TecT3jKF5fLtGNlzPlU7zblSPmAm2OImDbWL+LDOQ6pUm+4LOFz+ywS41Zw==" - }, - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "requires": { - "ms": "2.1.2" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" - }, - "default-resolution": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/default-resolution/-/default-resolution-2.0.0.tgz", - "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=" - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "requires": { - "object-keys": "^1.0.12" - } - }, - "detect-file": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", - "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=" - }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "requires": { - "once": "^1.4.0" - } - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es5-ext": { - "version": "0.10.60", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.60.tgz", - "integrity": "sha512-jpKNXIt60htYG59/9FGf2PYT3pwMpnEbNKysU+k/4FGwyGtMotOvcZOuW+EmXXYASRqYSXQfGL5cVIthOTgbkg==", - "requires": { - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.3", - "next-tick": "^1.1.0" - } - }, - "es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", - "requires": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" - } - }, - "es6-symbol": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", - "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", - "requires": { - "d": "^1.0.1", - "ext": "^1.1.2" - } - }, - "es6-weak-map": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz", - "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==", - "requires": { - "d": "1", - "es5-ext": "^0.10.46", - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.1" - } - }, - "execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "requires": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - } - }, - "expand-tilde": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", - "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", - "requires": { - "homedir-polyfill": "^1.0.1" - } - }, - "ext": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ext/-/ext-1.6.0.tgz", - "integrity": "sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg==", - "requires": { - "type": "^2.5.0" - }, - "dependencies": { - "type": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/type/-/type-2.6.0.tgz", - "integrity": "sha512-eiDBDOmkih5pMbo9OqsqPRGMljLodLcwd5XD5JbtNB0o89xZAwynY9EdCDsJU7LtcVCClu9DvM7/0Ep1hYX3EQ==" - } - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "findup-sync": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-5.0.0.tgz", - "integrity": "sha512-MzwXju70AuyflbgeOhzvQWAvvQdo1XL0A9bVvlXsYcFEBM87WR4OakL4OfZq+QRmr+duJubio+UtNQCPsVESzQ==", - "requires": { - "detect-file": "^1.0.0", - "is-glob": "^4.0.3", - "micromatch": "^4.0.4", - "resolve-dir": "^1.0.1" - } - }, - "fined": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fined/-/fined-2.0.0.tgz", - "integrity": "sha512-OFRzsL6ZMHz5s0JrsEr+TpdGNCtrVtnuG3x1yzGNiQHT0yaDnXAj8V/lWcpJVrnoDpcwXcASxAZYbuXda2Y82A==", - "requires": { - "expand-tilde": "^2.0.2", - "is-plain-object": "^5.0.0", - "object.defaults": "^1.1.0", - "object.pick": "^1.3.0", - "parse-filepath": "^1.0.2" - } - }, - "flagged-respawn": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-2.0.0.tgz", - "integrity": "sha512-Gq/a6YCi8zexmGHMuJwahTGzXlAZAOsbCVKduWXC6TlLCjjFRlExMJc4GC2NYPYZ0r/brw9P7CpRgQmlPVeOoA==" - }, - "flatted": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", - "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==" - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" - }, - "for-own": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", - "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", - "requires": { - "for-in": "^1.0.1" - } - }, - "fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" - }, - "fs-extra": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.1.tgz", - "integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==", - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" - }, - "get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - } - }, - "get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" - }, - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "global-modules": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", - "requires": { - "global-prefix": "^1.0.1", - "is-windows": "^1.0.1", - "resolve-dir": "^1.0.0" - } - }, - "global-prefix": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", - "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", - "requires": { - "expand-tilde": "^2.0.2", - "homedir-polyfill": "^1.0.1", - "ini": "^1.3.4", - "is-windows": "^1.0.1", - "which": "^1.2.14" - } - }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" - }, - "homedir-polyfill": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", - "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", - "requires": { - "parse-passwd": "^1.0.0" - } - }, - "hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" - }, - "human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==" - }, - "hypium": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/hypium/-/hypium-1.0.0.tgz", - "integrity": "sha512-nl+RQVv2AU/5FvFRhsXyWO5wh+2huhdqRZ3bszBWZzW+kpNI3AT4ydvVRYIfaQbYwV4UlX/rSc7BtFjLAezhow==" - }, - "iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - } - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" - }, - "interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==" - }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" - }, - "is-absolute": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", - "requires": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" - } - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" - }, - "is-core-module": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", - "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", - "requires": { - "has": "^1.0.3" - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==" - }, - "is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" - }, - "is-relative": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", - "requires": { - "is-unc-path": "^1.0.0" - } - }, - "is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" - }, - "is-unc-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", - "requires": { - "unc-path-regex": "^0.1.2" - } - }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" - }, - "is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" - }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" - }, - "json5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", - "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", - "requires": { - "minimist": "^1.2.5" - } - }, - "jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^2.0.0" - } - }, - "kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" - }, - "last-run": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/last-run/-/last-run-1.1.1.tgz", - "integrity": "sha1-RblpQsF7HHnHchmCWbqUO+v4yls=", - "requires": { - "default-resolution": "^2.0.0", - "es6-weak-map": "^2.0.1" - } - }, - "lazystream": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz", - "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", - "requires": { - "readable-stream": "^2.0.5" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - } - } - }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "requires": { - "invert-kv": "^1.0.0" - } - }, - "liftoff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-4.0.0.tgz", - "integrity": "sha512-rMGwYF8q7g2XhG2ulBmmJgWv25qBsqRbDn5gH0+wnuyeFt7QBJlHJmtg5qEdn4pN6WVAUMgXnIxytMFRX9c1aA==", - "requires": { - "extend": "^3.0.2", - "findup-sync": "^5.0.0", - "fined": "^2.0.0", - "flagged-respawn": "^2.0.0", - "is-plain-object": "^5.0.0", - "object.map": "^1.0.1", - "rechoir": "^0.8.0", - "resolve": "^1.20.0" - } - }, - "load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "lodash.defaults": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", - "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" - }, - "lodash.difference": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz", - "integrity": "sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=" - }, - "lodash.flatten": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", - "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" - }, - "lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" - }, - "lodash.union": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", - "integrity": "sha1-SLtQiECfFvGCFmZkHETdGqrjzYg=" - }, - "log4js": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.4.1.tgz", - "integrity": "sha512-iUiYnXqAmNKiIZ1XSAitQ4TmNs8CdZYTAWINARF3LjnsLN8tY5m0vRwd6uuWj/yNY0YHxeZodnbmxKFUOM2rMg==", - "requires": { - "date-format": "^4.0.3", - "debug": "^4.3.3", - "flatted": "^3.2.4", - "rfdc": "^1.3.0", - "streamroller": "^3.0.2" - } - }, - "make-iterator": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", - "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", - "requires": { - "kind-of": "^6.0.2" - } - }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" - }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" - }, - "micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "requires": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - } - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "mute-stdout": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-1.0.0.tgz", - "integrity": "sha1-WzLqB+tDyd7WEwQ0z5JvRrKn/U0=" - }, - "next-tick": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", - "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" - }, - "normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" - }, - "now-and-later": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.1.tgz", - "integrity": "sha512-KGvQ0cB70AQfg107Xvs/Fbu+dGmZoTRJp2TaPwcwQm3/7PteUyN2BCgk8KBMPGBUXZdVwyWS8fDCGFygBm19UQ==", - "requires": { - "once": "^1.3.2" - } - }, - "npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "requires": { - "path-key": "^3.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" - }, - "object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - } - }, - "object.defaults": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", - "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=", - "requires": { - "array-each": "^1.0.1", - "array-slice": "^1.0.0", - "for-own": "^1.0.0", - "isobject": "^3.0.0" - } - }, - "object.map": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz", - "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=", - "requires": { - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" - } - }, - "object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", - "requires": { - "isobject": "^3.0.1" - } - }, - "object.reduce": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object.reduce/-/object.reduce-1.0.1.tgz", - "integrity": "sha1-b+NI8qx/oPlcpiEiZZkJaCW7A60=", - "requires": { - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "os-locale": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", - "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", - "requires": { - "lcid": "^1.0.0" - } - }, - "parse-filepath": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", - "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=", - "requires": { - "is-absolute": "^1.0.0", - "map-cache": "^0.2.0", - "path-root": "^0.1.1" - } - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "requires": { - "error-ex": "^1.2.0" - } - }, - "parse-passwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", - "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=" - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" - }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" - }, - "path-root": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", - "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=", - "requires": { - "path-root-regex": "^0.1.0" - } - }, - "path-root-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz", - "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=" - }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "requires": { - "pinkie": "^2.0.0" - } - }, - "pretty-hrtime": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.0.tgz", - "integrity": "sha1-9ualItPmBwRSK/Db5oVu0g515Nw=" - }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" - }, - "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - } - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "readdir-glob": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.1.tgz", - "integrity": "sha512-91/k1EzZwDx6HbERR+zucygRFfiPl2zkIYZtv3Jjr6Mn7SkKcVct8aVO+sSRiGMc6fLf72du3d92/uY63YPdEA==", - "requires": { - "minimatch": "^3.0.4" - } - }, - "rechoir": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", - "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", - "requires": { - "resolve": "^1.20.0" - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" - }, - "require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=" - }, - "resolve": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", - "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", - "requires": { - "is-core-module": "^2.8.1", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - }, - "resolve-dir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", - "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", - "requires": { - "expand-tilde": "^2.0.0", - "global-modules": "^1.0.0" - } - }, - "resolve-package-path": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/resolve-package-path/-/resolve-package-path-4.0.3.tgz", - "integrity": "sha512-SRpNAPW4kewOaNUt8VPqhJ0UMxawMwzJD8V7m1cJfdSTK9ieZwS6K7Dabsm4bmLFM96Z5Y/UznrpG5kt1im8yA==", - "requires": { - "path-root": "^0.1.1" - } - }, - "rfdc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", - "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==" - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" - }, - "signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" - }, - "spdx-correct": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", - "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==" - }, - "spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz", - "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==" - }, - "stream-exhaust": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/stream-exhaust/-/stream-exhaust-1.0.2.tgz", - "integrity": "sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw==" - }, - "streamroller": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-3.0.6.tgz", - "integrity": "sha512-Qz32plKq/MZywYyhEatxyYc8vs994Gz0Hu2MSYXXLD233UyPeIeRBZARIIGwFer4Mdb8r3Y2UqKkgyDghM6QCg==", - "requires": { - "date-format": "^4.0.6", - "debug": "^4.3.4", - "fs-extra": "^10.0.1" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "requires": { - "is-utf8": "^0.2.0" - } - }, - "strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" - }, - "supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" - }, - "tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", - "requires": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "requires": { - "is-number": "^7.0.0" - }, - "dependencies": { - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" - } - } - }, - "type": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", - "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" - }, - "unc-path-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", - "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=" - }, - "undertaker": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.2.1.tgz", - "integrity": "sha512-71WxIzDkgYk9ZS+spIB8iZXchFhAdEo2YU8xYqBYJ39DIUIqziK78ftm26eecoIY49X0J2MLhG4hr18Yp6/CMA==", - "requires": { - "arr-flatten": "^1.0.1", - "arr-map": "^2.0.0", - "bach": "^1.0.0", - "collection-map": "^1.0.0", - "es6-weak-map": "^2.0.1", - "last-run": "^1.1.0", - "object.defaults": "^1.0.0", - "object.reduce": "^1.0.0", - "undertaker-registry": "^1.0.0" - } - }, - "undertaker-registry": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/undertaker-registry/-/undertaker-registry-1.0.1.tgz", - "integrity": "sha1-XkvaMI5KiirlhPm5pDWaSZglzFA=" - }, - "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" - }, - "uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "requires": { - "punycode": "^2.1.0" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "v8flags": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", - "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==", - "requires": { - "homedir-polyfill": "^1.0.1" - } - }, - "validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", - "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=" - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "y18n": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", - "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==" - }, - "yargs": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz", - "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", - "requires": { - "camelcase": "^3.0.0", - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "os-locale": "^1.4.0", - "read-pkg-up": "^1.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^1.0.2", - "which-module": "^1.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^5.0.0" - } - }, - "yargs-parser": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.1.tgz", - "integrity": "sha512-wpav5XYiddjXxirPoCTUPbqM0PXvJ9hiBMvuJgInvo4/lAOTZzUprArw17q2O1P2+GHhbBr18/iQwjL5Z9BqfA==", - "requires": { - "camelcase": "^3.0.0", - "object.assign": "^4.1.0" - } - }, - "zip-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.0.tgz", - "integrity": "sha512-zshzwQW7gG7hjpBlgeQP9RuyPGNxvJdzR8SUM3QhxCnLjWN2E7j3dOvpeDcQoETfHx0urRS7EtmVToql7YpU4A==", - "requires": { - "archiver-utils": "^2.1.0", - "compress-commons": "^4.1.0", - "readable-stream": "^3.6.0" - } - } - } -} diff --git a/package.json b/package.json index ab8f3d3a697b45cff3cb4c4eaf512d8ba2a379a1..f4afaac7ee9c1bfa5ecc2f00890b70a5e372fc17 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,20 @@ { - "name": "roundedimageview", - "version": "1.0.0", - "ohos": { - "org": "huawei", - "buildTool": "hvigor", - "directoryLevel": "project" - }, - "description": "example description", - "repository": {}, - "license": "Apache License 2.0", - "dependencies": { - "hypium": "^1.0.0", - "@ohos/hvigor": "1.0.6", - "@ohos/hvigor-ohos-plugin": "1.0.6" - } + "license": "Apache License 2.0", + "private": true, + "devDependencies": {}, + "name": "roundimageview", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.2", + "dependencies": { + "@ohos/hypium": "1.0.1", + "@ohos/hvigor-ohos-plugin": "1.1.6", + "hypium": "^1.0.0", + "@ohos/hvigor": "1.1.6" + } } diff --git "a/\346\223\215\344\275\234\346\255\245\351\252\244.md" "b/\346\223\215\344\275\234\346\255\245\351\252\244.md" new file mode 100644 index 0000000000000000000000000000000000000000..32ad9e3937ffb0f45a771986e0e64e6df96a0e2c --- /dev/null +++ "b/\346\223\215\344\275\234\346\255\245\351\252\244.md" @@ -0,0 +1,7 @@ +RoundedImageView组件测试步骤 + +步骤一:安装应用到RK3568单板(OpenHarmony 3.2 Release版本); + +步骤二:打开应用,进入到首页,切换类型即可查看对应的显示效果; + +