vis-core 0.28.14 → 0.28.16
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/command/AddMaterial.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.module.js +77 -32
- package/dist/utils/jsonFetch.d.ts +2 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.module.js
CHANGED
|
@@ -88,7 +88,7 @@ const publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRz
|
|
|
88
88
|
).toString(CryptoJS.enc.Utf8), Ne = JSON.parse(Pe), Ae = Date.now();
|
|
89
89
|
return !Ne.s || Ne.s > Ae ? (this.token = void 0, "") : Ne.e && Ne.e < Ae ? (this.token = void 0, "") : (Ne.isValid = O, Ne);
|
|
90
90
|
}
|
|
91
|
-
}, version = "0.28.
|
|
91
|
+
}, version = "0.28.16";
|
|
92
92
|
/**
|
|
93
93
|
* @license
|
|
94
94
|
* Copyright 2010-2025 Three.js Authors
|
|
@@ -58425,6 +58425,13 @@ class SetMaterialColor extends Command {
|
|
|
58425
58425
|
this.materialSlot
|
|
58426
58426
|
), this.attributeName = t.attributeName, this.oldValue = t.oldValue, this.newValue = t.newValue;
|
|
58427
58427
|
}
|
|
58428
|
+
fixJSON() {
|
|
58429
|
+
const t = this.json;
|
|
58430
|
+
if (this.material) {
|
|
58431
|
+
const r = this.editor.pencil.mList.getKey(this.material);
|
|
58432
|
+
r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
|
|
58433
|
+
}
|
|
58434
|
+
}
|
|
58428
58435
|
}
|
|
58429
58436
|
class SetMaterial extends Command {
|
|
58430
58437
|
constructor(t, r, m, v) {
|
|
@@ -58457,7 +58464,10 @@ class SetMaterial extends Command {
|
|
|
58457
58464
|
}
|
|
58458
58465
|
fixJSON() {
|
|
58459
58466
|
const t = this.json;
|
|
58460
|
-
t && t.oldMaterial && delete t.oldMaterial
|
|
58467
|
+
if (t && t.oldMaterial && delete t.oldMaterial, this.oldMaterial) {
|
|
58468
|
+
const r = this.editor.pencil.mList.getKey(this.oldMaterial);
|
|
58469
|
+
r && r !== t.objectUuid && (console.warn("SetMaterial:fix:", t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
|
|
58470
|
+
}
|
|
58461
58471
|
}
|
|
58462
58472
|
}
|
|
58463
58473
|
function parseMaterial(g) {
|
|
@@ -58518,7 +58528,10 @@ class SetMaterialMap extends Command {
|
|
|
58518
58528
|
}
|
|
58519
58529
|
fixJSON() {
|
|
58520
58530
|
const t = this.json;
|
|
58521
|
-
t && t.oldMap && delete t.oldMap
|
|
58531
|
+
if (t && t.oldMap && delete t.oldMap, this.material) {
|
|
58532
|
+
const r = this.editor.pencil.mList.getKey(this.material);
|
|
58533
|
+
r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
|
|
58534
|
+
}
|
|
58522
58535
|
}
|
|
58523
58536
|
}
|
|
58524
58537
|
function parseTexture(g) {
|
|
@@ -58588,9 +58601,7 @@ class SetMaterialValue extends Command {
|
|
|
58588
58601
|
super(t), this.type = "SetMaterialValue", this.name = `Set Material.${m}`, this.updatable = !0, this.object = r, this.materialSlot = C, this.material = this.editor.getObjectMaterial(r, C), this.oldValue = this.material !== void 0 ? this.material[m] : void 0, this.newValue = v, this.attributeName = m;
|
|
58589
58602
|
}
|
|
58590
58603
|
execute() {
|
|
58591
|
-
this.material !== void 0 && (this.material[this.attributeName] = this.newValue, needsUpdateAttributeName.includes(this.attributeName) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material),
|
|
58592
|
-
this.attributeName === "name" && this.editor.emit("mListChange");
|
|
58593
|
-
}));
|
|
58604
|
+
this.material !== void 0 && (this.material[this.attributeName] = this.newValue, needsUpdateAttributeName.includes(this.attributeName) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material), this.attributeName === "name" && this.editor.emit("mListChange"));
|
|
58594
58605
|
}
|
|
58595
58606
|
undo() {
|
|
58596
58607
|
this.material[this.attributeName] = this.oldValue, needsUpdateAttributeName.includes(this.attributeName) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material), setTimeout(() => {
|
|
@@ -58610,6 +58621,13 @@ class SetMaterialValue extends Command {
|
|
|
58610
58621
|
this.materialSlot
|
|
58611
58622
|
);
|
|
58612
58623
|
}
|
|
58624
|
+
fixJSON() {
|
|
58625
|
+
const t = this.json;
|
|
58626
|
+
if (this.material) {
|
|
58627
|
+
const r = this.editor.pencil.mList.getKey(this.material);
|
|
58628
|
+
r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
|
|
58629
|
+
}
|
|
58630
|
+
}
|
|
58613
58631
|
}
|
|
58614
58632
|
class SetMaterialVector extends Command {
|
|
58615
58633
|
constructor(t, r, m, v, C) {
|
|
@@ -58634,6 +58652,13 @@ class SetMaterialVector extends Command {
|
|
|
58634
58652
|
this.materialSlot
|
|
58635
58653
|
), this.attributeName = t.attributeName, this.oldValue = t.oldValue, this.newValue = t.newValue;
|
|
58636
58654
|
}
|
|
58655
|
+
fixJSON() {
|
|
58656
|
+
const t = this.json;
|
|
58657
|
+
if (this.material) {
|
|
58658
|
+
const r = this.editor.pencil.mList.getKey(this.material);
|
|
58659
|
+
r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
|
|
58660
|
+
}
|
|
58661
|
+
}
|
|
58637
58662
|
}
|
|
58638
58663
|
class SetMaterialMapVector extends Command {
|
|
58639
58664
|
constructor(t, r, m, v, C, _ = "repeat") {
|
|
@@ -58669,6 +58694,13 @@ class SetMaterialMapVector extends Command {
|
|
|
58669
58694
|
this.materialSlot
|
|
58670
58695
|
), this.attributeName = t.attributeName, t.attributeName2 && (this.attributeName2 = t.attributeName2), this.oldValue = t.oldValue, this.newValue = t.newValue, this.attributeName === "repeat" && (this.attributeName = "map");
|
|
58671
58696
|
}
|
|
58697
|
+
fixJSON() {
|
|
58698
|
+
const t = this.json;
|
|
58699
|
+
if (this.material) {
|
|
58700
|
+
const r = this.editor.pencil.mList.getKey(this.material);
|
|
58701
|
+
r && r !== t.objectUuid && (console.warn(`${this.type}:fix:`, t.objectUuid, r), t.objectUuid = r), r && (t.materialSlot = 0);
|
|
58702
|
+
}
|
|
58703
|
+
}
|
|
58672
58704
|
}
|
|
58673
58705
|
class SetPosition extends Command {
|
|
58674
58706
|
constructor(t, r, m, v, C) {
|
|
@@ -58757,11 +58789,13 @@ class SetValue extends Command {
|
|
|
58757
58789
|
}
|
|
58758
58790
|
fixObj() {
|
|
58759
58791
|
const t = this.properties ? this.object[this.properties] : this.object;
|
|
58760
|
-
t.isCamera && ["fov", "left", "right", "top", "bottom", "near", "far"].includes(
|
|
58792
|
+
if (t.isCamera && ["fov", "left", "right", "top", "bottom", "near", "far"].includes(
|
|
58761
58793
|
this.attributeName
|
|
58762
|
-
) && t.updateProjectionMatrix(),
|
|
58763
|
-
|
|
58764
|
-
|
|
58794
|
+
) && t.updateProjectionMatrix(), this.attributeName === "visible") {
|
|
58795
|
+
const r = this.editor.pencil.lead.objMap.get(this.object);
|
|
58796
|
+
r && r[t[this.attributeName] ? "show" : "hide"]();
|
|
58797
|
+
}
|
|
58798
|
+
(this.attributeName === "name" || this.attributeName === "prefab" || this.attributeName === "visible" || this.attributeName === "keepCamera") && this.editor.emit("baseObjectListChange");
|
|
58765
58799
|
}
|
|
58766
58800
|
undo() {
|
|
58767
58801
|
const t = this.properties ? this.object[this.properties] : this.object;
|
|
@@ -58924,26 +58958,37 @@ class AddMaterial extends Command {
|
|
|
58924
58958
|
constructor(r, m) {
|
|
58925
58959
|
super(r);
|
|
58926
58960
|
L0(this, "materialType");
|
|
58961
|
+
L0(this, "flag", !1);
|
|
58927
58962
|
L0(this, "addObjectUuid");
|
|
58928
58963
|
this.type = "AddMaterial", this.name = "Add Material", this.materialType = m;
|
|
58929
58964
|
}
|
|
58930
58965
|
execute() {
|
|
58931
58966
|
return H0(this, null, function* () {
|
|
58932
58967
|
this.addObjectUuid = `material_${this.id}`;
|
|
58933
|
-
const r = this.editor.pencil.mList
|
|
58968
|
+
const r = this.editor.pencil.mList;
|
|
58969
|
+
let m;
|
|
58970
|
+
if (this.materialType.startsWith("k:")) {
|
|
58971
|
+
const v = this.materialType.match(/k:([^|]+)\|s:([^|]+)/);
|
|
58972
|
+
if (v) {
|
|
58973
|
+
const C = v[1], _ = v[2], w = this.editor.pencil.lead.getObject(C);
|
|
58974
|
+
if (w) {
|
|
58975
|
+
const E = w.object3d;
|
|
58976
|
+
m = Array.isArray(E.material) ? E.material[+_] : E.material, this.flag = !0;
|
|
58977
|
+
} else
|
|
58978
|
+
console.warn(`Base object with key ${C} not found.`), m = new MeshBasicMaterial();
|
|
58979
|
+
} else
|
|
58980
|
+
console.warn(`Material type ${this.materialType} is not valid.`), m = new MeshBasicMaterial();
|
|
58981
|
+
} else this.materialType === "MeshLineMaterial" ? m = new Te$1({
|
|
58934
58982
|
color: new Color$1(16777215),
|
|
58935
58983
|
lineWidth: 1,
|
|
58936
58984
|
sizeAttenuation: 0
|
|
58937
|
-
}) : (
|
|
58938
|
-
|
|
58939
|
-
new THREE[this.materialType]()
|
|
58940
|
-
);
|
|
58941
|
-
m.name = `材质_${this.id}`, r.add(this.addObjectUuid, m);
|
|
58985
|
+
}) : m = new THREE[this.materialType]();
|
|
58986
|
+
m.name = `材质_${this.id}`, r.add(this.addObjectUuid, m), this.flag && this.editor.emit("materialChanged");
|
|
58942
58987
|
});
|
|
58943
58988
|
}
|
|
58944
58989
|
undo() {
|
|
58945
58990
|
return H0(this, null, function* () {
|
|
58946
|
-
this.editor.pencil.mList.remove(this.addObjectUuid);
|
|
58991
|
+
this.editor.pencil.mList.remove(this.addObjectUuid), this.flag && this.editor.emit("materialChanged");
|
|
58947
58992
|
});
|
|
58948
58993
|
}
|
|
58949
58994
|
toJSON() {
|
|
@@ -59327,7 +59372,7 @@ class History {
|
|
|
59327
59372
|
const Ne = parseInt(Pe.url.replace("$rp-", ""));
|
|
59328
59373
|
Pe._url ? (Pe.url = Bi(Q0({}, Pe._url), {
|
|
59329
59374
|
data: decodeUrlSafeBase64ToArrayBuffer(m[Ne])
|
|
59330
|
-
}), delete Pe._url) : Pe.url = m[Ne]
|
|
59375
|
+
}), delete Pe._url) : Pe.url = m[Ne];
|
|
59331
59376
|
}
|
|
59332
59377
|
});
|
|
59333
59378
|
}
|
|
@@ -59369,7 +59414,7 @@ class History {
|
|
|
59369
59414
|
return H0(this, null, function* () {
|
|
59370
59415
|
t.fromJSON(t.json);
|
|
59371
59416
|
try {
|
|
59372
|
-
!["AddObject", "CopyMaterial", "RemoveMaterial"].includes(t.json.type) && t.json.objectUuid && !t.object || (yield t.execute(), t.fixJSON());
|
|
59417
|
+
!["AddObject", "CopyMaterial", "RemoveMaterial"].includes(t.json.type) && t.json.objectUuid && !t.object || (yield t.execute(), this.editor.playing || t.fixJSON());
|
|
59373
59418
|
} catch (r) {
|
|
59374
59419
|
console.error(r, t);
|
|
59375
59420
|
}
|
|
@@ -59911,20 +59956,20 @@ class Config {
|
|
|
59911
59956
|
};
|
|
59912
59957
|
}
|
|
59913
59958
|
}
|
|
59914
|
-
const jsonFetch = (g, t, r =
|
|
59915
|
-
const m = makePromiseCreator(!0)
|
|
59916
|
-
return window.fetch(g).then((
|
|
59917
|
-
let
|
|
59918
|
-
if (
|
|
59919
|
-
return
|
|
59920
|
-
const
|
|
59921
|
-
return new Response(
|
|
59922
|
-
}) :
|
|
59959
|
+
const isGzip = (g) => !!(g.endsWith(".gzip") || g.endsWith(".gz")), jsonFetch = (g, t, r = isGzip) => {
|
|
59960
|
+
const m = makePromiseCreator(!0);
|
|
59961
|
+
return window.fetch(g).then((v) => {
|
|
59962
|
+
let C = v;
|
|
59963
|
+
if (C.ok)
|
|
59964
|
+
return r(g) && C.headers.get("content-encoding") !== "gzip" ? C.blob().then((_) => {
|
|
59965
|
+
const w = new DecompressionStream("gzip"), E = _.stream().pipeThrough(w);
|
|
59966
|
+
return new Response(E);
|
|
59967
|
+
}) : C;
|
|
59923
59968
|
throw new Error("Network response was not ok.");
|
|
59924
|
-
}).then((
|
|
59925
|
-
m.resolve(
|
|
59926
|
-
}).catch((
|
|
59927
|
-
m.reject(
|
|
59969
|
+
}).then((v) => v.json()).then((v) => {
|
|
59970
|
+
m.resolve(v);
|
|
59971
|
+
}).catch((v) => {
|
|
59972
|
+
m.reject(v);
|
|
59928
59973
|
}), m.promise;
|
|
59929
59974
|
};
|
|
59930
59975
|
class Editor {
|
|
@@ -3,5 +3,6 @@ type DownloadProgress = {
|
|
|
3
3
|
transferredBytes: number;
|
|
4
4
|
totalBytes: number;
|
|
5
5
|
};
|
|
6
|
-
declare const
|
|
6
|
+
export declare const isGzip: (url: string) => boolean;
|
|
7
|
+
declare const _default: (url: string, onDownloadProgress?: (progress: DownloadProgress) => void, gzip?: (url: string) => boolean) => Promise<any>;
|
|
7
8
|
export default _default;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.28.
|
|
1
|
+
declare const _default: "0.28.16";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vis-core",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.16",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "npm run version && PORT=5173 bundler-dev",
|
|
6
|
-
"build:site": "npm run version && bundler",
|
|
6
|
+
"build:site": "npm run version && PUBLIC_EXCLUDE=true bundler",
|
|
7
7
|
"build:lib": "npm run version && PUBLIC_EXCLUDE=true BUILD_LIBRARY=src/sdk/index.ts CSS_EXTRACT=false bundler && npm run build:type",
|
|
8
8
|
"build:type": "BUILD_LIBRARY=src/sdk/index.ts bundler-type",
|
|
9
9
|
"preview": "bundler-preview",
|