vis-core 0.33.17 → 0.33.19
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/README.md +22 -0
- package/dist/dist-6e_r_Ils.js +58 -0
- package/dist/e-BTBbEYEO.js +1 -0
- package/dist/index.d.ts +44 -38
- package/dist/index.js +1 -1
- package/dist/io.d.ts +69 -5
- package/dist/io.js +1 -1
- package/dist/runtimeImages-DCG8lEY9.js +1 -0
- package/dist/schema-Brre1WzE.js +1 -0
- package/dist/sha2-BCqd-su1.js +1 -0
- package/dist/validation-DDQJc7mH.js +1 -0
- package/package.json +3 -2
- package/dist/e-DDhN_TXt.js +0 -1
- package/dist/rolldown-runtime-NMqb_1LM.js +0 -1
- package/dist/runtimeImages-BnSAIZUX.js +0 -1
- package/dist/schema-BpVVlDZn.js +0 -1
- package/dist/validation-DiMfvx_5.js +0 -46
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n as r,o as s,r as i,t as n}from"./sha2-BCqd-su1.js";function o(e,t){if(null==e)return{};var r,s,i=function(e,t){if(null==e)return{};var r={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.includes(s))continue;r[s]=e[s]}return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s<n.length;s++)r=n[s],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var a,l,c,d=new class{constructor(e=32,t=67108864){s(this,"pending",/* @__PURE__ */new Map),s(this,"values",/* @__PURE__ */new Map),s(this,"bytes",0),s(this,"maxEntries",void 0),s(this,"maxBytes",void 0),this.maxEntries=e,this.maxBytes=t}load(e,t){const r=this.values.get(e);if(r)return this.values.delete(e),this.values.set(e,r),Promise.resolve(r);const s=this.pending.get(e);if(s)return s;const i=Promise.resolve().then(t).then(t=>{if(this.pending.get(e)===i&&(this.pending.delete(e),this.maxEntries>0&&t.bytes<=this.maxBytes))for(this.values.set(e,t),this.bytes+=t.bytes;this.values.size>this.maxEntries||this.bytes>this.maxBytes;)this.deleteValue(this.values.keys().next().value);return t},t=>{throw this.pending.get(e)===i&&this.pending.delete(e),t});return this.pending.set(e,i),i}deleteValue(e){const t=this.values.get(e);t&&(this.bytes-=t.bytes),this.values.delete(e)}clear(e){void 0!==e?(this.pending.delete(e),this.deleteValue(e)):(this.pending.clear(),this.values.clear(),this.bytes=0)}},u=e=>!!/\.(gzip|gz)(?:[?#]|$)/i.test(e),p=(a=t(function*(e,t,r=u){const s=yield window.fetch(e);if(!s.ok){try{var i;yield null===(i=s.body)||void 0===i?void 0:i.cancel()}catch(l){}throw new Error("Network response was not ok.")}let n=s;if(t)try{n=((e,t)=>{const r=Number(e.headers.get("content-length"))||0;let s=0;return e.body?new globalThis.Response(e.body.pipeThrough(new globalThis.TransformStream({start(){t({percent:0,transferredBytes:0,totalBytes:r})},transform(e,i){s+=e.byteLength,t({percent:0===r?0:s/r,transferredBytes:s,totalBytes:r}),i.enqueue(e)},flush(){t({percent:1,transferredBytes:s,totalBytes:r})}})),{status:e.status,statusText:e.statusText,headers:e.headers}):(t({percent:1,totalBytes:r,transferredBytes:s}),new globalThis.Response(null,{status:e.status,statusText:e.statusText,headers:e.headers}))})(n,t)}catch(c){try{var o;yield null===(o=s.body)||void 0===o?void 0:o.cancel(c)}catch(d){}throw c}if(r(e)&&"gzip"!==n.headers.get("content-encoding")){const e=new DecompressionStream("gzip"),t=n.body.pipeThrough(e);n=new Response(t)}const a=yield n.text();return{json:JSON.parse(a),bytes:2*a.length}}),function(e,t){return a.apply(this,arguments)}),f=(l=t(function*(e,t,r=u,s){try{var i,n;const o=null!==(i=null==s||null===(n=s.resolveURL)||void 0===n?void 0:n.call(s,e))&&void 0!==i?i:e,a=((e,t)=>{const r=null==t?void 0:t.cache;if(!1===r)return{enabled:!1,key:e,clone:!1};if(!0===r)return{enabled:!0,key:e,clone:!0};if(r&&"object"==typeof r){var s,i,n;const t=null===(s=r.enabled)||void 0===s||s;return{enabled:t,key:null!==(i=r.key)&&void 0!==i?i:e,clone:!!t&&(null===(n=r.clone)||void 0===n||n)}}return{enabled:!1,key:e,clone:!1}})(o,s),l=()=>p(o,t,()=>r(e)),c=(yield a.enabled?d.load(a.key,l):l()).json;return{res:a.enabled&&a.clone?structuredClone(c):c,err:void 0}}catch(o){return{res:void 0,err:o}}}),function(e,t){return l.apply(this,arguments)}),h=i,y=(c=t(function*(e,t){const{res:r,err:s}=yield f(h(e,null==t?void 0:t.assetsPrefix),void 0,void 0,(null==t?void 0:t.fetchOptions)||{cache:!0});if(s)throw s;return r}),function(e,t){return c.apply(this,arguments)}),m=e=>"string"==typeof e&&!!e&&!/[:\\?#\0]/.test(e)&&!e.split("/").some(e=>!e||"."===e||".."===e);function g(e,t,r){var s,i;if(!(null==e?void 0:e.mapNavigation))return;if("static"===e.mapNavigation.mode)throw Error("此作品为固定场景展示,不支持运行时区域切换或重建。请以动态模式重新导出。");const n=void 0===r?Object.values(null!==(s=e.regions)&&void 0!==s?s:{}).flat():null===(i=e.regions)||void 0===i?void 0:i[r];if(void 0!==r&&!Object.values(e.mapNavigation.templates).includes(r)||!(null==n?void 0:n.includes(t)))throw Error(`区域 ${t} 或场景模板不在动态导出范围内,请调整范围和模板后重新导出。`)}function v(e){if(void 0===e)return;const t=e;if(!t||1!==t.version||!Array.isArray(t.entries))throw Error("Invalid runtime asset catalog");const r=/* @__PURE__ */new Set,s=/* @__PURE__ */new Set,i=/* @__PURE__ */new Set;for(const a of t.entries){var n;if(!a||"string"!=typeof a.id||!a.id||r.has(a.id)||!m(a.path)||s.has(a.path)||!Array.isArray(a.sources)||!a.sources.length||a.sources.some(e=>"string"!=typeof e||!e||i.has(e))||new Set(a.sources).size!==a.sources.length||"string"!=typeof a.mimeType||!/^[\w.+-]+\/[\w.+-]+$/.test(a.mimeType)||!["identity","gzip"].includes(a.encoding)||!Number.isSafeInteger(a.bytes)||a.bytes<0||!/^[a-f0-9]{64}$/.test(a.sha256)||void 0!==a.data&&!(a.data instanceof ArrayBuffer))throw Error(`Invalid runtime asset: ${null!==(n=null==a?void 0:a.path)&&void 0!==n?n:"unknown"}`);r.add(a.id),s.add(a.path),a.sources.forEach(e=>i.add(e))}if(t.scope&&(!Number.isInteger(t.scope.rootAdcode)||t.scope.rootAdcode<0||!["province","city","district"].includes(t.scope.maxLevel)))throw Error("Invalid map export scope");const o=t.mapNavigation;if(void 0!==o){if(!o||!["static","dynamic"].includes(o.mode))throw Error("Invalid map navigation mode");if("dynamic"===o.mode&&(!o.scope||!Number.isInteger(o.scope.rootAdcode)||o.scope.rootAdcode<0||!["province","city","district"].includes(o.scope.maxLevel)||!o.templates||"object"!=typeof o.templates||Array.isArray(o.templates)||Object.entries(o.templates).some(([e,t])=>!["province","city","district"].includes(e)||"string"!=typeof t||!t.trim())))throw Error("Invalid map navigation templates or scope")}if(t.regions&&("object"!=typeof t.regions||Array.isArray(t.regions)||Object.values(t.regions).some(e=>!Array.isArray(e)||e.some(e=>!Number.isInteger(e)||e<0))))throw Error("Invalid runtime region catalog");if(void 0!==t.declaredSources&&(!Array.isArray(t.declaredSources)||t.declaredSources.some(e=>"string"!=typeof e||!e.trim())))throw Error("Invalid declared asset sources");if(void 0!==t.externalSources&&(!Array.isArray(t.externalSources)||t.externalSources.some(e=>"string"!=typeof e||!e.trim()||/[{}\0]/.test(e)||/^(?:data:|blob:|asset:)/i.test(e)||i.has(e))||new Set(t.externalSources).size!==t.externalSources.length))throw Error("Invalid external asset sources");if(void 0!==t.mapDataMode&&!["bundled","external"].includes(t.mapDataMode))throw Error("Invalid map data mode");if(void 0!==t.mapSwitchKey&&("string"!=typeof t.mapSwitchKey||!t.mapSwitchKey.trim()))throw Error("Invalid bundled map switch key");if(void 0!==t.projectId&&("string"!=typeof t.projectId||!t.projectId.trim()||t.projectId.length>64))throw Error("Invalid runtime asset project")}function w(e){const t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode(...e.subarray(r,r+32768)));return btoa(t.join(""))}function b(e){return e instanceof ArrayBuffer?new Uint8Array(e):Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function A(e){return x.apply(this,arguments)}function x(){return x=t(function*(e){const t=yield crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,"0")).join("")}),x.apply(this,arguments)}function E(e,t){return S.apply(this,arguments)}function S(){return(S=t(function*(e,t){if(t.length!==e.bytes||(yield A(t))!==e.sha256)throw Error(`资源校验失败:${e.path}`)})).apply(this,arguments)}function I(t,r){var s,i,n,o;if(!r)return t;if(!t)return structuredClone(r);const a=structuredClone(t),l=new Map(a.entries.map(e=>[e.id,e])),c=new Map(a.entries.flatMap(e=>e.sources.map(t=>[t,e.sha256])));for(const e of r.entries){for(const r of e.sources)if(c.has(r)&&c.get(r)!==e.sha256)throw Error(`资源地址存在不同内容:${r}。请修改资源地址或使用“打开项目”导入。`);const t=l.get(e.id);if(t)t.sources=[.../* @__PURE__ */new Set([...t.sources,...e.sources])];else{const t=structuredClone(e);a.entries.push(t),l.set(t.id,t)}for(const r of e.sources)c.set(r,e.sha256)}a.regions=e(e({},t.regions),r.regions),a.declaredSources=[.../* @__PURE__ */new Set([...null!==(s=t.declaredSources)&&void 0!==s?s:[],...null!==(i=r.declaredSources)&&void 0!==i?i:[]])];const d=[.../* @__PURE__ */new Set([...null!==(n=t.externalSources)&&void 0!==n?n:[],...null!==(o=r.externalSources)&&void 0!==o?o:[]])].filter(e=>!c.has(e));return d.length?a.externalSources=d:delete a.externalSources,v(a),a}var j=class{constructor(e,t="",o=!0){var a;s(this,"sources",/* @__PURE__ */new Map),s(this,"resolved",/* @__PURE__ */new Map),s(this,"externals",/* @__PURE__ */new Map),s(this,"catalog",void 0),s(this,"strict",void 0),s(this,"prefix",void 0),s(this,"resolve",e=>{var t;if(/^(data:|blob:)/i.test(e))return e;const s=i(e,this.prefix),o=null!==(t=this.sources.get(e))&&void 0!==t?t:this.sources.get(s);if(!o){var a;const t=null!==(a=this.externals.get(e))&&void 0!==a?a:this.externals.get(s);if(void 0!==t)return t;if(!this.strict)return s;throw Error(`资源包未包含:${e}。请扩大导出范围或补充资源后重新导出。`)}let l=this.resolved.get(o.id);if(!l){if(void 0!==o.data){const e=b(o.data);if(e.byteLength!==o.bytes||r(n(e))!==o.sha256)throw Error(`资源校验失败:${o.path}`);l=URL.createObjectURL(new Blob([e],{type:"gzip"===o.encoding?"application/gzip":o.mimeType}))}else{const e=this.catalog.baseUrl;if(!e)throw Error(`资源缺少文件内容或部署地址:${o.path}`);const t="undefined"==typeof location?"https://bundle.invalid/":location.href;l=new URL(o.path,new URL(e,t)).href}this.resolved.set(o.id,l)}return l}),this.catalog=e,this.prefix=t,this.strict=o,v(e);const l=(e,t)=>{const r=this.sources.get(e);if(r&&r.id!==t.id)throw Error(`资源地址重复:${e}`);this.sources.set(e,t)},c=e=>/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(e)?[e]:[e,i(e,t),`/${e.replace(/^\/+/,"")}`];for(const r of e.entries)for(const e of[...r.sources,`asset://${r.id}`])for(const t of c(e))l(t,r);for(const r of null!==(a=e.externalSources)&&void 0!==a?a:[]){const e=i(r,t);for(const t of c(r))this.externals.set(t,e)}}dispose(){for(const e of this.resolved.values())e.startsWith("blob:")&&URL.revokeObjectURL(e);this.resolved.clear()}},B=["format","schemaVersion","scenes","assets"];function $(e){const t=e.replace(/[?#].*$/,""),r=e.slice(t.length),s=new URL(e,"https://bundle.invalid").pathname;if(/\.zip$/i.test(s)||/(?:^|\/)manifest\.json$/i.test(s))return e;if(/\.[^/]+$/.test(s))throw Error("vis-core 仅支持 ZIP、分包目录或 manifest.json;独立 JSON/GZ 请先通过编辑平台导入并导出 ZIP。");return`${t.replace(/\/$/,"")}/manifest.json${r}`}function U(e,t){return k.apply(this,arguments)}function k(){return(k=t(function*(e,t){try{const r=new Uint8Array(yield e.slice(0,2).arrayBuffer()),s=/\.(gz|gzip)$/i.test(t)||31===r[0]&&139===r[1]?yield new Response(e.stream().pipeThrough(new DecompressionStream("gzip"))).text():yield e.text(),i=JSON.parse(s);if(!i||"object"!=typeof i||Array.isArray(i))throw Error("需要 JSON 对象");return i}catch(r){throw new Error(`无法读取文件 ${t}:${r instanceof Error?r.message:String(r)}`,{cause:r})}})).apply(this,arguments)}function O(e){return T.apply(this,arguments)}function T(){return T=t(function*(r,s="project.zip"){var i;const[{default:n},a,{createTextureFile:l},{SCENE_DOCUMENT_FORMAT:c},{resolveRuntimeImages:d}]=yield Promise.all([import("jszip"),import("./validation-DDQJc7mH.js").then(e=>e.r),import("./dist-6e_r_Ils.js").then(e=>e.R),import("./schema-Brre1WzE.js").then(e=>e.c),import("./runtimeImages-DCG8lEY9.js").then(e=>e.a)]),u=a;let p;try{p=yield n.loadAsync(r instanceof Blob?yield r.arrayBuffer():r)}catch(N){throw new Error(`无法解压 ZIP 文件 ${s}`,{cause:N})}const f=Object.values(p.files).filter(e=>!e.dir&&/(^|\/)manifest\.json$/.test(e.name)&&!e.name.startsWith("__MACOSX/")),h=null!==(i=p.file("manifest.json"))&&void 0!==i?i:1===f.length?f[0]:void 0;if(!h)throw new Error(f.length>1?"ZIP 中有多个 manifest.json,无法确定要导入的项目":"ZIP 中缺少 manifest.json,请选择平台导出的场景分包 ZIP");const y=h.name.slice(0,-13),m=yield U(new Blob([yield h.async("uint8array")]),h.name);u.assertSceneManifest(m);const g=function(){var e=t(function*(e){if(/[:\\?#\0]/.test(e)||e.split("/").some(e=>!e||"."===e||".."===e))throw new Error(`ZIP 内文件路径无效:${e}`);const t=p.file(y+e);if(!t)throw new Error(`ZIP 中缺少文件:${e}`);if(t.unsafeOriginalName&&t.unsafeOriginalName!==t.name)throw new Error(`ZIP 内文件路径无效:${e}`);return new Blob([yield t.async("uint8array")])});return function(t){return e.apply(this,arguments)}}(),v=[];for(const e of m.scenes){var w,b;const t=yield U(yield g(e.source),e.source);if(!(null===(w=t.scene)||void 0===w?void 0:w.object)||t.id!==e.id||(null===(b=t.vis)||void 0===b?void 0:b.type)!==e.vis.type)throw new Error(`场景文件与 manifest 不匹配:${e.source}`);v.push(t)}const{format:A,schemaVersion:x,scenes:S,assets:I}=m,j=e(e({},o(m,B)),{},{format:c,schemaVersion:6,scenes:v});if(u.assertRuntimeSceneDocument(j),j.runtimeAssets){delete j.runtimeAssets.baseUrl;for(const e of j.runtimeAssets.entries){const t=new Uint8Array(yield(yield g(e.path)).arrayBuffer());yield E(e,t),e.data=t.buffer}}const $=/* @__PURE__ */new Map,k={png:"image/png",jpg:"image/jpeg",webp:"image/webp",gif:"image/gif",avif:"image/avif",bmp:"image/bmp"};for(const e of Object.keys(null!=I?I:{})){var O,T,L;const t=new Uint8Array(yield(yield g(e)).arrayBuffer()),r=null!==(O=null!==(T=null==I||null===(L=I[e])||void 0===L?void 0:L.mimeType)&&void 0!==T?T:k[e.split(".").pop()])&&void 0!==O?O:"application/octet-stream";$.set(e,l(t.buffer,r))}return d(j,I,e=>$.get(e)),j}),T.apply(this,arguments)}var L=["assets"],N=e=>r(n(new Uint8Array(e))),M={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array},P={"image/png":"png","image/jpeg":"jpg","image/webp":"webp","image/gif":"gif","image/avif":"avif","image/bmp":"bmp","image/svg+xml":"svg","image/vnd.radiance":"hdr","image/x-tga":"tga","video/mp4":"mp4","video/webm":"webm","video/ogg":"ogv","video/quicktime":"mov","video/x-m4v":"m4v"},z=e=>"string"==typeof e&&/^assets\/[\w.-]+$/.test(e)&&!e.includes("..");function C(e){if(void 0!==e){if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Invalid media asset manifest");for(const[t,r]of Object.entries(e)){if(!z(t)||!r||!/^[a-f0-9]{64}$/.test(r.sha256)||!Number.isSafeInteger(r.bytes)||r.bytes<0||!/^[\w.+-]+\/[\w.+-]+$/.test(r.mimeType)||!["image","hdr","tga","video","pixels"].includes(r.kind))throw Error(`Invalid media asset: ${t}`);if("pixels"===r.kind){const e=r.pixels;if(!e||!Object.hasOwn(M,e.type)||!Number.isSafeInteger(e.width)||e.width<=0||!Number.isSafeInteger(e.height)||e.height<=0||void 0!==e.depth&&(!Number.isSafeInteger(e.depth)||e.depth<=0)||r.bytes%M[e.type].BYTES_PER_ELEMENT)throw Error(`Invalid pixel asset: ${t}`)}else if(void 0!==r.pixels)throw Error(`Unexpected pixel metadata: ${t}`)}}}function D(t,r){if(r instanceof ArrayBuffer&&(r.byteLength!==t.bytes||N(r)!==t.sha256))throw Error("Media resource checksum mismatch");return"pixels"===t.kind?e(e({},t.pixels),{},{encoding:"binary",sha256:t.sha256,data:r}):{encoding:"file",kind:t.kind,mimeType:t.mimeType,sha256:t.sha256,data:r}}var R=class{constructor(){s(this,"payloads",/* @__PURE__ */new WeakMap),s(this,"graphs",/* @__PURE__ */new WeakMap),s(this,"rows",/* @__PURE__ */new WeakMap)}row(t,r,s){const i=this.rows.get(t);if(i&&i.graph===s)return i.row;const n=e(e({},t),{},{[r]:s});return this.rows.set(t,{graph:s,row:n}),n}writePayload(t){var r;if("string"==typeof t){const e=/^data:((?:image|video)\/[^;,]+);base64,([\s\S]*)$/i.exec(t);if(!e)return;const r=b(e[2]).buffer;t={encoding:"file",kind:e[1].toLowerCase().startsWith("video/")?"video":"image",mimeType:e[1],sha256:N(r),data:r}}if(!t||"object"!=typeof t)return;const s=this.payloads.get(t);if(s)return s;let i,n;if("file"===t.encoding){if(!(t.data instanceof ArrayBuffer))throw Error("Media export requires owned file bytes");if(i=t.data,n={kind:t.kind,mimeType:t.mimeType,sha256:N(i),bytes:i.byteLength},n.sha256!==t.sha256)throw Error("Media resource checksum mismatch")}else{if(!("binary"===t.encoding||Object.hasOwn(M,t.type)&&(Array.isArray(t.data)||ArrayBuffer.isView(t.data))))return;{const r=M[t.type];if(!r)throw Error("Invalid pixel array type");if("binary"===t.encoding){if(!(t.data instanceof ArrayBuffer)||N(t.data)!==t.sha256)throw Error("Invalid binary pixel resource");i=t.data}else{const e=Array.isArray(t.data)?new r(t.data):t.data;i=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}n={kind:"pixels",mimeType:"application/octet-stream",sha256:N(i),bytes:i.byteLength,pixels:e({type:t.type,width:t.width,height:t.height},void 0===t.depth?{}:{depth:t.depth})}}}const o=n.pixels?"-"+N((new TextEncoder).encode(JSON.stringify(n.pixels)).buffer).slice(0,16):"",a="pixels"===n.kind?"bin":null!==(r=P[n.mimeType])&&void 0!==r?r:"bin",l=`assets/${"video"===n.kind?"video":"image"}-${n.sha256}${o}.${a}`;C({[l]:n});const c={path:l,info:n,file:{data:new Uint8Array(i),mimeType:n.mimeType}};return this.payloads.set(t,c),c}prepare(t){var r;const s={},i={};if(void 0!==t._resourcePool||void 0!==t.imageAssets)throw Error("Import legacy resources in editor-platform");const n=e=>{s[e.path]=e.info,i[e.path]=e.file},a=t=>{if(!t)return t;const r=this.graphs.get(t);if(r)return r.files.forEach(n),r.graph;const s=/* @__PURE__ */new Map,i=e=>{const t=e;if(Array.isArray(t))return t.map(i);const r=this.writePayload(t);return r?(s.set(r.path,r),r.path):t},o=e({},t);t.images&&(o.images=t.images.map(t=>e(e({},t),{},{url:i(t.url)}))),t.textures&&(o.textures=t.textures.map(r=>{let s=r.userData;if(!s)return r;if(void 0!==s._dataTexBase64||"number"==typeof s._videoSrc||void 0!==t._texDataPool)throw Error("Import legacy texture data in editor-platform");return void 0!==s._videoSrc&&(s=e(e({},s),{},{_videoSrc:i(s._videoSrc)})),s===r.userData?r:e(e({},r),{},{userData:s})}));const a=[...s.values()];return a.forEach(n),this.graphs.set(t,{graph:o,files:a}),o},{assets:l}=t,c=e({},o(t,L));if(t.scene&&(c.scene=a(t.scene)),t.scenes&&(c.scenes=t.scenes.map(e=>this.row(e,"scene",a(e.scene)))),t.materialLibrary&&(c.materialLibrary=t.materialLibrary.map(e=>this.row(e,"material",a(e.material)))),t.prefabLibrary&&(c.prefabLibrary=t.prefabLibrary.map(e=>this.row(e,"snapshot",a(e.snapshot)))),null===(r=t.d)||void 0===r?void 0:r.chartBg){const r=t.d.chartBg,s=a({images:r.images,textures:[r]});c.d=e(e({},t.d),{},{chartBg:e(e({},s.textures[0]),s.images?{images:s.images}:{})})}return{document:c,assets:s,files:i}}};function _(e,t,r){var s,i,n,o;if(!t)return;C(t);const a=/* @__PURE__ */new Map,l=e=>{if(Array.isArray(e))return e.map(l);if("string"!=typeof e)return e;if(!Object.hasOwn(t,e)){if(/^assets\/(image|video)-[a-f0-9]{64}[.-]/.test(e))throw Error(`Missing media asset metadata: ${e}`);return e}return a.has(e)||a.set(e,D(t[e],r(e,t[e]))),a.get(e)},c=e=>{var t,r,s;for(const i of null!==(t=null==e?void 0:e.images)&&void 0!==t?t:[])i.url=l(i.url);for(const i of null!==(r=null==e?void 0:e.textures)&&void 0!==r?r:[])void 0!==(null===(s=i.userData)||void 0===s?void 0:s._videoSrc)&&(i.userData._videoSrc=l(i.userData._videoSrc))};c(e.scene);for(const d of null!==(s=e.scenes)&&void 0!==s?s:[])c(d.scene);for(const d of null!==(i=e.materialLibrary)&&void 0!==i?i:[])c(d.material);for(const d of null!==(n=e.prefabLibrary)&&void 0!==n?n:[])c(d.snapshot);(null===(o=e.d)||void 0===o?void 0:o.chartBg)&&c({images:e.d.chartBg.images,textures:[e.d.chartBg]})}var Z="undefined"!=typeof crypto&&void 0!==crypto.subtle;function K(e){const t=e.replace(/-----BEGIN PUBLIC KEY-----/g,"").replace(/-----END PUBLIC KEY-----/g,"").replace(/\s/g,""),r=atob(t),s=new Uint8Array(r.length);for(let i=0;i<r.length;i++)s[i]=r.charCodeAt(i);return s.buffer}function V(){return(V=t(function*(e){return crypto.subtle.importKey("spki",K(e),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])})).apply(this,arguments)}var F="-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEU2vGIjpJQFRkGxVrw4gZL3dXm/1\nfrZBlUc8gjzam/VNZbT1swQSq/kLPmYH7ZykBvLzp7SpNdvOQ8rAqdSdvg==\n-----END PUBLIC KEY-----";var Y=Z?function(e){return V.apply(this,arguments)}(F):null,J=Z?null:new Uint8Array(K(F)).slice(26);function Q(e){return W.apply(this,arguments)}function W(){return(W=t(function*(e){let t;try{t=function(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=(4-t.length%4)%4,s=atob(t+"=".repeat(r)),i=new Uint8Array(s.length);for(let n=0;n<s.length;n++)i[n]=s.charCodeAt(n);return i}(e)}catch(o){return null}if(t.length<=64)return null;const r=t.slice(0,t.length-64),s=t.slice(t.length-64);let i;try{if(Z){const e=yield Y;i=yield crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},e,s,r)}else{const{p256:e}=yield import("@noble/curves/nist.js");i=e.verify(s,r,J,{lowS:!1})}}catch(a){return null}if(!i)return null;const n=function(e){if(e.length<1)return null;if(123===e[0])try{const t=JSON.parse((new TextDecoder).decode(e));return 2!==t.version||!["runtime","preview"].includes(t.purpose)||"string"!=typeof t.projectId||!t.projectId.trim()||t.projectId.length>64||!Array.isArray(t.adcodes)||!t.adcodes.length||t.adcodes.length>65535||t.adcodes.some(e=>!Number.isInteger(e)||e<0||e>16777215)||new Set(t.adcodes).size!==t.adcodes.length||void 0!==t.expire&&(!Number.isSafeInteger(t.expire)||t.expire<=0)||"preview"===t.purpose&&!t.expire?null:{purpose:t.purpose,projectId:t.projectId,adcodes:t.adcodes,expire:t.expire}}catch(l){return null}const t=e[0],r=!!(2&t),s=!!(4&t),i=!!(8&t);if(-16&t||r&&(s||i))return null;let n,o=1;if(1&t){if(e.length<o+4)return null;n=36e5*((e[o]<<24|e[o+1]<<16|e[o+2]<<8|e[o+3])>>>0),o+=4}let a=null;if(!r){if(e.length<o+1)return null;let t=e[o++];if(i){if(e.length<o+1)return null;t=t<<8|e[o++]}if(!t||e.length!==o+3*t)return null;a=[];for(let r=0;r<t;r++){const t=e[o]<<16|e[o+1]<<8|e[o+2];a.push(t),o+=3}}return o!==e.length?null:{adcodes:a,expire:n,prefixMatch:s}}(r);return n?n.expire&&Date.now()>n.expire?null:n:null})).apply(this,arguments)}function q(e,t,r){return G.apply(this,arguments)}function G(){return(G=t(function*(e,t,r){const s=yield Q(t);if(!(null==s?void 0:s.adcodes)||s.prefixMatch||"preview"===s.purpose||void 0!==r&&s.projectId!==r)return!1;const i=new Set(e),n=new Set(s.adcodes);return i.size>0&&i.size===n.size&&[...i].every(e=>n.has(e))})).apply(this,arguments)}function H(e,t){return X.apply(this,arguments)}function X(){return(X=t(function*(e,t){const r=yield Q(t);return!(!(null==r?void 0:r.adcodes)||r.prefixMatch||"preview"===r.purpose)&&r.adcodes.includes(e)})).apply(this,arguments)}var ee=(e,t)=>{const r=te(e),s=te(t).map(function(e,t){return e^r[Math.floor(t%r.length)]}).join(",");return btoa(s)};function te(e){const t=[];let r=0;for(let s=0;s<e.length;s++){let i=e.charCodeAt(s);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&s+1<e.length&&56320==(64512&e.charCodeAt(s+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++s)),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return t}export{E as _,C as a,y as b,O as c,g as d,v as f,I as g,w as h,R as i,$ as l,b as m,H as n,D as o,A as p,q as r,_ as s,ee as t,j as u,u as v,o as x,f as y};
|
package/dist/index.d.ts
CHANGED
|
@@ -242,7 +242,7 @@ declare class Area extends GroupObject {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
/** Validation is read-only and does not materialize or allocate runtime resources. */
|
|
245
|
-
export declare function assertProjectMaterials(document: Pick<VisSceneDocument, 'schemaVersion' | 'scenes' | 'materialLibrary' | 'prefabLibrary'
|
|
245
|
+
export declare function assertProjectMaterials(document: Pick<VisSceneDocument, 'schemaVersion' | 'scenes' | 'materialLibrary' | 'prefabLibrary'>): void;
|
|
246
246
|
|
|
247
247
|
/** vis-core 的运行时入口只接受编辑平台导出的完整场景文档。 */
|
|
248
248
|
export declare function assertRuntimeSceneDocument(value: unknown): asserts value is VisSceneDocument & Record<string, any>;
|
|
@@ -1858,6 +1858,8 @@ declare class CityPlane extends MeshObject {
|
|
|
1858
1858
|
rebuildFromScene(): void;
|
|
1859
1859
|
}
|
|
1860
1860
|
|
|
1861
|
+
export declare function cloneSceneDocument<T extends VisSceneDocument>(document: T): T;
|
|
1862
|
+
|
|
1861
1863
|
/** Duplicate scene-owned definitions, while retaining references to project assets. */
|
|
1862
1864
|
export declare function cloneSceneMaterials(document: VisSceneDocument, sourceId: string, newSceneId: string): {
|
|
1863
1865
|
scene: SceneViewportDocument;
|
|
@@ -2505,12 +2507,6 @@ declare class EventDispatcher {
|
|
|
2505
2507
|
dispatchEvent(event: DispatcherEvent): void;
|
|
2506
2508
|
}
|
|
2507
2509
|
|
|
2508
|
-
/** Internal: Consume an exclusively owned import copy; pooled slots still get independent payloads. */
|
|
2509
|
-
export declare function expandOwnedSceneDocumentResources<T extends VisSceneDocument>(expanded: T): T;
|
|
2510
|
-
|
|
2511
|
-
/** Expand at the editor import boundary so independently edited scenes own their data. */
|
|
2512
|
-
export declare function expandSceneDocumentResources<T extends VisSceneDocument>(document: T): T;
|
|
2513
|
-
|
|
2514
2510
|
/** Expand renderer pools, including snapshots retained as prefab baselines. */
|
|
2515
2511
|
export declare function expandStructureSnapshot<T extends Record<string, any>>(input: T): T;
|
|
2516
2512
|
|
|
@@ -2939,7 +2935,6 @@ declare class Loader {
|
|
|
2939
2935
|
|
|
2940
2936
|
declare interface LoaderConfig {
|
|
2941
2937
|
create: (manager: LoadingManager, options?: AssetOptions) => any;
|
|
2942
|
-
setPath?: (loader: any, prefix: string) => void;
|
|
2943
2938
|
setResponseType?: (loader: any, responseType: string) => void;
|
|
2944
2939
|
requiresDraco?: boolean;
|
|
2945
2940
|
}
|
|
@@ -3005,6 +3000,7 @@ declare class Map_4 extends Base_3 {
|
|
|
3005
3000
|
private authoredCameraPose?;
|
|
3006
3001
|
private cameraAngleOverrides?;
|
|
3007
3002
|
private bundledMapSwitchKey?;
|
|
3003
|
+
private navigationAssets?;
|
|
3008
3004
|
setRuntimeAssets(catalog?: RuntimeAssetCatalog): void;
|
|
3009
3005
|
private requireMapAuthorization;
|
|
3010
3006
|
protected authorizeSceneOptions(options: Record<string, any>): Promise<void>;
|
|
@@ -3263,6 +3259,14 @@ declare interface MapLabelStyle {
|
|
|
3263
3259
|
fontWeight?: string;
|
|
3264
3260
|
}
|
|
3265
3261
|
|
|
3262
|
+
export declare type MapNavigation = {
|
|
3263
|
+
mode: 'static';
|
|
3264
|
+
} | {
|
|
3265
|
+
mode: 'dynamic';
|
|
3266
|
+
scope: MapExportScope;
|
|
3267
|
+
templates: Partial<Record<MapExportScope['maxLevel'], string>>;
|
|
3268
|
+
};
|
|
3269
|
+
|
|
3266
3270
|
declare interface MapOptions extends BaseOptions {
|
|
3267
3271
|
adcode: number;
|
|
3268
3272
|
mapData?: MapBoundaryData;
|
|
@@ -3494,6 +3498,22 @@ declare type MatrixState = {
|
|
|
3494
3498
|
matrixAutoUpdate?: boolean;
|
|
3495
3499
|
};
|
|
3496
3500
|
|
|
3501
|
+
/** File metadata belongs to the manifest, never to a Three image URL. */
|
|
3502
|
+
declare interface MediaAssetInfo {
|
|
3503
|
+
sha256: string;
|
|
3504
|
+
bytes: number;
|
|
3505
|
+
mimeType: string;
|
|
3506
|
+
kind: 'image' | 'hdr' | 'tga' | 'video' | 'pixels';
|
|
3507
|
+
pixels?: {
|
|
3508
|
+
type: string;
|
|
3509
|
+
width: number;
|
|
3510
|
+
height: number;
|
|
3511
|
+
depth?: number;
|
|
3512
|
+
};
|
|
3513
|
+
}
|
|
3514
|
+
|
|
3515
|
+
declare type MediaAssetManifest = Record<string, MediaAssetInfo>;
|
|
3516
|
+
|
|
3497
3517
|
/** Save author edits without promoting page-local region textures into a shared definition. */
|
|
3498
3518
|
export declare function mergeAuthoredMaterialDefinition(savedDefinition: Record<string, any>, runtimeDefinition: Record<string, any>, options?: {
|
|
3499
3519
|
editedProperties?: string[];
|
|
@@ -4091,11 +4111,6 @@ declare class OrigonPages<T = any> {
|
|
|
4091
4111
|
dispose(): void;
|
|
4092
4112
|
}
|
|
4093
4113
|
|
|
4094
|
-
/** Pack an export copy only; preserve the editor's independent scene snapshots. */
|
|
4095
|
-
export declare function packSceneDocumentResources<T extends VisSceneDocument>(document: T, options?: {
|
|
4096
|
-
encodePixels?: boolean;
|
|
4097
|
-
}): T;
|
|
4098
|
-
|
|
4099
4114
|
/** Page identities are independent of Three's 32 rendering layers. */
|
|
4100
4115
|
declare class Pages {
|
|
4101
4116
|
private readonly indices;
|
|
@@ -4922,6 +4937,8 @@ declare interface RestoreBaseObjectOptions {
|
|
|
4922
4937
|
strictResourceReuse?: boolean;
|
|
4923
4938
|
}
|
|
4924
4939
|
|
|
4940
|
+
export declare function restoreRuntimeImageFiles(value: any, sources: MediaAssetManifest | undefined, files: Record<string, RuntimeImageAsset>): void;
|
|
4941
|
+
|
|
4925
4942
|
/**
|
|
4926
4943
|
* Live resources whose serialized definitions the caller has already verified.
|
|
4927
4944
|
* Reuse is explicit: equal UUIDs alone do not establish equal definitions.
|
|
@@ -4957,14 +4974,16 @@ export declare interface RuntimeAsset {
|
|
|
4957
4974
|
encoding: 'identity' | 'gzip';
|
|
4958
4975
|
bytes: number;
|
|
4959
4976
|
sha256: string;
|
|
4960
|
-
/**
|
|
4961
|
-
data?:
|
|
4977
|
+
/** Owned file bytes; legacy encoded catalogs must be imported by the platform. */
|
|
4978
|
+
data?: ArrayBuffer;
|
|
4962
4979
|
}
|
|
4963
4980
|
|
|
4964
4981
|
export declare interface RuntimeAssetCatalog {
|
|
4965
4982
|
version: 1;
|
|
4966
4983
|
entries: RuntimeAsset[];
|
|
4967
4984
|
scope?: MapExportScope;
|
|
4985
|
+
/** Explicit delivery contract; omitted only in older packages. */
|
|
4986
|
+
mapNavigation?: MapNavigation;
|
|
4968
4987
|
/** Enumerated interaction targets, including regions never opened in the editor. */
|
|
4969
4988
|
regions?: Record<string, number[]>;
|
|
4970
4989
|
declaredSources?: string[];
|
|
@@ -4978,23 +4997,18 @@ export declare interface RuntimeAssetCatalog {
|
|
|
4978
4997
|
baseUrl?: string;
|
|
4979
4998
|
}
|
|
4980
4999
|
|
|
4981
|
-
|
|
4982
|
-
* custom payloads keep their original serialization contract. */
|
|
4983
|
-
declare interface RuntimeImageAsset {
|
|
5000
|
+
export declare interface RuntimeImageAsset {
|
|
4984
5001
|
data: Uint8Array;
|
|
4985
5002
|
mimeType: string;
|
|
4986
5003
|
}
|
|
4987
5004
|
|
|
4988
5005
|
export declare const SCENE_DOCUMENT_FORMAT: "vis-scene";
|
|
4989
5006
|
|
|
4990
|
-
/** Schema 6 extends the document pool to authored material dependencies. */
|
|
4991
|
-
export declare const SCENE_DOCUMENT_RESOURCE_POOL_SCHEMA_VERSION: 6;
|
|
4992
|
-
|
|
4993
5007
|
export declare const SCENE_DOCUMENT_SCHEMA_VERSION: 6;
|
|
4994
5008
|
|
|
4995
5009
|
export declare const SCENE_MANIFEST_FORMAT: "vis-scene-manifest";
|
|
4996
5010
|
|
|
4997
|
-
export declare const SCENE_MANIFEST_SCHEMA_VERSION:
|
|
5011
|
+
export declare const SCENE_MANIFEST_SCHEMA_VERSION: 5;
|
|
4998
5012
|
|
|
4999
5013
|
export declare interface SceneBackInteraction {
|
|
5000
5014
|
trigger: 'click' | 'clickOutside';
|
|
@@ -5098,7 +5112,6 @@ export declare class SceneManager extends Event_2 {
|
|
|
5098
5112
|
private identityTrackedScenes;
|
|
5099
5113
|
private prefabOperations;
|
|
5100
5114
|
private transactionCacheDepth;
|
|
5101
|
-
private materialLibraryResources?;
|
|
5102
5115
|
private invalidatePendingOperations;
|
|
5103
5116
|
private assertGeneration;
|
|
5104
5117
|
private debugInteraction;
|
|
@@ -5140,7 +5153,7 @@ export declare class SceneManager extends Event_2 {
|
|
|
5140
5153
|
private playTransition;
|
|
5141
5154
|
/** 更新可编辑文档,并释放已经不属于文档的非活动场景实例。 */
|
|
5142
5155
|
setDocument(document: VisSceneDocument): void;
|
|
5143
|
-
/** Standalone material consumers
|
|
5156
|
+
/** Standalone material consumers own independent definitions. */
|
|
5144
5157
|
private resolvedMaterialLibrary;
|
|
5145
5158
|
/** Keep scene payloads lazy, while independent material APIs own a resolved catalog. */
|
|
5146
5159
|
private ownDocument;
|
|
@@ -5448,7 +5461,7 @@ declare type SceneSnapshot = Object3DJSON & {
|
|
|
5448
5461
|
/** File transport accepts ZIP bundles; in-memory documents remain available for editor integration. */
|
|
5449
5462
|
export declare type SceneSource = VisSceneDocument | VisSceneManifest | string | SceneBundleBinary;
|
|
5450
5463
|
|
|
5451
|
-
export declare type SceneStructureGraphKey = 'materialAliases' | 'shapes' | '_sharedOptionsPool'
|
|
5464
|
+
export declare type SceneStructureGraphKey = 'materialAliases' | 'shapes' | '_sharedOptionsPool';
|
|
5452
5465
|
|
|
5453
5466
|
/** Metadata is part of an owned structure transaction, never a scalar runtime patch. */
|
|
5454
5467
|
export declare interface SceneStructureObjectPatch {
|
|
@@ -5640,14 +5653,11 @@ declare class SphereShadow extends MeshObject {
|
|
|
5640
5653
|
rebuildFromScene(): void;
|
|
5641
5654
|
}
|
|
5642
5655
|
|
|
5643
|
-
/**
|
|
5644
|
-
*
|
|
5645
|
-
* payloads so scene and catalog copies do not multiply the deployed bytes.
|
|
5646
|
-
*/
|
|
5656
|
+
/** Create independently fetchable scenes; manifest 5 owns file metadata while
|
|
5657
|
+
* each native Three image URL points to one deduplicated media file. */
|
|
5647
5658
|
export declare function splitSceneDocument(document: VisSceneDocument, options?: {
|
|
5648
5659
|
sceneDirectory?: string;
|
|
5649
5660
|
extension?: '.json' | '.json.gz';
|
|
5650
|
-
externalizeImages?: boolean;
|
|
5651
5661
|
omitEditorAssets?: boolean;
|
|
5652
5662
|
}): SplitSceneDocumentBundle;
|
|
5653
5663
|
|
|
@@ -5941,7 +5951,7 @@ declare class UseMaterial extends PointerEvent_2 {
|
|
|
5941
5951
|
|
|
5942
5952
|
declare type ValuesOf<T extends readonly any[]> = T[number];
|
|
5943
5953
|
|
|
5944
|
-
export declare const VERSION = "0.33.
|
|
5954
|
+
export declare const VERSION = "0.33.19";
|
|
5945
5955
|
|
|
5946
5956
|
declare interface Viewport {
|
|
5947
5957
|
left: number;
|
|
@@ -5959,8 +5969,6 @@ export declare interface VisSceneDocument extends SceneDocumentMarker {
|
|
|
5959
5969
|
runtimeAssets?: RuntimeAssetCatalog;
|
|
5960
5970
|
entrySceneId: string;
|
|
5961
5971
|
scenes: SceneViewportDocument[];
|
|
5962
|
-
/** Schema 3: scene payloads; schema 6 also shares material-library payloads. */
|
|
5963
|
-
_resourcePool?: any[];
|
|
5964
5972
|
/** Schema 4: serializable definitions shared by explicit asset identity. */
|
|
5965
5973
|
materialLibrary?: MaterialAsset[];
|
|
5966
5974
|
/** Reusable definitions. SDK-enabled assets are retained in deployment exports. */
|
|
@@ -5973,16 +5981,14 @@ export declare interface VisSceneDocument extends SceneDocumentMarker {
|
|
|
5973
5981
|
|
|
5974
5982
|
export declare interface VisSceneManifest {
|
|
5975
5983
|
format: typeof SCENE_MANIFEST_FORMAT;
|
|
5976
|
-
schemaVersion:
|
|
5984
|
+
schemaVersion: typeof SCENE_MANIFEST_SCHEMA_VERSION;
|
|
5977
5985
|
/** Manifest 4: complete static dependencies, shared by every scene. */
|
|
5978
5986
|
runtimeAssets?: RuntimeAssetCatalog;
|
|
5979
5987
|
entrySceneId: string;
|
|
5980
5988
|
scenes: SceneManifestEntry[];
|
|
5981
5989
|
materialLibrary?: MaterialAsset[];
|
|
5982
|
-
/** Manifest
|
|
5983
|
-
|
|
5984
|
-
/** Externalized image files, relative to the manifest URL. */
|
|
5985
|
-
imageAssets?: string[];
|
|
5990
|
+
/** Manifest 5: media metadata keyed by native image URL. */
|
|
5991
|
+
assets?: MediaAssetManifest;
|
|
5986
5992
|
/** Reusable definitions. Only assets with sdkKey are available for SDK instantiation. */
|
|
5987
5993
|
prefabLibrary?: PrefabAsset[];
|
|
5988
5994
|
c?: Record<string, any>;
|