@manycore/custom-sdk 2.0.0 → 3.0.0-beta.0

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 (3) hide show
  1. package/index.d.ts +45 -152
  2. package/index.js +18 -18
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1,8 +1,31 @@
1
- import { IExportModelData } from '@manycore/custom-miniapp-sdk';
2
1
  import { IParamModelPhotoResponse } from '@manycore/custom-miniapp-sdk';
3
2
  import { IServClientService } from 'servkit';
4
3
  import { Number2 as Number2_2 } from '@manycore/custom-miniapp-sdk';
5
4
  import { ServService } from 'servkit';
5
+ import { ServServiceMeta } from 'servkit';
6
+
7
+ /**
8
+ * 小程序发射器
9
+ * 用于启动可运行于设计工具外的小程序
10
+ */
11
+ export declare class AppBooter {
12
+ /** 设计工具信道 */
13
+ private sappSDK;
14
+ private readonly serverDefer;
15
+ /** 独立工具信道 */
16
+ private readonly proxyTerminals;
17
+ private getCustomMiniAppService;
18
+ constructor(option?: IApplicationStartOption);
19
+ initializeServer: (option?: ITerminalConfig | undefined) => Promise<ServServiceMeta[]>;
20
+ /**
21
+ * 启动的小程序地址
22
+ * @param openParam.url 打开的小程序地址
23
+ * @returns {Window} 打开的小程序引用
24
+ */
25
+ bootstrap(openParam: {
26
+ url: string;
27
+ }): Promise<Window>;
28
+ }
6
29
 
7
30
  /**
8
31
  * app 配置服务
@@ -33,6 +56,26 @@ export declare class Application {
33
56
  * 判断当前是否在定制小程序下运行
34
57
  */
35
58
  isInCustomMiniAppMode(): boolean;
59
+ /**
60
+ * 判断是否是独立小程序
61
+ */
62
+ static isIndependentMiniApp(): boolean;
63
+ /**
64
+ * 获取宿主
65
+ * 可以通过postMessage和onMessageReceive实现与宿主的双向通信
66
+ * @returns
67
+ */
68
+ getHost: () => {
69
+ /** 启动器窗口的引用 */
70
+ booter?: Window | undefined;
71
+ /** 向宿主发送消息 */
72
+ postMessage: (message: any, targetOrigin?: string | undefined) => void;
73
+ /** 从宿主接受消息 */
74
+ onMessageReceive: (fn: (ev: {
75
+ data: any;
76
+ origin: string;
77
+ }) => void) => void;
78
+ };
36
79
  /**
37
80
  * 添加调试的utils
38
81
  * - 获取已初始化的service
@@ -711,38 +754,6 @@ export declare enum EProductDirection {
711
754
  XZ = 2
712
755
  }
713
756
 
714
- /**
715
- * 处理选中的内容
716
- */
717
- export declare enum ESelectedType {
718
- /**
719
- * 未选中模型
720
- */
721
- NULL = 0,
722
- /**
723
- * 模型或商品
724
- */
725
- MODEL = 1,
726
- /**
727
- * 五金信息
728
- */
729
- CASBIN = 2
730
- }
731
-
732
- /**
733
- * 设置选中内容类型
734
- */
735
- export declare enum ESetSelectType {
736
- /**
737
- * 模型或商品
738
- */
739
- MODEL = 1,
740
- /**
741
- * 五金
742
- */
743
- CASBIN = 2
744
- }
745
-
746
757
  /**
747
758
  * 定制行业工具线
748
759
  */
@@ -2621,34 +2632,6 @@ export declare class FittingDesignService extends BaseService {
2621
2632
  */
2622
2633
  export declare type ISceneSelectOption = IElement;
2623
2634
 
2624
- /**
2625
- * 当前选中的数据
2626
- */
2627
- export declare interface ISelected {
2628
- /**
2629
- * 选中的数据内容
2630
- */
2631
- data: IExportModelData[] | IHardwareData[];
2632
- /**
2633
- * 选中的数据类型
2634
- */
2635
- type: ESelectedType;
2636
- }
2637
-
2638
- /**
2639
- * 通过ID选中模型参数
2640
- */
2641
- export declare interface ISetSelectedByIdOption {
2642
- /**
2643
- * 模型ID/五金ID
2644
- */
2645
- id: string;
2646
- /**
2647
- * 选中的类型
2648
- */
2649
- type: ESetSelectType;
2650
- }
2651
-
2652
2635
  /**
2653
2636
  * 场景中,模型的颜色配置能力
2654
2637
  *
@@ -3205,6 +3188,7 @@ export declare class FittingDesignService extends BaseService {
3205
3188
  * ```
3206
3189
  *
3207
3190
  * @param options
3191
+ * @deprecated 该API即将废弃,后续不再维护,请使用`IDP.Custom.Design.Export.getModelJsonAsyncV2` API代替,可获得更好的性能优化
3208
3192
  */
3209
3193
  getParamData(options?: IGetParamModelJsonOption): Promise<any>;
3210
3194
  /**
@@ -3254,97 +3238,6 @@ export declare class FittingDesignService extends BaseService {
3254
3238
  }): Promise<IModelValidateResult | undefined>;
3255
3239
  }
3256
3240
 
3257
- /**
3258
- * 主要是用来与场景交互的,监听当前选中的对象, 获取选中的内容
3259
- *
3260
- * @example
3261
- * ```typescript
3262
- * const viewerSelectionService = application.getService(ModelViewerSelectionService);
3263
- * ```
3264
- */
3265
- export declare class ModelViewerSelectionService extends BaseService {
3266
- /**
3267
- * if watch EVENT_SELECT_CHANGED event
3268
- *
3269
- * @ignore
3270
- */
3271
- private hasWatchSelectionChange;
3272
- /**
3273
- * 获取当前选中的数据
3274
- */
3275
- getSelected(): ISelected;
3276
- /**
3277
- * 设置选中的模型
3278
- * 同时选中多个模型暂未支持,请勿使用
3279
- * @param option ISetSelectedByIdOption
3280
- * @example
3281
- * ```
3282
- * const viewerSelectionService = application.getService(ModelViewerSelectionService);
3283
- * const selectOption = {
3284
- * id: 'modelId...',
3285
- * type: ESetSelectType.MODEL,
3286
- * };
3287
- *
3288
- * viewerSelectionService.select(selectOption);
3289
- * ```
3290
- */
3291
- select(option: ISetSelectedByIdOption | ISetSelectedByIdOption[]): void;
3292
- /**
3293
- * 取消场景当中选中内容
3294
- * 同时取消多个模型暂未支持,请勿使用
3295
- * @param option
3296
- * @example
3297
- * ```
3298
- * const viewerSelectionService = application.getService(ModelViewerSelectionService);
3299
- * const selectOption = {
3300
- * id: 'modelId...',
3301
- * type: ESetSelectType.MODEL,
3302
- * };
3303
- *
3304
- * // 取消指定选中模型
3305
- * viewerSelectionService.unSelect(selectOption);
3306
- * // 默认取消全部选中模型
3307
- * viewerSelectionService.unSelect();
3308
- * ```
3309
- */
3310
- unSelect(option?: ISetSelectedByIdOption | ISetSelectedByIdOption[]): void;
3311
- /**
3312
- * 根据参数生成entity
3313
- * @param option
3314
- * @returns entity
3315
- * @private
3316
- * @ignore
3317
- */
3318
- private __generateEntity;
3319
- /**
3320
- * @ignore
3321
- */
3322
- private startWatchSelectedChangedEvent;
3323
- /**
3324
- * @ignore
3325
- */
3326
- private onSelectedChanged;
3327
- /**
3328
- * 监听当前选中内容
3329
- * @param fn
3330
- */
3331
- on(fn: (param: ISelected) => any): void;
3332
- /**
3333
- * 取消监听选中变化
3334
- * @param fn
3335
- */
3336
- off(fn?: (param: ISelected) => any): void;
3337
- /**
3338
- * 监听当前选中的内容(触发一次后自动取消)
3339
- * @param fn
3340
- */
3341
- once(fn: (param: ISelected) => any): void;
3342
- /**
3343
- * @ignore
3344
- */
3345
- __onDestroy(): void;
3346
- }
3347
-
3348
3241
  /**
3349
3242
  * ModelViewerSelectionService v2版本: 作为范围为场景内五金孔槽、参数化组合、参数化模型
3350
3243
  *