vis-core 0.23.2 → 0.23.3
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/editor/config.d.ts +19 -0
- package/dist/editor/index.d.ts +2 -11
- package/dist/editor/scripts.d.ts +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.module.js +59 -38
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -90,7 +90,7 @@ const publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRz
|
|
|
90
90
|
).toString(CryptoJS.enc.Utf8), qe = JSON.parse($e), st = Date.now();
|
|
91
91
|
return !qe.s || qe.s > st ? (this.token = void 0, "") : qe.e && qe.e < st ? (this.token = void 0, "") : (qe.isValid = Qe, qe);
|
|
92
92
|
}
|
|
93
|
-
}, version = "0.23.
|
|
93
|
+
}, version = "0.23.3";
|
|
94
94
|
/**
|
|
95
95
|
* @license
|
|
96
96
|
* Copyright 2010-2024 Three.js Authors
|
|
@@ -48558,7 +48558,7 @@ class Command {
|
|
|
48558
48558
|
return e.type = this.type, e.id = this.id, e.name = this.name, e.updatable = this.updatable, e;
|
|
48559
48559
|
}
|
|
48560
48560
|
fromJSON(e) {
|
|
48561
|
-
if (this.type = e.type, this.id = e.id, this.name = e.name, this.updatable = e.updatable, !this.editor.jsonVersion && e.objectUuid) {
|
|
48561
|
+
if (this.type = e.type, this.id = e.id, this.name = e.name, this.updatable = e.updatable, !this.editor.config.meta.jsonVersion && e.objectUuid) {
|
|
48562
48562
|
const s = this.editor.objectByUuid(e.objectUuid);
|
|
48563
48563
|
s && (e.objectUuid = this.editor.uuidByObject(s));
|
|
48564
48564
|
const r = this.editor.baseObjectByUuid(e.objectUuid);
|
|
@@ -49627,10 +49627,23 @@ class Scripts {
|
|
|
49627
49627
|
beforeExecuteUndo: [],
|
|
49628
49628
|
afterExecuteUndo: [],
|
|
49629
49629
|
beforeShow: [],
|
|
49630
|
-
afterShow: []
|
|
49630
|
+
afterShow: [],
|
|
49631
|
+
beforeFromJSON: [],
|
|
49632
|
+
afterFromJSON: [],
|
|
49633
|
+
errorFromJSON: []
|
|
49631
49634
|
});
|
|
49632
49635
|
H0(this, "source", "");
|
|
49633
|
-
this.editor = e
|
|
49636
|
+
this.editor = e, this.addEvents({
|
|
49637
|
+
beforeFromJSON: () => {
|
|
49638
|
+
window.postMessage({ type: "vis-core.fromJSON.start" }), console.time("vis-core:time.fromJSON");
|
|
49639
|
+
},
|
|
49640
|
+
afterFromJSON: () => {
|
|
49641
|
+
window.postMessage({ type: "vis-core.fromJSON.end" }), console.timeEnd("vis-core:time.fromJSON");
|
|
49642
|
+
},
|
|
49643
|
+
errorFromJSON: () => {
|
|
49644
|
+
window.postMessage({ type: "vis-core.fromJSON.error" }), console.timeEnd("vis-core:time.fromJSON");
|
|
49645
|
+
}
|
|
49646
|
+
});
|
|
49634
49647
|
}
|
|
49635
49648
|
addEvents(e) {
|
|
49636
49649
|
for (const s in e) {
|
|
@@ -49667,6 +49680,40 @@ class Scripts {
|
|
|
49667
49680
|
return r;
|
|
49668
49681
|
}
|
|
49669
49682
|
}
|
|
49683
|
+
class Config {
|
|
49684
|
+
constructor(e) {
|
|
49685
|
+
H0(this, "editor");
|
|
49686
|
+
H0(this, "meta", {
|
|
49687
|
+
name: "",
|
|
49688
|
+
key: "",
|
|
49689
|
+
open: !1,
|
|
49690
|
+
jsonVersion: "0.0.0",
|
|
49691
|
+
sdkVersion: "0.0.0"
|
|
49692
|
+
});
|
|
49693
|
+
this.editor = e;
|
|
49694
|
+
}
|
|
49695
|
+
setConfig(e, s) {
|
|
49696
|
+
this.meta[e] = s, this.editor.emit("configChanged", ai({}, this.meta));
|
|
49697
|
+
}
|
|
49698
|
+
fromJSON(e) {
|
|
49699
|
+
Object.keys(e).forEach((s) => {
|
|
49700
|
+
const r = s === "version" ? "jsonVersion" : s;
|
|
49701
|
+
r in this.meta && this.setConfig(r, e[s]);
|
|
49702
|
+
});
|
|
49703
|
+
}
|
|
49704
|
+
compareVersion() {
|
|
49705
|
+
compareVersion(this.meta.jsonVersion, this.meta.sdkVersion) === 1 && console.warn(
|
|
49706
|
+
"vis-core 版本过低,可能会出现问题",
|
|
49707
|
+
"json:" + this.meta.jsonVersion,
|
|
49708
|
+
"sdk:" + this.meta.sdkVersion
|
|
49709
|
+
);
|
|
49710
|
+
}
|
|
49711
|
+
toJSON() {
|
|
49712
|
+
return {
|
|
49713
|
+
version: this.meta.sdkVersion
|
|
49714
|
+
};
|
|
49715
|
+
}
|
|
49716
|
+
}
|
|
49670
49717
|
const jsonFetch = (c, e, s = !1) => {
|
|
49671
49718
|
const r = makePromiseCreator(!0), T = c.endsWith("gzip") || s;
|
|
49672
49719
|
return window.fetch(c).then((de) => {
|
|
@@ -49692,14 +49739,10 @@ class Editor {
|
|
|
49692
49739
|
H0(this, "history");
|
|
49693
49740
|
H0(this, "viewport");
|
|
49694
49741
|
H0(this, "scripts");
|
|
49742
|
+
H0(this, "config");
|
|
49695
49743
|
H0(this, "pencil");
|
|
49696
49744
|
H0(this, "on", this.events.on.bind(this.events));
|
|
49697
49745
|
H0(this, "emit", this.events.emit.bind(this.events));
|
|
49698
|
-
H0(this, "sdkVersion", version);
|
|
49699
|
-
H0(this, "jsonVersion");
|
|
49700
|
-
H0(this, "key");
|
|
49701
|
-
H0(this, "name");
|
|
49702
|
-
H0(this, "open", !1);
|
|
49703
49746
|
H0(this, "options");
|
|
49704
49747
|
H0(this, "selectOption", []);
|
|
49705
49748
|
H0(this, "selectOption2", []);
|
|
@@ -49719,7 +49762,7 @@ class Editor {
|
|
|
49719
49762
|
processUndosMaxFrameTime: Number.MAX_VALUE
|
|
49720
49763
|
}, e), this.events.setMaxListeners(9999999), this.viewport = new Viewport(this, {
|
|
49721
49764
|
visFactories: e.visFactories
|
|
49722
|
-
}), this.history = new History(this), this.scripts = new Scripts(this);
|
|
49765
|
+
}), this.history = new History(this), this.scripts = new Scripts(this), this.config = new Config(this), this.config.setConfig("sdkVersion", version);
|
|
49723
49766
|
}
|
|
49724
49767
|
getObjectMaterial(e, s) {
|
|
49725
49768
|
if (!e)
|
|
@@ -49814,7 +49857,7 @@ class Editor {
|
|
|
49814
49857
|
object: s.camera,
|
|
49815
49858
|
uuid: "camera"
|
|
49816
49859
|
}
|
|
49817
|
-
), !this.jsonVersion) {
|
|
49860
|
+
), !this.config.meta.jsonVersion) {
|
|
49818
49861
|
const Xe = new window.Map();
|
|
49819
49862
|
de.forEach((Ke, Je) => {
|
|
49820
49863
|
Xe.has(Ke.name) ? Ke.fixUuid = Ke.name + "_" + Je : (Ke.fixUuid = Ke.name, Xe.set(Ke.name, !0));
|
|
@@ -49844,7 +49887,7 @@ class Editor {
|
|
|
49844
49887
|
try {
|
|
49845
49888
|
s && !n$1(s) ? console.warn(
|
|
49846
49889
|
"fromJSON 第二个参数已修改,{beforeSetVisOptions:(r)=>r} 替代"
|
|
49847
|
-
) : s && this.scripts.addEvents(s),
|
|
49890
|
+
) : s && this.scripts.addEvents(s), this.scripts.dispatch("beforeFromJSON");
|
|
49848
49891
|
let Ke;
|
|
49849
49892
|
if (typeof e == "string") {
|
|
49850
49893
|
const Je = this.options.assetsPrefix + e, { res: Qe } = yield jsonFetch(Je);
|
|
@@ -49858,20 +49901,16 @@ class Editor {
|
|
|
49858
49901
|
if (!Je || !Je.isValid)
|
|
49859
49902
|
throw new Error("need accessToken");
|
|
49860
49903
|
}
|
|
49861
|
-
if (
|
|
49862
|
-
"vis-core 版本过低,可能会出现问题",
|
|
49863
|
-
"json:" + Ke.c.version,
|
|
49864
|
-
"sdk:" + this.sdkVersion
|
|
49865
|
-
), this.setConfig(Ke.c), this.history.fromJSON(Ke.h), this.viewport.fromJSON(Ke.v), Ke.s && this.scripts.fromJSON(Ke.s), yield this.history.processUndos(this.options.processUndosMaxFrameTime), (r = Ke.v.bg) != null && r.texture && this.viewport.vis) {
|
|
49904
|
+
if (this.config.fromJSON(Ke.c), this.config.compareVersion(), this.history.fromJSON(Ke.h), this.viewport.fromJSON(Ke.v), Ke.s && this.scripts.fromJSON(Ke.s), yield this.history.processUndos(this.options.processUndosMaxFrameTime), (r = Ke.v.bg) != null && r.texture && this.viewport.vis) {
|
|
49866
49905
|
const Je = parseTexture(Ke.v.bg.texture);
|
|
49867
49906
|
Je.colorSpace = SRGBColorSpace, this.viewport.vis.pencil.scene.background = Je;
|
|
49868
49907
|
}
|
|
49869
|
-
return this.scripts.dispatch("beforeShow"), (T = this.viewport.vis) == null || T.show(), this.scripts.dispatch("afterShow"), (de = this.pencil.controls) == null || de.saveState(), this.select(null),
|
|
49908
|
+
return this.scripts.dispatch("beforeShow"), (T = this.viewport.vis) == null || T.show(), this.scripts.dispatch("afterShow"), (de = this.pencil.controls) == null || de.saveState(), this.select(null), (Xe = this.viewport.vis) != null && Xe.workerOnce && this.playing && window.requestIdleCallback(() => {
|
|
49870
49909
|
var Je;
|
|
49871
49910
|
(Je = this.viewport.vis) == null || Je.worker.dispose();
|
|
49872
|
-
}), Ke;
|
|
49911
|
+
}), this.scripts.dispatch("afterFromJSON"), Ke;
|
|
49873
49912
|
} catch (Ke) {
|
|
49874
|
-
throw
|
|
49913
|
+
throw this.scripts.dispatch("errorFromJSON"), new Error("fromJSON error:" + Ke);
|
|
49875
49914
|
}
|
|
49876
49915
|
});
|
|
49877
49916
|
}
|
|
@@ -49884,24 +49923,6 @@ class Editor {
|
|
|
49884
49923
|
}
|
|
49885
49924
|
setViewportVis(...e) {
|
|
49886
49925
|
}
|
|
49887
|
-
setConfig(e) {
|
|
49888
|
-
const s = {
|
|
49889
|
-
name: this.name,
|
|
49890
|
-
key: this.key,
|
|
49891
|
-
version: this.jsonVersion,
|
|
49892
|
-
open: this.open
|
|
49893
|
-
};
|
|
49894
|
-
e.name && typeof e.name == "string" && (this.name = e.name), e.key !== void 0 && (this.key = e.key), e.version !== void 0 && (this.jsonVersion = e.version), e.open !== void 0 && (this.open = e.open), this.emit(
|
|
49895
|
-
"configChanged",
|
|
49896
|
-
{
|
|
49897
|
-
name: this.name,
|
|
49898
|
-
key: this.key,
|
|
49899
|
-
version: this.jsonVersion,
|
|
49900
|
-
open: this.open
|
|
49901
|
-
},
|
|
49902
|
-
s
|
|
49903
|
-
);
|
|
49904
|
-
}
|
|
49905
49926
|
getDataURL() {
|
|
49906
49927
|
return this.pencil ? (this.pencil.render(), this.pencil.renderer.domElement.toDataURL()) : "";
|
|
49907
49928
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.23.
|
|
1
|
+
declare const _default: "0.23.3";
|
|
2
2
|
export default _default;
|