vis-core 0.32.6 → 0.32.8
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/dist/index.d.ts +89 -26
- package/dist/index.js +2 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -86,9 +86,13 @@ declare class Area extends GroupObject {
|
|
|
86
86
|
/** vis-core 的运行时入口只接受编辑平台导出的完整场景文档。 */
|
|
87
87
|
export declare function assertRuntimeSceneDocument(value: unknown): asserts value is VisSceneDocument & Record<string, any>;
|
|
88
88
|
|
|
89
|
+
export declare function assertSceneManifest(value: unknown): asserts value is VisSceneManifest;
|
|
90
|
+
|
|
89
91
|
export declare function assertSupportedSceneDocument(value: unknown): void;
|
|
90
92
|
|
|
91
|
-
export declare
|
|
93
|
+
export declare type Base = Base_2;
|
|
94
|
+
|
|
95
|
+
declare class Base_2 extends Camera {
|
|
92
96
|
static VisName: string;
|
|
93
97
|
runtimePolicy: {
|
|
94
98
|
observeParentScale: boolean;
|
|
@@ -119,7 +123,7 @@ export declare class Base extends Camera {
|
|
|
119
123
|
private resolveRendererDepthBufferOptions;
|
|
120
124
|
private showDetectRes;
|
|
121
125
|
setOptions(options: Record<string, any>): void;
|
|
122
|
-
|
|
126
|
+
/* Excluded from this release type: fromJSON */
|
|
123
127
|
private runtimeInitialization?;
|
|
124
128
|
private disposed;
|
|
125
129
|
/* Excluded from this release type: initializeRuntime */
|
|
@@ -393,7 +397,9 @@ declare class DirectionalLight extends DirectionalLightObject {
|
|
|
393
397
|
render(): void;
|
|
394
398
|
}
|
|
395
399
|
|
|
396
|
-
export declare
|
|
400
|
+
export declare type Earth = Earth_2;
|
|
401
|
+
|
|
402
|
+
declare class Earth_2 extends Base_2 {
|
|
397
403
|
static VisName: string;
|
|
398
404
|
leftTruck: boolean;
|
|
399
405
|
options: Required<EarthOptions>;
|
|
@@ -404,7 +410,7 @@ export declare class Earth extends Base {
|
|
|
404
410
|
setOptions(options: EarthOptions): void;
|
|
405
411
|
handleSetting(key: string, value: any): void;
|
|
406
412
|
protected get objectTypes(): {
|
|
407
|
-
Earth:
|
|
413
|
+
Earth: Earth_3;
|
|
408
414
|
SphereShadow: SphereShadow;
|
|
409
415
|
Countries: typeof PlaneMap;
|
|
410
416
|
PlaneMap: typeof PlaneMap;
|
|
@@ -450,7 +456,7 @@ export declare class Earth extends Base {
|
|
|
450
456
|
protected onSceneRestored(): Promise<void>;
|
|
451
457
|
}
|
|
452
458
|
|
|
453
|
-
declare class
|
|
459
|
+
declare class Earth_3 extends Sphere {
|
|
454
460
|
objectType: string;
|
|
455
461
|
options: Required<Options_4>;
|
|
456
462
|
constructor(options: Options_4);
|
|
@@ -473,6 +479,8 @@ declare interface EarthSceneBindings {
|
|
|
473
479
|
secondaryMap?: string;
|
|
474
480
|
}
|
|
475
481
|
|
|
482
|
+
export declare type EmptySceneDefinition = Omit<SceneViewportDocument, 'scene'>;
|
|
483
|
+
|
|
476
484
|
declare class Event_2 {
|
|
477
485
|
event: EventEmitter;
|
|
478
486
|
private eventHandlers;
|
|
@@ -517,7 +525,12 @@ declare class HemisphereLight extends HemisphereLightObject {
|
|
|
517
525
|
*/
|
|
518
526
|
export declare function isSceneDocument(value: unknown): value is SceneDocumentMarker & Record<string, any>;
|
|
519
527
|
|
|
520
|
-
declare
|
|
528
|
+
export declare function isSceneManifest(value: unknown): value is VisSceneManifest;
|
|
529
|
+
|
|
530
|
+
declare type Map_2 = Map_3;
|
|
531
|
+
export { Map_2 as Map }
|
|
532
|
+
|
|
533
|
+
declare class Map_3 extends Base_2 {
|
|
521
534
|
static VisName: string;
|
|
522
535
|
options: Required<MapCityOptions>;
|
|
523
536
|
/** 当前唯一主地图的运行时状态。 */
|
|
@@ -712,7 +725,6 @@ declare class Map_2 extends Base {
|
|
|
712
725
|
applyRegionTextureRules(adcode: number): Promise<void>;
|
|
713
726
|
protected onDispose(): void;
|
|
714
727
|
}
|
|
715
|
-
export { Map_2 as Map }
|
|
716
728
|
|
|
717
729
|
declare interface MapAssetSources {
|
|
718
730
|
worldGeojson: string;
|
|
@@ -1212,6 +1224,10 @@ export declare const SCENE_DOCUMENT_FORMAT: "vis-scene";
|
|
|
1212
1224
|
|
|
1213
1225
|
export declare const SCENE_DOCUMENT_SCHEMA_VERSION: 3;
|
|
1214
1226
|
|
|
1227
|
+
export declare const SCENE_MANIFEST_FORMAT: "vis-scene-manifest";
|
|
1228
|
+
|
|
1229
|
+
export declare const SCENE_MANIFEST_SCHEMA_VERSION: 1;
|
|
1230
|
+
|
|
1215
1231
|
export declare interface SceneBackInteraction {
|
|
1216
1232
|
trigger: 'click' | 'clickOutside';
|
|
1217
1233
|
objectId: string;
|
|
@@ -1255,6 +1271,10 @@ export declare interface SceneInteractionFilter {
|
|
|
1255
1271
|
export declare class SceneManager extends Event_2 {
|
|
1256
1272
|
private options;
|
|
1257
1273
|
private document?;
|
|
1274
|
+
private manifest?;
|
|
1275
|
+
private manifestUrl?;
|
|
1276
|
+
private loadedDefinitions;
|
|
1277
|
+
private definitionLoads;
|
|
1258
1278
|
private runtimeHooks?;
|
|
1259
1279
|
private instances;
|
|
1260
1280
|
private currentSceneId;
|
|
@@ -1276,28 +1296,35 @@ export declare class SceneManager extends Event_2 {
|
|
|
1276
1296
|
getSafeAreaInsets(): MapSafeAreaInsets;
|
|
1277
1297
|
private captureCamera;
|
|
1278
1298
|
private playTransition;
|
|
1279
|
-
/** 接管一个已经恢复完成的场景,供编辑器首次加载时复用。 */
|
|
1280
|
-
attach(document: VisSceneDocument, sceneId: string, scene: Base): Base;
|
|
1281
1299
|
/** 更新可编辑文档,并释放已经不属于文档的非活动场景实例。 */
|
|
1282
1300
|
setDocument(document: VisSceneDocument): void;
|
|
1283
|
-
load(documentOrUrl: VisSceneDocument | string, hooks?: Record<string, any>): Promise<
|
|
1301
|
+
load(documentOrUrl: VisSceneDocument | VisSceneManifest | string, hooks?: Record<string, any>): Promise<Base_2>;
|
|
1302
|
+
/**
|
|
1303
|
+
* 创建一个没有快照输入的运行时页面,并在可选构建步骤完成后将其导出为
|
|
1304
|
+
* 标准单场景文档。主要供编辑器新建和旧模板迁移使用。
|
|
1305
|
+
*/
|
|
1306
|
+
createEmptyScene(definition: EmptySceneDefinition, build?: (scene: Base_2) => void | Promise<void>): Promise<Base_2>;
|
|
1284
1307
|
/**
|
|
1285
1308
|
* 以指定地图模板和行政区直接启动,不先加载文档配置的入口场景。
|
|
1286
1309
|
* 适用于宿主按路由或业务参数决定初始省、市、区的场景。
|
|
1287
1310
|
*/
|
|
1288
|
-
loadMapRegion(documentOrUrl: VisSceneDocument | string, sceneId: string, adcode: number, hooks?: Record<string, any>): Promise<
|
|
1289
|
-
loadMapRegion(documentOrUrl: VisSceneDocument | string, adcode: number, resolveScene: MapRegionSceneResolver, hooks?: Record<string, any>): Promise<
|
|
1311
|
+
loadMapRegion(documentOrUrl: VisSceneDocument | VisSceneManifest | string, sceneId: string, adcode: number, hooks?: Record<string, any>): Promise<Map_3>;
|
|
1312
|
+
loadMapRegion(documentOrUrl: VisSceneDocument | VisSceneManifest | string, adcode: number, resolveScene: MapRegionSceneResolver, hooks?: Record<string, any>): Promise<Map_3>;
|
|
1290
1313
|
private loadDocument;
|
|
1291
|
-
|
|
1314
|
+
private getSceneMetadata;
|
|
1315
|
+
private resolveManifestSource;
|
|
1316
|
+
private loadSceneDefinition;
|
|
1317
|
+
private createRuntimeSceneDocument;
|
|
1318
|
+
switchScene(sceneId: string, options?: SwitchSceneOptions, hooks?: Record<string, any>): Promise<Base_2 | null>;
|
|
1292
1319
|
/**
|
|
1293
1320
|
* 恢复并缓存一个非活动场景,不改变当前场景、导航历史或相机。
|
|
1294
1321
|
* 适合预制件场景:调用方可从返回实例取对象,再通过 instantiate({ target })
|
|
1295
1322
|
* 直接实例化到当前场景。
|
|
1296
1323
|
*/
|
|
1297
|
-
preloadScene(sceneId: string, hooks?: Record<string, any>): Promise<
|
|
1324
|
+
preloadScene(sceneId: string, hooks?: Record<string, any>): Promise<Base_2>;
|
|
1298
1325
|
/** 编辑器事务:在独立页面上修改参数并重建快照,成功后一起提交文档和实例。 */
|
|
1299
|
-
editScene(sceneId: string, edit: (scene:
|
|
1300
|
-
back(hooks?: Record<string, any>): Promise<
|
|
1326
|
+
editScene(sceneId: string, edit: (scene: Base_2, definition: SceneViewportDocument) => Promise<SceneViewportDocument>, hooks?: Record<string, any>): Promise<Base_2>;
|
|
1327
|
+
back(hooks?: Record<string, any>): Promise<Base_2 | null>;
|
|
1301
1328
|
/**
|
|
1302
1329
|
* 切到目标地图场景,并按 adcode 重建其中的地图。sceneId 不同时,语义等价于
|
|
1303
1330
|
* switchScene(sceneId) 后 switchMapRegion(adcode),但候选场景只在两步都成功后提交,
|
|
@@ -1305,19 +1332,20 @@ export declare class SceneManager extends Event_2 {
|
|
|
1305
1332
|
* 始终从文档基线构建隔离页面,避免对缓存实例反复施加缩放/删除修正。
|
|
1306
1333
|
* 旧页面在构建期间保持完整;只有所有资源、几何和交互就绪才提交导航。
|
|
1307
1334
|
*/
|
|
1308
|
-
switchMapRegion(sceneId: string, adcode: number, options?: SwitchSceneOptions, hooks?: Record<string, any>): Promise<
|
|
1335
|
+
switchMapRegion(sceneId: string, adcode: number, options?: SwitchSceneOptions, hooks?: Record<string, any>): Promise<Map_3 | null>;
|
|
1309
1336
|
/** 场景切换与区域切换共享一条返回历史。 */
|
|
1310
|
-
backMapRegion(hooks?: Record<string, any>): Promise<
|
|
1337
|
+
backMapRegion(hooks?: Record<string, any>): Promise<Base_2 | null>;
|
|
1311
1338
|
getCurrentSceneId(): string;
|
|
1312
1339
|
getCurrentScene<T extends SceneType>(type: T): SceneTypeMap[T] | null;
|
|
1313
|
-
getCurrentScene():
|
|
1340
|
+
getCurrentScene(): Base_2 | null;
|
|
1314
1341
|
private getCurrentSceneByType;
|
|
1315
1342
|
getScene<T extends SceneType>(sceneId: string, type: T): SceneTypeMap[T] | undefined;
|
|
1316
|
-
getScene(sceneId: string):
|
|
1343
|
+
getScene(sceneId: string): Base_2 | undefined;
|
|
1317
1344
|
getSceneByName<T extends SceneType>(name: string, type: T): SceneTypeMap[T] | undefined;
|
|
1318
|
-
getSceneByName(name: string):
|
|
1345
|
+
getSceneByName(name: string): Base_2 | undefined;
|
|
1319
1346
|
private getSceneByType;
|
|
1320
1347
|
getDocument(): VisSceneDocument | undefined;
|
|
1348
|
+
getManifest(): VisSceneManifest | undefined;
|
|
1321
1349
|
private bindSceneInteractions;
|
|
1322
1350
|
canBack(): boolean;
|
|
1323
1351
|
private disposeInstances;
|
|
@@ -1330,9 +1358,11 @@ export declare interface SceneManagerBehaviorOptions {
|
|
|
1330
1358
|
/** 输出射线命中和场景交互诊断,仅用于开发排查。 */
|
|
1331
1359
|
debugInteractions?: boolean;
|
|
1332
1360
|
/** 创建场景后、恢复 JSON 前调用。 */
|
|
1333
|
-
prepareScene?: (scene:
|
|
1361
|
+
prepareScene?: (scene: Base_2) => void;
|
|
1334
1362
|
/** 是否保留非活动场景实例;编辑器可关闭以限制 GPU/内存占用。 */
|
|
1335
1363
|
cacheScenes?: boolean;
|
|
1364
|
+
/** 自定义分包场景读取器;可从 IndexedDB 等非 HTTP 存储按需读取。 */
|
|
1365
|
+
loadScene?: (entry: SceneManifestEntry) => Promise<SceneViewportDocument>;
|
|
1336
1366
|
}
|
|
1337
1367
|
|
|
1338
1368
|
export declare type SceneManagerInitOptions = SceneManagerOptions & SceneManagerBehaviorOptions;
|
|
@@ -1344,6 +1374,13 @@ export declare interface SceneManagerOptions extends Pick<BaseOptions, 'containe
|
|
|
1344
1374
|
safeAreaInsets?: Partial<MapSafeAreaInsets>;
|
|
1345
1375
|
}
|
|
1346
1376
|
|
|
1377
|
+
export declare interface SceneManifestEntry extends Omit<SceneViewportDocument, 'scene'> {
|
|
1378
|
+
/** Relative to the manifest URL unless an absolute URL is supplied. */
|
|
1379
|
+
source: string;
|
|
1380
|
+
/** Uncompressed JSON bytes, used only for diagnostics and progress UI. */
|
|
1381
|
+
bytes?: number;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1347
1384
|
export declare interface SceneSwitchInteraction {
|
|
1348
1385
|
trigger: 'click' | 'clickOutside';
|
|
1349
1386
|
objectId: string;
|
|
@@ -1362,9 +1399,9 @@ export declare interface SceneTransitionOptions {
|
|
|
1362
1399
|
export declare type SceneType = keyof SceneTypeMap;
|
|
1363
1400
|
|
|
1364
1401
|
export declare interface SceneTypeMap {
|
|
1365
|
-
base:
|
|
1366
|
-
earth:
|
|
1367
|
-
map:
|
|
1402
|
+
base: Base_2;
|
|
1403
|
+
earth: Earth_2;
|
|
1404
|
+
map: Map_3;
|
|
1368
1405
|
}
|
|
1369
1406
|
|
|
1370
1407
|
export declare interface SceneViewportDocument {
|
|
@@ -1414,6 +1451,21 @@ declare class SphereShadow extends MeshObject {
|
|
|
1414
1451
|
rebuildFromScene(): void;
|
|
1415
1452
|
}
|
|
1416
1453
|
|
|
1454
|
+
/**
|
|
1455
|
+
* Creates deployable, independently fetchable scene JSON values. Resources are
|
|
1456
|
+
* expanded per scene so loading the entry scene never requires a global pool.
|
|
1457
|
+
*/
|
|
1458
|
+
export declare function splitSceneDocument(document: VisSceneDocument, options?: {
|
|
1459
|
+
sceneDirectory?: string;
|
|
1460
|
+
extension?: '.json' | '.json.gz';
|
|
1461
|
+
}): SplitSceneDocumentBundle;
|
|
1462
|
+
|
|
1463
|
+
export declare interface SplitSceneDocumentBundle {
|
|
1464
|
+
manifest: VisSceneManifest;
|
|
1465
|
+
/** Keys are the relative source paths written into the manifest. */
|
|
1466
|
+
scenes: Record<string, SceneViewportDocument>;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1417
1469
|
declare class SpotLight extends SpotLightObject {
|
|
1418
1470
|
constructor(...options: ConstructorParameters<typeof SpotLightObject>);
|
|
1419
1471
|
update(delta: number, elapsed: number): void;
|
|
@@ -1463,7 +1515,7 @@ export { TWEEN }
|
|
|
1463
1515
|
|
|
1464
1516
|
export { Tween }
|
|
1465
1517
|
|
|
1466
|
-
export declare const VERSION = "0.32.
|
|
1518
|
+
export declare const VERSION = "0.32.8";
|
|
1467
1519
|
|
|
1468
1520
|
export declare interface VisSceneDocument extends SceneDocumentMarker {
|
|
1469
1521
|
entrySceneId: string;
|
|
@@ -1476,6 +1528,17 @@ export declare interface VisSceneDocument extends SceneDocumentMarker {
|
|
|
1476
1528
|
s?: string;
|
|
1477
1529
|
}
|
|
1478
1530
|
|
|
1531
|
+
export declare interface VisSceneManifest {
|
|
1532
|
+
format: typeof SCENE_MANIFEST_FORMAT;
|
|
1533
|
+
schemaVersion: typeof SCENE_MANIFEST_SCHEMA_VERSION;
|
|
1534
|
+
entrySceneId: string;
|
|
1535
|
+
scenes: SceneManifestEntry[];
|
|
1536
|
+
c?: Record<string, any>;
|
|
1537
|
+
d?: Record<string, any>;
|
|
1538
|
+
h?: Record<string, any>;
|
|
1539
|
+
s?: string;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1479
1542
|
export { }
|
|
1480
1543
|
|
|
1481
1544
|
|