1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * ViewStackProcessor declaration
18 *
19 * Implemntation in C+ and exposed to JS
20 *
21 * all definitions in this file are framework internal
22 */
23
24declare class ViewStackProcessor {
25
26  // make and return new elementId
27  // will be used to create the next Component
28  // this is used for first rneder case
29  public static AllocateNewElmetIdForNextComponent(): number;
30
31  // start Get access recording, and account all access to given elmtId
32  // Note this can be a different elmtId than the one used to create new Component
33  public static StartGetAccessRecordingFor(elmtId: number): void;
34
35  /**
36   * get the elmtId to which any get access shoudl be accounted
37   * note this can be the same as the currently created elmtId (top of stack)
38   * but also a different one (in case a whole subtree gets accounted its root elmtId)
39   *
40   * returns the elmtId given by StartGetAccessRecordingFor
41   * -1 no access recording
42   */
43  public static GetElmtIdToAccountFor(): number;
44
45  // Stop get access recording
46  // also invalidates any reserved but unclaimed elmtId for Component creation
47  public static StopGetAccessRecording(): void;
48
49
50  /**
51   * when nesting observeComponentCreation functions, such as in the case of
52   * If, and the if branch creates a Text etc that requires an implict pop
53   *  this function is needed after executing the inner observeComponentCreation
54   *  and before read ViewStackProcessor.GetTopMostElementId(); on the outer one
55   */
56  public static ImplicitPopBeforeContinue(): void;
57
58  /**
59   * Called once JS update function has been executed, main component
60   * and its wrapping components in the stack need to be 'Finished'
61   * and then a local update be done on given main Element and
62   * wrapping Elements
63   * @param elmtId
64   */
65  public static FinishAndLocalUpdate(elmtId: number): void;
66
67
68  /**
69   * Returns a globally unique id from ElementRegister
70   * JS signatire: MakeUniqueId() : number
71  */
72  public static MakeUniqueId(): number;
73
74  /**
75   * return true if the current Container uses PartialUpdate code path
76   * see Container class foundation/arkui/ace_engine/frameworks/core/common/container.h
77   * calls UsesNewPipeline static function
78   */
79  public static UsesNewPipeline();
80
81  // Gets the framenode with tag and elmtId then pushes to the view stack.
82  public static GetAndPushFrameNode(tag: string, elmtId: number): void;
83  /** move deleted elmtIds from ElementRegistery in C++ to the caller */
84  public static moveDeletedElmtIds(elmtIds : Array<number>);
85}
86