idlize
1565 строк · 67.4 Кб
1
2> @koalaui/ets-plugin@1.3.5+devel test
3> npm run compile && npm run ets:test && mocha --reporter-option maxDiffSize=0
4
5
6> @koalaui/ets-plugin@1.3.5+devel compile
7> npm run patch-ts-patch && npm run patch-ohos-typescript && node ../node_modules/@ohos/typescript/bin/tsc -b .
8
9
10> @koalaui/ets-plugin@1.3.5+devel patch-ts-patch
11> node ../tools/patch-ts-patch.mjs ../node_modules/ts-patch
12
13
14> @koalaui/ets-plugin@1.3.5+devel patch-ohos-typescript
15> cd ../node_modules/@ohos/typescript && ts-patch install
16
17
18> @koalaui/ets-plugin@1.3.5+devel ets:test
19> cd test/ets; ../../../node_modules/@ohos/typescript/bin/tsc
20
21ETS->TS: D:/src/koala-ui/ets-plugin/test/ets/Rewrite.ets
22Would transform <ref *2> IdentifierObject {
23pos: 1046,
24end: 1070,
25flags: 1073741824,
26modifierFlagsCache: 0,
27transformFlags: 0,
28parent: <ref *1> NodeObject {
29pos: 1046,
30end: 1174,
31flags: 1073741824,
32modifierFlagsCache: 0,
33transformFlags: 4352,
34parent: NodeObject {
35pos: 1046,
36end: 1174,
37flags: 1073741824,
38modifierFlagsCache: 0,
39transformFlags: 4352,
40parent: [NodeObject],
41kind: 235,
42expression: [Circular *1],
43flowNode: [Object]
44},
45kind: 204,
46expression: [Circular *2],
47typeArguments: undefined,
48arguments: [
49[NodeObject],
50[NodeObject],
51pos: 1071,
52end: 1173,
53hasTrailingComma: false,
54transformFlags: 4352
55],
56id: 9677
57},
58kind: 78,
59originalKeywordKind: undefined,
60escapedText: 'animateTo',
61flowNode: {
62flags: 2050,
63node: NodeObject {
64pos: 1039,
65end: 1240,
66flags: 1073742080,
67modifierFlagsCache: 536870912,
68transformFlags: 4352,
69parent: [NodeObject],
70kind: 210,
71decorators: undefined,
72modifiers: undefined,
73symbol: [SymbolObject],
74localSymbol: undefined,
75locals: Map(0) {},
76nextContainer: [NodeObject],
77name: undefined,
78typeParameters: undefined,
79parameters: [Array],
80type: undefined,
81body: [NodeObject],
82equalsGreaterThanToken: [TokenObject],
83flowNode: [Object],
84endFlowNode: [Object],
85contextualType: undefined,
86inferenceContext: undefined,
87id: 9672
88}
89},
90id: 9678
91}
92KOALA: D:\src\koala-ui\ets-plugin\test\generated\Rewrite.ts
93ETS->TS: D:/src/koala-ui/ets-plugin/test/ets/Rewrite2.ets
94KOALA: D:\src\koala-ui\ets-plugin\test\generated\Rewrite2.ts
95ETS->TS: D:/src/koala-ui/ets-plugin/test/ets/Rewrite3.ets
96KOALA: D:\src\koala-ui\ets-plugin\test\generated\Rewrite3.ts
97
98
99Basic rewrites of ArkUI syntactic features
1001) Basic rewrites
1012) LocalStorageLinkExample rewrites
1023) LocalStoragePropExample rewrites
103
104
1050 passing (14ms)
1063 failing
107
1081) Basic rewrites of ArkUI syntactic features
109Basic rewrites:
110
111AssertionError: expected 'import { $r, $rawfile, AppStorage, Ap…' to equal 'import { $r, $rawfile, AppStorage, Ap…'
112+ expected - actual
113
114-import { $r, $rawfile, AppStorage, AppStorageLinkState, ArkButton, ArkCommonStruct1, ArkText, CanvasRenderingContext2D, CustomDialogController, DataChangeListener, Environment, ForEach, GestureGroup, IDataSource, LocalStorage, LongPressGesture, Observed, OnArkLifecycle, PanGesture, PanGestureOptions, PersistentStorage, PinchGesture, RenderingContextSettings, RotationGesture, Scroller, SubscribedAbstractProperty, SwipeGesture, SwiperController, TabsController, TapGesture, TextAreaController, ValueStorage, VideoController, animateTo, bindCustomDialog, contextLocalStateOf, createInstance, fp2px, getContext, getInspectorByKey, lpx2px, observableProxy, processArkLifecycleEvent, propValue, px2fp, px2lpx, px2vp, stateOf, vp2px } from "@koalaui/arkui";
115-import { registerArkuiEntry } from "@koalaui/arkui/ohos.router";
116-import { MutableState, OnChange, __key, contextLocal, mutableState, remember } from "@koalaui/runtime";
117-export class ArkEntryExampleComponent extends ArkCommonStruct1<ArkEntryExampleComponent, any> {
118- private _entry_local_storage_ = new LocalStorage();
119- constructor(private initializers: any, valueStorage?: ValueStorage) {
120- super(valueStorage);
121- }
122- /** @memo */
123- _build() {
124- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
125- return;
126- }
127- /** @memo */
128- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
129- const receiver = createInstance((storage?: ValueStorage) => {
130- const instance = new ArkEntryExampleComponent(initializers, storage);
131- return instance;
132- });
133- receiver._build();
134- return receiver;
135- }
136-}
137-class ArkComponentExampleComponent extends ArkCommonStruct1<ArkComponentExampleComponent, any> {
138- private _entry_local_storage_ = new LocalStorage();
139- constructor(private initializers: any, valueStorage?: ValueStorage) {
140- super(valueStorage);
141- }
142- /** @memo */
143- _build() {
144- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
145- return;
146- }
147- /** @memo */
148- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
149- const receiver = createInstance((storage?: ValueStorage) => {
150- const instance = new ArkComponentExampleComponent(initializers, storage);
151- return instance;
152- });
153- receiver._build();
154- return receiver;
155- }
156-}
157-class ArkBuildExampleComponent extends ArkCommonStruct1<ArkBuildExampleComponent, any> {
158- private _entry_local_storage_ = new LocalStorage();
159- constructor(private initializers: any, valueStorage?: ValueStorage) {
160- super(valueStorage);
161- }
162- /** @memo */
163- _build() {
164- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
165- return;
166- ArkText((instance: TextAttribute) => {
167- instance.fontColor(Color.Red)
168- .width(100);
169- }, () => {
170- }, "message");
171- }
172- /** @memo */
173- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
174- const receiver = createInstance((storage?: ValueStorage) => {
175- const instance = new ArkBuildExampleComponent(initializers, storage);
176- return instance;
177- });
178- receiver._build();
179- return receiver;
180- }
181-}
182-class ArkStateExampleComponent extends ArkCommonStruct1<ArkStateExampleComponent, any> {
183- private _entry_local_storage_ = new LocalStorage();
184- constructor(private initializers: any, valueStorage?: ValueStorage) {
185- super(valueStorage);
186- }
187- _x = stateOf<string>("hello", this, __key());
188- get x() {
189- return this._x!.value;
190- }
191- set x(value) {
192- this._x!.value = observableProxy(value);
193- }
194- /** @memo */
195- _build() {
196- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
197- return;
198- ArkText((instance: TextAttribute) => {
199- undefined;
200- }, () => {
201- }, this.x);
202- }
203- /** @memo */
204- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
205- const receiver = createInstance((storage?: ValueStorage) => {
206- const instance = new ArkStateExampleComponent(initializers, storage);
207- return instance;
208- });
209- receiver._build();
210- return receiver;
211- }
212-}
213-class ArkLinkExampleComponent extends ArkCommonStruct1<ArkLinkExampleComponent, any> {
214- private _entry_local_storage_ = new LocalStorage();
215- constructor(private initializers: any, valueStorage?: ValueStorage) {
216- super(valueStorage);
217- this._x = initializers.x;
218- }
219- _x: MutableState<string>;
220- get x() {
221- return this._x!.value;
222- }
223- set x(value) {
224- this._x!.value = observableProxy(value);
225- }
226- /** @memo */
227- _build() {
228- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
229- return;
230- ArkText((instance: TextAttribute) => {
231- undefined;
232- }, () => {
233- }, this.x);
234- }
235- /** @memo */
236- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
237- const receiver = createInstance((storage?: ValueStorage) => {
238- const instance = new ArkLinkExampleComponent(initializers, storage);
239- return instance;
240- });
241- receiver._build();
242- return receiver;
243- }
244-}
245-class ArkPropExampleComponent extends ArkCommonStruct1<ArkPropExampleComponent, any> {
246- private _entry_local_storage_ = new LocalStorage();
247- constructor(private initializers: any, valueStorage?: ValueStorage) {
248- super(valueStorage);
249- this._x = mutableState(initializers.x);
250- }
251- _x: MutableState<string>;
252- get x() {
253- return this._x!.value;
254- }
255- set x(value) {
256- this._x!.value = observableProxy(value);
257- }
258- /** @memo */
259- _build(_x: string) {
260- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
261- return;
262- propValue(_x, this._x);
263- ArkText((instance: TextAttribute) => {
264- undefined;
265- }, () => {
266- }, this.x);
267- }
268- /** @memo */
269- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
270- const receiver = createInstance((storage?: ValueStorage) => {
271- const instance = new ArkPropExampleComponent(initializers, storage);
272- return instance;
273- });
274- receiver._build(initializers.x);
275- return receiver;
276- }
277-}
278-class ArkProvideExampleComponent extends ArkCommonStruct1<ArkProvideExampleComponent, any> {
279- private _entry_local_storage_ = new LocalStorage();
280- constructor(private initializers: any, valueStorage?: ValueStorage) {
281- super(valueStorage);
282- this._x = initializers.x;
283- }
284- _x: MutableState<string>;
285- get x() {
286- return this._x!.value;
287- }
288- set x(value) {
289- this._x!.value = observableProxy(value);
290- }
291- /** @memo */
292- _build() {
293- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
294- return;
295- ArkText((instance: TextAttribute) => {
296- undefined;
297- }, () => {
298- }, this.x);
299- }
300- /** @memo */
301- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
302- const __provide_name = contextLocalStateOf<string>("name", () => "text");
303- const receiver = createInstance((storage?: ValueStorage) => {
304- const instance = new ArkProvideExampleComponent({
305- x: __provide_name,
306- ...initializers
307- }, storage);
308- return instance;
309- });
310- receiver._build();
311- return receiver;
312- }
313-}
314-class ArkConsumeExampleComponent extends ArkCommonStruct1<ArkConsumeExampleComponent, any> {
315- private _entry_local_storage_ = new LocalStorage();
316- constructor(private initializers: any, valueStorage?: ValueStorage) {
317- super(valueStorage);
318- this._x = initializers.x;
319- }
320- _x: MutableState<string>;
321- get x() {
322- return this._x!.value;
323- }
324- set x(value) {
325- this._x!.value = observableProxy(value);
326- }
327- /** @memo */
328- _build() {
329- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
330- return;
331- ArkText((instance: TextAttribute) => {
332- undefined;
333- }, () => {
334- }, this.x);
335- }
336- /** @memo */
337- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
338- const __consume_name = contextLocal<string>("name");
339- const receiver = createInstance((storage?: ValueStorage) => {
340- const instance = new ArkConsumeExampleComponent({
341- x: __consume_name,
342- ...initializers
343- }, storage);
344- return instance;
345- });
346- receiver._build();
347- return receiver;
348- }
349-}
350-class ArkBuilderExampleComponent extends ArkCommonStruct1<ArkBuilderExampleComponent, any> {
351- private _entry_local_storage_ = new LocalStorage();
352- constructor(private initializers: any, valueStorage?: ValueStorage) {
353- super(valueStorage);
354- }
355- /** @memo */
356- foo() {
357- ArkText((instance: TextAttribute) => {
358- undefined;
359- }, () => {
360- }, "hello");
361- }
362- /** @memo */
363- _build() {
364- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
365- return;
366- this.foo();
367- }
368- /** @memo */
369- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
370- const receiver = createInstance((storage?: ValueStorage) => {
371- const instance = new ArkBuilderExampleComponent(initializers, storage);
372- return instance;
373- });
374- receiver._build();
375- return receiver;
376- }
377-}
378-/** @memo */
379-function bar() {
380- ArkText((instance: TextAttribute) => {
381- undefined;
382- }, () => {
383- }, "hello");
384-}
385-class ArkIComponent extends ArkCommonStruct1<ArkIComponent, any> {
386- private _entry_local_storage_ = new LocalStorage();
387- constructor(private initializers: any, valueStorage?: ValueStorage) {
388- super(valueStorage);
389- }
390- /** @memo */
391- _build() {
392- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
393- return;
394- bar();
395- }
396- /** @memo */
397- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
398- const receiver = createInstance((storage?: ValueStorage) => {
399- const instance = new ArkIComponent(initializers, storage);
400- return instance;
401- });
402- receiver._build();
403- return receiver;
404- }
405-}
406-class ArkBuilderParamExampleComponent extends ArkCommonStruct1<ArkBuilderParamExampleComponent, any> {
407- private _entry_local_storage_ = new LocalStorage();
408- constructor(private initializers: any, valueStorage?: ValueStorage) {
409- super(valueStorage);
410- }
411- /** @memo */
412- foo: () => {} = this.initializers?.foo;
413- /** @memo */
414- _build() {
415- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
416- return;
417- this.foo();
418- }
419- /** @memo */
420- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
421- const receiver = createInstance((storage?: ValueStorage) => {
422- const instance = new ArkBuilderParamExampleComponent(initializers, storage);
423- return instance;
424- });
425- receiver._build();
426- return receiver;
427- }
428-}
429-// @Styles and @Extend
430-function looks<T extends CommonMethod<T>>(CommonInstance: T): void {
431- CommonInstance.height(500)
432- .width(400)
433- .backgroundColor(Color.Gray);
434-}
435-function clown__Column<T extends ColumnAttribute>(ColumnInstance: T): void {
436- ColumnInstance.height(500)
437- .width(400)
438- .backgroundColor(Color.Gray);
439-}
440-class ArkWatchExampleComponent extends ArkCommonStruct1<ArkWatchExampleComponent, any> {
441- private _entry_local_storage_ = new LocalStorage();
442- constructor(private initializers: any, valueStorage?: ValueStorage) {
443- super(valueStorage);
444- }
445- _x = stateOf<string>("hello", this, __key());
446- get x() {
447- return this._x!.value;
448- }
449- set x(value) {
450- this._x!.value = observableProxy(value);
451- }
452- watchFunction() {
453- console.log("Watch function");
454- }
455- /** @memo */
456- _build() {
457- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
458- return;
459- OnChange(this.x, () => this.watchFunction());
460- }
461- /** @memo */
462- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
463- const receiver = createInstance((storage?: ValueStorage) => {
464- const instance = new ArkWatchExampleComponent(initializers, storage);
465- return instance;
466- });
467- receiver._build();
468- return receiver;
469- }
470-}
471-class ArkStorageLinkExampleComponent extends ArkCommonStruct1<ArkStorageLinkExampleComponent, any> {
472- private _entry_local_storage_ = new LocalStorage();
473- constructor(private initializers: any, valueStorage?: ValueStorage) {
474- super(valueStorage);
475- }
476- _link = AppStorageLinkState<string>("storage", "Start");
477- get link() {
478- return this._link!.value;
479- }
480- set link(value) {
481- this._link!.value = observableProxy(value);
482- }
483- /** @memo */
484- _build() {
485- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
486- return;
487- }
488- /** @memo */
489- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
490- const receiver = createInstance((storage?: ValueStorage) => {
491- const instance = new ArkStorageLinkExampleComponent(initializers, storage);
492- return instance;
493- });
494- receiver._build();
495- return receiver;
496- }
497-}
498-class ArkStoragePropExampleComponent extends ArkCommonStruct1<ArkStoragePropExampleComponent, any> {
499- private _entry_local_storage_ = new LocalStorage();
500- constructor(private initializers: any, valueStorage?: ValueStorage) {
501- super(valueStorage);
502- }
503- _prop = stateOf<string>(AppStorageLinkState<string>("storage", "Start").value);
504- get prop() {
505- return this._prop!.value;
506- }
507- set prop(value) {
508- this._prop!.value = observableProxy(value);
509- }
510- /** @memo */
511- _build() {
512- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
513- return;
514- propValue(AppStorageLinkState<string>("storage", "Start").value, this._prop);
515- }
516- /** @memo */
517- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
518- const receiver = createInstance((storage?: ValueStorage) => {
519- const instance = new ArkStoragePropExampleComponent(initializers, storage);
520- return instance;
521- });
522- receiver._build();
523- return receiver;
524- }
525-}
526-class ArkCustomDialogExampleComponent extends ArkCommonStruct1<ArkCustomDialogExampleComponent, any> {
527- private _entry_local_storage_ = new LocalStorage();
528- constructor(private initializers: any, valueStorage?: ValueStorage) {
529- super(valueStorage);
530- }
531- controller: CustomDialogController = this.initializers?.controller;
532- /** @memo */
533- _build() {
534- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
535- return;
536- }
537- /** @memo */
538- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
539- const receiver = createInstance((storage?: ValueStorage) => {
540- const instance = new ArkCustomDialogExampleComponent(initializers, storage);
541- return instance;
542- });
543- receiver._build();
544- return receiver;
545- }
546-}
547-export class ArkCustomDialogControlleExampleComponent extends ArkCommonStruct1<ArkCustomDialogControlleExampleComponent, any> {
548- private _entry_local_storage_ = new LocalStorage();
549- constructor(private initializers: any, valueStorage?: ValueStorage) {
550- super(valueStorage);
551- }
552- dialogController: CustomDialogController = this.initializers?.dialogController ?? new CustomDialogController({
553- builder: CustomDialogExample(),
554- autoCancel: true,
555- alignment: DialogAlignment.Default,
556- offset: { dx: 0, dy: 0 },
557- gridCount: 4,
558- customStyle: false
559- });
560- aboutToAppear() {
561- this.dialogController.open();
562- }
563- aboutToDisappear() {
564- this.dialogController.close();
565- }
566- /** @memo */
567- _build() {
568- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
569- return;
570- }
571- /** @memo */
572- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
573- const receiver = createInstance((storage?: ValueStorage) => {
574- const instance = new ArkCustomDialogControlleExampleComponent(initializers, storage);
575- return instance;
576- });
577- receiver._build();
578- return receiver;
579- }
580-}
581-// ObjectLink and Observed
582-@Observed
583-class ObservedExample {
584- public c: number;
585- constructor(c: number) {
586- this.c = c;
587- }
588-}
589-class ArkObjectLinkExampleComponent extends ArkCommonStruct1<ArkObjectLinkExampleComponent, any> {
590- private _entry_local_storage_ = new LocalStorage();
591- constructor(private initializers: any, valueStorage?: ValueStorage) {
592- super(valueStorage);
593- this._a = mutableState(initializers.a);
594- }
595- _a: MutableState<ObservedExample>;
596- get a() {
597- return this._a!.value;
598- }
599- set a(value) {
600- this._a!.value = observableProxy(value);
601- }
602- /** @memo */
603- _build(_a: ObservedExample) {
604- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
605- return;
606- propValue(_a, this._a);
607- ArkButton((instance: ButtonAttribute) => {
608- instance.onClick(() => {
609- this.a.c += 1;
610- });
611- }, () => {
612- });
613- }
614- /** @memo */
615- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
616- const receiver = createInstance((storage?: ValueStorage) => {
617- const instance = new ArkObjectLinkExampleComponent(initializers, storage);
618- return instance;
619- });
620- receiver._build(initializers.a);
621- return receiver;
622- }
623-}
624-class ArkObjectLinkExampleParentComponent extends ArkCommonStruct1<ArkObjectLinkExampleParentComponent, any> {
625- private _entry_local_storage_ = new LocalStorage();
626- constructor(private initializers: any, valueStorage?: ValueStorage) {
627- super(valueStorage);
628- }
629- _a = stateOf<ObservedExample[]>([new ObservedExample(0), new ObservedExample(0)], this, __key());
630- get a() {
631- return this._a!.value;
632- }
633- set a(value) {
634- this._a!.value = observableProxy(value);
635- }
636- /** @memo */
637- _build() {
638- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
639- return;
640- ObjectLinkExample();
641- }
642- /** @memo */
643- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
644- const receiver = createInstance((storage?: ValueStorage) => {
645- const instance = new ArkObjectLinkExampleParentComponent(initializers, storage);
646- return instance;
647- });
648- receiver._build();
649- return receiver;
650- }
651-}
652-/** @memo */
653-export function EntryExample(initializers?: any) {
654- return ArkEntryExampleComponent._invoke(initializers);
655-}
656-/** @memo */
657-export function ComponentExample(initializers?: any) {
658- return ArkComponentExampleComponent._invoke(initializers);
659-}
660-/** @memo */
661-export function BuildExample(initializers?: any) {
662- return ArkBuildExampleComponent._invoke(initializers);
663-}
664-/** @memo */
665-export function StateExample(initializers?: any) {
666- return ArkStateExampleComponent._invoke(initializers);
667-}
668-/** @memo */
669-export function LinkExample(initializers?: any) {
670- return ArkLinkExampleComponent._invoke(initializers);
671-}
672-/** @memo */
673-export function PropExample(initializers?: any) {
674- return ArkPropExampleComponent._invoke(initializers);
675-}
676-/** @memo */
677-export function ProvideExample(initializers?: any) {
678- return ArkProvideExampleComponent._invoke(initializers);
679-}
680-/** @memo */
681-export function ConsumeExample(initializers?: any) {
682- return ArkConsumeExampleComponent._invoke(initializers);
683-}
684-/** @memo */
685-export function BuilderExample(initializers?: any) {
686- return ArkBuilderExampleComponent._invoke(initializers);
687-}
688-/** @memo */
689-export function I(initializers?: any) {
690- return ArkIComponent._invoke(initializers);
691-}
692-/** @memo */
693-export function BuilderParamExample(initializers?: any) {
694- return ArkBuilderParamExampleComponent._invoke(initializers);
695-}
696-/** @memo */
697-export function WatchExample(initializers?: any) {
698- return ArkWatchExampleComponent._invoke(initializers);
699-}
700-/** @memo */
701-export function StorageLinkExample(initializers?: any) {
702- return ArkStorageLinkExampleComponent._invoke(initializers);
703-}
704-/** @memo */
705-export function StoragePropExample(initializers?: any) {
706- return ArkStoragePropExampleComponent._invoke(initializers);
707-}
708-/** @memo */
709-export function CustomDialogExampleImpl(initializers?: any) {
710- return ArkCustomDialogExampleComponent._invoke(initializers);
711-}
712-export function CustomDialogExample(initializer: any = {}) {
713- return { build: bindCustomDialog(CustomDialogExampleImpl, initializer), buildOptions: initializer };
714-}
715-/** @memo */
716-export function CustomDialogControlleExample(initializers?: any) {
717- return ArkCustomDialogControlleExampleComponent._invoke(initializers);
718-}
719-/** @memo */
720-export function ObjectLinkExample(initializers?: any) {
721- return ArkObjectLinkExampleComponent._invoke(initializers);
722-}
723-/** @memo */
724-export function ObjectLinkExampleParent(initializers?: any) {
725- return ArkObjectLinkExampleParentComponent._invoke(initializers);
726-}
727-registerArkuiEntry(EntryExample, "Rewrite");
728-export const __Entry = EntryExample;
729+import { $r, $rawfile, AppStorage, AppStorageLinkState, ArkButton, ArkCommonStruct1, ArkText, CanvasRenderingContext2D, CustomDialogController, DataChangeListener, Environment, ForEach, GestureGroup, IDataSource, LocalStorage, LongPressGesture, Observed, OnArkLifecycle, PanGesture, PanGestureOptions, PersistentStorage, PinchGesture, RenderingContextSettings, RotationGesture, Scroller, SubscribedAbstractProperty, SwipeGesture, SwiperController, TabsController, TapGesture, TextAreaController, ValueStorage, VideoController, animateTo, bindCustomDialog, contextLocalStateOf, createInstance, fp2px, getContext, getInspectorByKey, lpx2px, observableProxy, processArkLifecycleEvent, propValue, px2fp, px2lpx, px2vp, stateOf, vp2px } from "@koalaui/arkui";
730+import { registerArkuiEntry } from "@koalaui/arkui/ohos.router";
731+import { MutableState, OnChange, __key, contextLocal, mutableState, remember } from "@koalaui/runtime";
732+export class ArkEntryExampleComponent extends ArkCommonStruct1<ArkEntryExampleComponent, any> {
733+ private _entry_local_storage_ = new LocalStorage();
734+ constructor(private initializers: any, valueStorage?: ValueStorage) {
735+ super(valueStorage);
736+ }
737+ /** @memo */
738+ _build() {
739+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
740+ return;
741+ }
742+ /** @memo */
743+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
744+ const receiver = createInstance((storage?: ValueStorage) => {
745+ const instance = new ArkEntryExampleComponent(initializers, storage);
746+ return instance;
747+ });
748+ receiver._build();
749+ return receiver;
750+ }
751+}
752+class ArkComponentExampleComponent extends ArkCommonStruct1<ArkComponentExampleComponent, any> {
753+ private _entry_local_storage_ = new LocalStorage();
754+ constructor(private initializers: any, valueStorage?: ValueStorage) {
755+ super(valueStorage);
756+ }
757+ /** @memo */
758+ _build() {
759+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
760+ return;
761+ }
762+ /** @memo */
763+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
764+ const receiver = createInstance((storage?: ValueStorage) => {
765+ const instance = new ArkComponentExampleComponent(initializers, storage);
766+ return instance;
767+ });
768+ receiver._build();
769+ return receiver;
770+ }
771+}
772+class ArkBuildExampleComponent extends ArkCommonStruct1<ArkBuildExampleComponent, any> {
773+ private _entry_local_storage_ = new LocalStorage();
774+ constructor(private initializers: any, valueStorage?: ValueStorage) {
775+ super(valueStorage);
776+ }
777+ /** @memo */
778+ _build() {
779+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
780+ return;
781+ ArkText((instance: TextAttribute) => {
782+ instance.fontColor(Color.Red)
783+ .width(100);
784+ }, () => {
785+ }, "message");
786+ }
787+ /** @memo */
788+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
789+ const receiver = createInstance((storage?: ValueStorage) => {
790+ const instance = new ArkBuildExampleComponent(initializers, storage);
791+ return instance;
792+ });
793+ receiver._build();
794+ return receiver;
795+ }
796+}
797+class ArkStateExampleComponent extends ArkCommonStruct1<ArkStateExampleComponent, any> {
798+ private _entry_local_storage_ = new LocalStorage();
799+ constructor(private initializers: any, valueStorage?: ValueStorage) {
800+ super(valueStorage);
801+ }
802+ _x = stateOf<string>("hello", this, __key());
803+ get x() {
804+ return this._x!.value;
805+ }
806+ set x(value) {
807+ this._x!.value = observableProxy(value);
808+ }
809+ /** @memo */
810+ _build() {
811+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
812+ return;
813+ ArkText((instance: TextAttribute) => {
814+ undefined;
815+ }, () => {
816+ }, this.x);
817+ }
818+ /** @memo */
819+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
820+ const receiver = createInstance((storage?: ValueStorage) => {
821+ const instance = new ArkStateExampleComponent(initializers, storage);
822+ return instance;
823+ });
824+ receiver._build();
825+ return receiver;
826+ }
827+}
828+class ArkLinkExampleComponent extends ArkCommonStruct1<ArkLinkExampleComponent, any> {
829+ private _entry_local_storage_ = new LocalStorage();
830+ constructor(private initializers: any, valueStorage?: ValueStorage) {
831+ super(valueStorage);
832+ this._x = initializers.x;
833+ }
834+ _x: MutableState<string>;
835+ get x() {
836+ return this._x!.value;
837+ }
838+ set x(value) {
839+ this._x!.value = observableProxy(value);
840+ }
841+ /** @memo */
842+ _build() {
843+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
844+ return;
845+ ArkText((instance: TextAttribute) => {
846+ undefined;
847+ }, () => {
848+ }, this.x);
849+ }
850+ /** @memo */
851+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
852+ const receiver = createInstance((storage?: ValueStorage) => {
853+ const instance = new ArkLinkExampleComponent(initializers, storage);
854+ return instance;
855+ });
856+ receiver._build();
857+ return receiver;
858+ }
859+}
860+class ArkPropExampleComponent extends ArkCommonStruct1<ArkPropExampleComponent, any> {
861+ private _entry_local_storage_ = new LocalStorage();
862+ constructor(private initializers: any, valueStorage?: ValueStorage) {
863+ super(valueStorage);
864+ this._x = mutableState(initializers.x);
865+ }
866+ _x: MutableState<string>;
867+ get x() {
868+ return this._x!.value;
869+ }
870+ set x(value) {
871+ this._x!.value = observableProxy(value);
872+ }
873+ /** @memo */
874+ _build(_x: string) {
875+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
876+ return;
877+ propValue(_x, this._x);
878+ ArkText((instance: TextAttribute) => {
879+ undefined;
880+ }, () => {
881+ }, this.x);
882+ }
883+ /** @memo */
884+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
885+ const receiver = createInstance((storage?: ValueStorage) => {
886+ const instance = new ArkPropExampleComponent(initializers, storage);
887+ return instance;
888+ });
889+ receiver._build(initializers.x);
890+ return receiver;
891+ }
892+}
893+class ArkProvideExampleComponent extends ArkCommonStruct1<ArkProvideExampleComponent, any> {
894+ private _entry_local_storage_ = new LocalStorage();
895+ constructor(private initializers: any, valueStorage?: ValueStorage) {
896+ super(valueStorage);
897+ this._x = initializers.x;
898+ }
899+ _x: MutableState<string>;
900+ get x() {
901+ return this._x!.value;
902+ }
903+ set x(value) {
904+ this._x!.value = observableProxy(value);
905+ }
906+ /** @memo */
907+ _build() {
908+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
909+ return;
910+ ArkText((instance: TextAttribute) => {
911+ undefined;
912+ }, () => {
913+ }, this.x);
914+ }
915+ /** @memo */
916+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
917+ const __provide_name = contextLocalStateOf<string>("name", () => "text");
918+ const receiver = createInstance((storage?: ValueStorage) => {
919+ const instance = new ArkProvideExampleComponent({
920+ x: __provide_name,
921+ ...initializers
922+ }, storage);
923+ return instance;
924+ });
925+ receiver._build();
926+ return receiver;
927+ }
928+}
929+class ArkConsumeExampleComponent extends ArkCommonStruct1<ArkConsumeExampleComponent, any> {
930+ private _entry_local_storage_ = new LocalStorage();
931+ constructor(private initializers: any, valueStorage?: ValueStorage) {
932+ super(valueStorage);
933+ this._x = initializers.x;
934+ }
935+ _x: MutableState<string>;
936+ get x() {
937+ return this._x!.value;
938+ }
939+ set x(value) {
940+ this._x!.value = observableProxy(value);
941+ }
942+ /** @memo */
943+ _build() {
944+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
945+ return;
946+ ArkText((instance: TextAttribute) => {
947+ undefined;
948+ }, () => {
949+ }, this.x);
950+ }
951+ /** @memo */
952+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
953+ const __consume_name = contextLocal<string>("name");
954+ const receiver = createInstance((storage?: ValueStorage) => {
955+ const instance = new ArkConsumeExampleComponent({
956+ x: __consume_name,
957+ ...initializers
958+ }, storage);
959+ return instance;
960+ });
961+ receiver._build();
962+ return receiver;
963+ }
964+}
965+class ArkChildComponent extends ArkCommonStruct1<ArkChildComponent, any> {
966+ private _entry_local_storage_ = new LocalStorage();
967+ constructor(private initializers: any, valueStorage?: ValueStorage) {
968+ super(valueStorage);
969+ }
970+ _myProp = stateOf<number>(40, this, __key());
971+ get myProp() {
972+ return this._myProp!.value;
973+ }
974+ set myProp(value) {
975+ this._myProp!.value = observableProxy(value);
976+ }
977+ /** @memo */
978+ _build() {
979+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
980+ return;
981+ ArkText((instance: TextAttribute) => {
982+ instance.width(this.myProp + 20)
983+ .onClick(() => {
984+ this.__animateTo({ duration: 1000 }, () => {
985+ this.myProp = this.myProp == 40 ? 120 : 40;
986+ });
987+ console.log("ARK CHILD", this.myProp);
988+ })
989+ .height(this.myProp + 100);
990+ }, () => {
991+ }, "Child");
992+ }
993+ /** @memo */
994+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
995+ const receiver = createInstance((storage?: ValueStorage) => {
996+ const instance = new ArkChildComponent(initializers, storage);
997+ return instance;
998+ });
999+ receiver._build();
1000+ return receiver;
1001+ }
1002+}
1003+class ArkBuilderExampleComponent extends ArkCommonStruct1<ArkBuilderExampleComponent, any> {
1004+ private _entry_local_storage_ = new LocalStorage();
1005+ constructor(private initializers: any, valueStorage?: ValueStorage) {
1006+ super(valueStorage);
1007+ }
1008+ /** @memo */
1009+ foo() {
1010+ ArkText((instance: TextAttribute) => {
1011+ undefined;
1012+ }, () => {
1013+ }, "hello");
1014+ }
1015+ /** @memo */
1016+ _build() {
1017+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
1018+ return;
1019+ this.foo();
1020+ }
1021+ /** @memo */
1022+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
1023+ const receiver = createInstance((storage?: ValueStorage) => {
1024+ const instance = new ArkBuilderExampleComponent(initializers, storage);
1025+ return instance;
1026+ });
1027+ receiver._build();
1028+ return receiver;
1029+ }
1030+}
1031+/** @memo */
1032+function bar() {
1033+ ArkText((instance: TextAttribute) => {
1034+ undefined;
1035+ }, () => {
1036+ }, "hello");
1037+}
1038+class ArkIComponent extends ArkCommonStruct1<ArkIComponent, any> {
1039+ private _entry_local_storage_ = new LocalStorage();
1040+ constructor(private initializers: any, valueStorage?: ValueStorage) {
1041+ super(valueStorage);
1042+ }
1043+ /** @memo */
1044+ _build() {
1045+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
1046+ return;
1047+ bar();
1048+ }
1049+ /** @memo */
1050+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
1051+ const receiver = createInstance((storage?: ValueStorage) => {
1052+ const instance = new ArkIComponent(initializers, storage);
1053+ return instance;
1054+ });
1055+ receiver._build();
1056+ return receiver;
1057+ }
1058+}
1059+class ArkBuilderParamExampleComponent extends ArkCommonStruct1<ArkBuilderParamExampleComponent, any> {
1060+ private _entry_local_storage_ = new LocalStorage();
1061+ constructor(private initializers: any, valueStorage?: ValueStorage) {
1062+ super(valueStorage);
1063+ }
1064+ /** @memo */
1065+ foo: () => {} = this.initializers?.foo;
1066+ /** @memo */
1067+ _build() {
1068+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
1069+ return;
1070+ this.foo();
1071+ }
1072+ /** @memo */
1073+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
1074+ const receiver = createInstance((storage?: ValueStorage) => {
1075+ const instance = new ArkBuilderParamExampleComponent(initializers, storage);
1076+ return instance;
1077+ });
1078+ receiver._build();
1079+ return receiver;
1080+ }
1081+}
1082+// @Styles and @Extend
1083+function looks<T extends CommonMethod<T>>(CommonInstance: T): void {
1084+ CommonInstance.height(500)
1085+ .width(400)
1086+ .backgroundColor(Color.Gray);
1087+}
1088+function clown__Column<T extends ColumnAttribute>(ColumnInstance: T): void {
1089+ ColumnInstance.height(500)
1090+ .width(400)
1091+ .backgroundColor(Color.Gray);
1092+}
1093+class ArkWatchExampleComponent extends ArkCommonStruct1<ArkWatchExampleComponent, any> {
1094+ private _entry_local_storage_ = new LocalStorage();
1095+ constructor(private initializers: any, valueStorage?: ValueStorage) {
1096+ super(valueStorage);
1097+ }
1098+ _x = stateOf<string>("hello", this, __key());
1099+ get x() {
1100+ return this._x!.value;
1101+ }
1102+ set x(value) {
1103+ this._x!.value = observableProxy(value);
1104+ }
1105+ watchFunction() {
1106+ console.log("Watch function");
1107+ }
1108+ /** @memo */
1109+ _build() {
1110+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
1111+ return;
1112+ OnChange(this.x, () => this.watchFunction());
1113+ }
1114+ /** @memo */
1115+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
1116+ const receiver = createInstance((storage?: ValueStorage) => {
1117+ const instance = new ArkWatchExampleComponent(initializers, storage);
1118+ return instance;
1119+ });
1120+ receiver._build();
1121+ return receiver;
1122+ }
1123+}
1124+class ArkStorageLinkExampleComponent extends ArkCommonStruct1<ArkStorageLinkExampleComponent, any> {
1125+ private _entry_local_storage_ = new LocalStorage();
1126+ constructor(private initializers: any, valueStorage?: ValueStorage) {
1127+ super(valueStorage);
1128+ }
1129+ _link = AppStorageLinkState<string>("storage", "Start");
1130+ get link() {
1131+ return this._link!.value;
1132+ }
1133+ set link(value) {
1134+ this._link!.value = observableProxy(value);
1135+ }
1136+ /** @memo */
1137+ _build() {
1138+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
1139+ return;
1140+ }
1141+ /** @memo */
1142+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
1143+ const receiver = createInstance((storage?: ValueStorage) => {
1144+ const instance = new ArkStorageLinkExampleComponent(initializers, storage);
1145+ return instance;
1146+ });
1147+ receiver._build();
1148+ return receiver;
1149+ }
1150+}
1151+class ArkStoragePropExampleComponent extends ArkCommonStruct1<ArkStoragePropExampleComponent, any> {
1152+ private _entry_local_storage_ = new LocalStorage();
1153+ constructor(private initializers: any, valueStorage?: ValueStorage) {
1154+ super(valueStorage);
1155+ }
1156+ _prop = stateOf<string>(AppStorageLinkState<string>("storage", "Start").value);
1157+ get prop() {
1158+ return this._prop!.value;
1159+ }
1160+ set prop(value) {
1161+ this._prop!.value = observableProxy(value);
1162+ }
1163+ /** @memo */
1164+ _build() {
1165+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
1166+ return;
1167+ propValue(AppStorageLinkState<string>("storage", "Start").value, this._prop);
1168+ }
1169+ /** @memo */
1170+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
1171+ const receiver = createInstance((storage?: ValueStorage) => {
1172+ const instance = new ArkStoragePropExampleComponent(initializers, storage);
1173+ return instance;
1174+ });
1175+ receiver._build();
1176+ return receiver;
1177+ }
1178+}
1179+class ArkCustomDialogExampleComponent extends ArkCommonStruct1<ArkCustomDialogExampleComponent, any> {
1180+ private _entry_local_storage_ = new LocalStorage();
1181+ constructor(private initializers: any, valueStorage?: ValueStorage) {
1182+ super(valueStorage);
1183+ }
1184+ controller: CustomDialogController = this.initializers?.controller;
1185+ /** @memo */
1186+ _build() {
1187+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
1188+ return;
1189+ }
1190+ /** @memo */
1191+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
1192+ const receiver = createInstance((storage?: ValueStorage) => {
1193+ const instance = new ArkCustomDialogExampleComponent(initializers, storage);
1194+ return instance;
1195+ });
1196+ receiver._build();
1197+ return receiver;
1198+ }
1199+}
1200+export class ArkCustomDialogControlleExampleComponent extends ArkCommonStruct1<ArkCustomDialogControlleExampleComponent, any> {
1201+ private _entry_local_storage_ = new LocalStorage();
1202+ constructor(private initializers: any, valueStorage?: ValueStorage) {
1203+ super(valueStorage);
1204+ }
1205+ dialogController: CustomDialogController = this.initializers?.dialogController ?? new CustomDialogController({
1206+ builder: CustomDialogExample(),
1207+ autoCancel: true,
1208+ alignment: DialogAlignment.Default,
1209+ offset: { dx: 0, dy: 0 },
1210+ gridCount: 4,
1211+ customStyle: false
1212+ });
1213+ aboutToAppear() {
1214+ this.dialogController.open();
1215+ }
1216+ aboutToDisappear() {
1217+ this.dialogController.close();
1218+ }
1219+ /** @memo */
1220+ _build() {
1221+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
1222+ return;
1223+ }
1224+ /** @memo */
1225+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
1226+ const receiver = createInstance((storage?: ValueStorage) => {
1227+ const instance = new ArkCustomDialogControlleExampleComponent(initializers, storage);
1228+ return instance;
1229+ });
1230+ receiver._build();
1231+ return receiver;
1232+ }
1233+}
1234+// ObjectLink and Observed
1235+@Observed
1236+class ObservedExample {
1237+ public c: number;
1238+ constructor(c: number) {
1239+ this.c = c;
1240+ }
1241+}
1242+class ArkObjectLinkExampleComponent extends ArkCommonStruct1<ArkObjectLinkExampleComponent, any> {
1243+ private _entry_local_storage_ = new LocalStorage();
1244+ constructor(private initializers: any, valueStorage?: ValueStorage) {
1245+ super(valueStorage);
1246+ this._a = mutableState(initializers.a);
1247+ }
1248+ _a: MutableState<ObservedExample>;
1249+ get a() {
1250+ return this._a!.value;
1251+ }
1252+ set a(value) {
1253+ this._a!.value = observableProxy(value);
1254+ }
1255+ /** @memo */
1256+ _build(_a: ObservedExample) {
1257+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
1258+ return;
1259+ propValue(_a, this._a);
1260+ ArkButton((instance: ButtonAttribute) => {
1261+ instance.onClick(() => {
1262+ this.a.c += 1;
1263+ });
1264+ }, () => {
1265+ });
1266+ }
1267+ /** @memo */
1268+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
1269+ const receiver = createInstance((storage?: ValueStorage) => {
1270+ const instance = new ArkObjectLinkExampleComponent(initializers, storage);
1271+ return instance;
1272+ });
1273+ receiver._build(initializers.a);
1274+ return receiver;
1275+ }
1276+}
1277+class ArkObjectLinkExampleParentComponent extends ArkCommonStruct1<ArkObjectLinkExampleParentComponent, any> {
1278+ private _entry_local_storage_ = new LocalStorage();
1279+ constructor(private initializers: any, valueStorage?: ValueStorage) {
1280+ super(valueStorage);
1281+ }
1282+ _a = stateOf<ObservedExample[]>([new ObservedExample(0), new ObservedExample(0)], this, __key());
1283+ get a() {
1284+ return this._a!.value;
1285+ }
1286+ set a(value) {
1287+ this._a!.value = observableProxy(value);
1288+ }
1289+ /** @memo */
1290+ _build() {
1291+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
1292+ return;
1293+ ObjectLinkExample();
1294+ }
1295+ /** @memo */
1296+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
1297+ const receiver = createInstance((storage?: ValueStorage) => {
1298+ const instance = new ArkObjectLinkExampleParentComponent(initializers, storage);
1299+ return instance;
1300+ });
1301+ receiver._build();
1302+ return receiver;
1303+ }
1304+}
1305+/** @memo */
1306+export function EntryExample(initializers?: any) {
1307+ return ArkEntryExampleComponent._invoke(initializers);
1308+}
1309+/** @memo */
1310+export function ComponentExample(initializers?: any) {
1311+ return ArkComponentExampleComponent._invoke(initializers);
1312+}
1313+/** @memo */
1314+export function BuildExample(initializers?: any) {
1315+ return ArkBuildExampleComponent._invoke(initializers);
1316+}
1317+/** @memo */
1318+export function StateExample(initializers?: any) {
1319+ return ArkStateExampleComponent._invoke(initializers);
1320+}
1321+/** @memo */
1322+export function LinkExample(initializers?: any) {
1323+ return ArkLinkExampleComponent._invoke(initializers);
1324+}
1325+/** @memo */
1326+export function PropExample(initializers?: any) {
1327+ return ArkPropExampleComponent._invoke(initializers);
1328+}
1329+/** @memo */
1330+export function ProvideExample(initializers?: any) {
1331+ return ArkProvideExampleComponent._invoke(initializers);
1332+}
1333+/** @memo */
1334+export function ConsumeExample(initializers?: any) {
1335+ return ArkConsumeExampleComponent._invoke(initializers);
1336+}
1337+/** @memo */
1338+export function Child(initializers?: any) {
1339+ return ArkChildComponent._invoke(initializers);
1340+}
1341+/** @memo */
1342+export function BuilderExample(initializers?: any) {
1343+ return ArkBuilderExampleComponent._invoke(initializers);
1344+}
1345+/** @memo */
1346+export function I(initializers?: any) {
1347+ return ArkIComponent._invoke(initializers);
1348+}
1349+/** @memo */
1350+export function BuilderParamExample(initializers?: any) {
1351+ return ArkBuilderParamExampleComponent._invoke(initializers);
1352+}
1353+/** @memo */
1354+export function WatchExample(initializers?: any) {
1355+ return ArkWatchExampleComponent._invoke(initializers);
1356+}
1357+/** @memo */
1358+export function StorageLinkExample(initializers?: any) {
1359+ return ArkStorageLinkExampleComponent._invoke(initializers);
1360+}
1361+/** @memo */
1362+export function StoragePropExample(initializers?: any) {
1363+ return ArkStoragePropExampleComponent._invoke(initializers);
1364+}
1365+/** @memo */
1366+export function CustomDialogExampleImpl(initializers?: any) {
1367+ return ArkCustomDialogExampleComponent._invoke(initializers);
1368+}
1369+export function CustomDialogExample(initializer: any = {}) {
1370+ return { build: bindCustomDialog(CustomDialogExampleImpl, initializer), buildOptions: initializer };
1371+}
1372+/** @memo */
1373+export function CustomDialogControlleExample(initializers?: any) {
1374+ return ArkCustomDialogControlleExampleComponent._invoke(initializers);
1375+}
1376+/** @memo */
1377+export function ObjectLinkExample(initializers?: any) {
1378+ return ArkObjectLinkExampleComponent._invoke(initializers);
1379+}
1380+/** @memo */
1381+export function ObjectLinkExampleParent(initializers?: any) {
1382+ return ArkObjectLinkExampleParentComponent._invoke(initializers);
1383+}
1384+registerArkuiEntry(EntryExample, "Rewrite");
1385+export const __Entry = EntryExample;
1386
1387at Context.<anonymous> (test\rewrites.test.ts:9:16)
1388at processImmediate (node:internal/timers:471:21)
1389
13902) Basic rewrites of ArkUI syntactic features
1391LocalStorageLinkExample rewrites:
1392
1393AssertionError: expected 'import { $r, $rawfile, AppStorage, Ar…' to equal 'import { $r, $rawfile, AppStorage, Ar…'
1394+ expected - actual
1395
1396-import { $r, $rawfile, AppStorage, ArkCommonStruct1, ArkText, CanvasRenderingContext2D, CustomDialogController, DataChangeListener, Environment, ForEach, GestureGroup, IDataSource, LocalStorage, LongPressGesture, Observed, OnArkLifecycle, PanGesture, PanGestureOptions, PersistentStorage, PinchGesture, RenderingContextSettings, RotationGesture, Scroller, StorageLinkState, SubscribedAbstractProperty, SwipeGesture, SwiperController, TabsController, TapGesture, TextAreaController, ValueStorage, VideoController, animateTo, createInstance, fp2px, getContext, getInspectorByKey, lpx2px, observableProxy, processArkLifecycleEvent, px2fp, px2lpx, px2vp, vp2px } from "@koalaui/arkui";
1397-import { registerArkuiEntry } from "@koalaui/arkui/ohos.router";
1398-import { remember } from "@koalaui/runtime";
1399-export const storage = new LocalStorage();
1400-class ArkLocalStorageLinkExampleComponent extends ArkCommonStruct1<ArkLocalStorageLinkExampleComponent, any> {
1401- private _entry_local_storage_ = storage;
1402- constructor(private initializers: any, valueStorage?: ValueStorage) {
1403- super(valueStorage);
1404- }
1405- _link = StorageLinkState<string>(this._entry_local_storage_, "storage", "Start");
1406- get link() {
1407- return this._link!.value;
1408- }
1409- set link(value) {
1410- this._link!.value = observableProxy(value);
1411- }
1412- /** @memo */
1413- _build() {
1414- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
1415- return;
1416- ArkText((instance: TextAttribute) => {
1417- undefined;
1418- }, () => {
1419- }, "LocalStorage entry = " + storage.get("storage"));
1420- }
1421- /** @memo */
1422- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
1423- const receiver = createInstance((storage?: ValueStorage) => {
1424- const instance = new ArkLocalStorageLinkExampleComponent(initializers, storage);
1425- return instance;
1426- });
1427- receiver._build();
1428- return receiver;
1429- }
1430-}
1431-/** @memo */
1432-export function LocalStorageLinkExample(initializers?: any) {
1433- return ArkLocalStorageLinkExampleComponent._invoke(initializers);
1434-}
1435-registerArkuiEntry(LocalStorageLinkExample, "Rewrite2");
1436-export const __Entry = LocalStorageLinkExample;
1437+import { $r, $rawfile, AppStorage, ArkCommonStruct1, ArkText, CanvasRenderingContext2D, CustomDialogController, DataChangeListener, Environment, ForEach, GestureGroup, IDataSource, LocalStorage, LongPressGesture, Observed, OnArkLifecycle, PanGesture, PanGestureOptions, PersistentStorage, PinchGesture, RenderingContextSettings, RotationGesture, Scroller, StorageLinkState, SubscribedAbstractProperty, SwipeGesture, SwiperController, TabsController, TapGesture, TextAreaController, ValueStorage, VideoController, animateTo, createInstance, fp2px, getContext, getInspectorByKey, lpx2px, observableProxy, processArkLifecycleEvent, px2fp, px2lpx, px2vp, vp2px } from "@koalaui/arkui";
1438+import { registerArkuiEntry } from "@koalaui/arkui/ohos.router";
1439+import { remember } from "@koalaui/runtime";
1440+export const storage = new LocalStorage();
1441+class ArkLocalStorageLinkExampleComponent extends ArkCommonStruct1<ArkLocalStorageLinkExampleComponent, any> {
1442+ private _entry_local_storage_ = storage;
1443+ constructor(private initializers: any, valueStorage?: ValueStorage) {
1444+ super(valueStorage);
1445+ }
1446+ _link = StorageLinkState<string>(this._entry_local_storage_, "storage", "Start");
1447+ get link() {
1448+ return this._link!.value;
1449+ }
1450+ set link(value) {
1451+ this._link!.value = observableProxy(value);
1452+ }
1453+ /** @memo */
1454+ _build() {
1455+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
1456+ return;
1457+ ArkText((instance: TextAttribute) => {
1458+ undefined;
1459+ }, () => {
1460+ }, "LocalStorage entry = " + storage.get("storage"));
1461+ }
1462+ /** @memo */
1463+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
1464+ const receiver = createInstance((storage?: ValueStorage) => {
1465+ const instance = new ArkLocalStorageLinkExampleComponent(initializers, storage);
1466+ return instance;
1467+ });
1468+ receiver._build();
1469+ return receiver;
1470+ }
1471+}
1472+/** @memo */
1473+export function LocalStorageLinkExample(initializers?: any) {
1474+ return ArkLocalStorageLinkExampleComponent._invoke(initializers);
1475+}
1476+registerArkuiEntry(LocalStorageLinkExample, "Rewrite2");
1477+export const __Entry = LocalStorageLinkExample;
1478
1479at Context.<anonymous> (test\rewrites.test.ts:14:16)
1480at processImmediate (node:internal/timers:471:21)
1481
14823) Basic rewrites of ArkUI syntactic features
1483LocalStoragePropExample rewrites:
1484
1485AssertionError: expected 'import { $r, $rawfile, AppStorage, Ar…' to equal 'import { $r, $rawfile, AppStorage, Ar…'
1486+ expected - actual
1487
1488-import { $r, $rawfile, AppStorage, ArkCommonStruct1, CanvasRenderingContext2D, CustomDialogController, DataChangeListener, Environment, ForEach, GestureGroup, IDataSource, LocalStorage, LongPressGesture, Observed, OnArkLifecycle, PanGesture, PanGestureOptions, PersistentStorage, PinchGesture, RenderingContextSettings, RotationGesture, Scroller, StorageLinkState, SubscribedAbstractProperty, SwipeGesture, SwiperController, TabsController, TapGesture, TextAreaController, ValueStorage, VideoController, animateTo, createInstance, fp2px, getContext, getInspectorByKey, lpx2px, observableProxy, processArkLifecycleEvent, propValue, px2fp, px2lpx, px2vp, stateOf, vp2px } from "@koalaui/arkui";
1489-import { registerArkuiEntry } from "@koalaui/arkui/ohos.router";
1490-import { remember } from "@koalaui/runtime";
1491-import { storage } from "./Rewrite2";
1492-class ArkLocalStoragePropExampleComponent extends ArkCommonStruct1<ArkLocalStoragePropExampleComponent, any> {
1493- private _entry_local_storage_ = storage;
1494- constructor(private initializers: any, valueStorage?: ValueStorage) {
1495- super(valueStorage);
1496- }
1497- _prop = stateOf<string>(StorageLinkState<string>(this._entry_local_storage_, "storage", "Start").value);
1498- get prop() {
1499- return this._prop!.value;
1500- }
1501- set prop(value) {
1502- this._prop!.value = observableProxy(value);
1503- }
1504- /** @memo */
1505- _build() {
1506- if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
1507- return;
1508- propValue(StorageLinkState<string>(this._entry_local_storage_, "storage", "Start").value, this._prop);
1509- }
1510- /** @memo */
1511- static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
1512- const receiver = createInstance((storage?: ValueStorage) => {
1513- const instance = new ArkLocalStoragePropExampleComponent(initializers, storage);
1514- return instance;
1515- });
1516- receiver._build();
1517- return receiver;
1518- }
1519-}
1520-/** @memo */
1521-export function LocalStoragePropExample(initializers?: any) {
1522- return ArkLocalStoragePropExampleComponent._invoke(initializers);
1523-}
1524-registerArkuiEntry(LocalStoragePropExample, "Rewrite3");
1525-export const __Entry = LocalStoragePropExample;
1526+import { $r, $rawfile, AppStorage, ArkCommonStruct1, CanvasRenderingContext2D, CustomDialogController, DataChangeListener, Environment, ForEach, GestureGroup, IDataSource, LocalStorage, LongPressGesture, Observed, OnArkLifecycle, PanGesture, PanGestureOptions, PersistentStorage, PinchGesture, RenderingContextSettings, RotationGesture, Scroller, StorageLinkState, SubscribedAbstractProperty, SwipeGesture, SwiperController, TabsController, TapGesture, TextAreaController, ValueStorage, VideoController, animateTo, createInstance, fp2px, getContext, getInspectorByKey, lpx2px, observableProxy, processArkLifecycleEvent, propValue, px2fp, px2lpx, px2vp, stateOf, vp2px } from "@koalaui/arkui";
1527+import { registerArkuiEntry } from "@koalaui/arkui/ohos.router";
1528+import { remember } from "@koalaui/runtime";
1529+import { storage } from "./Rewrite2";
1530+class ArkLocalStoragePropExampleComponent extends ArkCommonStruct1<ArkLocalStoragePropExampleComponent, any> {
1531+ private _entry_local_storage_ = storage;
1532+ constructor(private initializers: any, valueStorage?: ValueStorage) {
1533+ super(valueStorage);
1534+ }
1535+ _prop = stateOf<string>(StorageLinkState<string>(this._entry_local_storage_, "storage", "Start").value);
1536+ get prop() {
1537+ return this._prop!.value;
1538+ }
1539+ set prop(value) {
1540+ this._prop!.value = observableProxy(value);
1541+ }
1542+ /** @memo */
1543+ _build() {
1544+ if (!OnArkLifecycle((event: any) => processArkLifecycleEvent(this, event)))
1545+ return;
1546+ propValue(StorageLinkState<string>(this._entry_local_storage_, "storage", "Start").value, this._prop);
1547+ }
1548+ /** @memo */
1549+ static _invoke<T extends ArkCommonStruct1<T, A1>, A1>(initializers?: any) {
1550+ const receiver = createInstance((storage?: ValueStorage) => {
1551+ const instance = new ArkLocalStoragePropExampleComponent(initializers, storage);
1552+ return instance;
1553+ });
1554+ receiver._build();
1555+ return receiver;
1556+ }
1557+}
1558+/** @memo */
1559+export function LocalStoragePropExample(initializers?: any) {
1560+ return ArkLocalStoragePropExampleComponent._invoke(initializers);
1561+}
1562+registerArkuiEntry(LocalStoragePropExample, "Rewrite3");
1563+export const __Entry = LocalStoragePropExample;
1564
1565at Context.<anonymous> (test\rewrites.test.ts:19:16)
1566at processImmediate (node:internal/timers:471:21)
1567
1568
1569
1570