vis-core 0.33.16 → 0.33.17

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/io.d.ts CHANGED
@@ -1,9 +1,17 @@
1
+ export declare function assetDigest(bytes: Uint8Array): Promise<string>;
2
+
3
+ export declare const cityJsonName: (key: string, data: string) => string;
4
+
5
+ export declare function decodeAssetBytes(data: string): Uint8Array;
6
+
1
7
  declare type DownloadProgress = {
2
8
  percent: number;
3
9
  transferredBytes: number;
4
10
  totalBytes: number;
5
11
  };
6
12
 
13
+ export declare function encodeAssetBytes(bytes: Uint8Array): string;
14
+
7
15
  export declare const isGzip: (url: string) => boolean;
8
16
 
9
17
  export declare const jsonFetch: <T = any>(url: string, onDownloadProgress?: (progress: DownloadProgress) => void, gzip?: (url: string) => boolean, options?: JsonFetchOptions) => Promise<{
@@ -19,6 +27,190 @@ export declare type JsonFetchCacheOptions = {
19
27
 
20
28
  export declare type JsonFetchOptions = {
21
29
  cache?: boolean | JsonFetchCacheOptions;
30
+ resolveURL?: (url: string) => string;
22
31
  };
23
32
 
33
+ export declare interface MapExportScope {
34
+ rootAdcode: number;
35
+ maxLevel: 'province' | 'city' | 'district';
36
+ }
37
+
38
+ declare interface MapRegionBackInteraction {
39
+ trigger: 'click' | 'clickOutside';
40
+ objectId: string;
41
+ filter?: SceneInteractionFilter;
42
+ action: {
43
+ type: 'backMapRegion';
44
+ };
45
+ }
46
+
47
+ declare interface MapRegionSwitchInteraction {
48
+ trigger: 'click';
49
+ objectId: string;
50
+ filter?: SceneInteractionFilter;
51
+ action: {
52
+ /** 先恢复目标层级模板,再把其中的地图切换到命中的行政区。 */
53
+ type: 'switchMapRegion';
54
+ sceneId: string;
55
+ adcode: 'clicked' | number;
56
+ };
57
+ }
58
+
59
+ /** Retained catalog entries are keyed by the native scene material UUID. */
60
+ declare interface MaterialAlias {
61
+ assetId: string;
62
+ locked?: boolean;
63
+ }
64
+
65
+ declare interface MaterialAsset {
66
+ id: string;
67
+ revision: number;
68
+ scope: MaterialScope;
69
+ name: string;
70
+ /** Complete Material.toJSON(); schema 6 exports may pool image/texture payloads. */
71
+ material: Record<string, any>;
72
+ locked?: boolean;
73
+ /** Keep this definition and its dependencies in exports for later business use. Does not prevent editing or deletion. */
74
+ alwaysExport?: boolean;
75
+ }
76
+
77
+ /** Serializable project data. This deliberately contains no THREE instances or GPU ownership. */
78
+ declare type MaterialScope = {
79
+ kind: 'project';
80
+ } | {
81
+ kind: 'scene';
82
+ sceneId: string;
83
+ };
84
+
85
+ export declare function mergeRuntimeAssets(previous?: RuntimeAssetCatalog, incoming?: RuntimeAssetCatalog): RuntimeAssetCatalog | undefined;
86
+
87
+ declare interface PrefabAsset {
88
+ id: string;
89
+ name: string;
90
+ revision: number;
91
+ /** Stable public SDK identifier. Omit for assets used only by the editor. */
92
+ sdkKey?: string;
93
+ /** Legacy business templates own complete material snapshots, without promoting scene assets. */
94
+ materialMode?: 'embedded';
95
+ snapshot: Record<string, any>;
96
+ }
97
+
98
+ /** Read a self-contained ZIP into a document with persistent image payloads. */
99
+ export declare function readSceneBundleZip(input: SceneBundleBinary, name?: string): Promise<VisSceneDocument>;
100
+
101
+ /** Static dependencies owned by a project. Source URLs are lookup keys, never fallbacks. */
102
+ export declare interface RuntimeAsset {
103
+ id: string;
104
+ path: string;
105
+ sources: string[];
106
+ mimeType: string;
107
+ encoding: 'identity' | 'gzip';
108
+ bytes: number;
109
+ sha256: string;
110
+ /** Compressed/original file bytes, base64 encoded for project persistence. */
111
+ data?: string;
112
+ }
113
+
114
+ export declare interface RuntimeAssetCatalog {
115
+ version: 1;
116
+ entries: RuntimeAsset[];
117
+ scope?: MapExportScope;
118
+ /** Enumerated interaction targets, including regions never opened in the editor. */
119
+ regions?: Record<string, number[]>;
120
+ declaredSources?: string[];
121
+ /** Explicitly deployed shared files; these sources are not stored inside the ZIP. */
122
+ externalSources?: string[];
123
+ mapDataMode?: 'bundled' | 'external';
124
+ /** Signed authorization restricted to the exported map interaction targets. */
125
+ mapSwitchKey?: string;
126
+ projectId?: string;
127
+ /** Runtime-only base for an unpacked deployment. ZIP imports contain data instead. */
128
+ baseUrl?: string;
129
+ }
130
+
131
+ /** One resolver per scene; no global URL aliases or cross-project caches. */
132
+ export declare class RuntimeAssetResolver {
133
+ private sources;
134
+ private resolved;
135
+ private externals;
136
+ readonly catalog: RuntimeAssetCatalog;
137
+ private strict;
138
+ constructor(catalog: RuntimeAssetCatalog, prefix?: string, strict?: boolean);
139
+ resolve: (source: string) => string;
140
+ }
141
+
142
+ declare const SCENE_DOCUMENT_FORMAT: "vis-scene";
143
+
144
+ declare interface SceneBackInteraction {
145
+ trigger: 'click' | 'clickOutside';
146
+ objectId: string;
147
+ filter?: SceneInteractionFilter;
148
+ action: {
149
+ type: 'back';
150
+ };
151
+ }
152
+
153
+ export declare type SceneBundleBinary = Blob | ArrayBuffer | Uint8Array;
154
+
155
+ declare interface SceneDocumentMarker {
156
+ format: typeof SCENE_DOCUMENT_FORMAT;
157
+ schemaVersion: number;
158
+ }
159
+
160
+ declare type SceneInteraction = SceneSwitchInteraction | SceneBackInteraction | MapRegionSwitchInteraction | MapRegionBackInteraction;
161
+
162
+ declare interface SceneInteractionFilter {
163
+ mode: 'include' | 'exclude';
164
+ objectIds?: string[];
165
+ baseObjectTypes?: string[];
166
+ }
167
+
168
+ declare interface SceneSwitchInteraction {
169
+ trigger: 'click' | 'clickOutside';
170
+ objectId: string;
171
+ filter?: SceneInteractionFilter;
172
+ action: {
173
+ type: 'switchScene';
174
+ sceneId: string;
175
+ };
176
+ }
177
+
178
+ declare interface SceneViewportDocument {
179
+ id: string;
180
+ name: string;
181
+ interactions?: SceneInteraction[];
182
+ cs?: Record<string, number[]>;
183
+ csa?: string;
184
+ vis: {
185
+ type: string;
186
+ options: Record<string, any>;
187
+ };
188
+ scene: Record<string, any>;
189
+ /** Scene-local SceneResources aliases. Locked means retained on export, not GPU residency. */
190
+ materialAliases?: Record<string, MaterialAlias>;
191
+ }
192
+
193
+ export declare function verifyAssetBytes(asset: RuntimeAsset, bytes: Uint8Array): Promise<void>;
194
+
195
+ export declare function verifySwitchKey(adcode: number, key: string): Promise<boolean>;
196
+
197
+ /** Exported keys must authorize exactly these targets, never a wildcard or province prefix. */
198
+ export declare function verifySwitchKeyScope(adcodes: readonly number[], key: string, projectId?: string): Promise<boolean>;
199
+
200
+ declare interface VisSceneDocument extends SceneDocumentMarker {
201
+ runtimeAssets?: RuntimeAssetCatalog;
202
+ entrySceneId: string;
203
+ scenes: SceneViewportDocument[];
204
+ /** Schema 3: scene payloads; schema 6 also shares material-library payloads. */
205
+ _resourcePool?: any[];
206
+ /** Schema 4: serializable definitions shared by explicit asset identity. */
207
+ materialLibrary?: MaterialAsset[];
208
+ /** Reusable definitions. SDK-enabled assets are retained in deployment exports. */
209
+ prefabLibrary?: PrefabAsset[];
210
+ c?: Record<string, any>;
211
+ d?: Record<string, any>;
212
+ h?: Record<string, any>;
213
+ s?: string;
214
+ }
215
+
24
216
  export { }
package/dist/io.js CHANGED
@@ -1 +1 @@
1
- import{n as o,t as s}from"./jsonFetch-BQr9Uqag.js";export{s as isGzip,o as jsonFetch};
1
+ import{c as s,d as a,f as o,i as m,l as r,m as t,n as e,o as i,p,r as c,t as f,u as n}from"./e-DDhN_TXt.js";export{i as RuntimeAssetResolver,s as assetDigest,f as cityJsonName,r as decodeAssetBytes,n as encodeAssetBytes,p as isGzip,t as jsonFetch,a as mergeRuntimeAssets,m as readSceneBundleZip,o as verifyAssetBytes,e as verifySwitchKey,c as verifySwitchKeyScope};
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty,a=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),u=(e,r)=>{let o={};for(var l in e)t(o,l,{get:e[l],enumerable:!0});return r||t(o,Symbol.toStringTag,{value:"Module"}),o},p=(a,u,p)=>(p=null!=a?e(l(a)):{},((e,l,a,u)=>{if(l&&"object"==typeof l||"function"==typeof l)for(var p,b=o(l),c=0,s=b.length;c<s;c++)p=b[c],n.call(e,p)||p===a||t(e,p,{get:(e=>l[e]).bind(null,p),enumerable:!(u=r(l,p))||u.enumerable});return e})(!u&&a&&a.__esModule?p:t(p,"default",{value:a,enumerable:!0}),a));export{u as n,p as r,a as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-NMqb_1LM.js";var r=/* @__PURE__ */e({externalizeRuntimeImages:()=>n,resolveRuntimeImages:()=>t});function o(e,r){var o,n,t,i,a,s,l;const g=e=>{for(const o of null!=e?e:[])"string"==typeof o.url?o.url=r(o.url):Array.isArray(o.url)&&(o.url=o.url.map(e=>"string"==typeof e?r(e):e))};g(null===(o=e.scene)||void 0===o?void 0:o.images);for(const p of null!==(n=e.materialLibrary)&&void 0!==n?n:[])g(null===(t=p.material)||void 0===t?void 0:t.images);for(const p of null!==(i=e.prefabLibrary)&&void 0!==i?i:[])g(null===(a=p.snapshot)||void 0===a?void 0:a.images);for(const p of null!==(s=e.scenes)&&void 0!==s?s:[])g(null===(l=p.scene)||void 0===l?void 0:l.images)}function n(e){const r={},n=/* @__PURE__ */new Map,t={png:"png",jpeg:"jpg",jpg:"jpg",webp:"webp",gif:"gif",avif:"avif",bmp:"bmp"};return o(e,e=>{const o=n.get(e);if(o)return o;const i=/^data:image\/(png|jpeg|jpg|webp|gif|avif|bmp);base64,([\s\S]*)$/i.exec(e);if(!i)return e;let a;try{const e=atob(i[2]);a=new Uint8Array(e.length);for(let r=0;r<e.length;r++)a[r]=e.charCodeAt(r)}catch(g){return e}const s=i[1].toLowerCase(),l=`assets/image-${n.size}.${t[s]}`;return n.set(e,l),r[l]={data:a,mimeType:`image/${"jpg"===s?"jpeg":s}`},l}),r}function t(e,r,n){if(!(null==r?void 0:r.length))return;const t=new Set(r),i=e=>t.has(e)?n(e):e;o(e,i),e._resourcePool&&(e._resourcePool=e._resourcePool.map(e=>"string"==typeof e?i(e):Array.isArray(e)?e.map(e=>"string"==typeof e?i(e):e):e))}export{t as n,r,n as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-NMqb_1LM.js";var s=/* @__PURE__ */e({SCENE_DOCUMENT_FORMAT:()=>n,SCENE_DOCUMENT_SCHEMA_VERSION:()=>6,SCENE_MANIFEST_FORMAT:()=>o,SCENE_MANIFEST_SCHEMA_VERSION:()=>4,assertSupportedSceneDocument:()=>c,isSceneDocument:()=>i,isSceneManifest:()=>a}),n="vis-scene",r=6,o="vis-scene-manifest",t=4;function i(e){if(!e||"object"!=typeof e)return!1;const s=e;return"vis-scene"===s.format&&Number.isInteger(s.schemaVersion)&&s.schemaVersion>=1}function a(e){return!(!e||"object"!=typeof e)&&e.format===o}function c(e){if(i(e)&&e.schemaVersion>6)throw new Error(`Unsupported scene schema version: ${e.schemaVersion}. Maximum supported version: 6`)}export{c as a,s as c,t as i,r as n,i as o,o as r,a as s,n as t};