diff --git a/arkoala-arkts/test/README.md b/arkoala-arkts/test/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5413c4055eccf0e0ff165c786035b81e41bb1327 --- /dev/null +++ b/arkoala-arkts/test/README.md @@ -0,0 +1,37 @@ +# This is a small testsuite on arkoala/arkts state management + +the test cases are in src/ets + +## Initial setup + + +See https://gitee.com/openharmony-sig/arkcompiler_ets_frontend/blob/master/arkoala-arkts/README.md + +for the initial setup + +## How to see the rewrites + +At the moment you can take a look at the rewrite: + +``` +$ npm run compile:ets +``` + +Now check out the `build/generated` folder + + +## How to see compilation errors + +``` +$ npm run build:test +``` + +will try to compile the test cases up to .abc and will demonstrate the errors + +``` +$ npm run build:test:passed +``` + +should be able to run es2panda on the cases +TODO: at the moment the test cases should be adapter to ArkTS capabilities of es2panda + diff --git a/arkoala-arkts/test/arktsconfig-run-unmemoized.json b/arkoala-arkts/test/arktsconfig-run-unmemoized.json new file mode 100644 index 0000000000000000000000000000000000000000..054f9c7e45d2decff35d78d363c97b19ceb7d984 --- /dev/null +++ b/arkoala-arkts/test/arktsconfig-run-unmemoized.json @@ -0,0 +1,40 @@ +{ + "compilerOptions": { + "package": "@koalaui/arkts-arkui-test", + "outDir": "build/abc", + "baseUrl": ".", + "paths": { + "app": [ + "./build/unmemoized/build/generated" + ], + "@koalaui/compat": [ + "../../incremental/compat/src/arkts" + ], + "@koalaui/common": [ + "../../incremental/common/src" + ], + "@koalaui/runtime": [ + "../../incremental/runtime/build/unmemoized/src" + ], + "@koalaui/arkts-arkui": [ + "../arkui/build/unmemoized/src" + ], + "@koalaui/interop": [ + "../../interop/src/arkts" + ], + "#components": [ + "../arkui/build/unmemoized/src/generated/arkts" + ], + "@koalaui/arkui-common": [ + "../../arkoala/arkui-common/build/unmemoized/src", "../../arkoala/arkui-common/build/unmemoized/src/arkts" + ], + "#arkcompat": [ + "../../arkoala/arkui-common/build/unmemoized/src/arkts" + ], + "#arkstate": ["../../arkoala/arkui-common/build/unmemoized/src"] + } + }, + "include": [ + "./build/unmemoized/**/*.ts" + ] +} diff --git a/arkoala-arkts/test/package.json b/arkoala-arkts/test/package.json new file mode 100644 index 0000000000000000000000000000000000000000..1010448d2e197f4c2fb8e265c61913eb826c8d2e --- /dev/null +++ b/arkoala-arkts/test/package.json @@ -0,0 +1,32 @@ +{ + "name": "@koalaui/arkts-arkui-test", + "version": "1.4.1", + "description": "", + "scripts": { + "clean": "rimraf build generated unmemoized js_output abc lib app/test/build", + "compile:plugin": "cd ../../arkoala/ets-plugin && npm run compile", + "compile:ets": "npm run compile:plugin && cd src/ets && ets-tsc -p ./etsconfig.json", + "unmemoize": "npm run compile:ets && ets-tsc -p tsconfig-unmemoize.json", + "unmemoize:passed": "npm run compile:ets && ets-tsc -p tsconfig-unmemoize-passed.json", + "unmemoize:runtime": "npm run unmemoize --prefix ../../incremental/runtime", + "unmemoize:arkui-no-common": "npm run unmemoize --prefix ../arkui", + "unmemoize:arkui-common": "npm run unmemoize --prefix ../../arkoala/arkui-common", + "unmemoize:all": "npm run unmemoize:runtime && npm run unmemoize:arkui-no-common && npm run unmemoize:arkui-common && npm run unmemoize", + "unmemoize:all:passed": "npm run unmemoize:runtime && npm run unmemoize:arkui-no-common && npm run unmemoize:arkui-common && npm run unmemoize:passed", + "build:test": "npm run unmemoize:all && npm run build:test:inc", + "build:test:passed": "npm run unmemoize:all:passed && npm run build:test:inc", + "build:test:inc": "fast-arktsc --input-files ./arktsconfig-run-unmemoized.json --output-dir ./build --compiler ../../incremental/tools/panda/arkts/arktsc --link-name test && ninja ${NINJA_OPTIONS} -f build/build.ninja", + + "pack": "npm run cli-tools:check && cd app && DEVECO_SDK_HOME=../../../arkoala/ohos-sdk/ohos-sdk ../command-line-tools/hvigor/bin/hvigorw --no-daemon --mode module -p product=default -p module=test@default assembleHar", + "har-arm32": "npm run build:test && npm run --prefix ../../arkoala/ohos-sdk download && node scripts/build-har.mjs --name test --arch arm32 && npm run pack", + "har-arm64": "npm run build:test && npm run --prefix ../../arkoala/ohos-sdk download && node scripts/build-har.mjs --name test --arch arm64 && npm run pack", + "har-universal": "npm run build:test && npm run --prefix ../../arkoala/ohos-sdk download && node scripts/build-har-universal.mjs --name test && npm run pack", + + "cli-tools:chmod:bz": "node ../../arkoala/ohos-sdk/scripts/openlab-cli.mjs chmod -p ./command-line-tools/ohpm/bin -b 755 && node ../../arkoala/ohos-sdk/scripts/openlab-cli.mjs chmod -p ./command-line-tools/hvigor/bin -b 755", + "cli-tools:chmod:yz": "node ../../arkoala/ohos-sdk/scripts/gitlab-cli.mjs chmod -p ./command-line-tools/ohpm/bin -b 755 && node ../../arkoala/ohos-sdk/scripts/gitlab-cli.mjs chmod -p ./command-line-tools/hvigor/bin -b 755", + "cli-tools:download:bz": "node ../../arkoala/ohos-sdk/scripts/openlab-cli.mjs download -p command-line-tools -v 5.0.3502 -f command-line-tools.5.0.3502.zip -d command-line-tools && npm run cli-tools:chmod:bz", + "cli-tools:download:yz": "node ../../arkoala/ohos-sdk/scripts/gitlab-cli.mjs download -p deveco-tools -v 5.0.1300 -f deveco-tools.5.0.1300.zip -d command-line-tools && npm run cli-tools:chmod:yz", + "cli-tools:download": "test \"$KOALA_BZ\" = \"0\" && npm run cli-tools:download:yz || npm run cli-tools:download:bz", + "cli-tools:check": "test -d ./command-line-tools || npm run cli-tools:download" + } +} diff --git a/arkoala-arkts/test/scripts/build-har-universal.mjs b/arkoala-arkts/test/scripts/build-har-universal.mjs new file mode 100644 index 0000000000000000000000000000000000000000..06a194e3aba699f9a688c53d444ee0bea27b001a --- /dev/null +++ b/arkoala-arkts/test/scripts/build-har-universal.mjs @@ -0,0 +1,39 @@ +import { dirname } from "path" +import { fileURLToPath } from "url" + +import fs from "fs" +import path from "path" +import process from "process" +import minimist from "minimist" + +var args = minimist(process.argv.slice(2)) +const name = args["name"] + +const _dirname = dirname(fileURLToPath(import.meta.url)) + +const CWD = process.cwd() +const HAR_PATH = path.join(CWD, `app/${name}`) + + +function copyFile(from, to) { + if (!fs.existsSync(from)) { + throw new Error(`file ${from} does not exist`) + } + + console.log(`> Copy from: ${from} to ${to}`) + fs.cpSync(from, to, { recursive: true, force: true }) +} + + +function main() { + // arm32 + copyFile(path.join(_dirname, `../build/${name}.abc`), path.join(HAR_PATH, `libs/armeabi-v7a/${name}.abc.so`)) + + // arm64 + copyFile(path.join(_dirname, `../build/${name}.abc`), path.join(HAR_PATH, `libs/arm64-v8a/${name}.abc.so`)) + + //x64 + copyFile(path.join(_dirname, `../build/${name}.abc`), path.join(HAR_PATH, `libs/x86-64/${name}.abc.so`)) +} + +main() diff --git a/arkoala-arkts/test/scripts/build-har.mjs b/arkoala-arkts/test/scripts/build-har.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b61e5528d6f84a981352f66ece38161d4ad7375b --- /dev/null +++ b/arkoala-arkts/test/scripts/build-har.mjs @@ -0,0 +1,55 @@ +import { execSync } from "child_process" +import { dirname } from "path" +import { fileURLToPath } from "url" + +import fs from "fs" +import path from "path" +import process from "process" +import minimist from "minimist" + +var args = minimist(process.argv.slice(2)) +const arch = args["arch"] +const name = args["name"] + +const _dirname = dirname(fileURLToPath(import.meta.url)) + +const CWD = process.cwd() +// const BUNDLE_PATH = path.join(CWD, "arkoala-har-bundle") +const HAR_PATH = path.join(CWD, `app/${name}`) + +function execCmdSync(cmd, options) { + return execSync(cmd, options).toString().trim().replace("\n", " ") +} + +function rollupLaunch() { + console.log(`> Run rollup`) + execCmdSync("npx rollup -c") +} + +function copyFilesToHar(from, to) { + if (!fs.existsSync(from)) { + throw new Error(`file ${from} does not exist`) + } + + console.log(`> Copy from: ${from} to ${to}`) + fs.cpSync(from, to, { recursive: true, force: true }) +} + + +function main(targetLibDir, name) { + + // process.chdir(BUNDLE_PATH) + + // rollupLaunch() + /* we don't yet know which files should be in har */ + copyFilesToHar(path.join(_dirname, `../build/${name}.abc`), path.join(HAR_PATH, `libs/${targetLibDir}/${name}.abc.so`)) +} + +if (arch == "arm32") { + main("armeabi-v7a", name) +} else if (arch == "arm64") { + main("arm64-v8a", name) +} else { + console.log("Unsupported architecture: ", arch) + exit(1) +} diff --git a/arkoala-arkts/test/src/Page.ts b/arkoala-arkts/test/src/Page.ts new file mode 100644 index 0000000000000000000000000000000000000000..63ed529ace2fde426ddd36c54cb4b6d52e0eee80 --- /dev/null +++ b/arkoala-arkts/test/src/Page.ts @@ -0,0 +1,18 @@ +import { TestWrapper } from "app/TestWrapper" +import { UserView, UserViewBuilder } from "@koalaui/arkts-arkui" + +export class ViewTestApp extends UserView { + private params: String + constructor(params: String) { + super() + this.params = params + } + getBuilder(): UserViewBuilder { + /** @memo */ + let wrapper = () => { + TestWrapper() + } + return wrapper + } +} + diff --git a/arkoala-arkts/test/src/ets/etsconfig.json b/arkoala-arkts/test/src/ets/etsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..2e88d85ca28eddbc4e88c859887a1235d1275d80 --- /dev/null +++ b/arkoala-arkts/test/src/ets/etsconfig.json @@ -0,0 +1,21 @@ +{ + "extends": "../../../arkui/config/etsconfig-base.json", + "include": [ + "./**/*.ets" + ], + "compilerOptions": { + "types": [], + "baseUrl": ".", + "rootDirs": [ + "." + ], + "outDir": "../../build/ets-junk", + "plugins": [ + { + "transform": "@koalaui/ets-plugin/build/lib/src/ArkExpander.js", + "destination": "../../build/generated", + "arkui": "@koalaui/arkts-arkui" + } + ] + } +} diff --git a/arkoala-arkts/test/src/ets/test01.ets b/arkoala-arkts/test/src/ets/test01.ets new file mode 100644 index 0000000000000000000000000000000000000000..46f16dbd9509dcec39703e7aa9e994fcc44e0946 --- /dev/null +++ b/arkoala-arkts/test/src/ets/test01.ets @@ -0,0 +1,30 @@ +@Component +struct EntryComponent1 { + @Prop prop : number = 2; + build() { + Column() { + Button(`${this.prop}`).onClick(()=>{ + this.prop += 4; // only received once, change prop, will not synchronized to its Child. + }) + MyComponent1({state : this.prop}) + } + } +} + +@Component +struct MyComponent1 { + @State count: Resource = $r('sys.color.ohos_id_color_emphasize') + @State state : number = 1; + build() { + Column() { + Text(`Hello ${this.state}`) + .fontColor(this.count) + Button('change') + .onClick(() => { + this.count = $r('sys.media.ohos_user_auth_icon_face'); + }) + } + } +} + + diff --git a/arkoala-arkts/test/src/ets/test02.ets b/arkoala-arkts/test/src/ets/test02.ets new file mode 100644 index 0000000000000000000000000000000000000000..960c5bedb74158929076989487c56ee8e67382fa --- /dev/null +++ b/arkoala-arkts/test/src/ets/test02.ets @@ -0,0 +1,66 @@ +class Person2 { + public value: string; + + constructor(value: string) { + this.value = value; + } +} + +class Model2 { + public value: string; + public name: Person2; + constructor(value: string, person: Person2) { + this.value = value; + this.name = person; + } +} + +@Entry +@Component +struct Page2 { + // class类型 + @State @Watch("onTitleChange") title: Model2 = new Model2('Hello', new Person2('World')); + onTitleChange(name: string) { + console.log(`observe the object and object property change`) + } + + build() { + Column() { + Text(`assign a object: ${JSON.stringify(this.title)}`) + .id('Page2HelloWorld') + .fontSize(40) + .fontWeight(FontWeight.Bold) + .alignRules({ + center: { anchor: '__container__', align: VerticalAlign.Center }, + middle: { anchor: '__container__', align: HorizontalAlign.Center } + }).backgroundColor(Color.Green) + .onClick(()=>{ + this.title = new Model2('Hi', new Person2('ArkUI')); // assign the object to @State variable + }) + Text(`assign a object property: ${this.title.value}`) + .id('Page2HelloWorld') + .fontSize(40) + .fontWeight(FontWeight.Bold) + .alignRules({ + center: { anchor: '__container__', align: VerticalAlign.Center }, + middle: { anchor: '__container__', align: HorizontalAlign.Center } + }).backgroundColor(Color.Red) + .onClick(()=>{ + this.title.value = 'Hi'; // assign the object property + }) + Text(`assign a object second layer property: ${this.title.name.value}`) + .id('Page2HelloWorld') + .fontSize(40) + .fontWeight(FontWeight.Bold) + .alignRules({ + center: { anchor: '__container__', align: VerticalAlign.Center }, + middle: { anchor: '__container__', align: HorizontalAlign.Center } + }).backgroundColor(Color.Blue) + .onClick(()=>{ + this.title.name.value = 'ArkUI'; // can not observe properties of second-level objects + }) + } + .height('100%') + .width('100%') + } +} diff --git a/arkoala-arkts/test/src/ets/test03.ets b/arkoala-arkts/test/src/ets/test03.ets new file mode 100644 index 0000000000000000000000000000000000000000..4a84cd5e454cd4f063c719a83b292e763c7ac502 --- /dev/null +++ b/arkoala-arkts/test/src/ets/test03.ets @@ -0,0 +1,73 @@ +class Person3 { + public value: string; + + constructor(value: string) { + this.value = value; + } +} + +class Model3 { + public value: string; + public name: Person3; + constructor(value: string, person: Person3) { + this.value = value; + this.name = person; + } +} + +@Entry +@Component +struct Page3 { + // 数组类型 + @State @Watch("onTitleChange") title: Model3[] = [new Model3("11", new Person3("11")), new Model3("22", new Person3("22"))]; + onTitleChange(name: string) { + console.log(`observe the object and object property change`) + } + + build() { + Column() { + Text(`assign an array: ${JSON.stringify(this.title)}`) + .fontSize(30) + .fontWeight(FontWeight.Bold) + .alignRules({ + center: { anchor: '__container__', align: VerticalAlign.Center }, + middle: { anchor: '__container__', align: HorizontalAlign.Center } + }).backgroundColor(Color.Green) + .onClick(()=>{ + this.title = [new Model3("33", new Person3("33"))]; // Array assignment + }) + Text(`assign item: ${this.title[0].value}`) + .fontSize(30) + .fontWeight(FontWeight.Bold) + .alignRules({ + center: { anchor: '__container__', align: VerticalAlign.Center }, + middle: { anchor: '__container__', align: HorizontalAlign.Center } + }).backgroundColor(Color.Red) + .onClick(()=>{ + this.title[0] = new Model3("44", new Person3("44")); // Array item assignment + }) + Text(`delete array items: ${JSON.stringify(this.title)}`) + .fontSize(30) + .fontWeight(FontWeight.Bold) + .alignRules({ + center: { anchor: '__container__', align: VerticalAlign.Center }, + middle: { anchor: '__container__', align: HorizontalAlign.Center } + }).backgroundColor(Color.Gray) + .onClick(()=>{ + this.title.pop(); // + }) + Text(`Added array items: ${JSON.stringify(this.title)}`) + .fontSize(30) + .fontWeight(FontWeight.Bold) + .alignRules({ + center: { anchor: '__container__', align: VerticalAlign.Center }, + middle: { anchor: '__container__', align: HorizontalAlign.Center } + }).backgroundColor(Color.Yellow) + .onClick(()=>{ + this.title.push(new Model3("12", new Person3("12"))); + }) + } + .height('100%') + .width('100%') + } +} diff --git a/arkoala-arkts/test/src/ets/test04.ets b/arkoala-arkts/test/src/ets/test04.ets new file mode 100644 index 0000000000000000000000000000000000000000..d3ea0530949d167037ba191db4aa0682605a02bb --- /dev/null +++ b/arkoala-arkts/test/src/ets/test04.ets @@ -0,0 +1,35 @@ +@Entry +@Component +struct DatePickerExample { + @State selectedDate: Date = new Date('2021-08-08'); + + build() { + Column() { + Button('set selectedDate to 2023-07-08') + .margin(10) + .onClick(() => { + this.selectedDate = new Date('2023-07-08'); + }) + Button('increase the year by 1') + .margin(10) + .onClick(() => { + this.selectedDate.setFullYear(this.selectedDate.getFullYear() + 1); + }) + Button('increase the month by 1') + .margin(10) + .onClick(() => { + this.selectedDate.setMonth(this.selectedDate.getMonth() + 1); + }) + Button('increase the day by 1') + .margin(10) + .onClick(() => { + this.selectedDate.setDate(this.selectedDate.getDate() + 1); + }) + DatePicker({ + start: new Date('1970-1-1'), + end: new Date('2100-1-1'), + selected: this.selectedDate + }) + }.width('100%') + } +} diff --git a/arkoala-arkts/test/src/ets/test05.ets b/arkoala-arkts/test/src/ets/test05.ets new file mode 100644 index 0000000000000000000000000000000000000000..07727db12af8791fd2e0ac5c5fee4d83ee4af0f0 --- /dev/null +++ b/arkoala-arkts/test/src/ets/test05.ets @@ -0,0 +1,34 @@ +@Entry +@Component +struct MapSample { + @State message: Map = new Map([[0, "a"], [1, "b"], [3, "c"]]); + + build() { + Row() { + Column() { + ForEach(Array.from(this.message.entries()), (item: [number, string]) => { + Text(`${item[0]}`).fontSize(30) + Text(`${item[1]}`).fontSize(30) + Divider() + }, (item: [number, string], index: number) => JSON.stringify(item[1])) + Button('init map').onClick(() => { + this.message = new Map([[0, "e"], [1, "f"], [3, "g"]]); + }) + Button('set new one').onClick(() => { + this.message.set(4, "d"); + }) + Button('clear').onClick(() => { + this.message.clear(); + }) + Button('replace the first one').onClick(() => { + this.message.set(0, "aa"); + }) + Button('delete the first one').onClick(() => { + this.message.delete(0); + }) + } + .width('100%') + } + .height('100%') + } +} diff --git a/arkoala-arkts/test/src/ets/test06.ets b/arkoala-arkts/test/src/ets/test06.ets new file mode 100644 index 0000000000000000000000000000000000000000..c298008fc9c72b0e02b8e996d441b4a16d41b3ad --- /dev/null +++ b/arkoala-arkts/test/src/ets/test06.ets @@ -0,0 +1,32 @@ +@Entry +@Component +struct SetSample { + @State message: Set = new Set([0, 1, 2, 3, 4]); + + build() { + Row() { + Column() { + ForEach(Array.from(this.message.entries()), (item: [number, number]) => { + Text(`${item[0]}`).fontSize(30) + Divider() + }, (item: [number, number], index: number) => JSON.stringify(item[0].toString())) + Button('init set').onClick(() => { + this.message = new Set([10, 1, 2, 3, 8]); + }) + Button('set new one').onClick(() => { + this.message.add(5); + }) + Button('clear').onClick(() => { + this.message.clear(); + }) + Button('delete the first one').onClick(() => { + this.message.delete(0); + }) + } + .width('100%') + } + .height('100%') + } +} + + diff --git a/arkoala-arkts/test/src/ets/test07.ets b/arkoala-arkts/test/src/ets/test07.ets new file mode 100644 index 0000000000000000000000000000000000000000..a4d5406c20f1f5ed17a544482871de5dca52028f --- /dev/null +++ b/arkoala-arkts/test/src/ets/test07.ets @@ -0,0 +1,24 @@ +@Entry +@Component +struct EntryComponent7 { + build() { + Column() { + MyComponent7() + } + } +} + +@Component +struct MyComponent7 { + @State count: number | undefined = 0; + + build() { + Column() { + Text(`count(${this.count})`) + Button('change') + .onClick(() => { + this.count = undefined; // UI will be triggered + }) + } + } +} diff --git a/arkoala-arkts/test/src/ets/test08.ets b/arkoala-arkts/test/src/ets/test08.ets new file mode 100644 index 0000000000000000000000000000000000000000..5e91059e0d9d83a0f016db9554cac0ec327782dc --- /dev/null +++ b/arkoala-arkts/test/src/ets/test08.ets @@ -0,0 +1,27 @@ +// import { resourceManager } from '@kit.LocalizationKit'; + +@Entry +@Component +struct EntryComponent8 { + build() { + Column() { + MyComponent8() + } + } +} + +@Component +struct MyComponent8 { + @State count: Resource = $r('sys.color.ohos_id_color_emphasize') + + build() { + Column() { + Text('Hello') + .fontColor(this.count) + Button('change') + .onClick(() => { + this.count = $r('sys.media.ohos_user_auth_icon_face'); + }) + } + } +} diff --git a/arkoala-arkts/test/src/ets/test09.ets b/arkoala-arkts/test/src/ets/test09.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6bf04df39407dacd31975d0b079f0e9089b893a --- /dev/null +++ b/arkoala-arkts/test/src/ets/test09.ets @@ -0,0 +1,29 @@ +@Entry +@Component +struct EntryComponent { + @State state : number = 2; + build() { + Column() { + Button(`${this.state}`).onClick(()=>{ + this.state += 4; // change state, will synchronize to its Child. + }) + MyComponent({prop : this.state}) + } + } +} + +@Component +struct MyComponent { + @State count: Resource = $r('sys.color.ohos_id_color_emphasize') + @Prop prop : number = 1; + build() { + Column() { + Text(`Hello ${this.prop}`) + .fontColor(this.count) + Button('change') + .onClick(() => { + this.prop += 5 // change prop, will not sync back to its parent + }) + } + } +} diff --git a/arkoala-arkts/test/src/ets/test10.ets b/arkoala-arkts/test/src/ets/test10.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b453137c69818dcb08c023cc2c50a7a2340eb26 --- /dev/null +++ b/arkoala-arkts/test/src/ets/test10.ets @@ -0,0 +1,30 @@ +//import {AppStorageV2} from '@kit.ArkUI' +@Entry +@Component +struct EntryComponent10 { + @State state : number = 2; + build() { + Column() { + Button(`${this.state}`).onClick(()=>{ + this.state += 4; // change state, will synchronize to its Child. + }) + MyComponent10({link : this.state}) + } + } +} + +@Component +struct MyComponent10 { + @State count: Resource = $r('sys.color.ohos_id_color_emphasize') + @Link link : number; + build() { + Column() { + Text(`Hello ${this.link}`) + .fontColor(this.count) + Button('change') + .onClick(() => { + this.link += 5 // change link, will sync back to its parent + }) + } + } +} diff --git a/arkoala-arkts/test/src/ets/test11.ets b/arkoala-arkts/test/src/ets/test11.ets new file mode 100644 index 0000000000000000000000000000000000000000..c7ca7a31b9422d36290183f879e65d9e4fc2b679 --- /dev/null +++ b/arkoala-arkts/test/src/ets/test11.ets @@ -0,0 +1,46 @@ +class Model11 { + public value: string; + constructor(value: string) { + this.value = value; + } +} + +@Entry +@Component +struct EntryComponent11 { + build() { + Column() { + // 此处指定的任何命名参数都将在初始渲染时 + // 覆盖本地定义的默认值 + MyComponent11({ count: 1, increaseBy: 2 }) + MyComponent11({ title: new Model11('Hello, World 2'), count: 7 }) + } + } +} + +@Component +struct MyComponent11 { + + @State title: Model11 = new Model11('local child value'); + @State count: number = 0; + private increaseBy : number = 1; + + build() { + Column() { + Text(`count : ${this.count} titleValue : ${this.title.value}`) + Button() { + Text(`Click to change title`).fontSize(10) + }.onClick(() => { + // @State变量的更新将触发上面的Text组件内容更新 + this.title.value = this.title.value == 'Hello Ace' ? 'Hello World' : 'Hello Ace'; + }) + + Button() { + Text(`Click to increase count=${this.count}`).fontSize(10) + }.onClick(() => { + // @State变量的更新将触发上面的Text组件内容更新 + this.count += this.increaseBy; + }) + } // Column + } // build +} diff --git a/arkoala-arkts/test/src/ets/test12.ets b/arkoala-arkts/test/src/ets/test12.ets new file mode 100644 index 0000000000000000000000000000000000000000..dce9e8526514a6d8637dc6ca60c5af5a9fb4e392 --- /dev/null +++ b/arkoala-arkts/test/src/ets/test12.ets @@ -0,0 +1,97 @@ +@Observed +class Son12 { + public title: string; + + constructor(title: string) { + this.title = title; + } +} + +@Observed +class Father12 { + public name: string; + public son: Son12; + + constructor(name: string, son: Son12) { + this.name = name; + this.son = son; + } +} + + +@Entry +@Component +struct Person12 { + @State person: Father12 = new Father12('Hello', new Son12('world')); + + build() { + Column() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Button('change Father12 name') + .width(312) + .height(40) + .margin(12) + .fontColor('#FFFFFF,90%') + .onClick(() => { + this.person.name = "Hi"; + }) + Button('change Son12 title') + .width(312) + .height(40) + .margin(12) + .fontColor('#FFFFFF,90%') + .onClick(() => { + this.person.son.title = "ArkUI"; // Son12 must be decorated with @Observed + }) + Text(this.person.name) + .fontSize(16) + .margin(12) + .width(312) + .height(40) + .backgroundColor('#ededed') + .borderRadius(20) + .textAlign(TextAlign.Center) + .fontColor('#e6000000') + .onClick(() => { + this.person.name = 'Bye'; + }) + Text(this.person.son.title) + .fontSize(16) + .margin(12) + .width(312) + .height(40) + .backgroundColor('#ededed') + .borderRadius(20) + .textAlign(TextAlign.Center) + .onClick(() => { + this.person.son.title = "openHarmony"; + }) + Child({ child: this.person.son }) + } + + } + + } +} + + +@Component +struct Child { + @Prop child: Son12 = new Son12(''); + + build() { + Column() { + Text(this.child.title) + .fontSize(16) + .margin(12) + .width(312) + .height(40) + .backgroundColor('#ededed') + .borderRadius(20) + .textAlign(TextAlign.Center) + .onClick(() => { + this.child.title = 'Bye Bye'; + }) + } + } +} diff --git a/arkoala-arkts/test/src/ets/test13.ets b/arkoala-arkts/test/src/ets/test13.ets new file mode 100644 index 0000000000000000000000000000000000000000..c6bf46028cc372f373f1081e1465c22a963f6fe9 --- /dev/null +++ b/arkoala-arkts/test/src/ets/test13.ets @@ -0,0 +1,23 @@ +class Info13 { + info: string = 'Hello'; +} + +@Component +struct Child13 { + @Link test: Info13; + build() { + Text(this.test.info) + } +} + +@Entry +@Component +struct LinkExample { + @State info: Info13 = new Info13(); + build() { + Column() { + Child13({ test: this.info }) // also support this spec + Child13({ test: $info }) // support $ + } + } +} diff --git a/arkoala-arkts/test/src/ets/test14.ets b/arkoala-arkts/test/src/ets/test14.ets new file mode 100644 index 0000000000000000000000000000000000000000..40b9629a8a6636349b898ac8a385ebe252817693 --- /dev/null +++ b/arkoala-arkts/test/src/ets/test14.ets @@ -0,0 +1,50 @@ +@Component +struct Child14 { + @Consume selectedDate: Date; + + build() { + Column() { + Button(`child increase the day by 1`) + .onClick(() => { + this.selectedDate.setDate(this.selectedDate.getDate() + 1) + }) + Button('child update the new date') + .margin(10) + .onClick(() => { + this.selectedDate = new Date('2023-09-09') + }) + DatePicker({ + start: new Date('1970-1-1'), + end: new Date('2100-1-1'), + selected: this.selectedDate + }) + } + } +} + +@Entry +@Component +struct Parent14 { + @Provide selectedDate: Date = new Date('2021-08-08') + + build() { + Column() { + Button('parent increase the day by 1') + .margin(10) + .onClick(() => { + this.selectedDate.setDate(this.selectedDate.getDate() + 1) + }) + Button('parent update the new date') + .margin(10) + .onClick(() => { + this.selectedDate = new Date('2023-07-07') + }) + DatePicker({ + start: new Date('1970-1-1'), + end: new Date('2100-1-1'), + selected: this.selectedDate + }) + Child14() + } + } +} diff --git a/arkoala-arkts/test/src/ets/test15.ets b/arkoala-arkts/test/src/ets/test15.ets new file mode 100644 index 0000000000000000000000000000000000000000..15ad7966927c0968a27f45c5ca4b4ed001336ccf --- /dev/null +++ b/arkoala-arkts/test/src/ets/test15.ets @@ -0,0 +1,50 @@ +@Component +struct GrandSon15 { + // @Consume装饰的变量通过相同的属性名绑定其祖先内的@Provide装饰的变量 + @Consume("reviewVotes") reviewVotes: number; + + build() { + Column() { + Text(`reviewVotes(${this.reviewVotes})`) // Text显示10 + Button(`reviewVotes(${this.reviewVotes}), give +1`) + .onClick(() => this.reviewVotes += 1) + } + .width('50%') + } +} + +@Component +struct Child15 { + // @Provide({ allowOverride: "reviewVotes" }) reviewVotes: number = 10; + @Provide("reviewVotes") reviewVotes: number = 10; + + build() { + Row({ space: 5 }) { + GrandSon15() + } + } +} + +@Component +struct Parent15 { + // @Provide({ allowOverride: "reviewVotes" }) reviewVotes: number = 20; + @Provide("reviewVotes") reviewVotes: number = 20; + + build() { + Child15() + } +} + +@Entry +@Component +struct GrandParent15 { + @Provide("reviewVotes") reviewVotes: number = 40; + + build() { + Column() { + Button(`reviewVotes(${this.reviewVotes}), give +1`) + .onClick(() => this.reviewVotes += 1) + Parent15() + } + } +} diff --git a/arkoala-arkts/test/src/ets/test16.ets b/arkoala-arkts/test/src/ets/test16.ets new file mode 100644 index 0000000000000000000000000000000000000000..ea59a0288ea55c0322b9625f6709defc7bd4523b --- /dev/null +++ b/arkoala-arkts/test/src/ets/test16.ets @@ -0,0 +1,41 @@ +@Observed +class Info16 { + count: number; + + constructor(count: number) { + this.count = count; + } +} + +@Component +struct Child16 { + @ObjectLink num: Info16; + + build() { + Column() { + Text(`num的值: ${this.num.count}`) + .onClick(() => { + // 正确写法,可以更改@ObjectLink装饰变量的成员属性 + this.num.count += 20; // modify count can sync back its parent + }) + } + } +} + +@Entry +@Component +struct Parent16 { + @State num: Info16 = new Info16(10); + + build() { + Column() { + Text(`count的值: ${this.num.count}`) + Button('click') + .onClick(() => { + // 可以在父组件做整体替换 + this.num = new Info16(30); // modify ObjectLink object, can sync to its child + }) + Child16({num: this.num}) + } + } +} diff --git a/arkoala-arkts/test/src/ets/test17.ets b/arkoala-arkts/test/src/ets/test17.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b47318b052a0a94881696998dc4793fe1a1ab66 --- /dev/null +++ b/arkoala-arkts/test/src/ets/test17.ets @@ -0,0 +1,123 @@ +let NextID: number = 1; + +@Observed +class Bag { + public id: number; + public size: number; + + constructor(size: number) { + this.id = NextID++; + this.size = size; + } +} + +@Observed +class User { + public bag: Bag; + + constructor(bag: Bag) { + this.bag = bag; + } +} + +@Observed +class Book { + public bookName: BookName; + + constructor(bookName: BookName) { + this.bookName = bookName; + } +} + +@Observed +class BookName extends Bag { + public nameSize: number; + + constructor(nameSize: number) { + // 调用父类方法对nameSize进行处理 + super(nameSize); + this.nameSize = nameSize; + } +} + +@Component +struct Son17 { + label: string = 'Son17'; + @ObjectLink bag: Bag; + + build() { + Column() { + Text(`Son17 [${this.label}] this.bag.size = ${this.bag.size}`) + .fontColor('#ffffffff') + .backgroundColor('#ff3d9dba') + .width(320) + .height(50) + .borderRadius(25) + .margin(10) + .textAlign(TextAlign.Center) + Button(`Son17: this.bag.size add 1`) + .width(320) + .backgroundColor('#ff17a98d') + .margin(10) + .onClick(() => { + this.bag.size += 1; + }) + } + } +} + +@Component +struct Father17 { + label: string = 'Father17'; + @ObjectLink bookName: BookName; + + build() { + Row() { + Column() { + Text(`Father17 [${this.label}] this.bookName.size = ${this.bookName.size}`) + .fontColor('#ffffffff') + .backgroundColor('#ff3d9dba') + .width(320) + .height(50) + .borderRadius(25) + .margin(10) + .textAlign(TextAlign.Center) + Button(`Father17: this.bookName.size add 1`) + .width(320) + .backgroundColor('#ff17a98d') + .margin(10) + .onClick(() => { + this.bookName.size += 1; + console.log('this.bookName.size:' + this.bookName.size); + }) + } + .width(320) + } + } +} + +@Entry +@Component +struct GrandFather17 { + @State user: User = new User(new Bag(0)); + @State child: Book = new Book(new BookName(0)); + + build() { + Column() { + Son17({ label: 'Son17 #1', bag: this.user.bag }) + .width(320) + Father17({ label: 'Father17 #3', bookName: this.child.bookName }) + .width(320) + Button(`GrandFather17: this.child.bookName.size add 10`) + .width(320) + .backgroundColor('#ff17a98d') + .margin(10) + .onClick(() => { + this.child.bookName.size += 10; + console.log('this.child.bookName.size:' + this.child.bookName.size); + }) + } + } +} + + diff --git a/arkoala-arkts/test/src/ets/test18.ets b/arkoala-arkts/test/src/ets/test18.ets new file mode 100644 index 0000000000000000000000000000000000000000..445452787594347fe22fb7273597835d7d1f33b7 --- /dev/null +++ b/arkoala-arkts/test/src/ets/test18.ets @@ -0,0 +1,61 @@ +@Observed +class ObservedArray extends Array { + constructor(args: T[]) { + super(...args); + } +} + +@Component +struct Item { + @ObjectLink itemArr: ObservedArray; + + build() { + Row() { + ForEach(this.itemArr, (item: string, index: number) => { + Text(`${index}: ${item}`) + .width(100) + .height(100) + }, (item: string) => item) + } + } +} + +@Entry +@Component +struct IndexPage { + @State arr: Array> = [new ObservedArray(['apple']), new ObservedArray(['banana']), new ObservedArray(['orange'])]; + + build() { + Column() { + ForEach(this.arr, (itemArr: ObservedArray) => { + Item({ itemArr: itemArr }) + }, (item: ObservedArray) => item.toString()) + + Divider() + + Button('push two-dimensional array item') + .margin(10) + .onClick(() => { + this.arr[0].push('strawberry'); + }) + + Button('push array item') + .margin(10) + .onClick(() => { + this.arr.push(new ObservedArray(['pear'])); + }) + + Button('change two-dimensional array first item') + .margin(10) + .onClick(() => { + this.arr[0][0] = 'APPLE'; + }) + + Button('change array first item') + .margin(10) + .onClick(() => { + this.arr[0] = new ObservedArray(['watermelon']); + }) + } + } +} diff --git a/arkoala-arkts/test/src/ets/test19.ets b/arkoala-arkts/test/src/ets/test19.ets new file mode 100644 index 0000000000000000000000000000000000000000..51233f2ec7ffc67af869636731ceb7ef3cb66cdb --- /dev/null +++ b/arkoala-arkts/test/src/ets/test19.ets @@ -0,0 +1,75 @@ +@Observed +class Info { + public info: MySet; + + constructor(info: MySet) { + this.info = info; + } +} + + +@Observed +export class MySet extends Set { + public name: string; + + constructor(name?: string, args?: T[]) { + super(args); + this.name = name ? name : "My Set"; + } + + getName() { + return this.name; + } +} + +@Entry +@Component +struct SetSampleNested { + @State message: Info = new Info(new MySet("Set", [0, 1, 2, 3, 4])); + + build() { + Row() { + Column() { + SetSampleNestedChild({ mySet: this.message.info }) + } + .width('100%') + } + .height('100%') + } +} + +@Component +struct SetSampleNestedChild { + @ObjectLink mySet: MySet; + + build() { + Row() { + Column() { + ForEach(Array.from(this.mySet.entries()), (item: [number, number]) => { + Text(`${item}`).fontSize(30) + Divider() + }, (item: [number, number]) => item.toString()) + Button('set new one') + .width(200) + .margin(10) + .onClick(() => { + this.mySet.add(5); + }) + Button('clear') + .width(200) + .margin(10) + .onClick(() => { + this.mySet.clear(); + }) + Button('delete the first one') + .width(200) + .margin(10) + .onClick(() => { + this.mySet.delete(0); + }) + } + .width('100%') + } + .height('100%') + } +} diff --git a/arkoala-arkts/test/src/ets/test20.ets b/arkoala-arkts/test/src/ets/test20.ets new file mode 100644 index 0000000000000000000000000000000000000000..51233f2ec7ffc67af869636731ceb7ef3cb66cdb --- /dev/null +++ b/arkoala-arkts/test/src/ets/test20.ets @@ -0,0 +1,75 @@ +@Observed +class Info { + public info: MySet; + + constructor(info: MySet) { + this.info = info; + } +} + + +@Observed +export class MySet extends Set { + public name: string; + + constructor(name?: string, args?: T[]) { + super(args); + this.name = name ? name : "My Set"; + } + + getName() { + return this.name; + } +} + +@Entry +@Component +struct SetSampleNested { + @State message: Info = new Info(new MySet("Set", [0, 1, 2, 3, 4])); + + build() { + Row() { + Column() { + SetSampleNestedChild({ mySet: this.message.info }) + } + .width('100%') + } + .height('100%') + } +} + +@Component +struct SetSampleNestedChild { + @ObjectLink mySet: MySet; + + build() { + Row() { + Column() { + ForEach(Array.from(this.mySet.entries()), (item: [number, number]) => { + Text(`${item}`).fontSize(30) + Divider() + }, (item: [number, number]) => item.toString()) + Button('set new one') + .width(200) + .margin(10) + .onClick(() => { + this.mySet.add(5); + }) + Button('clear') + .width(200) + .margin(10) + .onClick(() => { + this.mySet.clear(); + }) + Button('delete the first one') + .width(200) + .margin(10) + .onClick(() => { + this.mySet.delete(0); + }) + } + .width('100%') + } + .height('100%') + } +} diff --git a/arkoala-arkts/test/src/ets/test21.ets b/arkoala-arkts/test/src/ets/test21.ets new file mode 100644 index 0000000000000000000000000000000000000000..999f324e260cd9b68624107200fe7fe9a88804d0 --- /dev/null +++ b/arkoala-arkts/test/src/ets/test21.ets @@ -0,0 +1,80 @@ +@Observed +class Source { + public source: number; + + constructor(source: number) { + this.source = source; + } +} + +@Observed +class Data { + public data: number; + + constructor(data: number) { + this.data = data; + } +} + +@Entry +@Component +struct Parent21 { + @State count: Source | Data | undefined = new Source(10); + + build() { + Column() { + Child21({ count: this.count }) + + Button('change count property') + .margin(10) + .onClick(() => { + // 判断count的类型,做属性的更新 + if (this.count instanceof Source) { + this.count.source += 1; + } else if (this.count instanceof Data) { + this.count.data += 1; + } else { + console.info('count is undefined, cannot change property'); + } + }) + + Button('change count to Source') + .margin(10) + .onClick(() => { + // 赋值为Source的实例 + this.count = new Source(100); + }) + + Button('change count to Data') + .margin(10) + .onClick(() => { + // 赋值为Data的实例 + this.count = new Data(100); + }) + + Button('change count to undefined') + .margin(10) + .onClick(() => { + // 赋值为undefined + this.count = undefined; + }) + }.width('100%') + } +} + +@Component +struct Child21 { + @ObjectLink count: Source | Data | undefined; + + build() { + Column() { + Text(`count is instanceof ${this.count instanceof Source ? 'Source' : + this.count instanceof Data ? 'Data' : 'undefined'}`) + .fontSize(30) + .margin(10) + + Text(`count's property is ${this.count instanceof Source ? this.count.source : this.count?.data}`).fontSize(15) + + }.width('100%') + } +} diff --git a/arkoala-arkts/test/src/ets/test22.ets b/arkoala-arkts/test/src/ets/test22.ets new file mode 100644 index 0000000000000000000000000000000000000000..f97b70a7ef5af052c9f7918971eed7718dac9c28 --- /dev/null +++ b/arkoala-arkts/test/src/ets/test22.ets @@ -0,0 +1,60 @@ +class LogTrack { + @Track str1: string; + @Track str2: string; + + constructor(str1: string) { + this.str1 = str1; + this.str2 = 'World'; + } +} + +class LogNotTrack { + str1: string; + str2: string; + + constructor(str1: string) { + this.str1 = str1; + this.str2 = '世界'; + } +} + +@Entry +@Component +struct AddLog { + @State logTrack: LogTrack = new LogTrack('Hello'); + @State logNotTrack: LogNotTrack = new LogNotTrack('你好'); + + isRender(index: number) { + console.log(`Text ${index} is rendered`); + return 50; + } + + build() { + Row() { + Column() { + Text(this.logTrack.str1) // Text1 + .fontSize(this.isRender(1)) + .fontWeight(FontWeight.Bold) + Text(this.logTrack.str2) // Text2 + .fontSize(this.isRender(2)) + .fontWeight(FontWeight.Bold) + Button('change logTrack.str1') + .onClick(() => { + this.logTrack.str1 = 'Bye'; + }) + Text(this.logNotTrack.str1) // Text3 + .fontSize(this.isRender(3)) + .fontWeight(FontWeight.Bold) + Text(this.logNotTrack.str2) // Text4 + .fontSize(this.isRender(4)) + .fontWeight(FontWeight.Bold) + Button('change logNotTrack.str1') + .onClick(() => { + this.logNotTrack.str1 = '再见'; + }) + } + .width('100%') + } + .height('100%') + } +} diff --git a/arkoala-arkts/test/src/ets/test23.ets b/arkoala-arkts/test/src/ets/test23.ets new file mode 100644 index 0000000000000000000000000000000000000000..75b382ab6e8118c0b7682128d2f721b36da43784 --- /dev/null +++ b/arkoala-arkts/test/src/ets/test23.ets @@ -0,0 +1,29 @@ +@Entry +@Component +struct UsePropertyName { + @State @Watch('countUpdated') apple: number = 0; + @State @Watch('countUpdated') cabbage: number = 0; + @State fruit: number = 0; + // @Watch 回调 + countUpdated(propName: string): void { + if (propName == 'apple') { + this.fruit = this.apple; + } + } + + build() { + Column() { + Text(`Number of apples: ${this.apple.toString()}`).fontSize(30) + Text(`Number of cabbages: ${this.cabbage.toString()}`).fontSize(30) + Text(`Total number of fruits: ${this.fruit.toString()}`).fontSize(30) + Button('Add apples') + .onClick(() => { + this.apple++; + }) + Button('Add cabbages') + .onClick(() => { + this.cabbage++; + }) + } + } +} diff --git a/arkoala-arkts/test/src/ets/test24.ets b/arkoala-arkts/test/src/ets/test24.ets new file mode 100644 index 0000000000000000000000000000000000000000..37d6917cc35918dbe3b064267ff0c83024c52155 --- /dev/null +++ b/arkoala-arkts/test/src/ets/test24.ets @@ -0,0 +1,57 @@ +@Observed +class Task { + isFinished: boolean = false; + + constructor(isFinished : boolean) { + this.isFinished = isFinished; + } +} + +@Entry +@Component +struct ParentComponent { + @State @Watch('onTaskAChanged') taskA: Task = new Task(false); + @State @Watch('onTaskBChanged') taskB: Task = new Task(false); + + onTaskAChanged(changedPropertyName: string): void { + console.log(`观测到父组件任务属性变化: ${changedPropertyName}`); + } + + onTaskBChanged(changedPropertyName: string): void { + console.log(`观测到父组件任务属性变化: ${changedPropertyName}`); + } + + build() { + Column() { + Text(`父组件任务A状态: ${this.taskA.isFinished ? '已完成' : '未完成'}`) + Text(`父组件任务B状态: ${this.taskB.isFinished ? '已完成' : '未完成'}`) + ChildComponent({ taskA: this.taskA, taskB: this.taskB }) + Button('切换任务状态') + .onClick(() => { + this.taskB = new Task(!this.taskB.isFinished); + this.taskA = new Task(!this.taskA.isFinished); + }) + } + } +} + +@Component +struct ChildComponent { + @ObjectLink @Watch('onObjectLinkTaskChanged') taskB: Task; + @Link @Watch('onLinkTaskChanged') taskA: Task; + + onObjectLinkTaskChanged(changedPropertyName: string): void { + console.log(`观测到子组件@ObjectLink关联的任务属性变化: ${changedPropertyName}`); + } + + onLinkTaskChanged(changedPropertyName: string): void { + console.log(`观测到子组件@Link关联的任务属性变化: ${changedPropertyName}`); + } + + build() { + Column() { + Text(`子组件任务A状态: ${this.taskA.isFinished ? '已完成' : '未完成'}`) + Text(`子组件任务B状态: ${this.taskB.isFinished ? '已完成' : '未完成'}`) + } + } +} diff --git a/arkoala-arkts/test/src/ets/test25.ets b/arkoala-arkts/test/src/ets/test25.ets new file mode 100644 index 0000000000000000000000000000000000000000..3a107e527a0b5545309ee0fe3b582fa8b592d70d --- /dev/null +++ b/arkoala-arkts/test/src/ets/test25.ets @@ -0,0 +1,35 @@ +@Component +struct TotalView { + @Prop @Watch('onCountUpdated') count: number = 0; + @State total: number = 0; + // @Watch 回调 + onCountUpdated(propName: string): void { + this.total += this.count; + } + + build() { + Text(`Total: ${this.total}`) + } +} + +@Entry +@Component +struct CountModifier { + @State @Watch('onCountChange') count: number = 0; + + onCountChange(name: string) { + console.log(`change count = ${this.count}`) + } + build() { + Column() { + Button('add to basket') + .onClick(() => { + for (let i = 0; i < 1000; i++) { + this.count++ + } + + }) + TotalView({ count: this.count }) + } + } +} diff --git a/arkoala-arkts/test/tsconfig-unmemoize-passed.json b/arkoala-arkts/test/tsconfig-unmemoize-passed.json new file mode 100644 index 0000000000000000000000000000000000000000..0411171290dfed102d891602c5c9c64586fb1460 --- /dev/null +++ b/arkoala-arkts/test/tsconfig-unmemoize-passed.json @@ -0,0 +1,69 @@ +{ + "extends": "@koalaui/build-common/tsconfig.json", + "compilerOptions": { + "types": [], + "plugins": [ + { + "transform": "@koalaui/compiler-plugin/build/lib/src/koala-transformer.js", + "trace": false, + "only_unmemoize": true, + "unmemoizeDir": "./build/unmemoized" + } + ], + "outDir": "./build/junk", + "baseUrl": ".", + "paths": { + "@koalaui/arkui-common": [ + "../../arkoala/arkui-common/src/arkts" + ], + "@koalaui/runtime": [ + "../../incremental/runtime" + ], + "#arkcompat": [ + "../../arkoala/arkui-common/src/arkts" + ], + "@koalaui/arkts-arkui": [ + "../arkui/src" + ], + "@koalaui/arkts-arkui/ohos.router": [ + "../arkui/src/ohos.router.ts" + ], + "app/*": [ + "./build/generated/*" + ] + } + }, + "files": [ + "../../incremental/tools/panda/arkts/std-lib/global.d.ts" + ], + "include": [ + "./build/generated", + "./src/**/*.ts" + ], + "exclude": [ + "../arkui/src/generated/arkts", + "../arkui/src/generated/common.ts", + "../arkui/src/generated/test_utils.ts", + "../arkui/src/generated/main.ts", + + "build/generated/test01.ts", + "build/generated/test08.ts", + "build/generated/test09.ts", + "build/generated/test10.ts", + "build/generated/test12.ts", + "build/generated/test16.ts", + "build/generated/test17.ts", + "build/generated/test18.ts", + "build/generated/test19.ts", + "build/generated/test20.ts", + "build/generated/test21.ts", + "build/generated/test22.ts", + "build/generated/test24.ts" + ], + "references": [ + { "path": "../../arkoala/arkui-common" }, + { "path": "../../arkoala/arkui-common/tsconfig-unmemoize.json" }, + { "path": "../../incremental/runtime" }, + { "path": "../arkui/tsconfig-unmemoize.json" } + ] +} diff --git a/arkoala-arkts/test/tsconfig-unmemoize.json b/arkoala-arkts/test/tsconfig-unmemoize.json new file mode 100644 index 0000000000000000000000000000000000000000..cc086dbc06db9cd854c4d70b92c7335a3e0c4674 --- /dev/null +++ b/arkoala-arkts/test/tsconfig-unmemoize.json @@ -0,0 +1,55 @@ +{ + "extends": "@koalaui/build-common/tsconfig.json", + "compilerOptions": { + "types": [], + "plugins": [ + { + "transform": "@koalaui/compiler-plugin/build/lib/src/koala-transformer.js", + "trace": false, + "only_unmemoize": true, + "unmemoizeDir": "./build/unmemoized" + } + ], + "outDir": "./build/junk", + "baseUrl": ".", + "paths": { + "@koalaui/arkui-common": [ + "../../arkoala/arkui-common/src/arkts" + ], + "@koalaui/runtime": [ + "../../incremental/runtime" + ], + "#arkcompat": [ + "../../arkoala/arkui-common/src/arkts" + ], + "@koalaui/arkts-arkui": [ + "../arkui/src" + ], + "@koalaui/arkts-arkui/ohos.router": [ + "../arkui/src/ohos.router.ts" + ], + "app/*": [ + "./build/generated/*" + ] + } + }, + "files": [ + "../../incremental/tools/panda/arkts/std-lib/global.d.ts" + ], + "include": [ + "./build/generated", + "./src/**/*.ts" + ], + "exclude": [ + "../arkui/src/generated/arkts", + "../arkui/src/generated/common.ts", + "../arkui/src/generated/test_utils.ts", + "../arkui/src/generated/main.ts" + ], + "references": [ + { "path": "../../arkoala/arkui-common" }, + { "path": "../../arkoala/arkui-common/tsconfig-unmemoize.json" }, + { "path": "../../incremental/runtime" }, + { "path": "../arkui/tsconfig-unmemoize.json" } + ] +}