@dcloudio/uni-app-x 0.7.114 → 0.7.116

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.114",
3
+ "version": "0.7.116",
4
4
  "description": "uni-app x types",
5
5
  "typings": "index.d.ts",
6
6
  "main": "index.d.ts",
@@ -142,6 +142,7 @@ declare global {
142
142
  getStyleBorderLeftWidth(): UniCSSUnitValue
143
143
  /**
144
144
  * 设置Flex相关CSS属性
145
+ * 注意:组合属性(如flex、flex-flow)不需要定义结构,由编译器拆分处理
145
146
  */
146
147
  setStyleFlexDirection(value: UniCSSFlexDirectionType): void
147
148
  getStyleFlexDirection(): UniCSSFlexDirectionType
@@ -324,9 +324,9 @@ declare global {
324
324
  options: UniSharedDataComponentOptions,
325
325
  ): InferSharedData<T, UniSharedDataComponent>
326
326
 
327
- function useSharedDataVFor<T, S extends UniSharedData>(sharedDataVFor: S): S
327
+ function useSharedDataVFor<T, S extends UniSharedData>(sharedDataVFor: UniSharedData): S
328
328
 
329
- function useSharedDataRecycleVFor<T, S extends UniSharedData>(sharedDataVFor: S): S
329
+ function useSharedDataRecycleVFor<T, S extends UniSharedData>(sharedDataVFor: UniSharedData): S
330
330
  // android kotlin 属性委托
331
331
  function observable(): any
332
332
  }
@@ -335,8 +335,8 @@ declare global {
335
335
  /**
336
336
  * 动态 sharedData class 的最小描述信息。
337
337
  *
338
- * 这份 descriptor 只服务于动态实例创建与字段/flag 存储分配,
339
- * 不扩展成复杂的 registry 或反射系统。
338
+ * 该描述信息由 sharedData bundle provider 返回,
339
+ * 供动态 sharedData 实例初始化字段槽和 flag 分配使用。
340
340
  */
341
341
  interface UniDynamicSharedDataClassDefinition {
342
342
  /**
@@ -348,8 +348,6 @@ declare global {
348
348
 
349
349
  /**
350
350
  * 当前 template 内唯一的 sharedData class 编号。
351
- *
352
- * 与动态 shared schema 中的 `sharedDataClassId` 对齐。
353
351
  */
354
352
  readonly sharedDataClassId: number
355
353
 
@@ -365,13 +363,6 @@ declare global {
365
363
 
366
364
  /**
367
365
  * 当前 class 的字段声明。
368
- *
369
- * 动态实现通过这些字段声明完成 fieldId -> flag 标记。
370
- *
371
- * 当前阶段不额外放 `nullable` / `valueTag`:
372
- * - 动态 `_setData(fieldId, value)` 不依赖这两类信息
373
- * - 解释器读取 `getField(fieldId)` / `getFlag(flagGroupId)` 也不依赖
374
- * - 如后续宿主实现证明需要,再单独补充
375
366
  */
376
367
  readonly fields: ReadonlyArray<UniDynamicSharedDataField>
377
368
  }
@@ -396,6 +387,47 @@ declare global {
396
387
  readonly flagBit: number
397
388
  }
398
389
 
390
+ /**
391
+ * 动态 sharedData 的最小初始化参数。
392
+ *
393
+ * 所有动态 sharedData 实例统一通过:
394
+ * - `bundleKey`
395
+ * - `sharedDataClassId`
396
+ *
397
+ * 完成初始化。
398
+ *
399
+ * root page / root component 的 `sharedDataClassId` 固定由编译器传入 `0`。
400
+ */
401
+ interface UniDynamicSharedDataInitOptions {
402
+ /**
403
+ * 当前动态 bundle 的稳定标识。
404
+ */
405
+ readonly bundleKey: string
406
+
407
+ /**
408
+ * 当前实例对应的 sharedData class 编号。
409
+ *
410
+ * root page / root component 固定为 `0`,
411
+ * 其他 scoped sharedData 使用编译器分配的实际 classId。
412
+ */
413
+ readonly sharedDataClassId: number
414
+ }
415
+
416
+ interface UniDynamicSharedDataBundle {
417
+ getSharedDataClassDefinition(sharedDataClassId: number): UniDynamicSharedDataClassDefinition
418
+ }
419
+
420
+ /**
421
+ * 动态 sharedData bundle provider 的接口定义。
422
+ */
423
+ interface UniDynamicSharedDataBundleProvider {
424
+ /**
425
+ * 根据 bundleKey 加载对应的动态 bundle。
426
+ * @param bundleKey
427
+ */
428
+ loadBundle(bundleKey: string): UniDynamicSharedDataBundle
429
+ }
430
+
399
431
  /**
400
432
  * 普通动态 sharedData 的最小读取接口。
401
433
  *
@@ -465,29 +497,38 @@ declare global {
465
497
  * 动态普通 scope 的最终目标基类。
466
498
  *
467
499
  * 外部仓库的真实实现应继承静态基类 `UniSharedData`,
468
- * 同时实现 `IUniDynamicSharedData`。
500
+ * 并通过 `bundleKey + sharedDataClassId` 初始化实例。
469
501
  */
470
502
  abstract class UniDynamicSharedData extends UniSharedData implements IUniDynamicSharedData {
503
+ /**
504
+ * 当前实例所属 bundleKey。
505
+ */
506
+ readonly _bundleKey: string
507
+
508
+ /**
509
+ * 当前实例对应的 sharedData class 编号。
510
+ */
511
+ readonly _sharedDataClassId: number
512
+
471
513
  /**
472
514
  * 当前动态实例对应的 sharedData class 描述。
515
+ *
516
+ * 该 metadata 由实例构造时通过 bundle provider 获取。
473
517
  */
474
518
  readonly _sharedDataClass: UniDynamicSharedDataClassDefinition
475
519
 
476
- constructor(scope: UniSharedDataPage, sharedDataClass: UniDynamicSharedDataClassDefinition)
520
+ constructor(scope: UniSharedDataPage, dynamicOptions: UniDynamicSharedDataInitOptions)
477
521
 
478
522
  abstract getField(fieldId: number): UniSharedDataAny
479
523
  abstract getFlag(flagGroupId: number): number
480
524
 
481
525
  /**
482
- * 动态模式继续复用静态 `_setData` / `_resetFlags()` 命名,
483
- * 但动态 `renderSharedData` 代码应优先传 `fieldId`,避免运行时再做
484
- * `key -> fieldId` 匹配。
526
+ * 动态 `renderSharedData` 主路径固定传 `fieldId`。
485
527
  *
486
- * 为兼容静态语义与旧调用形态,这里保留 `string` / `number` 双签名:
487
- * - `string`:兼容静态 sharedData 风格,仅做类型定义无需实现
488
- * - `number`:动态 sharedData 主路径,表示 `fieldId`
528
+ * 这里保留 `string` / `number` 双签名:
529
+ * - `string`:与静态基类签名保持兼容,不需要支持
530
+ * - `number`:动态 sharedData 通过字段编号设置数据,供解释器渲染器使用
489
531
  */
490
- // 同样保留双签名兼容静态调用形态,但动态实现只使用 `fieldId` 版本,无需实现 `string` 版本
491
532
  abstract _setData(key: string, value: any | null): void
492
533
  abstract _setData(fieldId: number, value: any | null): void
493
534
  }
@@ -496,22 +537,18 @@ declare global {
496
537
  * 动态组件 scope 的最终目标基类。
497
538
  *
498
539
  * 外部仓库真实实现需要保持与静态 `UniSharedDataComponent`
499
- * 相同的组件级 builtin 语义。
500
- *
501
- * 这里的 class 继承表达“复用哪一个静态基类”:
502
- * - component 复用 `UniSharedDataComponent`
503
- *
504
- * 因为这里不继承 `UniDynamicSharedData`,所以动态读取接口仍需显式声明,
505
- * 不能只留在 `IUniDynamicSharedDataComponent` 里。
540
+ * 相同的组件级 builtin 语义,并通过 `bundleKey + sharedDataClassId`
541
+ * 初始化实例。
506
542
  */
507
543
  abstract class UniDynamicSharedDataComponent extends UniSharedDataComponent implements IUniDynamicSharedDataComponent {
544
+ readonly _bundleKey: string
545
+ readonly _sharedDataClassId: number
508
546
  readonly _sharedDataClass: UniDynamicSharedDataClassDefinition
509
547
 
510
- constructor(scope: UniSharedDataPage, options: UniSharedDataComponentOptions, sharedDataClass: UniDynamicSharedDataClassDefinition)
548
+ constructor(scope: UniSharedDataPage, options: UniSharedDataComponentOptions, dynamicOptions: UniDynamicSharedDataInitOptions)
511
549
 
512
550
  abstract getField(fieldId: number): UniSharedDataAny
513
551
  abstract getFlag(flagGroupId: number): number
514
- // 同样保留双签名兼容静态调用形态,但动态实现只使用 `fieldId` 版本,无需实现 `string` 版本
515
552
  abstract _setData(key: string, value: any | null): void
516
553
  abstract _setData(fieldId: number, value: any | null): void
517
554
  abstract getVueId(): number
@@ -523,25 +560,18 @@ declare global {
523
560
  * 动态页面 scope 的最终目标基类。
524
561
  *
525
562
  * 外部仓库真实实现应继承 `UniSharedDataPage`,
526
- * 并沿用 component builtin 读取面。
527
- *
528
- * 这里不写成 `UniDynamicSharedDataPage extends UniDynamicSharedDataComponent`。
529
- * 原因:
530
- * 1. `page` 是否属于 `component`,由接口继承表达
531
- * 2. class 继承优先表达真实静态基类复用关系
532
- * 3. `UniSharedDataPage` 已经继承 `UniSharedDataComponent`
533
- *
534
- * 因为这里不继承 `UniDynamicSharedDataComponent`,所以动态读取接口同样
535
- * 需要显式声明,不能只留在 `IUniDynamicSharedDataPage` 里。
563
+ * 并沿用 component builtin 读取面,通过 `bundleKey + sharedDataClassId`
564
+ * 初始化实例。
536
565
  */
537
566
  abstract class UniDynamicSharedDataPage extends UniSharedDataPage implements IUniDynamicSharedDataPage {
567
+ readonly _bundleKey: string
568
+ readonly _sharedDataClassId: number
538
569
  readonly _sharedDataClass: UniDynamicSharedDataClassDefinition
539
570
 
540
- constructor(pageIdOrScope: number | UniSharedDataPage, options: UniSharedDataComponentOptions, sharedDataClass: UniDynamicSharedDataClassDefinition)
571
+ constructor(pageIdOrScope: number | UniSharedDataPage, options: UniSharedDataComponentOptions, dynamicOptions: UniDynamicSharedDataInitOptions)
541
572
 
542
573
  abstract getField(fieldId: number): UniSharedDataAny
543
574
  abstract getFlag(flagGroupId: number): number
544
- // 同样保留双签名兼容静态调用形态,但动态实现只使用 `fieldId` 版本,无需实现 `string` 版本
545
575
  abstract _setData(key: string, value: any | null): void
546
576
  abstract _setData(fieldId: number, value: any | null): void
547
577
  abstract getVueId(): number