@dcloudio/uni-app-x 0.7.99 → 0.7.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-app-x",
3
- "version": "0.7.99",
3
+ "version": "0.7.100",
4
4
  "description": "uni-app x types",
5
5
  "typings": "index.d.ts",
6
6
  "main": "index.d.ts",
@@ -17,52 +17,52 @@ declare global {
17
17
  | UniSharedDataFunctionEventListener
18
18
  | UniSharedDataFunctionSetTemplateRef
19
19
 
20
- type UniSharedDataFunctionEventListener = (event : UniEvent) => void
21
- type UniSharedDataFunctionSetTemplateRef = (el : UniElement) => void
20
+ type UniSharedDataFunctionEventListener = (event: UniEvent) => void
21
+ type UniSharedDataFunctionSetTemplateRef = (el: UniElement) => void
22
22
 
23
23
  class UniSharedData {
24
24
  /**
25
25
  * 所属文件
26
26
  * @internal
27
27
  */
28
- _filename ?: string | null
28
+ _filename?: string | null
29
29
  /**
30
30
  * ArkTS/Kotlin/JavaScript 层数据缓存,主要用于判断属性值是否有变化
31
31
  * @internal
32
32
  */
33
- _cacheProps : Map<string, UniSharedDataAny>
33
+ _cacheProps: Map<string, UniSharedDataAny>
34
34
  /**
35
35
  * 所属页面,用于批量执行响应式变更
36
36
  * @internal
37
37
  */
38
- _scope : UniSharedDataPage
38
+ _scope: UniSharedDataPage
39
39
  /**
40
40
  * 是否已初始化完成,主要用于二次更新时触发响应式
41
41
  * @internal
42
42
  */
43
- _setReady() : void
43
+ _setReady(): void
44
44
  /**
45
45
  * 属性变更时收集 Jobs
46
46
  * @internal
47
47
  */
48
- _queueJobs : (key : string) => void
48
+ _queueJobs: (key: string) => void
49
49
  /**
50
50
  * 设置 callMethod,用于 script cpp 调用 $callMethod 方法
51
51
  * @internal
52
52
  */
53
- _setCallMethod(fn : (...args : any[]) => void) : void
53
+ _setCallMethod(fn: (...args: any[]) => void): void
54
54
  /**
55
55
  * 重置当前数据对象的所有标记位
56
56
  * @internal
57
57
  */
58
- _resetFlags() : void
59
- constructor(scope : UniSharedDataPage)
58
+ _resetFlags(): void
59
+ constructor(scope: UniSharedDataPage)
60
60
  }
61
61
 
62
62
  enum UniSharedDataComponentStyleIsolation {
63
63
  Isolated,
64
64
  App,
65
- AppAndPage
65
+ AppAndPage,
66
66
  }
67
67
 
68
68
  enum UniSharedDataComponentRenderer {
@@ -77,79 +77,103 @@ declare global {
77
77
  }
78
78
 
79
79
  interface UniSharedDataComponentOptions {
80
- vueId : number
81
- styleIsolation : UniSharedDataComponentStyleIsolation
82
- renderer : UniSharedDataComponentRenderer
83
- flatten : UniSharedDataComponentFlatten
80
+ vueId: number
81
+ styleIsolation: UniSharedDataComponentStyleIsolation
82
+ renderer: UniSharedDataComponentRenderer
83
+ flatten: UniSharedDataComponentFlatten
84
84
  }
85
85
 
86
86
  abstract class UniSharedDataComponent extends UniSharedData {
87
87
  /**
88
88
  * 组件的类名
89
89
  */
90
- static className : string
90
+ static className: string
91
91
  /**
92
92
  * 当前页面或组件的样式表
93
93
  * @internal
94
94
  */
95
- static styleSheet : Map<string, Map<string, Map<number, any>>>
95
+ static styleSheet: Map<string, Map<string, Map<number, any>>>
96
96
  /**
97
97
  * vue实例ID
98
98
  * @internal
99
99
  */
100
- _vueId : number
100
+ _vueId: number
101
101
  /**
102
102
  * 当前页面或组件关联的 UniPage 对象
103
103
  * @internal
104
104
  */
105
- _page : UniPage
105
+ _page: UniPage
106
106
  /**
107
107
  * 当前组件所在的上下文,主要用于查找上下文组件的样式表
108
108
  * @internal
109
109
  */
110
- _ctx : UniSharedDataComponent | null
110
+ _ctx: UniSharedDataComponent | null
111
111
  /**
112
112
  * 当前组件或页面样式隔离策略
113
113
  */
114
- _styleIsolation : UniSharedDataComponentStyleIsolation
114
+ _styleIsolation: UniSharedDataComponentStyleIsolation
115
115
  /**
116
116
  * 当前组件实例是否拍平
117
117
  */
118
- _flatten : UniSharedDataComponentFlatten
118
+ _flatten: UniSharedDataComponentFlatten
119
119
  /**
120
120
  * 当前组件或页面渲染类型,页面也有可能作为组件来渲染
121
121
  */
122
- _renderer : UniSharedDataComponentRenderer
122
+ _renderer: UniSharedDataComponentRenderer
123
123
  /**
124
124
  * 自定义组件需要透传的属性
125
125
  * @internal
126
126
  */
127
- _inheritAttrs : UniSharedDataJSONObject
128
- constructor(scope : UniSharedDataPage, options : UniSharedDataComponentOptions)
127
+ _inheritAttrs: UniSharedDataJSONObject
128
+ constructor(scope: UniSharedDataPage, options: UniSharedDataComponentOptions)
129
129
  /**
130
130
  * 自定义组件需要透传的属性,需要暴露给前端设置: set_inheritAttrs()
131
131
  * @param attrs
132
132
  */
133
- set_inheritAttrs(attrs : UniSharedDataJSONObject) : void
133
+ set_inheritAttrs(attrs: UniSharedDataJSONObject): void
134
134
  /**
135
135
  * 监听组件根节点样式变更
136
136
  * @internal
137
137
  */
138
- useComputedStyle(options : {
139
- properties : number[]
140
- filterProperties ?: boolean | null
141
- callback : (result : Array<[string, any | null]>) => void
142
- }) : Map<string, any | null>
138
+ useComputedStyle(options: {
139
+ properties: number[]
140
+ filterProperties?: boolean | null
141
+ callback: (result: Array<[string, any | null]>) => void
142
+ }): Map<string, any | null>
143
+ /**
144
+ * 目前仅限 android 平台
145
+ * 文本布局缓存数组
146
+ * @internal
147
+ */
148
+ _textLayouts: Array<[number, number, number]>
149
+ /**
150
+ * 目前仅限 android 平台
151
+ * 创建文本布局(先缓存,后批量同步至kotlin层)
152
+ * 接收三个参数:nodeId, fid, eid
153
+ * 内部存储为数组解构_textLayouts[[nodeId, fid, eid]]
154
+ * 应该统一存储在scope中(即页面上)
155
+ * @internal
156
+ */
157
+ _createTextLayout(nodeId: number, fid: number, eid: number): void
158
+ /**
159
+ * 目前仅限 android 平台
160
+ * 批量同步文本布局至kotlin层,kotlin层会根据_textLayouts数组进行处理(编译器生成指定函数switch执行具体的创建逻辑)
161
+ * 需要确保调用时机(确保在排版之前同步触发):
162
+ * 当页面首次渲染时,在调用c层renderElement之后同步调用
163
+ * 当页面二次更新时,在flushJobs中所有element jobs执行完之后调用
164
+ * @internal
165
+ */
166
+ _flushTextLayouts(): void
143
167
  /**
144
168
  * 由编译器动态生成的子类中的 Element 渲染器
145
169
  * @internal
146
170
  */
147
- abstract _renderElement() : UniElementBlock
171
+ abstract _renderElement(): UniElementBlock
148
172
  /**
149
173
  * 由编译器动态生成的子类中的 NativeView 渲染器
150
174
  * @internal
151
175
  */
152
- abstract _renderNativeView() : UniNativeViewBlock
176
+ abstract _renderNativeView(): UniNativeViewBlock
153
177
  }
154
178
 
155
179
  abstract class UniSharedDataPage extends UniSharedDataComponent {
@@ -158,29 +182,29 @@ declare global {
158
182
  * key 是组件class名称
159
183
  * @internal
160
184
  */
161
- _styleSheetCache : Map<string, Map<string, Map<string, Map<string, unknown>>>>
185
+ _styleSheetCache: Map<string, Map<string, Map<string, Map<string, unknown>>>>
162
186
  /**
163
187
  * 本次更新收集到的element Jobs,用于批量执行响应式变更(c层)
164
188
  * @internal
165
189
  */
166
- _elementJobs : Array<ReactiveEffect<any | null>>
190
+ _elementJobs: Array<ReactiveEffect<any | null>>
167
191
  /**
168
192
  * 本次更新收集到的kotlin element Jobs,用于批量执行响应式变更
169
193
  * @internal
170
194
  */
171
- _kotlinElementJobs : Array<ReactiveEffect<any | null>>
195
+ _kotlinElementJobs: Array<ReactiveEffect<any | null>>
172
196
  /**
173
197
  * 本次更新收集到的nativeView Jobs,用于批量执行响应式变更
174
198
  * @internal
175
199
  */
176
- _nativeViewJobs : Array<ReactiveEffect<any | null>>
200
+ _nativeViewJobs: Array<ReactiveEffect<any | null>>
177
201
 
178
- constructor(pageId : number, options : UniSharedDataComponentOptions)
202
+ constructor(pageId: number, options: UniSharedDataComponentOptions)
179
203
  /**
180
204
  * 批量执行响应式变更
181
205
  * @internal
182
206
  */
183
- _flushJobs : () => Promise<void> | void
207
+ _flushJobs: () => Promise<void> | void
184
208
  /**
185
209
  * 页面渲染函数
186
210
  * 调用页面的 _renderElement 和 _renderNativeView
@@ -188,7 +212,7 @@ declare global {
188
212
  * 拿到两个渲染器执行后的 Block 后,插入到页面的根 NativeView 和根 Dom元素中
189
213
  * @internal
190
214
  */
191
- _render : () => Promise<void>
215
+ _render: () => Promise<void>
192
216
  }
193
217
 
194
218
  abstract class UniSharedDataApp extends UniSharedData {
@@ -196,7 +220,7 @@ declare global {
196
220
  * 当前应用全局样式
197
221
  * @internal
198
222
  */
199
- static styleSheet : Map<string, Map<string, Map<number, any>>>
223
+ static styleSheet: Map<string, Map<string, Map<number, any>>>
200
224
  }
201
225
 
202
226
  enum UniSharedDataVForDirty {
@@ -215,7 +239,7 @@ declare global {
215
239
  }
216
240
 
217
241
  type UniSharedDataVForMount = {
218
- readonly index : number
242
+ readonly index: number
219
243
  }
220
244
 
221
245
  type UniSharedDataVForUnmount = {
@@ -223,9 +247,9 @@ declare global {
223
247
  * 需要移除的索引值
224
248
  * 重要:该索引值是oldBlocks中的索引值
225
249
  */
226
- readonly index : number
227
- readonly doRemove : boolean
228
- readonly doDeregister : boolean
250
+ readonly index: number
251
+ readonly doRemove: boolean
252
+ readonly doDeregister: boolean
229
253
  }
230
254
 
231
255
  type UniSharedDataVForUpdate = {
@@ -233,21 +257,21 @@ declare global {
233
257
  * 需要更新的索引值
234
258
  * update((newBlocks[index] = oldBlocks[oldIndex]), getItem(source, i))
235
259
  */
236
- readonly index : number
260
+ readonly index: number
237
261
  /**
238
262
  * 旧索引值
239
263
  */
240
- readonly oldIndex : number
264
+ readonly oldIndex: number
241
265
  }
242
266
 
243
267
  class UniSharedDataVFor<T extends UniSharedData> extends UniSharedData {
244
- setData(data : T[]) : void
245
- setMount(mount : UniSharedDataVForMount[]) : void
246
- setUnmount(unmount : UniSharedDataVForUnmount[]) : void
247
- setUpdate(update : UniSharedDataVForUpdate[]) : void
248
- setDirty(dirty : UniSharedDataVForDirty) : void
249
- create : () => T
250
- constructor(scope : UniSharedDataPage)
268
+ setData(data: T[]): void
269
+ setMount(mount: UniSharedDataVForMount[]): void
270
+ setUnmount(unmount: UniSharedDataVForUnmount[]): void
271
+ setUpdate(update: UniSharedDataVForUpdate[]): void
272
+ setDirty(dirty: UniSharedDataVForDirty): void
273
+ create: () => T
274
+ constructor(scope: UniSharedDataPage)
251
275
  }
252
276
 
253
277
  class VueReactivity { }
@@ -258,18 +282,21 @@ declare global {
258
282
 
259
283
  type InferSharedData<T, R extends UniSharedData = UniSharedData> = T extends keyof UniSharedDataRegistry ? UniSharedDataRegistry[T] : R
260
284
 
261
- function useSharedData<T extends string>(scope : UniSharedDataPage) : InferSharedData<T>
285
+ function useSharedData<T extends string>(scope: UniSharedDataPage): InferSharedData<T>
262
286
 
263
- function useSharedDataPage<T extends string>(pageIdOrScope : number | UniSharedDataPage, options : UniSharedDataComponentOptions) : InferSharedData<T, UniSharedDataPage>
287
+ function useSharedDataPage<T extends string>(
288
+ pageIdOrScope: number | UniSharedDataPage,
289
+ options: UniSharedDataComponentOptions,
290
+ ): InferSharedData<T, UniSharedDataPage>
264
291
 
265
292
  function useSharedDataComponent<T extends string>(
266
- scope : UniSharedDataPage,
267
- options : UniSharedDataComponentOptions
268
- ) : InferSharedData<T, UniSharedDataComponent>
293
+ scope: UniSharedDataPage,
294
+ options: UniSharedDataComponentOptions,
295
+ ): InferSharedData<T, UniSharedDataComponent>
269
296
 
270
- function useSharedDataVFor<T, S extends UniSharedData>(sharedDataVFor : S) : S
297
+ function useSharedDataVFor<T, S extends UniSharedData>(sharedDataVFor: S): S
271
298
 
272
- function useSharedDataRecycleVFor<T, S extends UniSharedData>(sharedDataVFor : S) : S
299
+ function useSharedDataRecycleVFor<T, S extends UniSharedData>(sharedDataVFor: S): S
273
300
  }
274
301
 
275
302
  export { }