vis-core 0.32.8 → 0.33.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.
package/dist/index.d.ts CHANGED
@@ -17,12 +17,15 @@ import { MeshObject } from 'gl-draw';
17
17
  import { MultiPolygon } from 'geojson';
18
18
  import { NodeObject } from 'gl-draw';
19
19
  import { Pencil } from 'gl-draw';
20
+ import { PickFunctionsItem } from 'gl-draw';
20
21
  import { PointLightObject } from 'gl-draw';
21
22
  import { Polygon } from 'geojson';
22
23
  import { Position } from 'geojson';
23
24
  import { ProjectionOptions } from 'gl-draw';
24
25
  import { RectAreaLightObject } from 'gl-draw';
26
+ import { RestoreBaseObjectOptions } from 'gl-draw';
25
27
  import { RoomEnvironment } from 'three/examples/jsm/environments/RoomEnvironment.js';
28
+ import { SceneSnapshot } from 'gl-draw';
26
29
  import { SpotLightObject } from 'gl-draw';
27
30
  import { SpriteObject } from 'gl-draw';
28
31
  import * as THREE from 'three';
@@ -37,6 +40,7 @@ declare class AmbientLight extends AmbientLightObject {
37
40
  export declare namespace animationUtils {
38
41
  export {
39
42
  timeOut,
43
+ TweenOptions,
40
44
  sinusoidalInOut,
41
45
  baseObjectFadeIn,
42
46
  baseObjectFadeOut,
@@ -47,22 +51,21 @@ export declare namespace animationUtils {
47
51
 
48
52
  declare class Arc extends LineObject {
49
53
  objectType: string;
50
- options: Options;
51
- constructor(options: Options);
54
+ options: Options_5;
55
+ constructor(options: Options_5);
52
56
  create(): Promise<void>;
53
- line: {
54
- options: {
55
- nodes: THREE.Vector3[];
56
- };
57
- };
58
57
  getCurve(): THREE.CubicBezierCurve3;
59
58
  setControlPoints(points: [THREE.Vector3, THREE.Vector3, THREE.Vector3, THREE.Vector3]): void;
60
59
  setPath(from: THREE.Vector3 | number[], to: THREE.Vector3 | number[], radius: number, setPointWidth?: (p: number) => number): void;
60
+ private updatePickTargetGeometry;
61
61
  pickTube: Tube | null;
62
62
  private pickTargetVersion;
63
+ private pickBindings;
63
64
  addPickTarget(radius?: number, show?: boolean): Promise<Tube | undefined>;
65
+ /** Restored picking children are adopted instead of allocating a duplicate tube. */
66
+ rebuildFromScene(): Promise<void>;
64
67
  dispose(): void;
65
- onPointerEvent(...args: Parameters<BaseObject['onPointerEvent']>): void;
68
+ protected createPointerBinding(type: PickFunctionsItem['type'], cb: PickFunctionsItem['cb']): () => void;
66
69
  setColor(color: string): void;
67
70
  animateIn({ duration, delay, repeat, onComplete, onRepeat, }?: {
68
71
  duration?: number;
@@ -83,6 +86,9 @@ declare class Area extends GroupObject {
83
86
  rebuildFromScene(): void;
84
87
  }
85
88
 
89
+ /** Validation is read-only and does not materialize or allocate runtime resources. */
90
+ export declare function assertProjectMaterials(document: Pick<VisSceneDocument, 'schemaVersion' | 'scenes' | 'materialLibrary' | 'prefabLibrary'>): void;
91
+
86
92
  /** vis-core 的运行时入口只接受编辑平台导出的完整场景文档。 */
87
93
  export declare function assertRuntimeSceneDocument(value: unknown): asserts value is VisSceneDocument & Record<string, any>;
88
94
 
@@ -98,23 +104,35 @@ declare class Base_2 extends Camera {
98
104
  observeParentScale: boolean;
99
105
  applyDisabledMouseButtons: boolean;
100
106
  cacheCityGeometry: boolean;
107
+ includePrefabPreviews: boolean;
101
108
  };
102
109
  leftTruck: boolean;
103
110
  options: BaseOptions;
104
111
  showState: boolean;
105
- settings: Record<string, any>;
106
112
  lead: Lead;
107
- mList: default_2['mList'];
113
+ sceneResources: default_2['sceneResources'];
108
114
  tier0: boolean;
109
115
  pmremGenerator: THREE.PMREMGenerator | null;
110
116
  re: RoomEnvironment | null;
111
117
  roomEnvMap?: THREE.Texture;
112
118
  private roomEnvTarget?;
119
+ private roomEnvLease?;
113
120
  visName: string;
114
121
  private detectRes?;
115
122
  private ownsPencil;
116
123
  publicDir: Record<string, string>;
124
+ private prefabAssets;
125
+ private prefabMaterials;
126
+ private prefabOperations;
127
+ /** Inspect SDK-enabled definitions without creating scene objects or resources. */
128
+ getPrefabLibrary(): PrefabAsset[];
129
+ /* Excluded from this release type: setPrefabLibrary */
130
+ instantiatePrefab(keyOrAssetId: string, options?: InstantiatePrefabOptions): Promise<BaseObject>;
131
+ private cancelPrefabOperations;
117
132
  constructor(options: BaseOptions);
133
+ getMaterialGroup(group: string): Record<string, THREE.Material<THREE.MaterialEventMap>> | null;
134
+ registerMaterialGroup(group: string, materials: Record<string, THREE.Material | null>): void;
135
+ copyMaterialGroup(source: string, target: string): Record<string, THREE.Material<THREE.MaterialEventMap>>;
118
136
  private getDetectRes;
119
137
  private getQueryOverrides;
120
138
  private getEffectiveLogarithmicDepthBuffer;
@@ -126,6 +144,8 @@ declare class Base_2 extends Camera {
126
144
  /* Excluded from this release type: fromJSON */
127
145
  private runtimeInitialization?;
128
146
  private disposed;
147
+ private readonly handleObjectIdentityChanged;
148
+ private readonly handleMaterialIdentityChanged;
129
149
  /* Excluded from this release type: initializeRuntime */
130
150
  /** 子类扩展点:运行环境只初始化一次,适合建立投影和绑定控制器事件。 */
131
151
  protected onRuntimeReady(): Promise<void>;
@@ -135,8 +155,8 @@ declare class Base_2 extends Camera {
135
155
  protected onDispose(): void;
136
156
  protected get objectTypes(): Record<string, any>;
137
157
  protected get defaultCameraUp(): THREE.Vector3;
138
- private observeScale;
139
158
  private createRuntime;
159
+ private reportScriptError;
140
160
  private sceneActive;
141
161
  setSceneActive(): void;
142
162
  /**
@@ -154,18 +174,30 @@ declare class Base_2 extends Camera {
154
174
  /** 场景页提交后的默认入场动画;地图可覆盖为更有空间感的过渡。 */
155
175
  playEnterTransition({ duration, onPrepared, }: SceneEnterTransitionOptions): Promise<void>;
156
176
  addCSS3DRenderer(container?: HTMLElement): void;
157
- initSettingsObj?: Record<string, any>;
158
- mouseButtonsActiveStore: Record<string, any> | null;
159
- private initSettings;
160
- handleSetting(key: string, value: any): void;
177
+ private controlsInitialized;
178
+ private temporaryControls;
179
+ /** A copy of the authored configuration; temporary input locks are not persisted. */
180
+ getControls(): Readonly<SceneControlsOptions>;
181
+ setControls(patch: SceneControlsOptions): void;
182
+ /** Overrides compose in acquisition order and can be released in any order. */
183
+ setTemporaryControls(patch: SceneControlsOptions): () => void;
184
+ private validateControls;
185
+ private initializeControls;
186
+ protected applyControls(): void;
187
+ protected applyControlOptions(controls: SceneControlsOptions): void;
161
188
  protected prepareInitialCamera(): Promise<void>;
189
+ private restoreCameraControlTarget;
162
190
  private showing?;
191
+ private sceneTemporarilyHidden;
192
+ private authoredSceneVisible;
193
+ private hideSceneContent;
194
+ private showSceneContent;
163
195
  show(): Promise<void>;
164
196
  hide(): void;
165
- exportScene(): THREE.Object3DJSON;
166
- exportBaseObject(baseObject: BaseObject): THREE.Object3DJSON;
167
- restoreBaseObject(data: string | THREE.Object3DJSON, target?: BaseObject, objectsMap?: Record<string, any>, signal?: AbortSignal): Promise<BaseObject<THREE.Object3D<THREE.Object3DEventMap>>>;
168
- restoreScene(str: string | THREE.Object3DJSON, objectsMap?: Record<string, any>): Promise<void>;
197
+ exportScene(): SceneSnapshot;
198
+ exportBaseObject(baseObject: BaseObject): SceneSnapshot;
199
+ restoreBaseObject(data: string | THREE.Object3DJSON, target?: BaseObject, objectsMap?: Record<string, any>, signal?: AbortSignal, options?: RestoreBaseObjectOptions): Promise<BaseObject<THREE.Object3D<THREE.Object3DEventMap>>>;
200
+ restoreScene(str: string | THREE.Object3DJSON, objectsMap?: Record<string, any>, restoreOptions?: RestoreBaseObjectOptions): Promise<void>;
169
201
  getClassRefByType(type: string): typeof BaseObject;
170
202
  addGroup(): Promise< GroupObject>;
171
203
  addCSS2D(dom: HTMLElement, options?: {
@@ -188,10 +220,9 @@ declare class Base_2 extends Camera {
188
220
  uuidByObject(object: THREE.Object3D): string | undefined;
189
221
  objectByUuid(key: string): THREE.Object3D<THREE.Object3DEventMap>;
190
222
  uuidByBaseObject(object: BaseObject): string;
191
- baseObjectByUuid(key: `arc${string}`): Arc;
192
- baseObjectByUuid(key: `sprite${string}`): Sprite;
193
- baseObjectByUuid(key: string): BaseObject;
194
- private normalizeBaseObjectKey;
223
+ baseObjectByUuid(uuid: string): BaseObject;
224
+ /** Compatibility method name; key is the persisted UUID. */
225
+ baseObjectByKey(key: string): BaseObject;
195
226
  baseObjectByName(name: string): BaseObject<THREE.Object3D<THREE.Object3DEventMap>> | undefined;
196
227
  dispose(): void;
197
228
  }
@@ -202,7 +233,7 @@ declare const baseObjectBounce: (obj: BaseObject, up: string | undefined, to: nu
202
233
  repeat?: number | undefined;
203
234
  repeatResolve?: number | undefined;
204
235
  repeatDelay?: number | undefined;
205
- }) => Promise<any>;
236
+ }) => Promise<void>;
206
237
  stop: () => void;
207
238
  };
208
239
 
@@ -212,7 +243,7 @@ declare const baseObjectBounceIn: (obj: BaseObject, up?: string) => {
212
243
  repeat?: number | undefined;
213
244
  repeatResolve?: number | undefined;
214
245
  repeatDelay?: number | undefined;
215
- }) => Promise<any>;
246
+ }) => Promise<void>;
216
247
  stop: () => void;
217
248
  };
218
249
 
@@ -222,7 +253,7 @@ declare const baseObjectFadeIn: (obj: BaseObject) => {
222
253
  repeat?: number | undefined;
223
254
  repeatResolve?: number | undefined;
224
255
  repeatDelay?: number | undefined;
225
- }) => Promise<any>;
256
+ }) => Promise<void>;
226
257
  stop: () => void;
227
258
  };
228
259
 
@@ -232,7 +263,7 @@ declare const baseObjectFadeOut: (obj: BaseObject) => {
232
263
  repeat?: number | undefined;
233
264
  repeatResolve?: number | undefined;
234
265
  repeatDelay?: number | undefined;
235
- }) => Promise<any>;
266
+ }) => Promise<void>;
236
267
  stop: () => void;
237
268
  };
238
269
 
@@ -248,11 +279,25 @@ declare interface BaseOptions {
248
279
  tier?: number;
249
280
  observeParentScale?: boolean;
250
281
  createIfNeeded?: boolean;
282
+ materialBindings?: MaterialBindings;
251
283
  /** 相机输入与场景运行控制,由平台随场景参数导出。 */
252
284
  controls?: SceneControlsOptions;
253
285
  [key: string]: any;
254
286
  }
255
287
 
288
+ export declare function bindMaterialAsset<T extends VisSceneDocument>(document: T, options: BindMaterialAssetOptions): T;
289
+
290
+ export declare interface BindMaterialAssetOptions {
291
+ sceneId: string;
292
+ assetId: string;
293
+ /** Scene graph UUID or the managed object's _baseObjectUuid. */
294
+ objectId?: string;
295
+ /** A multi-material slot, defaulting to 0. */
296
+ slot?: number;
297
+ /** Optional semantic lookup role; the catalog entry uses the material UUID. */
298
+ alias?: string;
299
+ }
300
+
256
301
  declare class Box extends MeshObject {
257
302
  objectType: string;
258
303
  create(): void;
@@ -264,6 +309,7 @@ declare class Building extends GroupObject {
264
309
  constructor(options: Options_9);
265
310
  create(): Promise<void>;
266
311
  rebuildFromScene(): void;
312
+ private gradientMaterials;
267
313
  worldPositionZ: {
268
314
  value: number;
269
315
  };
@@ -311,12 +357,22 @@ declare class City {
311
357
  road: Road;
312
358
  pencil: Pencil;
313
359
  lead: Pencil['lead'];
314
- mList: Pencil['mList'];
360
+ sceneResources: Pencil['sceneResources'];
315
361
  constructor(pencil: Pencil);
316
362
  setOptions(options: CityOptions): void;
317
363
  multiplyScalar: number;
318
364
  private getProjectionOptions;
319
365
  fixNearFar(n?: number, f?: number): void;
366
+ /** Load and validate only; prefetching must never mutate shared Lead state. */
367
+ preloadResources(): Promise<{
368
+ sources: {
369
+ building: string | undefined;
370
+ road: string | undefined;
371
+ river: string | undefined;
372
+ grassland: string | undefined;
373
+ };
374
+ data: Partial<Record<"building" | "road" | "river" | "grassland", any>>;
375
+ }>;
320
376
  init(existingGroup?: GroupObject): Promise<void>;
321
377
  drawCityPlane(adcode: number, target?: BaseObject): Promise<void>;
322
378
  drawBuilding(options?: {
@@ -341,6 +397,7 @@ declare class City {
341
397
  }
342
398
 
343
399
  declare interface CityOptions {
400
+ materialBindings?: MaterialBindings;
344
401
  adcode: number;
345
402
  jsonName: string;
346
403
  cacheKey?: string;
@@ -375,6 +432,13 @@ declare class CityPlane extends MeshObject {
375
432
  dispose(): void;
376
433
  }
377
434
 
435
+ /** Duplicate scene-owned definitions, while retaining references to project assets. */
436
+ export declare function cloneSceneMaterials(document: VisSceneDocument, sourceId: string, newSceneId: string): {
437
+ scene: SceneViewportDocument;
438
+ materialLibrary: MaterialAsset[];
439
+ idMap: Map<string, string>;
440
+ };
441
+
378
442
  /** Rebind internal targets while preserving links to scenes outside the copied set. */
379
443
  export declare function cloneSceneWithIds(scene: SceneViewportDocument, ids: Map<string, string>): SceneViewportDocument;
380
444
 
@@ -391,12 +455,45 @@ declare class ContinentsBg extends GroupObject {
391
455
  dispose(): void;
392
456
  }
393
457
 
458
+ /** Explicit creation persists even with no aliases or object users. */
459
+ export declare function createMaterialAsset<T extends VisSceneDocument>(document: T, options: CreateMaterialAssetOptions): T;
460
+
461
+ export declare interface CreateMaterialAssetOptions {
462
+ id: string;
463
+ name: string;
464
+ material: Record<string, any>;
465
+ scope?: MaterialScope;
466
+ locked?: boolean;
467
+ }
468
+
469
+ /**
470
+ * Share resource indices for one synchronous extraction batch. The scene's
471
+ * resource tables must remain unchanged until the batch finishes. Each result
472
+ * owns independent copies of its material and dependencies.
473
+ */
474
+ export declare function createMaterialDefinitionExtractor(scene: SceneViewportDocument): (materialUuid: string) => Record<string, any>;
475
+
476
+ /** Runtime delivery boundary shared by single-file, split and IndexedDB exports. */
477
+ export declare function createRuntimeSceneDocument(document: VisSceneDocument): VisSceneDocument;
478
+
479
+ /** Convert authored asset aliases to the native catalog expected by graph restoration. */
480
+ export declare function createRuntimeSceneGraph(scene: SceneViewportDocument, options?: {
481
+ omitPrefabPreviews?: boolean;
482
+ }): Record<string, any>;
483
+
394
484
  declare class DirectionalLight extends DirectionalLightObject {
395
485
  constructor(...options: ConstructorParameters<typeof DirectionalLightObject>);
396
486
  update(delta: number, elapsed: number): void;
397
487
  render(): void;
398
488
  }
399
489
 
490
+ /** One-click copy and apply; preserve the source's user-visible scope. */
491
+ export declare function duplicateMaterialForObject<T extends VisSceneDocument>(document: T, options: Omit<BindMaterialAssetOptions, 'alias'> & {
492
+ objectId: string;
493
+ newAssetId: string;
494
+ name?: string;
495
+ }): T;
496
+
400
497
  export declare type Earth = Earth_2;
401
498
 
402
499
  declare class Earth_2 extends Base_2 {
@@ -408,7 +505,7 @@ declare class Earth_2 extends Base_2 {
408
505
  secondaryMap?: PlaneMap;
409
506
  get mapArea(): ExtrudePolygonObject[];
410
507
  setOptions(options: EarthOptions): void;
411
- handleSetting(key: string, value: any): void;
508
+ protected applyControlOptions(controls: SceneControlsOptions): void;
412
509
  protected get objectTypes(): {
413
510
  Earth: Earth_3;
414
511
  SphereShadow: SphereShadow;
@@ -437,6 +534,7 @@ declare class Earth_2 extends Base_2 {
437
534
  Group: GroupObject;
438
535
  };
439
536
  private rotationControls?;
537
+ private releaseRotationLock?;
440
538
  private readonly stopAutoRotate;
441
539
  private readonly resumeAutoRotate;
442
540
  protected onRuntimeReady(): Promise<void>;
@@ -458,8 +556,8 @@ declare class Earth_2 extends Base_2 {
458
556
 
459
557
  declare class Earth_3 extends Sphere {
460
558
  objectType: string;
461
- options: Required<Options_4>;
462
- constructor(options: Options_4);
559
+ options: Required<Options_2>;
560
+ constructor(options: Options_2);
463
561
  create(): void;
464
562
  rebuildFromScene(): void;
465
563
  }
@@ -495,6 +593,9 @@ declare class Event_2 {
495
593
  /** Expand at the editor import boundary so independently edited scenes own their data. */
496
594
  export declare function expandSceneDocumentResources<T extends VisSceneDocument>(document: T): T;
497
595
 
596
+ /** Extract only this material's dependencies, without mutating the scene snapshot. */
597
+ export declare function extractMaterialDefinition(scene: SceneViewportDocument, materialUuid: string): Record<string, any>;
598
+
498
599
  declare const findAdcodeInfo: (adcode: number) => {
499
600
  adcode: number;
500
601
  lng: number;
@@ -512,6 +613,15 @@ declare type GeoJSON_3 = FeatureCollection<Polygon | MultiPolygon>;
512
613
 
513
614
  declare type GeoJSON_4 = FeatureCollection<Polygon | MultiPolygon>;
514
615
 
616
+ /** Saved configuration dependencies protect definitions, without representing live usage. */
617
+ export declare function getMaterialDependencies(document: Pick<VisSceneDocument, 'scenes'>, assetId?: string): MaterialUsage[];
618
+
619
+ /** Includes unloaded scene snapshots, aliases, and every multi-material slot. */
620
+ export declare function getMaterialUsages(document: Pick<VisSceneDocument, 'scenes'>, assetId?: string): MaterialUsage[];
621
+
622
+ /** Templates remain dependencies even when every scene instance has been removed. */
623
+ export declare function getPrefabMaterialDependencies(document: Pick<VisSceneDocument, 'prefabLibrary'>, assetId: string): PrefabAsset[];
624
+
515
625
  export declare function getSceneDocument(document: VisSceneDocument, sceneId?: string, options?: {
516
626
  resolveResources?: boolean;
517
627
  }): SceneViewportDocument;
@@ -519,6 +629,13 @@ export declare function getSceneDocument(document: VisSceneDocument, sceneId?: s
519
629
  declare class HemisphereLight extends HemisphereLightObject {
520
630
  }
521
631
 
632
+ export declare interface InstantiatePrefabOptions {
633
+ /** Parent in the destination scene. Defaults to the scene root. */
634
+ target?: BaseObject;
635
+ /** Defaults to true so business style changes cannot edit another instance. */
636
+ cloneMaterial?: boolean;
637
+ }
638
+
522
639
  /**
523
640
  * 新场景文档以完整场景快照作为恢复基线。
524
641
  * 未带标记的 JSON 属于旧格式,仍由编辑器的兼容流程处理。
@@ -527,6 +644,9 @@ export declare function isSceneDocument(value: unknown): value is SceneDocumentM
527
644
 
528
645
  export declare function isSceneManifest(value: unknown): value is VisSceneManifest;
529
646
 
647
+ /** Copy once and redirect every user in this scene, including its SceneResources aliases. */
648
+ export declare function makeMaterialSceneLocal<T extends VisSceneDocument>(document: T, assetId: string, sceneId: string, newAssetId: string): T;
649
+
530
650
  declare type Map_2 = Map_3;
531
651
  export { Map_2 as Map }
532
652
 
@@ -614,6 +734,10 @@ declare class Map_3 extends Base_2 {
614
734
  protected prepareInitialCamera(): Promise<void>;
615
735
  private updateMapBoundary;
616
736
  /* Excluded from this release type: finalizeRegionGeometry */
737
+ private prepareCityVis;
738
+ private preloadCityVis;
739
+ /** Keep at most two cities ahead in the loader; all Lead writes stay ordered. */
740
+ private initCitySequence;
617
741
  initCityVis(adcode: number, grey?: boolean): Promise<City>;
618
742
  initCityOnMap(adcode: number): Promise<void>;
619
743
  private _getParentBgMetrics;
@@ -715,12 +839,15 @@ declare class Map_3 extends Base_2 {
715
839
  */
716
840
  private applyOverlayLayers;
717
841
  /**
718
- * 根据 switchFixConfig 对场景中的对象做位置/缩放修复
842
+ * Apply the region behavior authored on each object.
719
843
  */
720
- private applySwitchFixConfig;
844
+ private applyRegionObjectState;
721
845
  /* Excluded from this release type: rebuildRegion */
846
+ private rebuildRegionGeometry;
722
847
  /** 候选区域提交后的相机过渡,不参与场景序列化。 */
723
848
  playRegionEnterTransition({ duration, sourceCamera, onPrepared, }: MapRegionEnterTransitionOptions): Promise<void>;
849
+ /** Region rules are page-local runtime overrides of a saved material asset. */
850
+ private regionRuleMaterial;
724
851
  private setRegionTexture;
725
852
  applyRegionTextureRules(adcode: number): Promise<void>;
726
853
  protected onDispose(): void;
@@ -782,8 +909,6 @@ declare interface MapOptions extends BaseOptions {
782
909
  lineOffset?: number;
783
910
  extrudeLineWidth?: number;
784
911
  extrudeLine?: boolean;
785
- equirectangular?: boolean;
786
- winkel3?: boolean;
787
912
  projectionType?: 'mercator' | 'equirectangular' | 'winkel3';
788
913
  polarAngle?: number;
789
914
  azimuthAngle?: number;
@@ -799,7 +924,6 @@ declare interface MapOptions extends BaseOptions {
799
924
  geojsonMapReplace?: Record<string, GeoJSON_3 | string | number>;
800
925
  extrudeLineGeojsonMapReplace?: Record<string, GeoJSON_3 | string | number>;
801
926
  shadowMap?: boolean;
802
- switchFixConfig?: SwitchFixConfig;
803
927
  /** switchMapRegion 后按场景声明替换区域相关纹理。 */
804
928
  regionTextureRules?: RegionTextureRule[];
805
929
  /** 动态地图、城市数据和水面纹理的资源地址模板。 */
@@ -848,7 +972,7 @@ export declare interface MapSafeAreaOptions {
848
972
  smoothTime?: number;
849
973
  }
850
974
 
851
- /** 平台导出的运行时对象绑定,使用 Lead 的完整 key,不依赖命名规则。 */
975
+ /** 平台导出的运行时对象绑定,直接引用 Object3D.uuid。 */
852
976
  declare interface MapSceneBindings {
853
977
  container: string;
854
978
  region: {
@@ -860,6 +984,86 @@ declare interface MapSceneBindings {
860
984
  cities: string[];
861
985
  }
862
986
 
987
+ export declare const MATERIAL_ASSET_ID = "_materialAssetId";
988
+
989
+ export declare const MATERIAL_ASSET_REVISION = "_materialAssetRevision";
990
+
991
+ export declare const MATERIAL_RUNTIME_PROPERTIES = "_materialRuntimeProperties";
992
+
993
+ /** Retained catalog entries are keyed by the native scene material UUID. */
994
+ export declare interface MaterialAlias {
995
+ assetId: string;
996
+ locked?: boolean;
997
+ }
998
+
999
+ export declare interface MaterialAsset {
1000
+ id: string;
1001
+ revision: number;
1002
+ scope: MaterialScope;
1003
+ name: string;
1004
+ /** A complete Material.toJSON() value, including texture and image dependencies. */
1005
+ material: Record<string, any>;
1006
+ locked?: boolean;
1007
+ }
1008
+
1009
+ declare type MaterialBindings = Record<string, Record<string, string>>;
1010
+
1011
+ /** A declared scalar edit; revisions are commit metadata rather than editable properties. */
1012
+ export declare interface MaterialDefinitionScope {
1013
+ readonly assetIds: readonly string[];
1014
+ readonly properties: readonly string[];
1015
+ }
1016
+
1017
+ /** One explicit mapping from an asset's authored resource UUIDs to runtime resource UUIDs. */
1018
+ export declare function materializeAssetDefinition(asset: MaterialAsset, materialUuid?: string): Record<string, any>;
1019
+
1020
+ /** Mutate a detached working snapshot owned exclusively by the caller. */
1021
+ export declare function materializeOwnedSceneMaterials<T extends SceneViewportDocument>(scene: T, library?: MaterialAsset[]): T;
1022
+
1023
+ export declare function materializeProjectMaterials<T extends VisSceneDocument>(document: T): T;
1024
+
1025
+ /**
1026
+ * Scoped scalar history for already normalized snapshots. Unchanged object,
1027
+ * geometry and texture tables are borrowed; callers must keep snapshots immutable.
1028
+ * Structural/texture changes must use the full materialization entrypoint.
1029
+ */
1030
+ export declare function materializeSceneMaterialDefinitions<T extends SceneViewportDocument>(scenes: readonly T[], previousAssets: MaterialAsset[], nextAssets: MaterialAsset[], scope?: MaterialDefinitionScope): T[];
1031
+
1032
+ /** Inject authoritative definitions while keeping each scene's material UUIDs stable. */
1033
+ export declare function materializeSceneMaterials<T extends SceneViewportDocument>(scene: T, library?: MaterialAsset[]): T;
1034
+
1035
+ /** One validation context per batch; never cached across caller mutations. */
1036
+ export declare function materializeSceneMaterialsBatch<T extends SceneViewportDocument>(scenes: readonly T[], library?: MaterialAsset[]): T[];
1037
+
1038
+ /** Serializable project data. This deliberately contains no THREE instances or GPU ownership. */
1039
+ export declare type MaterialScope = {
1040
+ kind: 'project';
1041
+ } | {
1042
+ kind: 'scene';
1043
+ sceneId: string;
1044
+ };
1045
+
1046
+ export declare interface MaterialUsage {
1047
+ assetId: string;
1048
+ sceneId: string;
1049
+ objectId: string;
1050
+ slot: number;
1051
+ /** Constructor input rather than a native mesh material slot. */
1052
+ optionPath?: string[];
1053
+ alias?: string;
1054
+ }
1055
+
1056
+ /** Save author edits without promoting page-local region textures into a shared definition. */
1057
+ export declare function mergeAuthoredMaterialDefinition(savedDefinition: Record<string, any>, runtimeDefinition: Record<string, any>, options?: {
1058
+ editedProperties?: string[];
1059
+ }): Record<string, any>;
1060
+
1061
+ export declare function mergeProjectMaterials(target: VisSceneDocument, incoming: VisSceneDocument): {
1062
+ document: VisSceneDocument;
1063
+ materialLibrary: MaterialAsset[];
1064
+ idMap: Map<string, string>;
1065
+ };
1066
+
863
1067
  declare class Model extends GroupObject {
864
1068
  options: Options_7;
865
1069
  mixer: THREE.AnimationMixer | null;
@@ -940,16 +1144,45 @@ declare class Mountain extends GroupObject {
940
1144
  rebuildFromScene(): void;
941
1145
  }
942
1146
 
943
- declare interface Options extends NonNullable<ConstructorParameters<typeof LineObject>[0]> {
944
- from: number[];
945
- to: number[];
946
- control1?: number[];
947
- control2?: number[];
948
- radius?: number;
949
- globe?: boolean;
950
- color?: string;
951
- lineWidth?: number;
952
- offsetLoop?: boolean;
1147
+ /** Bind serialized runtime materials and alias catalogs to authored assets. */
1148
+ export declare function normalizeProjectMaterials<T extends VisSceneDocument>(document: T): T;
1149
+
1150
+ declare interface Options {
1151
+ /** @deprecated Legacy generation scope, read only when importing old snapshots. */
1152
+ uuid?: string;
1153
+ areaGroup?: boolean;
1154
+ geojson: GeoJSON_2;
1155
+ projection?: {
1156
+ center: [number, number];
1157
+ scale: number;
1158
+ rotate?: [number, number];
1159
+ projectionType?: 'mercator' | 'equirectangular' | 'winkel3';
1160
+ };
1161
+ extrudeLineGeojson?: GeoJSON_2;
1162
+ hasSide?: boolean;
1163
+ hasTop?: boolean;
1164
+ hasLine?: boolean;
1165
+ start?: number;
1166
+ depth?: number;
1167
+ lineOffset?: number;
1168
+ bbox?: number[];
1169
+ topSegments?: number;
1170
+ conic?: boolean;
1171
+ castShadow?: boolean;
1172
+ mergeSide?: boolean;
1173
+ hasExtrudeLine?: boolean;
1174
+ materialOptions: {
1175
+ topMat: THREE.Material;
1176
+ sideMat?: THREE.Material;
1177
+ lineMat?: MeshLineMaterial;
1178
+ extrudeLineMat?: MeshLineMaterial;
1179
+ bgTopMat?: THREE.Material;
1180
+ bgSideMat?: THREE.Material;
1181
+ bgLineMat?: MeshLineMaterial;
1182
+ bgExtrudeLineMat?: MeshLineMaterial;
1183
+ };
1184
+ onTop?: number;
1185
+ bloom?: boolean;
953
1186
  }
954
1187
 
955
1188
  declare interface Options_10 {
@@ -962,6 +1195,7 @@ declare interface Options_10 {
962
1195
  cacheKey?: string;
963
1196
  meters?: number;
964
1197
  grey?: boolean;
1198
+ material?: MeshLineMaterial;
965
1199
  }
966
1200
 
967
1201
  declare interface Options_11 {
@@ -998,59 +1232,36 @@ declare interface Options_13 {
998
1232
  }
999
1233
 
1000
1234
  declare interface Options_2 {
1001
- path?: THREE.Curve<THREE.Vector3>;
1002
1235
  radius?: number;
1003
- multiplyScalar?: number;
1236
+ rotationY?: number;
1004
1237
  }
1005
1238
 
1006
1239
  declare interface Options_3 {
1007
- uuid?: string;
1008
- areaGroup?: boolean;
1009
- geojson: GeoJSON_2;
1010
- projection?: {
1011
- center: [number, number];
1012
- scale: number;
1013
- rotate?: [number, number];
1014
- projectionType?: 'mercator' | 'equirectangular' | 'winkel3';
1015
- };
1016
- extrudeLineGeojson?: GeoJSON_2;
1017
- hasSide?: boolean;
1018
- hasTop?: boolean;
1019
- hasLine?: boolean;
1020
- start?: number;
1021
- depth?: number;
1022
- lineOffset?: number;
1023
- bbox?: number[];
1024
- topSegments?: number;
1025
- conic?: boolean;
1026
- castShadow?: boolean;
1027
- mergeSide?: boolean;
1028
- hasExtrudeLine?: boolean;
1029
- materialOptions: {
1030
- topMat: THREE.Material;
1031
- sideMat?: THREE.Material;
1032
- lineMat?: MeshLineMaterial;
1033
- extrudeLineMat?: MeshLineMaterial;
1034
- bgTopMat?: THREE.Material;
1035
- bgSideMat?: THREE.Material;
1036
- bgLineMat?: MeshLineMaterial;
1037
- bgExtrudeLineMat?: MeshLineMaterial;
1038
- };
1039
- onTop?: number;
1040
- bloom?: boolean;
1240
+ radius?: number;
1041
1241
  }
1042
1242
 
1043
1243
  declare interface Options_4 {
1044
- radius?: number;
1045
- rotationY?: number;
1244
+ sprite?: boolean;
1046
1245
  }
1047
1246
 
1048
- declare interface Options_5 {
1247
+ declare interface Options_5 extends NonNullable<ConstructorParameters<typeof LineObject>[0]> {
1248
+ from: number[];
1249
+ to: number[];
1250
+ control1?: number[];
1251
+ control2?: number[];
1049
1252
  radius?: number;
1253
+ globe?: boolean;
1254
+ color?: string;
1255
+ lineWidth?: number;
1256
+ offsetLoop?: boolean;
1050
1257
  }
1051
1258
 
1052
1259
  declare interface Options_6 {
1053
- sprite?: boolean;
1260
+ path?: THREE.Curve<THREE.Vector3>;
1261
+ radius?: number;
1262
+ multiplyScalar?: number;
1263
+ /** Compact saved inputs for an Arc's derived picking geometry. */
1264
+ arcControlPoints?: number[][];
1054
1265
  }
1055
1266
 
1056
1267
  declare interface Options_7 {
@@ -1062,6 +1273,11 @@ declare interface Options_7 {
1062
1273
  }
1063
1274
 
1064
1275
  declare interface Options_8 {
1276
+ materialOptions: {
1277
+ topMat: THREE.Material;
1278
+ sideMat: THREE.Material;
1279
+ lineMat: MeshLineMaterial;
1280
+ };
1065
1281
  scale: number;
1066
1282
  depth: number;
1067
1283
  assetsPrefix?: string;
@@ -1081,11 +1297,17 @@ declare interface Options_9 {
1081
1297
  hasSide?: boolean;
1082
1298
  sideGradient?: boolean;
1083
1299
  grey?: boolean;
1300
+ materialOptions?: Record<string, THREE.Material>;
1084
1301
  }
1085
1302
 
1086
1303
  /** Pack an export copy only; preserve the editor's independent scene snapshots. */
1087
1304
  export declare function packSceneDocumentResources<T extends VisSceneDocument>(document: T): T;
1088
1305
 
1306
+ export declare function patchSceneStructureDocument(document: VisSceneDocument, sceneId: string, patch: SceneStructurePatch): VisSceneDocument;
1307
+
1308
+ /** Validate every affected scene and both catalogs before exposing any saved state. */
1309
+ export declare function patchSceneStructureTransactionDocument(document: VisSceneDocument, transaction: SceneStructureTransaction): VisSceneDocument;
1310
+
1089
1311
  declare class Plane extends MeshObject {
1090
1312
  objectType: string;
1091
1313
  create(): void;
@@ -1093,7 +1315,7 @@ declare class Plane extends MeshObject {
1093
1315
 
1094
1316
  declare class PlaneMap extends GroupObject {
1095
1317
  objectType: string;
1096
- options: Required<Omit<Options_3, 'bbox' | 'extrudeLineGeojson'>> & Pick<Options_3, 'bbox' | 'extrudeLineGeojson'>;
1318
+ options: Required<Omit<Options, 'bbox' | 'extrudeLineGeojson' | 'uuid'>> & Pick<Options, 'bbox' | 'extrudeLineGeojson' | 'uuid'>;
1097
1319
  isActive: boolean;
1098
1320
  groupArr: GroupObject[];
1099
1321
  areaArr: ExtrudePolygonObject[];
@@ -1101,7 +1323,7 @@ declare class PlaneMap extends GroupObject {
1101
1323
  mergeSideArea: ExtrudePolygonObject | null;
1102
1324
  extrudelineArr?: LineObject[];
1103
1325
  splitPolygons: number;
1104
- constructor(options: Options_3);
1326
+ constructor(options: Options);
1105
1327
  create(): Promise<void>;
1106
1328
  private markGeneratedObjects;
1107
1329
  private ensureExtrudeLineMaterials;
@@ -1124,13 +1346,15 @@ declare class PlaneMap extends GroupObject {
1124
1346
  onTop?: number;
1125
1347
  areaGroup?: boolean;
1126
1348
  }): Promise<LineObject[]>;
1349
+ private shouldUseGeometryWorker;
1127
1350
  getPropertiesKey(properties: Record<string, any>): string;
1128
1351
  geojson2Meta(geojson: GeoJSON_2): {
1129
1352
  coords: Position[][];
1130
1353
  properties: GeoJsonProperties;
1131
1354
  }[];
1132
1355
  update(_delta: number, elapsed: number): void;
1133
- findGroup(adcode: string | number, fix?: boolean): GroupObject | undefined;
1356
+ findGroup(adcode: string | number, _fix?: boolean): GroupObject | undefined;
1357
+ private batchMaterialChanges;
1134
1358
  useAreaMaterial(key: string): void;
1135
1359
  useLineMaterial(key: string): void;
1136
1360
  useExtrudeLineMaterial(key: string): void;
@@ -1141,7 +1365,6 @@ declare class PlaneMap extends GroupObject {
1141
1365
  deactive(): void;
1142
1366
  render(): void;
1143
1367
  rebuildFromScene(): void;
1144
- private clearGeneratedRegionProperties;
1145
1368
  /**
1146
1369
  * 场景快照保存的是网格实际材质,options 中的 Material 会被导出器过滤。
1147
1370
  * 恢复完成后从生成对象反推下一次区域重建所需的运行时材质。
@@ -1159,8 +1382,8 @@ declare class PlaneShadow extends MeshObject {
1159
1382
 
1160
1383
  declare class Point extends BaseObject {
1161
1384
  objectType: string;
1162
- options: Options_6;
1163
- constructor(options: Options_6);
1385
+ options: Options_4;
1386
+ constructor(options: Options_4);
1164
1387
  get material(): THREE.MeshBasicMaterial | THREE.SpriteMaterial;
1165
1388
  getMaterial(): THREE.MeshBasicMaterial | THREE.SpriteMaterial;
1166
1389
  create(): Promise<void>;
@@ -1174,11 +1397,29 @@ declare class PointLight extends PointLightObject {
1174
1397
  render(): void;
1175
1398
  }
1176
1399
 
1400
+ export declare interface PrefabAsset {
1401
+ id: string;
1402
+ name: string;
1403
+ revision: number;
1404
+ /** Stable public SDK identifier. Omit for assets used only by the editor. */
1405
+ sdkKey?: string;
1406
+ snapshot: Record<string, any>;
1407
+ }
1408
+
1409
+ /** An opaque, single-use topology transaction owned by the SceneManager that prepared it. */
1410
+ export declare interface PreparedSceneStructure {
1411
+ readonly [preparedSceneStructure]: true;
1412
+ }
1413
+
1414
+ declare const preparedSceneStructure: unique symbol;
1415
+
1416
+ export declare function promoteMaterialToProject<T extends VisSceneDocument>(document: T, assetId: string): T;
1417
+
1177
1418
  declare class RectAreaLight extends RectAreaLightObject {
1178
1419
  }
1179
1420
 
1180
1421
  declare interface RegionTextureRule {
1181
- /** mList 中的材质 key,例如 plane#topMat。 */
1422
+ /** 材质 UUID,或显式材质角色,例如 plane#topMat。 */
1182
1423
  material: string;
1183
1424
  /** THREE.Material 上的纹理属性,例如 map、emissiveMap。 */
1184
1425
  property: string;
@@ -1196,14 +1437,25 @@ export declare interface RemappedSceneDocument {
1196
1437
  entrySceneId: string;
1197
1438
  scenes: SceneViewportDocument[];
1198
1439
  idMap: Map<string, string>;
1440
+ materialLibrary?: MaterialAsset[];
1441
+ /** Reusable definitions, independent of scene instances. */
1442
+ prefabLibrary?: PrefabAsset[];
1199
1443
  }
1200
1444
 
1445
+ /** A cross-project import remaps identities even if equal JSON happens to collide. */
1446
+ export declare function remapProjectMaterialIds<T extends VisSceneDocument>(document: T, createId: (asset: MaterialAsset, index: number) => string): {
1447
+ document: T;
1448
+ idMap: Map<string, string>;
1449
+ };
1450
+
1201
1451
  /**
1202
1452
  * 复制一组场景并为它们分配新 ID,同时保持文档内部的场景跳转关系。
1203
1453
  * 用于把完整模板追加到另一个场景文档中。
1204
1454
  */
1205
1455
  export declare function remapSceneDocumentIds(document: VisSceneDocument, createSceneId: (scene: SceneViewportDocument, index: number) => string): RemappedSceneDocument;
1206
1456
 
1457
+ export declare function removeProjectMaterial<T extends VisSceneDocument>(document: T, assetId: string): T;
1458
+
1207
1459
  declare class Ring extends MeshObject {
1208
1460
  objectType: string;
1209
1461
  create(): void;
@@ -1220,13 +1472,20 @@ declare class Road extends GroupObject {
1220
1472
  dispose(): void;
1221
1473
  }
1222
1474
 
1475
+ /** Only ordinary encoded images are externalized. Typed pixel data, videos and
1476
+ * custom payloads keep their original serialization contract. */
1477
+ declare interface RuntimeImageAsset {
1478
+ data: Uint8Array;
1479
+ mimeType: string;
1480
+ }
1481
+
1223
1482
  export declare const SCENE_DOCUMENT_FORMAT: "vis-scene";
1224
1483
 
1225
- export declare const SCENE_DOCUMENT_SCHEMA_VERSION: 3;
1484
+ export declare const SCENE_DOCUMENT_SCHEMA_VERSION: 5;
1226
1485
 
1227
1486
  export declare const SCENE_MANIFEST_FORMAT: "vis-scene-manifest";
1228
1487
 
1229
- export declare const SCENE_MANIFEST_SCHEMA_VERSION: 1;
1488
+ export declare const SCENE_MANIFEST_SCHEMA_VERSION: 2;
1230
1489
 
1231
1490
  export declare interface SceneBackInteraction {
1232
1491
  trigger: 'click' | 'clickOutside';
@@ -1237,10 +1496,18 @@ export declare interface SceneBackInteraction {
1237
1496
  };
1238
1497
  }
1239
1498
 
1499
+ /** Scene membership/options delta. Existing authored graphs must use structure patches. */
1500
+ export declare interface SceneCollectionTransaction {
1501
+ scenes: readonly SceneViewportDocument[];
1502
+ entrySceneId: string;
1503
+ materialLibrary?: readonly MaterialAsset[];
1504
+ prefabLibrary?: readonly PrefabAsset[];
1505
+ }
1506
+
1240
1507
  declare interface SceneControlsOptions {
1241
- mouseLeft?: number | boolean;
1242
- mouseRight?: number | boolean;
1243
- mouseWheel?: number | boolean;
1508
+ mouseLeft?: number;
1509
+ mouseRight?: number;
1510
+ mouseWheel?: number;
1244
1511
  mouseNone?: boolean;
1245
1512
  viewportPadding?: [number, number, number, number];
1246
1513
  autoRotateSpeed?: number;
@@ -1257,6 +1524,11 @@ declare interface SceneEnterTransitionOptions {
1257
1524
  onPrepared?: () => void;
1258
1525
  }
1259
1526
 
1527
+ export declare interface SceneInstantiatePrefabOptions extends InstantiatePrefabOptions {
1528
+ /** A scene already loaded by this manager. Defaults to the current scene. */
1529
+ sceneId?: string;
1530
+ }
1531
+
1260
1532
  export declare type SceneInteraction = SceneSwitchInteraction | SceneBackInteraction | MapRegionSwitchInteraction | MapRegionBackInteraction;
1261
1533
 
1262
1534
  export declare interface SceneInteractionFilter {
@@ -1283,11 +1555,22 @@ export declare class SceneManager extends Event_2 {
1283
1555
  private isRegionSwitching;
1284
1556
  private pencil?;
1285
1557
  private safeAreaInsets;
1558
+ private generation;
1559
+ private documentIdentityRevision;
1560
+ private preparedStructures;
1561
+ private pendingInstances;
1562
+ private identityTrackedScenes;
1563
+ private prefabOperations;
1564
+ private transactionCacheDepth;
1565
+ private invalidatePendingOperations;
1566
+ private assertGeneration;
1286
1567
  private debugInteraction;
1287
1568
  private enablePickDebug;
1288
1569
  private disposeInactiveScenes;
1289
1570
  constructor(options: SceneManagerInitOptions);
1290
1571
  private prepareScene;
1572
+ /** Publish one identity remap without exporting runtimes or copying other pages/resources. */
1573
+ remapCommittedIdentity(sceneId: string, previous: string, next: string, objectIdentity: boolean): boolean;
1291
1574
  /**
1292
1575
  * 设置宿主界面的运行时地图安全区。该状态不进入场景文档,并会自动传给
1293
1576
  * 当前地图、缓存地图和后续创建的地图区域。
@@ -1298,12 +1581,57 @@ export declare class SceneManager extends Event_2 {
1298
1581
  private playTransition;
1299
1582
  /** 更新可编辑文档,并释放已经不属于文档的非活动场景实例。 */
1300
1583
  setDocument(document: VisSceneDocument): void;
1584
+ private syncPrefabLibraries;
1585
+ /**
1586
+ * Replace the complete metadata projection for existing scenes without
1587
+ * recopying assets. Omitted interactions remove the field; own undefined is
1588
+ * preserved, so callers editing only names must include the other metadata.
1589
+ */
1590
+ patchDocumentMetadata(patch: {
1591
+ entrySceneId: string;
1592
+ scenes: Pick<SceneViewportDocument, 'id' | 'name' | 'interactions'>[];
1593
+ s?: string;
1594
+ }): void;
1595
+ /** Commit camera/controls state without validating or cloning authored resources. */
1596
+ patchSceneViewport(sceneId: string, patch: SceneViewportPatch): void;
1597
+ /** Apply validated object properties without copying unrelated nodes or resource tables. */
1598
+ patchSceneObjects(sceneId: string, patches: SceneObjectPatch[]): void;
1599
+ /** Native inspector edits keep the validated topology/resource baseline and its UUID index. */
1600
+ patchSceneObjectProperties(sceneId: string, patches: readonly SceneObjectPropertyPatch[]): void;
1601
+ /** Commit a validated topology delta without cloning unrelated saved scenes or resources. */
1602
+ patchSceneStructure(sceneId: string, patch: SceneStructurePatch): void;
1603
+ /** Commit related topology changes across scenes without exposing intermediate revisions. */
1604
+ patchSceneStructureTransaction(transaction: SceneStructureTransaction): void;
1605
+ private requireStructureDocument;
1606
+ /** Own and validate a topology delta before allocating or moving runtime objects. */
1607
+ prepareSceneStructure(sceneId: string, patch: SceneStructurePatch): PreparedSceneStructure;
1608
+ /** Prepare related edits across scenes and shared catalogs as one atomic transaction. */
1609
+ prepareSceneStructureTransaction(transaction: SceneStructureTransaction): PreparedSceneStructure;
1610
+ /** Own only new pages and changed metadata; retain every existing authored graph. */
1611
+ prepareSceneCollectionTransaction(transaction: SceneCollectionTransaction): PreparedSceneStructure;
1612
+ /** A newly hydrated empty Base seed acquires its own camera/default options once. */
1613
+ prepareSceneInitialization(sceneId: string, definition: SceneViewportDocument): PreparedSceneStructure;
1614
+ /** Collection edits keep cached pages until their enclosing history transaction accepts. */
1615
+ activateSceneForTransaction(sceneId: string, hooks?: Record<string, any>, signal?: AbortSignal): Promise<Base_2>;
1616
+ /** Retire exactly the detached page; never invalidate other loaded pages or pending resources. */
1617
+ retireSceneForTransaction(sceneId: string, expected: Base_2): void;
1618
+ private ownPreparedStructure;
1619
+ private requirePreparedStructure;
1620
+ /**
1621
+ * Check the saved sections affected by topology history without handing out
1622
+ * the private candidate. Editor config/dev metadata is outside this delta.
1623
+ */
1624
+ preparedSceneStructureMatches(prepared: PreparedSceneStructure, target: Pick<VisSceneDocument, 'scenes' | 'materialLibrary' | 'prefabLibrary'>): boolean;
1625
+ /** Commit the already validated candidate once, provided its source is still current. */
1626
+ commitSceneStructure(prepared: PreparedSceneStructure): void;
1627
+ /** Commit scalar material history without accepting or copying caller object graphs. */
1628
+ patchMaterialDefinitions(assets: MaterialAsset[], scenes: Pick<SceneViewportDocument, 'id'>[], scope?: MaterialDefinitionScope): void;
1301
1629
  load(documentOrUrl: VisSceneDocument | VisSceneManifest | string, hooks?: Record<string, any>): Promise<Base_2>;
1302
1630
  /**
1303
1631
  * 创建一个没有快照输入的运行时页面,并在可选构建步骤完成后将其导出为
1304
1632
  * 标准单场景文档。主要供编辑器新建和旧模板迁移使用。
1305
1633
  */
1306
- createEmptyScene(definition: EmptySceneDefinition, build?: (scene: Base_2) => void | Promise<void>): Promise<Base_2>;
1634
+ createEmptyScene(definition: EmptySceneDefinition, build?: (scene: Base_2) => void | Promise<void>, materialLibrary?: MaterialAsset[]): Promise<Base_2>;
1307
1635
  /**
1308
1636
  * 以指定地图模板和行政区直接启动,不先加载文档配置的入口场景。
1309
1637
  * 适用于宿主按路由或业务参数决定初始省、市、区的场景。
@@ -1313,6 +1641,7 @@ export declare class SceneManager extends Event_2 {
1313
1641
  private loadDocument;
1314
1642
  private getSceneMetadata;
1315
1643
  private resolveManifestSource;
1644
+ private resolveBundleImages;
1316
1645
  private loadSceneDefinition;
1317
1646
  private createRuntimeSceneDocument;
1318
1647
  switchScene(sceneId: string, options?: SwitchSceneOptions, hooks?: Record<string, any>): Promise<Base_2 | null>;
@@ -1344,10 +1673,25 @@ export declare class SceneManager extends Event_2 {
1344
1673
  getSceneByName<T extends SceneType>(name: string, type: T): SceneTypeMap[T] | undefined;
1345
1674
  getSceneByName(name: string): Base_2 | undefined;
1346
1675
  private getSceneByType;
1676
+ /** Inspect saved definitions without creating or pinning runtime materials. */
1677
+ getMaterialLibrary(): MaterialAsset[];
1678
+ /** SDK-enabled definitions stay unloaded until explicitly instantiated. */
1679
+ getPrefabLibrary(): PrefabAsset[];
1680
+ instantiatePrefab(keyOrAssetId: string, options?: SceneInstantiatePrefabOptions): Promise< BaseObject>;
1681
+ /**
1682
+ * Update a saved asset and transactionally rebuild each affected cached page.
1683
+ * Reacquire Base/Object handles after this call: replaced pages are disposed.
1684
+ * Current runtime geometry, options, active page and camera are preserved.
1685
+ */
1686
+ updateMaterial(assetId: string, patch: Partial<Pick<MaterialAsset, 'name' | 'material' | 'locked'>>): Promise<Base_2 | null>;
1687
+ /** Immutable borrowed snapshot for coordinated COW editing; write through patch APIs. */
1688
+ getDocumentSnapshot(): Readonly<VisSceneDocument> | undefined;
1347
1689
  getDocument(): VisSceneDocument | undefined;
1348
1690
  getManifest(): VisSceneManifest | undefined;
1349
1691
  private bindSceneInteractions;
1350
1692
  canBack(): boolean;
1693
+ /** Release a cached/active page while retaining its document and saved material definitions. */
1694
+ unloadScene(sceneId: string): boolean;
1351
1695
  private disposeInstances;
1352
1696
  dispose(): void;
1353
1697
  }
@@ -1381,6 +1725,105 @@ export declare interface SceneManifestEntry extends Omit<SceneViewportDocument,
1381
1725
  bytes?: number;
1382
1726
  }
1383
1727
 
1728
+ /** Dependency closure for a selected scene; preserve unused aliases as document uses. */
1729
+ export declare function sceneMaterialLibrary(scene: SceneViewportDocument, library?: MaterialAsset[], prefabs?: VisSceneDocument['prefabLibrary']): MaterialAsset[];
1730
+
1731
+ export declare interface SceneObjectPatch {
1732
+ uuid: string;
1733
+ state: {
1734
+ matrix?: number[];
1735
+ matrixAutoUpdate?: boolean;
1736
+ pivot?: number[] | null;
1737
+ name?: string;
1738
+ visible?: boolean;
1739
+ layers?: number;
1740
+ };
1741
+ unset?: ('matrix' | 'matrixAutoUpdate' | 'pivot' | 'name' | 'visible' | 'layers')[];
1742
+ }
1743
+
1744
+ declare interface SceneObjectPropertyPatch {
1745
+ uuid: string;
1746
+ state: Record<string, any>;
1747
+ unset?: readonly string[];
1748
+ }
1749
+
1750
+ declare type ScenePropertyField = typeof scenePropertyFields[number];
1751
+
1752
+ export declare const scenePropertyFields: readonly ["color", "groundColor", "intensity", "distance", "decay", "angle", "penumbra", "width", "height", "castShadow", "receiveShadow", "frustumCulled", "renderOrder", "up", "center", "shadow", "near", "far", "fov", "aspect", "zoom", "left", "right", "top", "bottom", "focus", "filmGauge", "filmOffset", "view", "backgroundBlurriness", "backgroundIntensity", "environmentIntensity", "backgroundRotation", "environmentRotation"];
1753
+
1754
+ export declare type SceneStructureGraphKey = 'materialAliases' | 'shapes' | '_sharedOptionsPool' | '_texDataPool';
1755
+
1756
+ /** Metadata is part of an owned structure transaction, never a scalar runtime patch. */
1757
+ export declare interface SceneStructureObjectPatch {
1758
+ uuid: string;
1759
+ state: SceneObjectPatch['state'] & Partial<Record<ScenePropertyField, any>> & {
1760
+ matrixAutoUpdate?: boolean;
1761
+ userData?: Record<string, any>;
1762
+ geometry?: string | null;
1763
+ material?: string | string[];
1764
+ background?: number | string | null;
1765
+ environment?: string | null;
1766
+ };
1767
+ unset?: (NonNullable<SceneObjectPatch['unset']>[number] | ScenePropertyField | 'matrixAutoUpdate' | 'userData' | 'geometry' | 'material' | 'background' | 'environment')[];
1768
+ }
1769
+
1770
+ export declare interface SceneStructurePatch {
1771
+ /** Final direct-child order. Omitting an old child detaches its subtree. */
1772
+ parents: {
1773
+ uuid: string;
1774
+ children: string[];
1775
+ }[];
1776
+ /** New serialized subtree roots, with UUIDs absent from the current scene. */
1777
+ additions?: Record<string, any>[];
1778
+ /** Replace existing subtree roots, retaining their UUID and owning the supplied descendants. */
1779
+ replacements?: Record<string, any>[];
1780
+ objects?: SceneStructureObjectPatch[];
1781
+ /** Viewport payload participates atomically with object/resource changes. */
1782
+ viewport?: SceneStructureViewportPatch;
1783
+ /** Authored scene aliases; these refer to assets, rather than runtime material UUIDs. */
1784
+ aliases?: {
1785
+ set?: NonNullable<SceneViewportDocument['materialAliases']>;
1786
+ unset?: true;
1787
+ };
1788
+ /** Keep object removals and their authored interaction bindings in one transaction. */
1789
+ interactions?: {
1790
+ set?: SceneViewportDocument['interactions'];
1791
+ unset?: true;
1792
+ };
1793
+ /** Small graph metadata and explicitly changed pools, never an entire scene graph. */
1794
+ graph?: {
1795
+ set?: Partial<Record<SceneStructureGraphKey, any>>;
1796
+ unset?: SceneStructureGraphKey[];
1797
+ };
1798
+ resources?: Partial<Record<SceneStructureResource, {
1799
+ upsert?: Record<string, any>[];
1800
+ remove?: string[];
1801
+ unset?: true;
1802
+ }>>;
1803
+ assets?: {
1804
+ upsert?: MaterialAsset[];
1805
+ remove?: string[];
1806
+ };
1807
+ prefabs?: {
1808
+ upsert?: PrefabAsset[];
1809
+ remove?: string[];
1810
+ };
1811
+ }
1812
+
1813
+ export declare type SceneStructureResource = 'geometries' | 'materials' | 'textures' | 'images' | 'skeletons' | 'animations';
1814
+
1815
+ /** Scene edits and shared catalogs form one atomic project-document transaction. */
1816
+ export declare interface SceneStructureTransaction {
1817
+ scenes: {
1818
+ sceneId: string;
1819
+ patch: Omit<SceneStructurePatch, 'assets' | 'prefabs'>;
1820
+ }[];
1821
+ assets?: SceneStructurePatch['assets'];
1822
+ prefabs?: SceneStructurePatch['prefabs'];
1823
+ }
1824
+
1825
+ export declare type SceneStructureViewportPatch = Partial<SceneViewportPatch>;
1826
+
1384
1827
  export declare interface SceneSwitchInteraction {
1385
1828
  trigger: 'click' | 'clickOutside';
1386
1829
  objectId: string;
@@ -1415,23 +1858,34 @@ export declare interface SceneViewportDocument {
1415
1858
  options: Record<string, any>;
1416
1859
  };
1417
1860
  scene: Record<string, any>;
1861
+ /** Scene-local SceneResources aliases. Locked means retained on export, not GPU residency. */
1862
+ materialAliases?: Record<string, MaterialAlias>;
1863
+ }
1864
+
1865
+ /** Camera motion and controls do not change authored scene topology/resources. */
1866
+ export declare interface SceneViewportPatch {
1867
+ camera: {
1868
+ uuid: string;
1869
+ type: 'PerspectiveCamera' | 'OrthographicCamera';
1870
+ state: Record<string, any>;
1871
+ unset: string[];
1872
+ };
1873
+ cs?: SceneViewportDocument['cs'];
1874
+ csa?: string;
1875
+ controls: Record<string, any>;
1418
1876
  }
1419
1877
 
1420
1878
  export declare function selectSceneDocument(document: VisSceneDocument, sceneId: string): VisSceneDocument;
1421
1879
 
1422
1880
  declare type SerializedClip = ReturnType<(typeof THREE.AnimationClip)['toJSON']>;
1423
1881
 
1424
- declare const sinusoidalInOut: ({ onUpdate, onComplete, backwards, }?: {
1425
- onUpdate?: ((v: number) => void) | undefined;
1426
- onComplete?: (() => void) | undefined;
1427
- backwards?: boolean | undefined;
1428
- }) => {
1882
+ declare const sinusoidalInOut: ({ owner, onUpdate, onComplete, onCancel, backwards, }?: TweenOptions) => {
1429
1883
  start: ({ duration, repeat, repeatResolve, repeatDelay, }?: {
1430
1884
  duration?: number | undefined;
1431
1885
  repeat?: number | undefined;
1432
1886
  repeatResolve?: number | undefined;
1433
1887
  repeatDelay?: number | undefined;
1434
- }) => Promise<any>;
1888
+ }) => Promise<void>;
1435
1889
  stop: () => void;
1436
1890
  };
1437
1891
 
@@ -1445,8 +1899,8 @@ declare class Sphere extends MeshObject {
1445
1899
 
1446
1900
  declare class SphereShadow extends MeshObject {
1447
1901
  objectType: string;
1448
- options: Required<Options_5>;
1449
- constructor(options: Options_5);
1902
+ options: Required<Options_3>;
1903
+ constructor(options: Options_3);
1450
1904
  create(): Promise<void>;
1451
1905
  rebuildFromScene(): void;
1452
1906
  }
@@ -1458,12 +1912,16 @@ declare class SphereShadow extends MeshObject {
1458
1912
  export declare function splitSceneDocument(document: VisSceneDocument, options?: {
1459
1913
  sceneDirectory?: string;
1460
1914
  extension?: '.json' | '.json.gz';
1915
+ externalizeImages?: boolean;
1916
+ omitEditorAssets?: boolean;
1461
1917
  }): SplitSceneDocumentBundle;
1462
1918
 
1463
1919
  export declare interface SplitSceneDocumentBundle {
1464
1920
  manifest: VisSceneManifest;
1465
1921
  /** Keys are the relative source paths written into the manifest. */
1466
1922
  scenes: Record<string, SceneViewportDocument>;
1923
+ /** Binary files to write alongside the manifest and scene files. */
1924
+ assets?: Record<string, RuntimeImageAsset>;
1467
1925
  }
1468
1926
 
1469
1927
  declare class SpotLight extends SpotLightObject {
@@ -1478,20 +1936,7 @@ declare class Sprite extends SpriteObject {
1478
1936
  setDesiredPixelSize(size: number): void;
1479
1937
  }
1480
1938
 
1481
- declare interface SwitchFixConfig {
1482
- /** 按参考缩放比缩放,并移到地图中心 */
1483
- s?: string[];
1484
- /** z 位置按缩放比缩放 */
1485
- z?: string[];
1486
- /** 移到地图顶面 */
1487
- t?: string[];
1488
- /** 移到地图底面 */
1489
- b?: string[];
1490
- /** 灯光按缩放比调整 */
1491
- l?: string[];
1492
- /** 删除对象 */
1493
- r?: string[];
1494
- }
1939
+ export declare function stripMaterialAssetBinding<T extends Record<string, any>>(material: T): T;
1495
1940
 
1496
1941
  export declare interface SwitchSceneOptions {
1497
1942
  /** 返回历史时不再记录当前场景。 */
@@ -1506,8 +1951,8 @@ declare const timeOut: (ms: number) => Promise<any>;
1506
1951
 
1507
1952
  declare class Tube extends MeshObject {
1508
1953
  objectType: string;
1509
- options: Options_2;
1510
- constructor(options: Options_2);
1954
+ options: Options_6;
1955
+ constructor(options: Options_6);
1511
1956
  create(): void;
1512
1957
  }
1513
1958
 
@@ -1515,13 +1960,27 @@ export { TWEEN }
1515
1960
 
1516
1961
  export { Tween }
1517
1962
 
1518
- export declare const VERSION = "0.32.8";
1963
+ declare interface TweenOptions {
1964
+ owner?: Pick<Pencil, 'animations'>;
1965
+ onUpdate?: (value: number) => void;
1966
+ onComplete?: () => void;
1967
+ onCancel?: () => void;
1968
+ backwards?: boolean;
1969
+ }
1970
+
1971
+ export declare function updateProjectMaterial<T extends VisSceneDocument>(document: T, assetId: string, patch: Partial<Pick<MaterialAsset, 'name' | 'material' | 'locked'>>): T;
1972
+
1973
+ export declare const VERSION = "0.33.0";
1519
1974
 
1520
1975
  export declare interface VisSceneDocument extends SceneDocumentMarker {
1521
1976
  entrySceneId: string;
1522
1977
  scenes: SceneViewportDocument[];
1523
1978
  /** Schema 3: image/video/data payloads shared across scenes, never live textures. */
1524
1979
  _resourcePool?: any[];
1980
+ /** Schema 4: serializable definitions shared by explicit asset identity. */
1981
+ materialLibrary?: MaterialAsset[];
1982
+ /** Reusable definitions. SDK-enabled assets are retained in deployment exports. */
1983
+ prefabLibrary?: PrefabAsset[];
1525
1984
  c?: Record<string, any>;
1526
1985
  d?: Record<string, any>;
1527
1986
  h?: Record<string, any>;
@@ -1530,9 +1989,14 @@ export declare interface VisSceneDocument extends SceneDocumentMarker {
1530
1989
 
1531
1990
  export declare interface VisSceneManifest {
1532
1991
  format: typeof SCENE_MANIFEST_FORMAT;
1533
- schemaVersion: typeof SCENE_MANIFEST_SCHEMA_VERSION;
1992
+ schemaVersion: 1 | typeof SCENE_MANIFEST_SCHEMA_VERSION;
1534
1993
  entrySceneId: string;
1535
1994
  scenes: SceneManifestEntry[];
1995
+ materialLibrary?: MaterialAsset[];
1996
+ /** Externalized image files, relative to the manifest URL. */
1997
+ imageAssets?: string[];
1998
+ /** Reusable definitions. Only assets with sdkKey are available for SDK instantiation. */
1999
+ prefabLibrary?: PrefabAsset[];
1536
2000
  c?: Record<string, any>;
1537
2001
  d?: Record<string, any>;
1538
2002
  h?: Record<string, any>;
@@ -1540,15 +2004,3 @@ export declare interface VisSceneManifest {
1540
2004
  }
1541
2005
 
1542
2006
  export { }
1543
-
1544
-
1545
-
1546
- declare module '@turf/turf' {
1547
- export function point(...args: any[]): any;
1548
- export function polygon(...args: any[]): any;
1549
- export function booleanPointInPolygon(...args: any[]): boolean;
1550
- export function center(...args: any[]): any;
1551
- export function centroid(...args: any[]): any;
1552
- export function bbox(...args: any[]): any;
1553
- export function union(...args: any[]): any;
1554
- }