@dcloudio/uni-app-x 0.7.115 → 0.7.117

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.
Files changed (128) hide show
  1. package/package.json +1 -1
  2. package/types/dom2-internal/UniElement.d.ts +1 -0
  3. package/types/dom2-internal/sharedData.d.ts +235 -127
  4. package/types/uni/uts-plugin-api/lib/uni-editor/utssdk/global.d.ts +2 -0
  5. package/types/uni/uts-plugin-api/lib/uni-editor/utssdk/index.d.ts +1 -0
  6. package/types/uni/uts-plugin-api/lib/uni-editor/utssdk/interface.d.ts +57 -3
  7. package/types/uni/uts-plugin-component/lib/uni-editor/utssdk/global.d.ts +2 -0
  8. package/types/uni/uts-plugin-component/lib/uni-editor/utssdk/index.d.ts +1 -0
  9. package/types/uni/uts-plugin-component/lib/uni-editor/utssdk/interface.d.ts +57 -3
  10. package/types/node_modules/.package-lock.json +0 -20
  11. package/types/node_modules/typescript/LICENSE.txt +0 -55
  12. package/types/node_modules/typescript/ThirdPartyNoticeText.txt +0 -193
  13. package/types/node_modules/typescript/bin/tsc +0 -2
  14. package/types/node_modules/typescript/bin/tsserver +0 -2
  15. package/types/node_modules/typescript/lib/cancellationToken.js +0 -90
  16. package/types/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +0 -1880
  17. package/types/node_modules/typescript/lib/de/diagnosticMessages.generated.json +0 -1880
  18. package/types/node_modules/typescript/lib/es/diagnosticMessages.generated.json +0 -1880
  19. package/types/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +0 -1880
  20. package/types/node_modules/typescript/lib/it/diagnosticMessages.generated.json +0 -1880
  21. package/types/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +0 -1880
  22. package/types/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +0 -1880
  23. package/types/node_modules/typescript/lib/lib.d.ts +0 -22
  24. package/types/node_modules/typescript/lib/lib.decorators.d.ts +0 -386
  25. package/types/node_modules/typescript/lib/lib.decorators.legacy.d.ts +0 -22
  26. package/types/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +0 -33
  27. package/types/node_modules/typescript/lib/lib.dom.d.ts +0 -28596
  28. package/types/node_modules/typescript/lib/lib.dom.iterable.d.ts +0 -475
  29. package/types/node_modules/typescript/lib/lib.es2015.collection.d.ts +0 -147
  30. package/types/node_modules/typescript/lib/lib.es2015.core.d.ts +0 -597
  31. package/types/node_modules/typescript/lib/lib.es2015.d.ts +0 -28
  32. package/types/node_modules/typescript/lib/lib.es2015.generator.d.ts +0 -77
  33. package/types/node_modules/typescript/lib/lib.es2015.iterable.d.ts +0 -495
  34. package/types/node_modules/typescript/lib/lib.es2015.promise.d.ts +0 -81
  35. package/types/node_modules/typescript/lib/lib.es2015.proxy.d.ts +0 -128
  36. package/types/node_modules/typescript/lib/lib.es2015.reflect.d.ts +0 -144
  37. package/types/node_modules/typescript/lib/lib.es2015.symbol.d.ts +0 -46
  38. package/types/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +0 -326
  39. package/types/node_modules/typescript/lib/lib.es2016.array.include.d.ts +0 -116
  40. package/types/node_modules/typescript/lib/lib.es2016.d.ts +0 -21
  41. package/types/node_modules/typescript/lib/lib.es2016.full.d.ts +0 -23
  42. package/types/node_modules/typescript/lib/lib.es2016.intl.d.ts +0 -31
  43. package/types/node_modules/typescript/lib/lib.es2017.d.ts +0 -25
  44. package/types/node_modules/typescript/lib/lib.es2017.date.d.ts +0 -31
  45. package/types/node_modules/typescript/lib/lib.es2017.full.d.ts +0 -23
  46. package/types/node_modules/typescript/lib/lib.es2017.intl.d.ts +0 -44
  47. package/types/node_modules/typescript/lib/lib.es2017.object.d.ts +0 -49
  48. package/types/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +0 -135
  49. package/types/node_modules/typescript/lib/lib.es2017.string.d.ts +0 -45
  50. package/types/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +0 -53
  51. package/types/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +0 -77
  52. package/types/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +0 -43
  53. package/types/node_modules/typescript/lib/lib.es2018.d.ts +0 -24
  54. package/types/node_modules/typescript/lib/lib.es2018.full.d.ts +0 -24
  55. package/types/node_modules/typescript/lib/lib.es2018.intl.d.ts +0 -83
  56. package/types/node_modules/typescript/lib/lib.es2018.promise.d.ts +0 -30
  57. package/types/node_modules/typescript/lib/lib.es2018.regexp.d.ts +0 -37
  58. package/types/node_modules/typescript/lib/lib.es2019.array.d.ts +0 -79
  59. package/types/node_modules/typescript/lib/lib.es2019.d.ts +0 -24
  60. package/types/node_modules/typescript/lib/lib.es2019.full.d.ts +0 -24
  61. package/types/node_modules/typescript/lib/lib.es2019.intl.d.ts +0 -23
  62. package/types/node_modules/typescript/lib/lib.es2019.object.d.ts +0 -33
  63. package/types/node_modules/typescript/lib/lib.es2019.string.d.ts +0 -37
  64. package/types/node_modules/typescript/lib/lib.es2019.symbol.d.ts +0 -24
  65. package/types/node_modules/typescript/lib/lib.es2020.bigint.d.ts +0 -727
  66. package/types/node_modules/typescript/lib/lib.es2020.d.ts +0 -27
  67. package/types/node_modules/typescript/lib/lib.es2020.date.d.ts +0 -42
  68. package/types/node_modules/typescript/lib/lib.es2020.full.d.ts +0 -24
  69. package/types/node_modules/typescript/lib/lib.es2020.intl.d.ts +0 -474
  70. package/types/node_modules/typescript/lib/lib.es2020.number.d.ts +0 -28
  71. package/types/node_modules/typescript/lib/lib.es2020.promise.d.ts +0 -47
  72. package/types/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +0 -97
  73. package/types/node_modules/typescript/lib/lib.es2020.string.d.ts +0 -42
  74. package/types/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +0 -37
  75. package/types/node_modules/typescript/lib/lib.es2021.d.ts +0 -23
  76. package/types/node_modules/typescript/lib/lib.es2021.full.d.ts +0 -24
  77. package/types/node_modules/typescript/lib/lib.es2021.intl.d.ts +0 -166
  78. package/types/node_modules/typescript/lib/lib.es2021.promise.d.ts +0 -48
  79. package/types/node_modules/typescript/lib/lib.es2021.string.d.ts +0 -33
  80. package/types/node_modules/typescript/lib/lib.es2021.weakref.d.ts +0 -76
  81. package/types/node_modules/typescript/lib/lib.es2022.array.d.ts +0 -121
  82. package/types/node_modules/typescript/lib/lib.es2022.d.ts +0 -26
  83. package/types/node_modules/typescript/lib/lib.es2022.error.d.ts +0 -73
  84. package/types/node_modules/typescript/lib/lib.es2022.full.d.ts +0 -24
  85. package/types/node_modules/typescript/lib/lib.es2022.intl.d.ts +0 -117
  86. package/types/node_modules/typescript/lib/lib.es2022.object.d.ts +0 -26
  87. package/types/node_modules/typescript/lib/lib.es2022.regexp.d.ts +0 -39
  88. package/types/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts +0 -39
  89. package/types/node_modules/typescript/lib/lib.es2022.string.d.ts +0 -25
  90. package/types/node_modules/typescript/lib/lib.es2023.array.d.ts +0 -924
  91. package/types/node_modules/typescript/lib/lib.es2023.collection.d.ts +0 -21
  92. package/types/node_modules/typescript/lib/lib.es2023.d.ts +0 -22
  93. package/types/node_modules/typescript/lib/lib.es2023.full.d.ts +0 -24
  94. package/types/node_modules/typescript/lib/lib.es2023.intl.d.ts +0 -56
  95. package/types/node_modules/typescript/lib/lib.es5.d.ts +0 -4585
  96. package/types/node_modules/typescript/lib/lib.es6.d.ts +0 -23
  97. package/types/node_modules/typescript/lib/lib.esnext.array.d.ts +0 -35
  98. package/types/node_modules/typescript/lib/lib.esnext.collection.d.ts +0 -106
  99. package/types/node_modules/typescript/lib/lib.esnext.d.ts +0 -28
  100. package/types/node_modules/typescript/lib/lib.esnext.decorators.d.ts +0 -28
  101. package/types/node_modules/typescript/lib/lib.esnext.disposable.d.ts +0 -185
  102. package/types/node_modules/typescript/lib/lib.esnext.full.d.ts +0 -24
  103. package/types/node_modules/typescript/lib/lib.esnext.intl.d.ts +0 -21
  104. package/types/node_modules/typescript/lib/lib.esnext.object.d.ts +0 -29
  105. package/types/node_modules/typescript/lib/lib.esnext.promise.d.ts +0 -35
  106. package/types/node_modules/typescript/lib/lib.esnext.regexp.d.ts +0 -25
  107. package/types/node_modules/typescript/lib/lib.esnext.string.d.ts +0 -29
  108. package/types/node_modules/typescript/lib/lib.scripthost.d.ts +0 -322
  109. package/types/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +0 -33
  110. package/types/node_modules/typescript/lib/lib.webworker.d.ts +0 -9431
  111. package/types/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +0 -23
  112. package/types/node_modules/typescript/lib/lib.webworker.iterable.d.ts +0 -276
  113. package/types/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +0 -1880
  114. package/types/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +0 -1880
  115. package/types/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +0 -1880
  116. package/types/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +0 -1880
  117. package/types/node_modules/typescript/lib/tsc.js +0 -129741
  118. package/types/node_modules/typescript/lib/tsserver.js +0 -621
  119. package/types/node_modules/typescript/lib/tsserverlibrary.d.ts +0 -17
  120. package/types/node_modules/typescript/lib/tsserverlibrary.js +0 -21
  121. package/types/node_modules/typescript/lib/typesMap.json +0 -497
  122. package/types/node_modules/typescript/lib/typescript.d.ts +0 -11240
  123. package/types/node_modules/typescript/lib/typescript.js +0 -194910
  124. package/types/node_modules/typescript/lib/typingsInstaller.js +0 -236
  125. package/types/node_modules/typescript/lib/watchGuard.js +0 -53
  126. package/types/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +0 -1880
  127. package/types/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +0 -1880
  128. package/types/node_modules/typescript/package.json +0 -116
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-app-x",
3
- "version": "0.7.115",
3
+ "version": "0.7.117",
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
@@ -333,220 +333,328 @@ declare global {
333
333
 
334
334
  declare global {
335
335
  /**
336
- * 动态 sharedData class 的最小描述信息。
336
+ * 动态 sharedData 字段定义。
337
337
  *
338
- * 这份 descriptor 只服务于动态实例创建与字段/flag 存储分配,
339
- * 不扩展成复杂的 registry 或反射系统。
338
+ * 这里保留最小运行时需要的信息:
339
+ * - fieldId:字段编号
340
+ * - flagGroupId:所在 flag group
341
+ * - flagBit:所在 bit
340
342
  */
341
- interface UniDynamicSharedDataClassDefinition {
343
+ interface UniSharedDataDynamicFieldDefinition {
342
344
  /**
343
- * sharedData class 名称。
345
+ * 当前 template 内唯一的字段编号。
346
+ */
347
+ readonly fieldId: number
348
+
349
+ /**
350
+ * 该字段对应的 flag group 编号。
351
+ */
352
+ readonly flagGroupId: number
353
+
354
+ /**
355
+ * 该字段在 flag group 中对应的 bit。
356
+ */
357
+ readonly flagBit: number
358
+ }
359
+
360
+ /**
361
+ * 动态 sharedData class 定义。
362
+ *
363
+ * 用于:
364
+ * - 构造动态 sharedData 实例时初始化字段槽
365
+ * - 初始化 flag group
366
+ * - 调试 / 诊断 / 宿主校验
367
+ */
368
+ interface UniSharedDataDynamicClassDefinition {
369
+ /**
370
+ * 对齐静态 sharedData class 的名称。
344
371
  *
345
- * 用于调试、日志和与静态 sharedData class 对照。
372
+ * 主要用于调试、日志和对照,不参与热路径判断。
346
373
  */
347
374
  readonly sharedDataClassName: string
348
375
 
349
376
  /**
350
377
  * 当前 template 内唯一的 sharedData class 编号。
351
378
  *
352
- * 与动态 shared schema 中的 `sharedDataClassId` 对齐。
379
+ * root page / root component 固定为 0。
353
380
  */
354
381
  readonly sharedDataClassId: number
355
382
 
356
383
  /**
357
- * class 持有的字段数量。
384
+ * 当前 class 的字段数量。
358
385
  */
359
386
  readonly fieldCount: number
360
387
 
361
388
  /**
362
- * class 持有的 flag group 数量。
389
+ * 当前 class flag group 数量。
363
390
  */
364
391
  readonly flagGroupCount: number
365
392
 
366
393
  /**
367
- * 当前 class 的字段声明。
368
- *
369
- * 动态实现通过这些字段声明完成 fieldId -> flag 标记。
370
- *
371
- * 当前阶段不额外放 `nullable` / `valueTag`:
372
- * - 动态 `_setData(fieldId, value)` 不依赖这两类信息
373
- * - 解释器读取 `getField(fieldId)` / `getFlag(flagGroupId)` 也不依赖
374
- * - 如后续宿主实现证明需要,再单独补充
394
+ * 当前 class 的字段定义。
375
395
  */
376
- readonly fields: ReadonlyArray<UniDynamicSharedDataField>
396
+ readonly fields: ReadonlyArray<UniSharedDataDynamicFieldDefinition>
377
397
  }
378
398
 
379
399
  /**
380
- * 动态 sharedData 字段声明。
400
+ * 动态 sharedData 的初始化参数。
401
+ *
402
+ * 这是 renderSharedData 直接使用的构造参数。
381
403
  */
382
- interface UniDynamicSharedDataField {
404
+ interface UniDynamicSharedDataInitOptions {
383
405
  /**
384
- * 当前 template 内唯一的字段编号。
406
+ * 当前动态 bundle 的稳定标识。
385
407
  */
386
- readonly fieldId: number
408
+ readonly bundleKey: string
387
409
 
388
410
  /**
389
- * 对应的 flag group 编号。
411
+ * 当前实例对应的 sharedData class 编号。
412
+ *
413
+ * 约束:
414
+ * - root page:0
415
+ * - root component:0
416
+ * - scoped sharedData:编译器分配的实际 classId
390
417
  */
391
- readonly flagGroupId: number
418
+ readonly sharedDataClassId: number
419
+ }
392
420
 
421
+ /**
422
+ * UniSharedDataDynamicState 的初始化参数。
423
+ *
424
+ * 这是宿主真实实现类在内部创建 state 时使用的参数。
425
+ * renderSharedData 不直接传这个对象。
426
+ */
427
+ interface UniSharedDataDynamicStateOptions extends UniDynamicSharedDataInitOptions {
393
428
  /**
394
- * 对应的 flag bit
429
+ * bundleKey 读取原始二进制 bytes
430
+ *
431
+ * 只负责读取 bytes。
432
+ * 缓存、decode、classDefinition 查询由当前仓库实现。
395
433
  */
396
- readonly flagBit: number
434
+ readonly readBytes: (bundleKey: string) => Uint8Array
397
435
  }
398
436
 
399
437
  /**
400
- * 普通动态 sharedData 的最小读取接口。
401
- *
402
- * 解释器只依赖字段与 flag 读取。
403
- *
404
- * 非解释器使用的内部字段、方法,命名尽量贴近静态 sharedData:
405
- * - 复用已有静态基类字段
406
- * - 内部方法沿用 `_xxx` 风格
438
+ * 普通动态 sharedData 的最小读取协议。
407
439
  *
408
- * 这样外部仓库实现动态 sharedData 时,底层更容易复用现有代码。
440
+ * 解释器只依赖这些读取能力。
409
441
  */
410
442
  interface IUniDynamicSharedData {
443
+ /**
444
+ * 当前实例所属 bundleKey。
445
+ */
446
+ readonly _bundleKey: string
447
+
448
+ /**
449
+ * 当前实例对应的 sharedData class 编号。
450
+ */
451
+ readonly _sharedDataClassId: number
452
+
453
+ /**
454
+ * 当前实例绑定的 class 定义。
455
+ */
456
+ readonly _sharedDataClass: UniSharedDataDynamicClassDefinition
457
+
411
458
  /**
412
459
  * 按字段编号读取值。
413
- *
414
- * 这里的 `fieldId` 由编译器 shared schema 分配,
415
- * 解释器与真实实现都以该编号作为统一索引。
416
460
  */
417
461
  getField(fieldId: number): UniSharedDataAny
418
462
 
419
463
  /**
420
- * 按 flag 组编号读取脏标记。
421
- *
422
- * 返回值与静态 sharedData 的 flag group 对齐,
423
- * 解释器只关心位图值本身,不关心内部存储结构。
464
+ * 按 flag group 编号读取脏标记位图。
424
465
  */
425
466
  getFlag(flagGroupId: number): number
426
467
  }
427
468
 
428
469
  /**
429
- * 动态组件 sharedData 的最小接口。
470
+ * 动态组件 sharedData 的最小读取协议。
430
471
  *
431
- * 对齐静态 renderer 会直接读取的 component builtin
432
- * - `_vueId`
433
- * - `_flatten`
434
- * - `_renderer`
472
+ * 对齐静态 renderer 会直接读取的 builtin
435
473
  */
436
474
  interface IUniDynamicSharedDataComponent extends IUniDynamicSharedData {
437
- /**
438
- * 返回组件或页面实例的 vueId。
439
- */
440
475
  getVueId(): number
441
-
442
- /**
443
- * 返回组件当前 flatten 状态。
444
- */
445
476
  getFlatten(): UniSharedDataComponentFlatten
446
-
447
- /**
448
- * 返回当前 renderer 类型。
449
- */
450
477
  getRenderer(): UniSharedDataComponentRenderer
451
478
  }
452
479
 
453
480
  /**
454
- * 动态页面 sharedData 的最小接口。
481
+ * 动态页面 sharedData 的最小读取协议。
455
482
  *
456
- * 接口层明确表达:dynamic page 也是 dynamic component。
457
- *
458
- * 当前阶段 page 不额外增加读取能力,直接继承 component 接口。
459
- * `_flushJobs`、`_render`、`_textLayouts` 等行为属于真实运行时职责,
460
- * 不放进当前解释器契约。
483
+ * 当前阶段 page 不额外增加读取面,直接继承 component 协议。
461
484
  */
462
485
  interface IUniDynamicSharedDataPage extends IUniDynamicSharedDataComponent {}
463
486
 
464
487
  /**
465
- * 动态普通 scope 的最终目标基类。
488
+ * 动态 sharedData 的运行时状态对象。
466
489
  *
467
- * 外部仓库的真实实现应继承静态基类 `UniSharedData`,
468
- * 同时实现 `IUniDynamicSharedData`。
490
+ * 职责:
491
+ * - load bytes
492
+ * - bundle cache
493
+ * - decode
494
+ * - sharedDataClassId -> classDefinition
495
+ * - 字段值存储
496
+ * - flags 存储
497
+ * - render callback 执行
469
498
  */
470
- abstract class UniDynamicSharedData extends UniSharedData implements IUniDynamicSharedData {
499
+ class UniSharedDataDynamicState {
500
+ constructor(owner: IUniDynamicSharedData | IUniDynamicSharedDataComponent | IUniDynamicSharedDataPage, options: UniSharedDataDynamicStateOptions)
501
+
502
+ /**
503
+ * 当前实例绑定的 classDefinition。
504
+ */
505
+ getClassDefinition(): UniSharedDataDynamicClassDefinition
506
+
507
+ /**
508
+ * 读取字段值。
509
+ */
510
+ getField(fieldId: number): UniSharedDataAny
511
+
512
+ /**
513
+ * 读取 flag group。
514
+ */
515
+ getFlag(flagGroupId: number): number
516
+
517
+ /**
518
+ * 写字段值。
519
+ *
520
+ * 返回值表示该写入是否产生有效变化。
521
+ */
522
+ setField(fieldId: number, value: UniSharedDataAny | null): boolean
523
+
471
524
  /**
472
- * 当前动态实例对应的 sharedData class 描述。
525
+ * 清空当前实例的 flags。
473
526
  */
474
- readonly _sharedDataClass: UniDynamicSharedDataClassDefinition
527
+ resetFlags(): void
475
528
 
476
- constructor(scope: UniSharedDataPage, sharedDataClass: UniDynamicSharedDataClassDefinition)
529
+ /**
530
+ * 执行动态 renderElement callback。
531
+ *
532
+ * 返回值必须和静态渲染一致。
533
+ */
534
+ renderElement(): UniElementBlock
477
535
 
478
- abstract getField(fieldId: number): UniSharedDataAny
479
- abstract getFlag(flagGroupId: number): number
536
+ /**
537
+ * 执行动态 renderKotlinElement callback。
538
+ *
539
+ * 返回值必须和静态渲染一致。
540
+ */
541
+ renderKotlinElement(): UniElementBlock
480
542
 
481
543
  /**
482
- * 动态模式继续复用静态 `_setData` / `_resetFlags()` 命名,
483
- * 但动态 `renderSharedData` 代码应优先传 `fieldId`,避免运行时再做
484
- * `key -> fieldId` 匹配。
544
+ * 执行动态 renderNativeView callback。
485
545
  *
486
- * 为兼容静态语义与旧调用形态,这里保留 `string` / `number` 双签名:
487
- * - `string`:兼容静态 sharedData 风格,仅做类型定义无需实现
488
- * - `number`:动态 sharedData 主路径,表示 `fieldId`
546
+ * 返回值必须和静态渲染一致。
489
547
  */
490
- // 同样保留双签名兼容静态调用形态,但动态实现只使用 `fieldId` 版本,无需实现 `string` 版本
491
- abstract _setData(key: string, value: any | null): void
492
- abstract _setData(fieldId: number, value: any | null): void
548
+ renderNativeView(): UniNativeViewBlock
493
549
  }
494
550
 
495
551
  /**
496
- * 动态组件 scope 的最终目标基类。
552
+ * 普通动态 scope sharedData。
497
553
  *
498
- * 外部仓库真实实现需要保持与静态 `UniSharedDataComponent`
499
- * 相同的组件级 builtin 语义。
500
- *
501
- * 这里的 class 继承表达“复用哪一个静态基类”:
502
- * - component 复用 `UniSharedDataComponent`
503
- *
504
- * 因为这里不继承 `UniDynamicSharedData`,所以动态读取接口仍需显式声明,
505
- * 不能只留在 `IUniDynamicSharedDataComponent` 里。
554
+ * 真实实现由宿主仓库提供。
555
+ * renderSharedData 会直接 new 该类。
506
556
  */
507
- abstract class UniDynamicSharedDataComponent extends UniSharedDataComponent implements IUniDynamicSharedDataComponent {
508
- readonly _sharedDataClass: UniDynamicSharedDataClassDefinition
509
-
510
- constructor(scope: UniSharedDataPage, options: UniSharedDataComponentOptions, sharedDataClass: UniDynamicSharedDataClassDefinition)
511
-
512
- abstract getField(fieldId: number): UniSharedDataAny
513
- abstract getFlag(flagGroupId: number): number
514
- // 同样保留双签名兼容静态调用形态,但动态实现只使用 `fieldId` 版本,无需实现 `string` 版本
515
- abstract _setData(key: string, value: any | null): void
516
- abstract _setData(fieldId: number, value: any | null): void
517
- abstract getVueId(): number
518
- abstract getFlatten(): UniSharedDataComponentFlatten
519
- abstract getRenderer(): UniSharedDataComponentRenderer
557
+ class UniDynamicSharedData extends UniSharedData implements IUniDynamicSharedData {
558
+ readonly _bundleKey: string
559
+ readonly _sharedDataClassId: number
560
+ readonly _sharedDataClass: UniSharedDataDynamicClassDefinition
561
+ readonly _dynamicState: UniSharedDataDynamicState
562
+
563
+ constructor(dynamicOptions: UniDynamicSharedDataInitOptions)
564
+
565
+ getField(fieldId: number): UniSharedDataAny
566
+ getFlag(flagGroupId: number): number
567
+
568
+ /**
569
+ * 仅做类型,动态 sharedData 不支持按 name 写入。
570
+ */
571
+ _setData(name: string, value: UniSharedDataAny | null): void
572
+ /**
573
+ * 动态渲染始终按 fieldId 写入。
574
+ */
575
+ _setData(fieldId: number, value: UniSharedDataAny | null): void
576
+
577
+ /**
578
+ * 对齐静态 sharedData 生命周期。
579
+ */
580
+ _resetFlags(): void
581
+
582
+ /**
583
+ * 保持和静态渲染一致的 callback 入口。
584
+ */
585
+ _renderElement(): UniElementBlock
586
+ _renderKotlinElement(): UniElementBlock
587
+ _renderNativeView(): UniNativeViewBlock
520
588
  }
521
589
 
522
590
  /**
523
- * 动态页面 scope 的最终目标基类。
591
+ * 动态组件 root sharedData。
524
592
  *
525
- * 外部仓库真实实现应继承 `UniSharedDataPage`,
526
- * 并沿用 component builtin 读取面。
527
- *
528
- * 这里不写成 `UniDynamicSharedDataPage extends UniDynamicSharedDataComponent`。
529
- * 原因:
530
- * 1. `page` 是否属于 `component`,由接口继承表达
531
- * 2. class 继承优先表达真实静态基类复用关系
532
- * 3. `UniSharedDataPage` 已经继承 `UniSharedDataComponent`
593
+ * renderSharedData 会直接 new 该类,
594
+ * sharedDataClassId 固定为 0。
595
+ */
596
+ class UniDynamicSharedDataComponent extends UniSharedDataComponent implements IUniDynamicSharedDataComponent {
597
+ readonly _bundleKey: string
598
+ readonly _sharedDataClassId: number
599
+ readonly _sharedDataClass: UniSharedDataDynamicClassDefinition
600
+ readonly _dynamicState: UniSharedDataDynamicState
601
+
602
+ constructor(dynamicOptions: UniDynamicSharedDataInitOptions)
603
+
604
+ getField(fieldId: number): UniSharedDataAny
605
+ getFlag(flagGroupId: number): number
606
+ getVueId(): number
607
+ getFlatten(): UniSharedDataComponentFlatten
608
+ getRenderer(): UniSharedDataComponentRenderer
609
+ /**
610
+ * 仅做类型,动态 sharedData 不支持按 name 写入。
611
+ */
612
+ _setData(name: string, value: UniSharedDataAny | null): void
613
+ /**
614
+ * 动态渲染始终按 fieldId 写入。
615
+ */
616
+ _setData(fieldId: number, value: UniSharedDataAny | null): void
617
+
618
+ _resetFlags(): void
619
+
620
+ _renderElement(): UniElementBlock
621
+ _renderKotlinElement(): UniElementBlock
622
+ _renderNativeView(): UniNativeViewBlock
623
+ }
624
+
625
+ /**
626
+ * 动态页面 root sharedData。
533
627
  *
534
- * 因为这里不继承 `UniDynamicSharedDataComponent`,所以动态读取接口同样
535
- * 需要显式声明,不能只留在 `IUniDynamicSharedDataPage` 里。
628
+ * renderSharedData 会直接 new 该类,
629
+ * sharedDataClassId 固定为 0。
536
630
  */
537
- abstract class UniDynamicSharedDataPage extends UniSharedDataPage implements IUniDynamicSharedDataPage {
538
- readonly _sharedDataClass: UniDynamicSharedDataClassDefinition
539
-
540
- constructor(pageIdOrScope: number | UniSharedDataPage, options: UniSharedDataComponentOptions, sharedDataClass: UniDynamicSharedDataClassDefinition)
541
-
542
- abstract getField(fieldId: number): UniSharedDataAny
543
- abstract getFlag(flagGroupId: number): number
544
- // 同样保留双签名兼容静态调用形态,但动态实现只使用 `fieldId` 版本,无需实现 `string` 版本
545
- abstract _setData(key: string, value: any | null): void
546
- abstract _setData(fieldId: number, value: any | null): void
547
- abstract getVueId(): number
548
- abstract getFlatten(): UniSharedDataComponentFlatten
549
- abstract getRenderer(): UniSharedDataComponentRenderer
631
+ class UniDynamicSharedDataPage extends UniSharedDataPage implements IUniDynamicSharedDataPage {
632
+ readonly _bundleKey: string
633
+ readonly _sharedDataClassId: number
634
+ readonly _sharedDataClass: UniSharedDataDynamicClassDefinition
635
+ readonly _dynamicState: UniSharedDataDynamicState
636
+
637
+ constructor(dynamicOptions: UniDynamicSharedDataInitOptions)
638
+
639
+ getField(fieldId: number): UniSharedDataAny
640
+ getFlag(flagGroupId: number): number
641
+ getVueId(): number
642
+ getFlatten(): UniSharedDataComponentFlatten
643
+ getRenderer(): UniSharedDataComponentRenderer
644
+
645
+ /**
646
+ * 仅做类型,动态 sharedData 不支持按 name 写入。
647
+ */
648
+ _setData(name: string, value: UniSharedDataAny | null): void
649
+ /**
650
+ * 动态渲染始终按 fieldId 写入。
651
+ */
652
+ _setData(fieldId: number, value: UniSharedDataAny | null): void
653
+ _resetFlags(): void
654
+
655
+ _renderElement(): UniElementBlock
656
+ _renderKotlinElement(): UniElementBlock
657
+ _renderNativeView(): UniNativeViewBlock
550
658
  }
551
659
  }
552
660
 
@@ -6,6 +6,7 @@
6
6
  UniEditorElementOptions as UniEditorElementOptionsOrigin,
7
7
  UniEditorElementInsertImageOptions as UniEditorElementInsertImageOptionsOrigin,
8
8
  UniEditorElementInsertTextOptions as UniEditorElementInsertTextOptionsOrigin,
9
+ UniEditorElementInsertMentionOptions as UniEditorElementInsertMentionOptionsOrigin,
9
10
  UniEditorElementSetContentsOptions as UniEditorElementSetContentsOptionsOrigin,
10
11
  UniEditorElementGetSelectionTextOptionsRes as UniEditorElementGetSelectionTextOptionsResOrigin,
11
12
  UniEditorElementGetSelectionTextOptions as UniEditorElementGetSelectionTextOptionsOrigin,
@@ -25,6 +26,7 @@
25
26
  type UniEditorElementOptions = UniEditorElementOptionsOrigin
26
27
  type UniEditorElementInsertImageOptions = UniEditorElementInsertImageOptionsOrigin
27
28
  type UniEditorElementInsertTextOptions = UniEditorElementInsertTextOptionsOrigin
29
+ type UniEditorElementInsertMentionOptions = UniEditorElementInsertMentionOptionsOrigin
28
30
  type UniEditorElementSetContentsOptions = UniEditorElementSetContentsOptionsOrigin
29
31
  type UniEditorElementGetSelectionTextOptionsRes = UniEditorElementGetSelectionTextOptionsResOrigin
30
32
  type UniEditorElementGetSelectionTextOptions = UniEditorElementGetSelectionTextOptionsOrigin
@@ -6,6 +6,7 @@
6
6
  UniEditorElementOptions,
7
7
  UniEditorElementInsertImageOptions,
8
8
  UniEditorElementInsertTextOptions,
9
+ UniEditorElementInsertMentionOptions,
9
10
  UniEditorElementSetContentsOptions,
10
11
  UniEditorElementGetSelectionTextOptionsRes,
11
12
  UniEditorElementGetSelectionTextOptions,
@@ -33,6 +33,35 @@ export type UniEditorElementInsertTextOptions = {
33
33
  complete ?: ((res : UniEditorElementOptionsCompleteRes) => void) | null
34
34
  }
35
35
 
36
+ export type UniEditorElementInsertMentionOptions = {
37
+ /**
38
+ * 被 @ 的人 id
39
+ */
40
+ id ?: string | null,
41
+ /**
42
+ * 被 @ 的人名字
43
+ */
44
+ name?: string | null,
45
+ /**
46
+ * 提及文本颜色,默认为 #1677ff
47
+ * @defaultValue #1677ff
48
+ */
49
+ color?: string | null,
50
+ /**
51
+ * 提及背景颜色,默认为 #e6f3ff
52
+ * @defaultValue #e6f3ff
53
+ */
54
+ background?: string | null,
55
+ /**
56
+ * 提及圆角,默认为 4px
57
+ * @defaultValue 4px
58
+ */
59
+ radius?: string | null,
60
+ success ?: ((res : UniEditorElementOptionsSuccessRes) => void) | null
61
+ fail ?: ((res : UniEditorElementOptionsFailRes) => void) | null
62
+ complete ?: ((res : UniEditorElementOptionsCompleteRes) => void) | null
63
+ }
64
+
36
65
  export type UniEditorElementSetContentsOptions = {
37
66
  delta ?: any | null,
38
67
  html ?: string | null,
@@ -70,6 +99,7 @@ export interface IUniEditorElement extends UniElement {
70
99
  insertDivider(options : UniEditorElementOptions | null) : void
71
100
  insertImage(options : UniEditorElementInsertImageOptions | null) : void
72
101
  insertText(options : UniEditorElementInsertTextOptions | null) : void
102
+ insertMention(options ?: UniEditorElementInsertMentionOptions | null) : void
73
103
  setContents(options : UniEditorElementSetContentsOptions | null) : void
74
104
  getContents(options : UniEditorElementGetContentsOptions | null) : void
75
105
  clear(options : UniEditorElementOptions | null) : void
@@ -554,6 +584,30 @@ export interface EditorContext {
554
584
  * }
555
585
  */
556
586
  insertText(options ?: UniEditorElementInsertTextOptions | null) : void
587
+ /**
588
+ * 插入可整块删除的提及,提及文本默认为 @名字,当选区存在时覆盖选区文本,当选区不存在时插入到光标处
589
+ * @uniPlatform {
590
+ * "app": {
591
+ * "android": {
592
+ * "osVer": "4.4",
593
+ * "uniVer": "x",
594
+ * "unixVer": "5.04"
595
+ * },
596
+ * "ios": {
597
+ * "osVer": "12.0",
598
+ * "uniVer": "x",
599
+ * "unixVer": "5.04"
600
+ * },
601
+ * "harmony": {
602
+ * "osVer": "√",
603
+ * "uniVer": "x",
604
+ * "unixVer": "5.04",
605
+ * "unixVaporVer": "5.04"
606
+ * }
607
+ * },
608
+ * }
609
+ */
610
+ insertMention(options ?: UniEditorElementInsertMentionOptions | null) : void
557
611
  /**
558
612
  * 初始化编辑器内容,html和delta同时存在时仅delta生效
559
613
  * @uniPlatform {
@@ -771,8 +825,8 @@ export interface EditorContext {
771
825
  */
772
826
  blur(options ?: UniEditorElementOptions | null) : void
773
827
  }
774
-
775
- export type CreateEditorContextAsync = (options: CreateEditorContextAsyncOptions) => void
828
+
829
+ export type CreateEditorContextAsync = (options: CreateEditorContextAsyncOptions) => void
776
830
 
777
831
  export interface Uni {
778
832
  /**
@@ -852,4 +906,4 @@ export interface Uni {
852
906
  * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/create-editor-context-async.html
853
907
  */
854
908
  createEditorContextAsync : CreateEditorContextAsync
855
- }
909
+ }
@@ -6,6 +6,7 @@
6
6
  UniEditorElementOptions as UniEditorElementOptionsOrigin,
7
7
  UniEditorElementInsertImageOptions as UniEditorElementInsertImageOptionsOrigin,
8
8
  UniEditorElementInsertTextOptions as UniEditorElementInsertTextOptionsOrigin,
9
+ UniEditorElementInsertMentionOptions as UniEditorElementInsertMentionOptionsOrigin,
9
10
  UniEditorElementSetContentsOptions as UniEditorElementSetContentsOptionsOrigin,
10
11
  UniEditorElementGetSelectionTextOptionsRes as UniEditorElementGetSelectionTextOptionsResOrigin,
11
12
  UniEditorElementGetSelectionTextOptions as UniEditorElementGetSelectionTextOptionsOrigin,
@@ -25,6 +26,7 @@
25
26
  type UniEditorElementOptions = UniEditorElementOptionsOrigin
26
27
  type UniEditorElementInsertImageOptions = UniEditorElementInsertImageOptionsOrigin
27
28
  type UniEditorElementInsertTextOptions = UniEditorElementInsertTextOptionsOrigin
29
+ type UniEditorElementInsertMentionOptions = UniEditorElementInsertMentionOptionsOrigin
28
30
  type UniEditorElementSetContentsOptions = UniEditorElementSetContentsOptionsOrigin
29
31
  type UniEditorElementGetSelectionTextOptionsRes = UniEditorElementGetSelectionTextOptionsResOrigin
30
32
  type UniEditorElementGetSelectionTextOptions = UniEditorElementGetSelectionTextOptionsOrigin
@@ -6,6 +6,7 @@
6
6
  UniEditorElementOptions,
7
7
  UniEditorElementInsertImageOptions,
8
8
  UniEditorElementInsertTextOptions,
9
+ UniEditorElementInsertMentionOptions,
9
10
  UniEditorElementSetContentsOptions,
10
11
  UniEditorElementGetSelectionTextOptionsRes,
11
12
  UniEditorElementGetSelectionTextOptions,