next-flow-interface 0.24.13 → 0.24.18

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 (2) hide show
  1. package/index.d.ts +1258 -9
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -29,6 +29,7 @@ import {
29
29
  WebGPUEngine,
30
30
  } from '@babylonjs/core'
31
31
  import { WebXRDefaultExperience } from '@babylonjs/core/XR/webXRDefaultExperience'
32
+ import OSS from 'ali-oss'
32
33
  import { EmptyProps, InputNumberProps, SelectProps, SwitchProps } from 'antd'
33
34
  import { Color, ColorPickerProps } from 'antd/es/color-picker'
34
35
  import { DefaultOptionType } from 'antd/es/select'
@@ -335,13 +336,102 @@ export declare enum AttributeType {
335
336
  }
336
337
 
337
338
  /**
339
+ * 自动播放服务
340
+ *
341
+ * 负责管理场景的自动播放功能,按照设定的时间间隔自动切换场景步骤(Step)。
342
+ * 支持循环播放模式,并根据会议状态和页面浏览状态自动控制播放行为。
343
+ *
344
+ * @remarks
345
+ * - 单例模式,通过 `AutoPlayService.instance` 获取实例
346
+ * - 自动播放会受到以下条件限制:
347
+ * - 用户正在跟随访客时不播放
348
+ * - 页面不在浏览状态时不播放
349
+ * - 项目设置中未开启自动播放时不播放
350
+ * - 播放间隔和循环模式由 `RvProjectService.state.playing` 配置决定
351
+ *
352
+ * @example
353
+ * ```typescript
354
+ * // 获取服务实例
355
+ * const autoPlayService = AutoPlayService.instance
356
+ *
357
+ * // 检查是否有下一个步骤
358
+ * const hasNext = autoPlayService.hasNextStep(true)
359
+ *
360
+ * // 尝试跳转到下一个步骤
361
+ * const success = autoPlayService.tryNextStep(false)
362
+ *
363
+ * // 手动启动下一次自动播放(通常由服务内部调用)
364
+ * autoPlayService.next(3000, true) // 3秒后切换,循环播放
365
+ * ```
366
+ *
338
367
  * @public
339
368
  */
340
369
  export declare class AutoPlayService {
370
+ /**
371
+ * 获取服务单例实例
372
+ *
373
+ * @returns AutoPlayService 单例实例
374
+ *
375
+ * @public
376
+ */
341
377
  static get instance(): AutoPlayService
378
+ /**
379
+ * 私有构造函数
380
+ *
381
+ * 确保单例模式,外部无法直接实例化。
382
+ * 构造时会自动调用初始化方法。
383
+ *
384
+ * @private
385
+ */
342
386
  private constructor()
387
+ /**
388
+ * 启动下一次自动播放
389
+ *
390
+ * 设置一个定时器,在指定的时间间隔后自动切换到下一个场景步骤。
391
+ * 如果有下一个步骤,会递归调用自己继续下一轮播放。
392
+ *
393
+ * @param interval - 播放间隔时间(毫秒)
394
+ * @param loop - 是否循环播放,true 表示播放到最后一个步骤后回到第一个
395
+ *
396
+ * @remarks
397
+ * 此方法会持续递归调用直到没有下一个步骤或被 stopAutoPlay 中断。
398
+ * 定时器 ID 会存储在 currentTimeoutId 中,用于后续取消操作。
399
+ *
400
+ * @public
401
+ */
343
402
  next(interval: number, loop: boolean): void
403
+ /**
404
+ * 检查是否有下一个步骤
405
+ *
406
+ * 判断当前场景是否可以切换到下一个步骤。
407
+ *
408
+ * @param loop - 是否循环播放模式
409
+ * @returns true 表示有下一个步骤可以切换,false 表示已经是最后一个步骤且不循环
410
+ *
411
+ * @remarks
412
+ * 循环模式下,如果至少有2个步骤,则始终返回 true(可以循环回第一个)。
413
+ * 非循环模式下,只有当前步骤不是最后一个时才返回 true。
414
+ *
415
+ * @public
416
+ */
344
417
  hasNextStep(loop: boolean): boolean
418
+ /**
419
+ * 尝试切换到下一个步骤
420
+ *
421
+ * 根据当前步骤位置和循环模式,切换到下一个场景步骤。
422
+ *
423
+ * @param loop - 是否循环播放模式
424
+ * @returns true 表示成功切换到下一个步骤,false 或 undefined 表示切换失败
425
+ *
426
+ * @remarks
427
+ * - 如果当前不是最后一个步骤,切换到顺序中的下一个步骤
428
+ * - 如果已经是最后一个步骤且开启了循环模式,切换到第一个步骤
429
+ * - 循环模式至少需要2个步骤才能生效
430
+ *
431
+ * 实际的步骤切换通过修改 `SpaceService.instance.page.sid` 实现。
432
+ *
433
+ * @public
434
+ */
345
435
  tryNextStep(loop: boolean): true | undefined
346
436
  }
347
437
 
@@ -422,6 +512,12 @@ export declare interface BasePlugin {
422
512
  onUninstall?: () => Promise<void>
423
513
  }
424
514
 
515
+ export declare class BasicAttribute extends NodeAttribute<RvBasic> {
516
+ path: string[]
517
+ defaultValue: RvBasic
518
+ generate(sid?: string, nid?: string): RvBasic
519
+ }
520
+
425
521
  /**
426
522
  * @public
427
523
  */
@@ -437,24 +533,219 @@ export declare interface BatchApplyProps extends DivProps {
437
533
  }
438
534
 
439
535
  /**
536
+ * 批量应用服务
537
+ *
538
+ * @remarks
539
+ * 该服务用于管理多场景批量编辑功能。允许用户选择多个场景(step),
540
+ * 并对选中的场景批量应用相同的属性变更。
541
+ *
542
+ * 主要功能:
543
+ * - 管理选中场景列表
544
+ * - 提供全选/取消全选功能
545
+ * - 支持订阅选中状态变化
546
+ * - 提供批量遍历和应用操作的方法
547
+ *
548
+ * @example
549
+ * ```typescript
550
+ * // 获取服务实例
551
+ * const batchService = BatchApplyService.instance
552
+ *
553
+ * // 订阅选中状态变化
554
+ * const unsubscribe = batchService.subscribe((selected) => {
555
+ * console.log('当前选中的场景:', selected)
556
+ * })
557
+ *
558
+ * // 选择所有场景
559
+ * batchService.selectAll()
560
+ *
561
+ * // 批量修改场景属性
562
+ * batchService.forEach((rvStep) => {
563
+ * rvStep.name.set('新场景名称')
564
+ * })
565
+ *
566
+ * // 取消订阅
567
+ * unsubscribe()
568
+ * ```
569
+ *
440
570
  * @public
441
571
  */
442
572
  export declare class BatchApplyService {
573
+ /**
574
+ * 获取 BatchApplyService 的单例实例
575
+ *
576
+ * @returns BatchApplyService 的单例实例
577
+ *
578
+ * @public
579
+ */
443
580
  static get instance(): BatchApplyService
444
- _selected: string[]
445
581
  private constructor()
582
+ /**
583
+ * 获取当前选中的场景ID数组
584
+ *
585
+ * @returns 选中的场景ID数组
586
+ *
587
+ * @public
588
+ */
446
589
  get selected(): string[]
590
+ /**
591
+ * 设置当前选中的场景ID数组
592
+ *
593
+ * @param selected - 要设置的场景ID数组
594
+ *
595
+ * @remarks
596
+ * 设置选中状态后,会自动通知所有订阅者
597
+ *
598
+ * @public
599
+ */
447
600
  set selected(selected: string[])
601
+ /**
602
+ * 选中所有场景
603
+ *
604
+ * @remarks
605
+ * 将当前项目中所有场景的ID添加到选中列表中
606
+ *
607
+ * @example
608
+ * ```typescript
609
+ * BatchApplyService.instance.selectAll()
610
+ * ```
611
+ *
612
+ * @public
613
+ */
448
614
  selectAll(): void
615
+ /**
616
+ * 取消选中所有场景
617
+ *
618
+ * @remarks
619
+ * 清空选中列表,不再选中任何场景
620
+ *
621
+ * @example
622
+ * ```typescript
623
+ * BatchApplyService.instance.unselectAll()
624
+ * ```
625
+ *
626
+ * @public
627
+ */
449
628
  unselectAll(): void
629
+ /**
630
+ * 判断是否已选中所有场景
631
+ *
632
+ * @returns 如果所有场景都已选中返回 true,否则返回 false
633
+ *
634
+ * @example
635
+ * ```typescript
636
+ * if (BatchApplyService.instance.isAllSelected()) {
637
+ * console.log('已选中所有场景')
638
+ * }
639
+ * ```
640
+ *
641
+ * @public
642
+ */
450
643
  isAllSelected(): boolean
644
+ /**
645
+ * 订阅选中状态变化
646
+ *
647
+ * @param subscriber - 订阅回调函数,当选中状态变化时会被调用
648
+ * @returns 取消订阅的函数,调用后将移除该订阅者
649
+ *
650
+ * @remarks
651
+ * 当选中的场景列表发生变化时,所有订阅者都会收到通知
652
+ *
653
+ * @example
654
+ * ```typescript
655
+ * const unsubscribe = BatchApplyService.instance.subscribe((selected) => {
656
+ * console.log('选中场景数量:', selected.length)
657
+ * console.log('选中场景ID:', selected)
658
+ * })
659
+ *
660
+ * // 需要取消订阅时调用
661
+ * unsubscribe()
662
+ * ```
663
+ *
664
+ * @public
665
+ */
451
666
  subscribe(subscriber: BatchApplySubscriber): () => void
667
+ /**
668
+ * 取消订阅选中状态变化
669
+ *
670
+ * @param subscriber - 要取消的订阅回调函数
671
+ *
672
+ * @remarks
673
+ * 从订阅列表中移除指定的订阅者
674
+ *
675
+ * @public
676
+ */
452
677
  unsubscribe(subscriber: BatchApplySubscriber): void
678
+ /**
679
+ * 遍历所有选中的场景并执行操作
680
+ *
681
+ * @param f - 对每个场景执行的回调函数,接收场景的 RhineVar 对象
682
+ *
683
+ * @throws 如果场景数据获取失败会抛出错误
684
+ *
685
+ * @remarks
686
+ * 遍历所有选中的场景,对每个场景执行指定的操作。
687
+ * 这是批量修改场景属性的核心方法。
688
+ *
689
+ * @example
690
+ * ```typescript
691
+ * // 批量修改所有选中场景的名称
692
+ * BatchApplyService.instance.forEach((rvStep) => {
693
+ * rvStep.name.set('统一场景名称')
694
+ * })
695
+ *
696
+ * // 批量修改场景的背景颜色
697
+ * BatchApplyService.instance.forEach((rvStep) => {
698
+ * rvStep.background.color.set('#ffffff')
699
+ * })
700
+ * ```
701
+ *
702
+ * @public
703
+ */
453
704
  forEach(f: (rvStep: StoredRhineVar<RvStep>) => void): void
705
+ /**
706
+ * 遍历所有选中场景中当前选中节点的属性并执行操作
707
+ *
708
+ * @param f - 对每个节点执行的回调函数,接收节点的 RhineVar 对象
709
+ *
710
+ * @throws 如果节点属性数据获取失败会抛出错误
711
+ *
712
+ * @remarks
713
+ * 该方法结合了场景批量选择和节点选择。它会遍历所有选中的场景,
714
+ * 在每个场景中找到当前选中的节点(由 RsSelectionService 管理),
715
+ * 然后对这些节点执行指定的操作。
716
+ *
717
+ * 使用场景:当需要在多个场景中同时修改相同节点的属性时使用此方法。
718
+ * 例如:在多个场景中同时修改某个模型的颜色、位置等属性。
719
+ *
720
+ * @example
721
+ * ```typescript
722
+ * // 在所有选中场景中,修改当前选中节点的可见性
723
+ * BatchApplyService.instance.forEachAttributes((rvNode) => {
724
+ * rvNode.visible.set(false)
725
+ * })
726
+ *
727
+ * // 在所有选中场景中,修改当前选中节点的位置
728
+ * BatchApplyService.instance.forEachAttributes((rvNode) => {
729
+ * rvNode.position.x.set(100)
730
+ * rvNode.position.y.set(200)
731
+ * })
732
+ *
733
+ * // 在所有选中场景中,修改当前选中节点的材质颜色
734
+ * BatchApplyService.instance.forEachAttributes((rvNode) => {
735
+ * rvNode.material.color.set('#ff0000')
736
+ * })
737
+ * ```
738
+ *
739
+ * @public
740
+ */
454
741
  forEachAttributes(f: (rvNode: StoredRhineVar<RvNode>) => void): void
455
742
  }
456
743
 
457
744
  /**
745
+ * 批量应用订阅者回调函数类型
746
+ *
747
+ * @param selected - 当前选中的场景ID数组
748
+ *
458
749
  * @public
459
750
  */
460
751
  export declare type BatchApplySubscriber = (selected: string[]) => void
@@ -611,15 +902,142 @@ export declare interface ContextMenuCreateOptions {
611
902
  }
612
903
 
613
904
  /**
905
+ * 右键菜单管理服务
906
+ *
907
+ * @remarks
908
+ * 该服务提供了一个集中管理系统,用于创建、显示和控制右键菜单。
909
+ * 采用单例模式,确保整个应用程序中只存在一个实例。
910
+ *
911
+ * @example
912
+ * 基础用法:
913
+ * ```typescript
914
+ * const menuController = ContextMenuService.instance.create({
915
+ * x: 100,
916
+ * y: 200,
917
+ * lines: [
918
+ * {
919
+ * text: '复制',
920
+ * onClick: () => console.log('Copy clicked')
921
+ * },
922
+ * {
923
+ * text: '粘贴',
924
+ * onClick: () => console.log('Paste clicked')
925
+ * }
926
+ * ]
927
+ * })
928
+ * menuController.show()
929
+ * ```
930
+ *
614
931
  * @public
615
932
  */
616
933
  export declare class ContextMenuService {
934
+ /**
935
+ * 获取 ContextMenuService 的单例实例
936
+ *
937
+ * @returns 单例实例
938
+ *
939
+ * @public
940
+ */
617
941
  static get instance(): ContextMenuService
618
- private constructor()
942
+ /**
943
+ * 包含所有活动右键菜单的响应式数组
944
+ *
945
+ * @remarks
946
+ * 该数组使用 Valtio proxy 包装以实现响应式更新。
947
+ * 当右键菜单被添加或移除时,UI 将自动反映这些变化。
948
+ *
949
+ * @public
950
+ */
619
951
  contextMenus: ContextMenu[]
952
+ /**
953
+ * 创建一个新的右键菜单
954
+ *
955
+ * @param options - 右键菜单的配置选项
956
+ * @returns 用于管理右键菜单生命周期的控制器对象
957
+ *
958
+ * @remarks
959
+ * 该方法使用指定的选项创建一个新的右键菜单。如果未提供 ID,
960
+ * 将自动生成一个唯一的 ID。返回的控制器可用于显示或销毁菜单。
961
+ *
962
+ * @example
963
+ * ```typescript
964
+ * const controller = ContextMenuService.instance.create({
965
+ * x: event.clientX,
966
+ * y: event.clientY,
967
+ * closeOnOutsideClick: true,
968
+ * lines: [
969
+ * {
970
+ * text: '删除',
971
+ * icon: TrashIcon,
972
+ * onClick: () => handleDelete()
973
+ * }
974
+ * ]
975
+ * })
976
+ * controller.show()
977
+ * ```
978
+ *
979
+ * @public
980
+ */
620
981
  create(options: ContextMenuCreateOptions): ContextMenuController
982
+ /**
983
+ * 根据 ID 获取右键菜单
984
+ *
985
+ * @param id - 右键菜单的唯一 ID
986
+ * @returns 如果找到则返回右键菜单实例,否则返回 undefined
987
+ *
988
+ * @example
989
+ * ```typescript
990
+ * const menu = ContextMenuService.instance.get('context-menu-0')
991
+ * if (menu) {
992
+ * console.log('Found menu at:', menu.x, menu.y)
993
+ * }
994
+ * ```
995
+ *
996
+ * @public
997
+ */
621
998
  get(id: string): ContextMenu | undefined
999
+ /**
1000
+ * 关闭指定的右键菜单
1001
+ *
1002
+ * @param contextMenu - 要关闭的右键菜单 ID 字符串或 ContextMenu 实例
1003
+ * @returns 一个 Promise,如果菜单成功关闭则解析为 true,否则为 false
1004
+ *
1005
+ * @remarks
1006
+ * 该方法从活动菜单列表中移除右键菜单。如果未找到菜单或菜单当前未显示,
1007
+ * 则返回 false。
1008
+ *
1009
+ * @example
1010
+ * ```typescript
1011
+ * // 通过 ID 关闭
1012
+ * await ContextMenuService.instance.close('context-menu-0')
1013
+ *
1014
+ * // 通过实例关闭
1015
+ * const menu = ContextMenuService.instance.get('context-menu-0')
1016
+ * if (menu) {
1017
+ * await ContextMenuService.instance.close(menu)
1018
+ * }
1019
+ * ```
1020
+ *
1021
+ * @public
1022
+ */
622
1023
  close(contextMenu: string | ContextMenu): Promise<boolean>
1024
+ /**
1025
+ * 关闭所有活动的右键菜单
1026
+ *
1027
+ * @returns 一个 Promise,解析为被关闭的菜单数量
1028
+ *
1029
+ * @remarks
1030
+ * 该方法一次性从活动菜单列表中移除所有右键菜单。
1031
+ * 适用于清理操作或需要重置菜单状态的场景。
1032
+ *
1033
+ * @example
1034
+ * ```typescript
1035
+ * const closedCount = await ContextMenuService.instance.closeAll()
1036
+ * console.log(`Closed ${closedCount} menus`)
1037
+ * ```
1038
+ *
1039
+ * @public
1040
+ */
623
1041
  closeAll(): Promise<number>
624
1042
  }
625
1043
 
@@ -649,6 +1067,18 @@ declare function degreesToQuaternion(v: V3): Quaternion
649
1067
 
650
1068
  declare function degreeToRadians(v: V3): V3
651
1069
 
1070
+ /**
1071
+ * 根据路径删除对象中的值
1072
+ * @param source - 源对象
1073
+ * @param path - 路径
1074
+ * @example
1075
+ * ```ts
1076
+ * const obj = { a: { b: 1 } }
1077
+ * RvUtils.setByRvPath(obj, "a.b") // obj === { a: {} }
1078
+ * ```
1079
+ */
1080
+ declare function deleteByRvPath(source: StoredRhineVar, path: string | RvPath): void
1081
+
652
1082
  /**
653
1083
  * @public
654
1084
  */
@@ -802,14 +1232,123 @@ export declare interface DialogPlugin extends IconPlugin {
802
1232
  }
803
1233
 
804
1234
  /**
1235
+ * 对话框服务
1236
+ *
1237
+ * @remarks
1238
+ * 用于管理应用中的所有对话框,提供创建、打开、关闭对话框的功能。
1239
+ * 支持确认对话框和输入对话框两种常用类型。
1240
+ *
1241
+ * @example
1242
+ * 创建确认对话框
1243
+ * ```typescript
1244
+ * const result = await DialogService.instance.confirm({
1245
+ * title: '删除确认',
1246
+ * content: '确定要删除这个文件吗?',
1247
+ * theme: ThemeColor.RED
1248
+ * })
1249
+ * if (result) {
1250
+ * // 用户点击了确认
1251
+ * }
1252
+ * ```
1253
+ *
1254
+ * @example
1255
+ * 创建输入对话框
1256
+ * ```typescript
1257
+ * const name = await DialogService.instance.input({
1258
+ * title: '输入名称',
1259
+ * inputPlaceholder: '请输入文件名',
1260
+ * defaultValue: 'untitled'
1261
+ * })
1262
+ * console.log('用户输入:', name)
1263
+ * ```
1264
+ *
805
1265
  * @public
806
1266
  */
807
1267
  export declare class DialogService {
1268
+ /**
1269
+ * 获取 DialogService 的单例实例
1270
+ *
1271
+ * @returns DialogService 实例
1272
+ */
808
1273
  static get instance(): DialogService
809
1274
  private constructor()
1275
+ /**
1276
+ * 创建一个自定义对话框
1277
+ *
1278
+ * @remarks
1279
+ * 根据提供的配置创建对话框实例。如果未指定 ID,会自动生成唯一 ID。
1280
+ * 可以通过 show 参数控制是否立即显示对话框。
1281
+ *
1282
+ * @param options - 对话框配置选项
1283
+ * @param show - 是否立即显示对话框,默认为 true
1284
+ * @returns 返回创建的 Dialog 实例
1285
+ *
1286
+ * @example
1287
+ * ```typescript
1288
+ * const dialog = await DialogService.instance.create({
1289
+ * title: '自定义对话框',
1290
+ * contentView: MyCustomComponent,
1291
+ * confirmText: '确定',
1292
+ * cancelText: '取消'
1293
+ * })
1294
+ * ```
1295
+ */
810
1296
  create(options: DialogCreateOptions, show?: boolean): Promise<Dialog>
1297
+ /**
1298
+ * 当前所有对话框实例的数组
1299
+ *
1300
+ * @remarks
1301
+ * 保存所有已创建的对话框实例,用于查询和管理
1302
+ */
811
1303
  dialogs: Dialog[]
1304
+ /**
1305
+ * 对话框渲染器实例
1306
+ *
1307
+ * @remarks
1308
+ * 负责对话框的实际渲染和显示逻辑
1309
+ */
812
1310
  renderer: DialogViewRenderer
1311
+ /**
1312
+ * 创建确认对话框
1313
+ *
1314
+ * @remarks
1315
+ * 显示一个带有确认和取消按钮的对话框,用户点击按钮后返回对应的布尔值。
1316
+ * 适用于需要用户确认的操作场景,如删除、保存、提交等。
1317
+ *
1318
+ * @param options - 确认对话框配置选项
1319
+ * @param options.title - 对话框标题
1320
+ * @param options.titleIcon - 标题图标,可以是 React 组件或字符串
1321
+ * @param options.content - 对话框文本内容
1322
+ * @param options.contentView - 自定义内容视图组件
1323
+ * @param options.icon - 对话框图标
1324
+ * @param options.theme - 主题颜色,默认为蓝色
1325
+ * @param options.confirmText - 确认按钮文本,默认为 'Confirm'
1326
+ * @param options.cancelText - 取消按钮文本,默认为 'Cancel'
1327
+ * @param options.leftMode - 是否左对齐模式
1328
+ * @param options.className - 自定义 CSS 类名
1329
+ * @param options.style - 自定义样式对象
1330
+ * @param options.onConfirm - 确认按钮点击回调
1331
+ * @param options.onCancel - 取消按钮点击回调
1332
+ * @param options.onClose - 对话框关闭回调
1333
+ * @param options.closeOnOutsideClick - 是否允许点击外部关闭
1334
+ * @param options.enableCloseButton - 是否显示关闭按钮,默认为 false
1335
+ * @param show - 是否立即显示对话框,默认为 true
1336
+ * @returns Promise,resolve 为 true 表示用户点击确认,false 表示取消
1337
+ *
1338
+ * @example
1339
+ * ```typescript
1340
+ * const confirmed = await DialogService.instance.confirm({
1341
+ * title: '删除文件',
1342
+ * content: '此操作不可恢复,确定要删除吗?',
1343
+ * theme: ThemeColor.RED,
1344
+ * confirmText: '删除',
1345
+ * cancelText: '取消'
1346
+ * })
1347
+ * if (confirmed) {
1348
+ * // 执行删除操作
1349
+ * }
1350
+ * ```
1351
+ */
813
1352
  confirm(
814
1353
  options: {
815
1354
  title: string
@@ -831,6 +1370,56 @@ export declare class DialogService {
831
1370
  },
832
1371
  show?: boolean,
833
1372
  ): Promise<boolean>
1373
+ /**
1374
+ * 创建输入对话框
1375
+ *
1376
+ * @remarks
1377
+ * 显示一个带有输入框的对话框,用户可以输入文本内容。
1378
+ * 支持默认值、占位符、输入验证等功能,适用于需要用户输入信息的场景。
1379
+ *
1380
+ * @param options - 输入对话框配置选项
1381
+ * @param options.title - 对话框标题
1382
+ * @param options.titleIcon - 标题图标,可以是 React 组件或字符串
1383
+ * @param options.content - 对话框文本内容
1384
+ * @param options.contentView - 自定义内容视图组件
1385
+ * @param options.icon - 对话框图标
1386
+ * @param options.theme - 主题颜色,默认为蓝色
1387
+ * @param options.leftMode - 是否左对齐模式
1388
+ * @param options.className - 自定义 CSS 类名
1389
+ * @param options.style - 自定义样式对象
1390
+ * @param options.confirmText - 确认按钮文本,默认为 'Confirm'
1391
+ * @param options.cancelText - 取消按钮文本,默认为 'Cancel'
1392
+ * @param options.defaultValue - 输入框默认值
1393
+ * @param options.inputPlaceholder - 输入框占位符文本
1394
+ * @param options.autoFocus - 是否自动聚焦输入框
1395
+ * @param options.allowEmpty - 是否允许空输入
1396
+ * @param options.onChange - 输入内容变化回调
1397
+ * @param options.onCheck - 输入验证函数,返回 true 表示验证通过
1398
+ * @param options.onConfirm - 确认按钮点击回调,接收输入的值
1399
+ * @param options.onCancel - 取消按钮点击回调
1400
+ * @param options.onClose - 对话框关闭回调
1401
+ * @param options.closeOnOutsideClick - 是否允许点击外部关闭
1402
+ * @param options.enableCloseButton - 是否显示关闭按钮,默认为 false
1403
+ * @param show - 是否立即显示对话框,默认为 true
1404
+ * @returns Promise,resolve 为用户输入的字符串,取消时返回空字符串
1405
+ *
1406
+ * @example
1407
+ * ```typescript
1408
+ * const name = await DialogService.instance.input({
1409
+ * title: '重命名文件',
1410
+ * inputPlaceholder: '请输入新文件名',
1411
+ * defaultValue: 'myfile.txt',
1412
+ * onCheck: (value) => {
1413
+ * // 验证文件名格式
1414
+ * return /^[a-zA-Z0-9._-]+$/.test(value)
1415
+ * }
1416
+ * })
1417
+ * if (name) {
1418
+ * // 使用用户输入的名称
1419
+ * console.log('新文件名:', name)
1420
+ * }
1421
+ * ```
1422
+ */
834
1423
  input(
835
1424
  options: {
836
1425
  title: string
@@ -858,9 +1447,82 @@ export declare class DialogService {
858
1447
  },
859
1448
  show?: boolean,
860
1449
  ): Promise<string | undefined>
1450
+ /**
1451
+ * 根据 ID 获取对话框实例
1452
+ *
1453
+ * @param id - 对话框的唯一标识符
1454
+ * @returns 对话框实例,如果未找到则返回 undefined
1455
+ *
1456
+ * @example
1457
+ * ```typescript
1458
+ * const dialog = DialogService.instance.get('dialog-1')
1459
+ * if (dialog) {
1460
+ * console.log('找到对话框:', dialog.title)
1461
+ * }
1462
+ * ```
1463
+ */
861
1464
  get(id: string): Dialog | undefined
1465
+ /**
1466
+ * 打开对话框
1467
+ *
1468
+ * @remarks
1469
+ * 显示指定的对话框。可以传入对话框实例或对话框 ID。
1470
+ * 如果渲染器未加载或找不到指定的对话框,会抛出错误。
1471
+ *
1472
+ * @param dialog - 对话框实例或对话框 ID
1473
+ * @returns Promise,resolve 为布尔值表示是否成功打开
1474
+ * @throws 渲染器未加载时抛出 'Dialog renderer not loaded'
1475
+ * @throws 找不到指定对话框时抛出 'Failed to find dialog'
1476
+ *
1477
+ * @example
1478
+ * ```typescript
1479
+ * // 通过实例打开
1480
+ * const dialog = await DialogService.instance.create(options, false)
1481
+ * await DialogService.instance.open(dialog)
1482
+ *
1483
+ * // 通过 ID 打开
1484
+ * await DialogService.instance.open('dialog-1')
1485
+ * ```
1486
+ */
862
1487
  open(dialog: Dialog | string): Promise<boolean>
1488
+ /**
1489
+ * 关闭对话框
1490
+ *
1491
+ * @remarks
1492
+ * 关闭指定的对话框。可以传入对话框实例或对话框 ID。
1493
+ * 如果渲染器未加载或找不到指定的对话框,会抛出错误。
1494
+ *
1495
+ * @param dialog - 对话框实例或对话框 ID
1496
+ * @returns Promise,resolve 为布尔值表示是否成功关闭
1497
+ * @throws 渲染器未加载时抛出 'Dialog renderer not loaded'
1498
+ * @throws 找不到指定对话框时抛出 'Failed to find dialog'
1499
+ *
1500
+ * @example
1501
+ * ```typescript
1502
+ * // 通过实例关闭
1503
+ * await DialogService.instance.close(dialog)
1504
+ *
1505
+ * // 通过 ID 关闭
1506
+ * await DialogService.instance.close('dialog-1')
1507
+ * ```
1508
+ */
863
1509
  close(dialog: Dialog | string): Promise<boolean>
1510
+ /**
1511
+ * 关闭所有对话框
1512
+ *
1513
+ * @remarks
1514
+ * 关闭当前所有打开的对话框。会依次关闭 dialogs 数组中的每个对话框。
1515
+ * 如果渲染器未加载,会抛出错误。
1516
+ *
1517
+ * @returns Promise,resolve 为成功关闭的对话框数量
1518
+ * @throws 渲染器未加载时抛出 'Dialog renderer not loaded'
1519
+ *
1520
+ * @example
1521
+ * ```typescript
1522
+ * const closedCount = await DialogService.instance.closeAll()
1523
+ * console.log(`已关闭 ${closedCount} 个对话框`)
1524
+ * ```
1525
+ */
864
1526
  closeAll(): Promise<number>
865
1527
  }
866
1528
 
@@ -1046,22 +1708,179 @@ export declare enum FirstLoadModelServiceStatus {
1046
1708
  export declare type FirstLoadModelServiceSubscriber = (type: FirstLoadModelServiceEventType) => void
1047
1709
 
1048
1710
  /**
1711
+ * 首次加载服务
1712
+ *
1713
+ * @remarks
1714
+ * 负责管理项目首次打开时所有文件的下载和加载过程。
1715
+ * 该服务会在项目初始化时自动下载 RhineVarData.files 中定义的所有文件,
1716
+ * 并提供加载进度、状态监控和错误处理等功能。
1717
+ *
1718
+ * 采用单例模式设计,通过 `FirstLoadService.instance` 访问唯一实例。
1719
+ *
1720
+ * @example
1721
+ * ```typescript
1722
+ * // 启动首次加载
1723
+ * FirstLoadService.instance.start()
1724
+ *
1725
+ * // 监听加载进度
1726
+ * FirstLoadService.instance.subscribe((type) => {
1727
+ * if (type === FirstLoadServiceEventType.PROGRESS) {
1728
+ * console.log(`已加载: ${FirstLoadService.instance.loadedSize} / ${FirstLoadService.instance.totalSize}`)
1729
+ * }
1730
+ * })
1731
+ * ```
1732
+ *
1049
1733
  * @public
1050
1734
  */
1051
1735
  export declare class FirstLoadService {
1736
+ /**
1737
+ * 获取 FirstLoadService 的单例实例
1738
+ *
1739
+ * @returns FirstLoadService 的唯一实例
1740
+ *
1741
+ * @public
1742
+ */
1052
1743
  static get instance(): FirstLoadService
1053
- private constructor()
1744
+ /**
1745
+ * 当前加载服务的状态
1746
+ *
1747
+ * @remarks
1748
+ * 可能的状态值:
1749
+ * - WAITING: 等待开始
1750
+ * - LOADING: 正在加载
1751
+ * - LOADED: 加载完成
1752
+ * - ERROR: 加载出错
1753
+ * - CANCELED: 加载取消
1754
+ *
1755
+ * @public
1756
+ */
1054
1757
  status: FirstLoadServiceStatus
1758
+ /**
1759
+ * 本地数据对象列表
1760
+ *
1761
+ * @remarks
1762
+ * 包含所有正在加载或已加载的文件的本地数据对象,
1763
+ * 每个 LocalData 对象包含文件的 fid、状态、进度等信息。
1764
+ *
1765
+ * @public
1766
+ */
1055
1767
  localDataList: LocalData[]
1768
+ /**
1769
+ * 当前正在加载中的文件数量
1770
+ *
1771
+ * @remarks
1772
+ * 包括状态为 LOADING、WAITING 或 PAUSED 的文件
1773
+ *
1774
+ * @public
1775
+ */
1056
1776
  loadingNumber: number
1777
+ /**
1778
+ * 已成功加载的文件数量
1779
+ *
1780
+ * @public
1781
+ */
1057
1782
  loadedNumber: number
1783
+ /**
1784
+ * 加载失败的文件数量
1785
+ *
1786
+ * @public
1787
+ */
1058
1788
  errorNumber: number
1789
+ /**
1790
+ * 已取消加载的文件数量
1791
+ *
1792
+ * @public
1793
+ */
1059
1794
  canceledNumber: number
1795
+ /**
1796
+ * 需要加载的文件总大小(字节)
1797
+ *
1798
+ * @public
1799
+ */
1060
1800
  totalSize: number
1801
+ /**
1802
+ * 已加载的文件大小(字节)
1803
+ *
1804
+ * @remarks
1805
+ * 根据每个文件的下载进度计算得出,用于显示整体加载进度
1806
+ *
1807
+ * @public
1808
+ */
1061
1809
  loadedSize: number
1810
+ /**
1811
+ * 开始加载的时间戳(毫秒)
1812
+ *
1813
+ * @remarks
1814
+ * 用于计算总加载耗时
1815
+ *
1816
+ * @public
1817
+ */
1062
1818
  startTime: number
1819
+ /**
1820
+ * 开始加载所有文件
1821
+ *
1822
+ * @remarks
1823
+ * 启动首次加载流程,会遍历 RvFileService.instance.files 中的所有文件并开始下载。
1824
+ * 该方法会:
1825
+ * 1. 检查是否有需要加载的文件
1826
+ * 2. 跳过正在上传中的文件(uploading = true)
1827
+ * 3. 计算文件总大小
1828
+ * 4. 调用 LocalDataService 加载每个文件
1829
+ * 5. 监听加载进度和状态变化
1830
+ * 6. 在所有文件加载完成或出错时触发相应事件
1831
+ *
1832
+ * 如果加载过程中出现错误,会弹出对话框提示用户刷新页面重新加载。
1833
+ *
1834
+ * @example
1835
+ * ```typescript
1836
+ * // 在项目初始化时启动文件加载
1837
+ * FirstLoadService.instance.start()
1838
+ * ```
1839
+ *
1840
+ * @public
1841
+ */
1063
1842
  start(): void
1843
+ /**
1844
+ * 订阅加载事件
1845
+ *
1846
+ * @remarks
1847
+ * 注册一个回调函数来监听文件加载的各种事件:
1848
+ * - START: 开始加载
1849
+ * - PROGRESS: 加载进度更新
1850
+ * - LOADED: 所有文件加载完成
1851
+ * - ERROR: 加载出错
1852
+ * - CANCELED: 加载取消
1853
+ *
1854
+ * @param subscriber - 事件回调函数
1855
+ * @returns 取消订阅的函数,调用后将停止接收事件通知
1856
+ *
1857
+ * @example
1858
+ * ```typescript
1859
+ * const unsubscribe = FirstLoadService.instance.subscribe((type) => {
1860
+ * if (type === FirstLoadServiceEventType.PROGRESS) {
1861
+ * console.log('Loading progress:', FirstLoadService.instance.loadedSize)
1862
+ * } else if (type === FirstLoadServiceEventType.LOADED) {
1863
+ * console.log('All files loaded!')
1864
+ * }
1865
+ * })
1866
+ *
1867
+ * // 取消订阅
1868
+ * unsubscribe()
1869
+ * ```
1870
+ *
1871
+ * @public
1872
+ */
1064
1873
  subscribe(subscriber: FirstLoadServiceSubscriber): () => void
1874
+ /**
1875
+ * 取消订阅加载事件
1876
+ *
1877
+ * @remarks
1878
+ * 从订阅者列表中移除指定的回调函数,移除后将不再接收事件通知
1879
+ *
1880
+ * @param subscriber - 要取消订阅的回调函数
1881
+ *
1882
+ * @public
1883
+ */
1065
1884
  unsubscribe(subscriber: FirstLoadServiceSubscriber): void
1066
1885
  }
1067
1886
 
@@ -1563,34 +2382,225 @@ export declare interface LocalData {
1563
2382
  }
1564
2383
 
1565
2384
  /**
2385
+ * 本地数据服务
2386
+ *
2387
+ * 负责管理所有本地数据,包括文件和一些模型内部的派生对象。
2388
+ * 监听 RhineVar 文件系统的变化,实时加载文件到本地。
2389
+ * 提供文件的加载、删除、状态管理和订阅功能。
2390
+ *
1566
2391
  * @public
2392
+ * @example
2393
+ * ```typescript
2394
+ * // 获取服务实例
2395
+ * const localDataService = LocalDataService.instance
2396
+ *
2397
+ * // 加载文件
2398
+ * await localDataService.load(fid, url, mime)
2399
+ *
2400
+ * // 订阅文件加载事件
2401
+ * localDataService.afterLoaded(fid, (localData) => {
2402
+ * console.log('文件已加载:', localData)
2403
+ * })
2404
+ * ```
1567
2405
  */
1568
2406
  export declare class LocalDataService {
2407
+ /**
2408
+ * 获取 LocalDataService 单例实例
2409
+ *
2410
+ * @returns LocalDataService 实例
2411
+ * @public
2412
+ */
1569
2413
  static get instance(): LocalDataService
1570
2414
  private constructor()
2415
+ /**
2416
+ * 本地数据文件存储 Map
2417
+ *
2418
+ * 键为文件ID(fid),值为本地数据对象(LocalData)
2419
+ *
2420
+ * @public
2421
+ */
1571
2422
  files: Map<string, LocalData>
2423
+ /**
2424
+ * 根据文件ID获取本地数据
2425
+ *
2426
+ * @param fid - 文件ID
2427
+ * @returns 本地数据对象,如果不存在则返回 undefined
2428
+ * @public
2429
+ */
1572
2430
  get(fid: string): LocalData | undefined
2431
+ /**
2432
+ * 检查是否存在指定的本地数据
2433
+ *
2434
+ * @param fid - 文件ID
2435
+ * @returns 如果存在返回 true,否则返回 false
2436
+ * @public
2437
+ */
1573
2438
  has(fid: string): boolean
2439
+ /**
2440
+ * 添加本地数据
2441
+ *
2442
+ * 如果指定的文件ID已存在,则返回已存在的本地数据。
2443
+ * 否则创建新的本地数据对象,并发布 ADD 和 LOADED 事件。
2444
+ *
2445
+ * @param option - 添加本地数据的选项
2446
+ * @returns 本地数据对象
2447
+ * @public
2448
+ */
1574
2449
  add(option: AddLocalDataOption): LocalData
1575
2450
  /**
1576
2451
  * 加载一个文件到本地
1577
2452
  *
1578
- * @param fid - 文件在rv中的fid
1579
- * @param url - 文件的直接下载链接或者oss链接
1580
- * @Param mime - 文件类型
2453
+ * 根据提供的 URL 类型(blob、http/https、oss)下载文件到本地。
2454
+ * 支持下载进度跟踪,下载完成后会自动处理文件内容(JSON、文本等)。
2455
+ * 如果文件已存在且已加载完成,则直接返回已存在的本地数据。
2456
+ *
2457
+ * @param fid - 文件在 RhineVar 中的文件ID
2458
+ * @param url - 文件的直接下载链接、Blob URL 或 OSS 链接
2459
+ * @param mime - 文件 MIME 类型,默认为 UNKNOWN
2460
+ * @returns Promise<LocalData> - 返回本地数据对象的 Promise
2461
+ * @public
1581
2462
  */
1582
2463
  load(fid: string, url: string, mime?: string): Promise<LocalData>
2464
+ /**
2465
+ * 通过 File 对象加载文件到本地
2466
+ *
2467
+ * 直接使用浏览器 File 对象创建本地数据,适用于用户上传文件的场景。
2468
+ * 加载完成后会自动处理文件内容(JSON、文本等)。
2469
+ *
2470
+ * @param fid - 文件ID
2471
+ * @param file - 浏览器 File 对象
2472
+ * @param mime - 文件 MIME 类型,默认为 UNKNOWN
2473
+ * @returns Promise<LocalData> - 返回本地数据对象的 Promise
2474
+ * @public
2475
+ */
1583
2476
  loadByFile(fid: string, file: File, mime?: string): Promise<LocalData>
2477
+ /**
2478
+ * 处理文件加载完成后的操作
2479
+ *
2480
+ * 根据文件 MIME 类型自动解析文件内容:
2481
+ * - 如果是 JSON 文件,解析为 JSON 对象并存储到 localData.json
2482
+ * - 如果是文本文件,读取为文本字符串并存储到 localData.text
2483
+ *
2484
+ * @param localData - 本地数据对象
2485
+ * @returns Promise<boolean> - 是否成功处理
2486
+ * @public
2487
+ */
1584
2488
  processAfterLoad(localData: LocalData): Promise<boolean>
2489
+ /**
2490
+ * 移除指定的本地数据
2491
+ *
2492
+ * 从本地数据 Map 中删除指定的文件数据,并发布 REMOVE 事件。
2493
+ *
2494
+ * @param fid - 文件ID
2495
+ * @returns 如果成功移除返回 true,如果文件不存在返回 false
2496
+ * @public
2497
+ */
1585
2498
  remove(fid: string): boolean
2499
+ /**
2500
+ * 暂停文件下载
2501
+ *
2502
+ * @param fid - 文件ID
2503
+ * @returns 是否成功暂停
2504
+ * @public
2505
+ * @throws 该方法尚未实现
2506
+ */
1586
2507
  pause(fid: string): boolean
2508
+ /**
2509
+ * 恢复文件下载
2510
+ *
2511
+ * @param fid - 文件ID
2512
+ * @returns 是否成功恢复
2513
+ * @public
2514
+ * @throws 该方法尚未实现
2515
+ */
1587
2516
  resume(fid: string): boolean
2517
+ /**
2518
+ * 取消文件下载
2519
+ *
2520
+ * @param fid - 文件ID
2521
+ * @returns 是否成功取消
2522
+ * @public
2523
+ * @throws 该方法尚未实现
2524
+ */
1588
2525
  cancel(fid: string): boolean
2526
+ /**
2527
+ * 获取本地文件的 Blob URL
2528
+ *
2529
+ * 将本地数据转换为浏览器可用的 Blob URL,用于在浏览器中显示或下载文件。
2530
+ * 如果数据类型是 BLOB,则创建 Blob URL;如果是 OBJECT,则创建 MediaSource URL。
2531
+ *
2532
+ * @param fid - 文件ID
2533
+ * @returns Blob URL 字符串,如果文件不存在或未加载完成则返回空字符串
2534
+ * @public
2535
+ */
1589
2536
  getLocalUrl(fid: string): string
2537
+ /**
2538
+ * 释放本地文件的 Blob URL
2539
+ *
2540
+ * 释放之前通过 getLocalUrl 创建的 Blob URL,避免内存泄漏。
2541
+ *
2542
+ * @param fid - 文件ID
2543
+ * @returns 如果成功释放返回 true,如果文件不存在或没有 URL 返回 false
2544
+ * @public
2545
+ */
1590
2546
  releaseLocalUrl(fid: string): boolean
2547
+ /**
2548
+ * 订阅所有本地数据的事件
2549
+ *
2550
+ * 订阅所有文件的加载、进度、错误等事件。
2551
+ * 每当任何文件发生事件时,订阅回调函数都会被调用。
2552
+ *
2553
+ * @param subscriber - 订阅回调函数
2554
+ * @returns 取消订阅的函数
2555
+ * @public
2556
+ * @example
2557
+ * ```typescript
2558
+ * const unsubscribe = LocalDataService.instance.subscribe((type, localData) => {
2559
+ * console.log('事件类型:', type)
2560
+ * console.log('本地数据:', localData)
2561
+ * })
2562
+ *
2563
+ * // 取消订阅
2564
+ * unsubscribe()
2565
+ * ```
2566
+ */
1591
2567
  subscribe(subscriber: LocalDataServiceSubscriber): () => void
2568
+ /**
2569
+ * 取消订阅所有本地数据的事件
2570
+ *
2571
+ * @param subscriber - 要取消的订阅回调函数
2572
+ * @public
2573
+ */
1592
2574
  unsubscribe(subscriber: LocalDataServiceSubscriber): void
2575
+ /**
2576
+ * 订阅单个文件的事件
2577
+ *
2578
+ * 只订阅指定文件ID的事件,不会接收其他文件的事件通知。
2579
+ *
2580
+ * @param fid - 文件ID
2581
+ * @param subscriber - 订阅回调函数
2582
+ * @returns 取消订阅的函数
2583
+ * @public
2584
+ * @example
2585
+ * ```typescript
2586
+ * const unsubscribe = LocalDataService.instance.subscribeSingle(fid, (type, localData) => {
2587
+ * if (type === LocalDataServiceEventType.LOADED) {
2588
+ * console.log('文件加载完成:', localData)
2589
+ * }
2590
+ * })
2591
+ *
2592
+ * // 取消订阅
2593
+ * unsubscribe()
2594
+ * ```
2595
+ */
1593
2596
  subscribeSingle(fid: string, subscriber: LocalDataServiceSubscriber): () => void
2597
+ /**
2598
+ * 取消订阅单个文件的事件
2599
+ *
2600
+ * @param fid - 文件ID
2601
+ * @param subscriber - 要取消的订阅回调函数
2602
+ * @public
2603
+ */
1594
2604
  unsubscribeSingle(fid: string, subscriber: LocalDataServiceSubscriber): void
1595
2605
  publish(fid: string, type: LocalDataServiceEventType, localData: LocalData): void
1596
2606
  afterLoaded(fid: string, subscriber: (localData: LocalData) => void): void
@@ -1676,6 +2686,19 @@ declare function makeRvPath(path: string): RvPath
1676
2686
  */
1677
2687
  declare function makeRvPathString(path: RvPath): string
1678
2688
 
2689
+ export declare class MaterialNodeAttribute extends NodeAttribute<RvMaterialNode> {
2690
+ path: string[]
2691
+ defaultValue: RvMaterialNode
2692
+ multiInitialize(nidList?: string[]): void
2693
+ }
2694
+
2695
+ export declare class MaterialPbrAttribute extends NodeAttribute<RvMaterialPBR> {
2696
+ path: string[]
2697
+ defaultValue: RvMaterialPBR
2698
+ multiInitialize(nidList?: string[]): void
2699
+ generate(sid?: string, nid?: string): RvMaterialPBR
2700
+ }
2701
+
1679
2702
  /**
1680
2703
  * @public
1681
2704
  */
@@ -2062,6 +3085,8 @@ export declare abstract class NodeAttribute<T extends object = never> extends Ba
2062
3085
  get targetNidList(): string[]
2063
3086
  generate(sid?: string, nid?: string): T
2064
3087
  multiGenerate(sidList?: string[], nidList?: string[]): Map<string, Map<string, T>>
3088
+ readonly sameGenerateForStepsMode = true
3089
+ readonly sameGenerateForNodesMode = false
2065
3090
  initialize(nid?: string): void
2066
3091
  isInitialized(nid?: string): boolean
2067
3092
  multiInitialize(nidList?: string[]): void
@@ -2172,25 +3197,245 @@ export declare enum OssUploadInstanceStatus {
2172
3197
  }
2173
3198
 
2174
3199
  /**
3200
+ * OSS 上传服务
3201
+ *
3202
+ * @remarks
3203
+ * 该服务负责管理所有 OSS 上传任务队列,提供文件上传、取消、状态监听等功能。
3204
+ * 所有上传任务都会创建对应的 RvFile 记录,并在协同数据中标记 `uploading: true`。
3205
+ * 上传完成后会自动更新 RvFile 的 URL 并移除上传标记。
3206
+ *
3207
+ * @example
3208
+ * ```typescript
3209
+ * // 上传文件
3210
+ * const fid = await OssUploadService.instance.upload(file)
3211
+ *
3212
+ * // 监听上传进度
3213
+ * OssUploadService.instance.subscribe((type, instance) => {
3214
+ * if (type === OssUploadServiceEventType.PROGRESS) {
3215
+ * console.log(`上传进度: ${instance.progress}%`)
3216
+ * }
3217
+ * })
3218
+ * ```
3219
+ *
2175
3220
  * @public
2176
3221
  */
2177
3222
  export declare class OssUploadService {
3223
+ /**
3224
+ * 获取 OssUploadService 单例实例
3225
+ *
3226
+ * @returns OssUploadService 单例实例
3227
+ *
3228
+ * @public
3229
+ */
2178
3230
  static get instance(): OssUploadService
2179
- private constructor()
3231
+ /**
3232
+ * 当前所有上传实例的集合
3233
+ *
3234
+ * @remarks
3235
+ * 使用 Map 结构存储,key 为文件 ID (fid),value 为上传实例对象。
3236
+ * 上传完成后,实例会从集合中自动移除。
3237
+ *
3238
+ * @public
3239
+ */
2180
3240
  instances: Map<string, OssUploadInstance>
3241
+ /**
3242
+ * 根据文件 ID 获取上传实例
3243
+ *
3244
+ * @param fid - 文件 ID
3245
+ * @returns 上传实例对象,如果不存在则返回 undefined
3246
+ *
3247
+ * @public
3248
+ */
2181
3249
  get(fid: string): OssUploadInstance | undefined
3250
+ /**
3251
+ * 检查是否存在指定 ID 的上传任务
3252
+ *
3253
+ * @param fid - 文件 ID
3254
+ * @returns 如果存在返回 true,否则返回 false
3255
+ *
3256
+ * @public
3257
+ */
2182
3258
  has(fid: string): boolean
3259
+ /**
3260
+ * 检查指定的 File 对象是否已经在上传队列中
3261
+ *
3262
+ * @param file - 要检查的 File 对象
3263
+ * @returns 如果该文件已在上传队列中返回 true,否则返回 false
3264
+ *
3265
+ * @remarks
3266
+ * 该方法通过遍历所有上传实例来比较 File 对象引用
3267
+ *
3268
+ * @public
3269
+ */
2183
3270
  hasFile(file: File): boolean
3271
+ /**
3272
+ * 上传完成后从队列中移除的延迟时间(毫秒)
3273
+ *
3274
+ * @defaultValue 100
3275
+ *
3276
+ * @public
3277
+ */
2184
3278
  REMOVE_INTERVAL_AFTER_COMPLETED: number
3279
+ /**
3280
+ * 上传文件到 OSS
3281
+ *
3282
+ * @param file - 要上传的文件对象
3283
+ * @param fid - 文件 ID,如果不提供则自动生成
3284
+ * @param mime - 文件 MIME 类型,如果不提供则自动检测
3285
+ * @param hash - 文件哈希值(可选)
3286
+ * @returns Promise,上传任务启动后返回
3287
+ *
3288
+ * @remarks
3289
+ * 该方法会执行以下操作:
3290
+ * 1. 创建 RvFile 记录,标记 `uploading: true`
3291
+ * 2. 创建上传实例并加入队列
3292
+ * 3. 开始上传并触发相关事件(START、PROGRESS、UPLOADED/FAILED)
3293
+ * 4. 上传成功后更新 RvFile 的 URL 并移除 uploading 标记
3294
+ * 5. 上传失败后自动删除 RvFile 记录
3295
+ * 6. 将文件添加到本地数据服务
3296
+ *
3297
+ * @throws 如果创建 RvFile 失败,抛出 Error
3298
+ *
3299
+ * @example
3300
+ * ```typescript
3301
+ * // 基本用法
3302
+ * await OssUploadService.instance.upload(file)
3303
+ *
3304
+ * // 指定文件 ID
3305
+ * await OssUploadService.instance.upload(file, 'custom-fid')
3306
+ *
3307
+ * // 指定 MIME 类型和哈希值
3308
+ * await OssUploadService.instance.upload(file, 'custom-fid', 'image/png', 'sha256-hash')
3309
+ * ```
3310
+ *
3311
+ * @public
3312
+ */
2185
3313
  upload(file: File, fid?: string, mime?: string, hash?: string): Promise<void>
3314
+ /**
3315
+ * 暂停指定的上传任务
3316
+ *
3317
+ * @param fid - 文件 ID
3318
+ * @returns 暂停操作是否成功
3319
+ *
3320
+ * @remarks
3321
+ * 该方法尚未实现,调用会抛出异常
3322
+ *
3323
+ * @throws 方法未实现错误
3324
+ *
3325
+ * @public
3326
+ */
2186
3327
  pause(fid: string): boolean
3328
+ /**
3329
+ * 恢复指定的上传任务
3330
+ *
3331
+ * @param fid - 文件 ID
3332
+ * @returns 恢复操作是否成功
3333
+ *
3334
+ * @remarks
3335
+ * 该方法尚未实现,调用会抛出异常
3336
+ *
3337
+ * @throws 方法未实现错误
3338
+ *
3339
+ * @public
3340
+ */
2187
3341
  resume(fid: string): boolean
3342
+ /**
3343
+ * 取消指定的上传任务
3344
+ *
3345
+ * @param fid - 文件 ID
3346
+ * @returns 取消操作是否成功
3347
+ *
3348
+ * @remarks
3349
+ * 取消上传后会发布 CANCELED 事件,无论取消是否成功都会发布该事件。
3350
+ * 取消后上传实例仍会保留在队列中,直到超时或手动移除。
3351
+ *
3352
+ * @example
3353
+ * ```typescript
3354
+ * const fid = 'file-id'
3355
+ * if (OssUploadService.instance.cancel(fid)) {
3356
+ * console.log('上传已取消')
3357
+ * }
3358
+ * ```
3359
+ *
3360
+ * @public
3361
+ */
2188
3362
  cancel(fid: string): boolean
3363
+ /**
3364
+ * 订阅所有文件的上传事件
3365
+ *
3366
+ * @param subscriber - 订阅回调函数,当任何文件的上传状态改变时会被调用
3367
+ * @returns 取消订阅的函数
3368
+ *
3369
+ * @remarks
3370
+ * 该方法会监听所有文件的上传事件,包括:
3371
+ * - START: 上传开始
3372
+ * - PROGRESS: 上传进度更新
3373
+ * - UPLOADED: 上传成功
3374
+ * - FAILED: 上传失败
3375
+ * - CANCELED: 上传取消
3376
+ *
3377
+ * @example
3378
+ * ```typescript
3379
+ * const unsubscribe = OssUploadService.instance.subscribe((type, instance) => {
3380
+ * console.log(`文件 ${instance.fid} 状态: ${type}, 进度: ${instance.progress}%`)
3381
+ * })
3382
+ *
3383
+ * // 取消订阅
3384
+ * unsubscribe()
3385
+ * ```
3386
+ *
3387
+ * @public
3388
+ */
2189
3389
  subscribe(subscriber: OssUploadServiceSubscriber): () => void
3390
+ /**
3391
+ * 取消订阅所有文件的上传事件
3392
+ *
3393
+ * @param subscriber - 要取消的订阅回调函数
3394
+ *
3395
+ * @remarks
3396
+ * 从订阅列表中移除指定的订阅者
3397
+ *
3398
+ * @public
3399
+ */
2190
3400
  unsubscribe(subscriber: OssUploadServiceSubscriber): void
3401
+ /**
3402
+ * 订阅指定文件的上传事件
3403
+ *
3404
+ * @param fid - 要订阅的文件 ID
3405
+ * @param subscriber - 订阅回调函数,当该文件的上传状态改变时会被调用
3406
+ * @returns 取消订阅的函数
3407
+ *
3408
+ * @remarks
3409
+ * 该方法只监听指定文件的上传事件。相比 {@link subscribe},这个方法更适合只关注单个文件的场景。
3410
+ * 事件类型包括:START、PROGRESS、UPLOADED、FAILED、CANCELED
3411
+ *
3412
+ * @example
3413
+ * ```typescript
3414
+ * const unsubscribe = OssUploadService.instance.subscribeSingle('file-id', (type, instance) => {
3415
+ * if (type === OssUploadServiceEventType.UPLOADED) {
3416
+ * console.log('文件上传完成')
3417
+ * }
3418
+ * })
3419
+ *
3420
+ * // 取消订阅
3421
+ * unsubscribe()
3422
+ * ```
3423
+ *
3424
+ * @public
3425
+ */
2191
3426
  subscribeSingle(fid: string, subscriber: OssUploadServiceSubscriber): () => void
3427
+ /**
3428
+ * 取消订阅指定文件的上传事件
3429
+ *
3430
+ * @param fid - 文件 ID
3431
+ * @param subscriber - 要取消的订阅回调函数
3432
+ *
3433
+ * @remarks
3434
+ * 从指定文件的订阅列表中移除订阅者
3435
+ *
3436
+ * @public
3437
+ */
2192
3438
  unsubscribeSingle(fid: string, subscriber: OssUploadServiceSubscriber): void
2193
- publish(fid: string, type: OssUploadServiceEventType, uploadInstance: OssUploadInstance): void
2194
3439
  }
2195
3440
 
2196
3441
  /**
@@ -3199,6 +4444,8 @@ export declare class RsNodeService {
3199
4444
  * ```
3200
4445
  */
3201
4446
  getNodeByNid(nid: string): Node_2 | null
4447
+ getMeshByNid(nid: string): Mesh | null
4448
+ getMaterialByNid(nid: string): Material | null
3202
4449
  /**
3203
4450
  * 根据 Babylon.js uniqueId 获取 nid
3204
4451
  *
@@ -3897,7 +5144,6 @@ export declare class RvLoopAttribute {
3897
5144
  */
3898
5145
  export declare interface RvMaterial {
3899
5146
  general: RvMaterialGeneral
3900
- preset: RvPresetType
3901
5147
  pbr?: RvMaterialPBR
3902
5148
  node?: RvMaterialNode
3903
5149
  texture: RvMaterialTexture
@@ -3963,6 +5209,7 @@ export declare interface RvMaterialGeneral {
3963
5209
  isExtracted: boolean
3964
5210
  transparencyMode: TransparencyMode
3965
5211
  needDepthPrePass: boolean
5212
+ preset: RvPresetType
3966
5213
  }
3967
5214
 
3968
5215
  /**
@@ -4501,6 +5748,7 @@ export declare const RvUtils: {
4501
5748
  ensureRvPathString: typeof ensureRvPathString
4502
5749
  getByRvPath: typeof getByRvPath
4503
5750
  setByRvPath: typeof setByRvPath
5751
+ deleteByRvPath: typeof deleteByRvPath
4504
5752
  checkRvPathOverlay: typeof checkRvPathOverlay
4505
5753
  checkRvPathStartWith: typeof checkRvPathStartWith
4506
5754
  checkAnyRvPathOverlay: typeof checkAnyRvPathOverlay
@@ -4827,6 +6075,7 @@ export declare abstract class StepAttribute<T extends object = never> extends Ba
4827
6075
  get targetSidList(): string[]
4828
6076
  generate(sid?: string): T
4829
6077
  multiGenerate(sidList?: string[]): Map<string, T>
6078
+ readonly sameGenerateForStepsMode = true
4830
6079
  initialize(): void
4831
6080
  isInitialized(): boolean
4832
6081
  mark(path: string | RvPath, sid?: string): void