shop-components 0.1.67 → 0.1.68
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.
|
@@ -21,6 +21,7 @@ export declare class DeviceViewer extends LitElement {
|
|
|
21
21
|
theme: undefined | string;
|
|
22
22
|
onChange: undefined | Function;
|
|
23
23
|
usePathTracing: boolean;
|
|
24
|
+
actions: string[];
|
|
24
25
|
shelfLevel: number;
|
|
25
26
|
shapeKeys: Map<any, any>;
|
|
26
27
|
colors: Skin[];
|
|
@@ -43,6 +44,8 @@ export declare class DeviceViewer extends LitElement {
|
|
|
43
44
|
clearAMR: () => void;
|
|
44
45
|
exportAMR: () => Promise<void>;
|
|
45
46
|
addAMR: () => void;
|
|
47
|
+
playAction: (name: string) => void;
|
|
48
|
+
pauseAction: (name: string) => void;
|
|
46
49
|
clean: () => void;
|
|
47
50
|
recreate: () => void;
|
|
48
51
|
setShapeKey: (key: string, val: any) => void;
|
|
@@ -10,6 +10,8 @@ export interface SlotProps {
|
|
|
10
10
|
}>;
|
|
11
11
|
slot: Object3D;
|
|
12
12
|
show: boolean;
|
|
13
|
+
isMirror: boolean;
|
|
14
|
+
mirrorTarget?: string;
|
|
13
15
|
}
|
|
14
16
|
export interface DeviceInfo {
|
|
15
17
|
name: string;
|
|
@@ -52,7 +54,10 @@ export declare class Slot extends CSS2DObject {
|
|
|
52
54
|
get hasDevice(): boolean;
|
|
53
55
|
deviceInfo: DeviceInfo | undefined;
|
|
54
56
|
holeTarget: Object3D | undefined;
|
|
57
|
+
mirrorTarget: Slot | undefined;
|
|
55
58
|
private _showSlot;
|
|
59
|
+
private _isMirror;
|
|
60
|
+
get isMirror(): boolean;
|
|
56
61
|
constructor(props: SlotProps);
|
|
57
62
|
private _preventDefaults;
|
|
58
63
|
shapeKeyChanged(key: string, value: number): void;
|
package/dist/shop-components.mjs
CHANGED
|
@@ -57414,14 +57414,14 @@ const Rt = {
|
|
|
57414
57414
|
class kx extends V0 {
|
|
57415
57415
|
constructor(A) {
|
|
57416
57416
|
const e = document.createElement("div");
|
|
57417
|
-
super(e), this.props = A, this._emitter = new sr(), this._slotContainer = new St(), this._bracketSlots = [], this._hasError = !1, this.useBracket = !1, this.addEventListener = this._emitter.addListener.bind(this._emitter), this.removeEventListener = this._emitter.removeListener.bind(this._emitter), this._canInstall = !1, this._loading = !1, this._selected = !1, this._deviceSelected = !1, this._allFunctions = /* @__PURE__ */ new Set(), this._functions = /* @__PURE__ */ new Set(), this._timer = 0, this._parentPos = new O(), this._wrapper = new St(), this._showSlot = !0, this._preventDefaults = (t) => {
|
|
57417
|
+
super(e), this.props = A, this._emitter = new sr(), this._slotContainer = new St(), this._bracketSlots = [], this._hasError = !1, this.useBracket = !1, this.addEventListener = this._emitter.addListener.bind(this._emitter), this.removeEventListener = this._emitter.removeListener.bind(this._emitter), this._canInstall = !1, this._loading = !1, this._selected = !1, this._deviceSelected = !1, this._allFunctions = /* @__PURE__ */ new Set(), this._functions = /* @__PURE__ */ new Set(), this._timer = 0, this._parentPos = new O(), this._wrapper = new St(), this._showSlot = !0, this._isMirror = !1, this._preventDefaults = (t) => {
|
|
57418
57418
|
t.preventDefault(), t.stopPropagation();
|
|
57419
|
-
}, this.getWP = this._slotContainer.getWorldPosition.bind(this._slotContainer), this._showSlot = typeof A.show == "boolean" ? A.show : !0, this.name = A.name, this._slotUI = new qt({
|
|
57419
|
+
}, this.getWP = this._slotContainer.getWorldPosition.bind(this._slotContainer), this._showSlot = typeof A.show == "boolean" ? A.show : !0, this.name = A.name, this._isMirror = A.isMirror, this._slotUI = new qt({
|
|
57420
57420
|
name: A.name,
|
|
57421
57421
|
onRemove: () => {
|
|
57422
57422
|
this.clearSlot(), this._emitter.emit(Rt.ON_DEVICE_DELETED);
|
|
57423
57423
|
}
|
|
57424
|
-
}), this._slotUI.slot = this, this._slotUI.hide = !this._showSlot, e.append(this._slotUI), this._parentPos.copy(this.props.slot.position), this._slotUI.addEventListener("function-removed", ({ detail: t }) => {
|
|
57424
|
+
}), this._slotUI.slot = this, this._slotUI.hide = !this._showSlot || this.isMirror, e.append(this._slotUI), this._parentPos.copy(this.props.slot.position), this._slotUI.addEventListener("function-removed", ({ detail: t }) => {
|
|
57425
57425
|
this.removeFunction(t);
|
|
57426
57426
|
}), this._slotUI.addEventListener("function-added", ({ detail: t }) => {
|
|
57427
57427
|
this.addFunction(t);
|
|
@@ -57456,6 +57456,9 @@ class kx extends V0 {
|
|
|
57456
57456
|
get hasDevice() {
|
|
57457
57457
|
return this._slotContainer.children.length > 0;
|
|
57458
57458
|
}
|
|
57459
|
+
get isMirror() {
|
|
57460
|
+
return this._isMirror;
|
|
57461
|
+
}
|
|
57459
57462
|
shapeKeyChanged(A, e) {
|
|
57460
57463
|
var t;
|
|
57461
57464
|
if (this.props.follows.has(A)) {
|
|
@@ -57491,7 +57494,7 @@ class kx extends V0 {
|
|
|
57491
57494
|
throw new Error(`Fail to load device from: ${A.url}`);
|
|
57492
57495
|
if (e.traverse((t) => {
|
|
57493
57496
|
t.userData.isDevice = !0;
|
|
57494
|
-
}), A.bracketUrl) {
|
|
57497
|
+
}), this.isMirror && e.scale.set(1, 1, -1), A.bracketUrl) {
|
|
57495
57498
|
const t = await this.loadGlb(A.bracketUrl);
|
|
57496
57499
|
if (t)
|
|
57497
57500
|
this.clearSlot(), this._emitter.emit(Rt.ON_DEVICE_REPLACED), t.traverse((i) => {
|
|
@@ -57504,7 +57507,7 @@ class kx extends V0 {
|
|
|
57504
57507
|
});
|
|
57505
57508
|
} else
|
|
57506
57509
|
this.clearSlot(), this._emitter.emit(Rt.ON_DEVICE_REPLACED), this._slotContainer.add(e);
|
|
57507
|
-
this.deviceInfo = A, this._slotUI.deviceName = A.name, this._slotUI.filled = !0, this.holeTarget && (this.holeTarget.visible = !1);
|
|
57510
|
+
this.mirrorTarget && this.mirrorTarget.install(A), this.deviceInfo = A, this._slotUI.deviceName = A.name, this._slotUI.filled = !0, this.holeTarget && (this.holeTarget.visible = !1);
|
|
57508
57511
|
} catch (e) {
|
|
57509
57512
|
throw e;
|
|
57510
57513
|
} finally {
|
|
@@ -57545,7 +57548,7 @@ class kx extends V0 {
|
|
|
57545
57548
|
clearSlot() {
|
|
57546
57549
|
this._bracketSlots = [], this._slotContainer.children.forEach((A) => {
|
|
57547
57550
|
A.removeFromParent(), Oi(A);
|
|
57548
|
-
}), this._slotUI.filled = !1, this.deviceInfo = void 0, this._slotUI.deviceName = "", this.holeTarget && (this.holeTarget.visible = !0);
|
|
57551
|
+
}), this._slotUI.filled = !1, this.deviceInfo = void 0, this._slotUI.deviceName = "", this.holeTarget && (this.holeTarget.visible = !0), this.mirrorTarget && this.mirrorTarget.clearSlot();
|
|
57549
57552
|
}
|
|
57550
57553
|
enable() {
|
|
57551
57554
|
this._slotUI.disable = !1;
|
|
@@ -62724,6 +62727,8 @@ class Pj extends Ie {
|
|
|
62724
62727
|
this.shapeKeys.has(s) && (this.sizeBox.follow = s, this.sizeBox.followOrigin = this._shapeKeys.get(s) || 0, this.sizeBox.followScale = e.userData[r]);
|
|
62725
62728
|
}
|
|
62726
62729
|
});
|
|
62730
|
+
}), this.slots.forEach((e) => {
|
|
62731
|
+
e.props.mirrorTarget && (e.mirrorTarget = this.slots.find((t) => t.props.slot.name === e.props.mirrorTarget));
|
|
62727
62732
|
}), A.updateMatrixWorld(!0), this._container.add(A), this.sizeBox.generate(A), this.sizeBox.show();
|
|
62728
62733
|
}
|
|
62729
62734
|
// 设置长宽高,针对可配置的车体生效
|
|
@@ -62881,59 +62886,62 @@ class Pj extends Ie {
|
|
|
62881
62886
|
}
|
|
62882
62887
|
}
|
|
62883
62888
|
generateSlot(A, e) {
|
|
62889
|
+
var t;
|
|
62884
62890
|
if (A.userData.isSlot) {
|
|
62885
|
-
const t = A.userData.name;
|
|
62886
|
-
if (
|
|
62887
|
-
const
|
|
62888
|
-
let
|
|
62889
|
-
|
|
62890
|
-
|
|
62891
|
+
const i = A.userData.name, r = A.userData.isMirror, s = (t = A.userData.mirrorSlot) == null ? void 0 : t.name;
|
|
62892
|
+
if (i) {
|
|
62893
|
+
const o = A.userData.holeTarget && A.userData.holeTarget.name;
|
|
62894
|
+
let a;
|
|
62895
|
+
o && e.traverse((c) => {
|
|
62896
|
+
c.name === o && (a = c);
|
|
62891
62897
|
});
|
|
62892
|
-
const
|
|
62893
|
-
Object.keys(A.userData).forEach((
|
|
62894
|
-
if (
|
|
62895
|
-
const
|
|
62896
|
-
if (
|
|
62897
|
-
let
|
|
62898
|
-
|
|
62899
|
-
scale:
|
|
62900
|
-
origin: this.shapeKeys.get(
|
|
62898
|
+
const l = /* @__PURE__ */ new Map();
|
|
62899
|
+
Object.keys(A.userData).forEach((c) => {
|
|
62900
|
+
if (c.startsWith("follow_")) {
|
|
62901
|
+
const h = c.split("_")[1];
|
|
62902
|
+
if (h) {
|
|
62903
|
+
let f = A.userData[c];
|
|
62904
|
+
l.set(h, {
|
|
62905
|
+
scale: f,
|
|
62906
|
+
origin: this.shapeKeys.get(h) || 0
|
|
62901
62907
|
});
|
|
62902
62908
|
}
|
|
62903
62909
|
}
|
|
62904
62910
|
});
|
|
62905
|
-
const
|
|
62906
|
-
name:
|
|
62907
|
-
follows:
|
|
62911
|
+
const u = new kx({
|
|
62912
|
+
name: i,
|
|
62913
|
+
follows: l,
|
|
62908
62914
|
slot: A,
|
|
62909
|
-
show: this._showSlots
|
|
62915
|
+
show: this._showSlots,
|
|
62916
|
+
isMirror: r,
|
|
62917
|
+
mirrorTarget: s
|
|
62910
62918
|
});
|
|
62911
|
-
return
|
|
62919
|
+
return u.holeTarget = a, u.addEventListener(Rt.ON_DROP, (c) => {
|
|
62912
62920
|
this._app && this._app.props.useSound && this._app.sound.play();
|
|
62913
|
-
}),
|
|
62914
|
-
this._slots.forEach((
|
|
62915
|
-
|
|
62921
|
+
}), u.addEventListener(Rt.ON_BEFORE_SELECTED, (c) => {
|
|
62922
|
+
this._slots.forEach((h) => {
|
|
62923
|
+
h.selected && (h.selected = !1);
|
|
62916
62924
|
});
|
|
62917
|
-
}),
|
|
62925
|
+
}), u.addEventListener(Rt.ON_ERROR_STATE_CHANGE, (c) => {
|
|
62918
62926
|
if (this._app)
|
|
62919
|
-
if (this._app._outlinePassError.selectedObjects = this._app._outlinePassError.selectedObjects.filter((
|
|
62920
|
-
if (
|
|
62921
|
-
if (this._app._outlinePassError.selectedObjects.find((
|
|
62922
|
-
var
|
|
62923
|
-
return
|
|
62927
|
+
if (this._app._outlinePassError.selectedObjects = this._app._outlinePassError.selectedObjects.filter((h) => !!h.parent), c) {
|
|
62928
|
+
if (u.device) {
|
|
62929
|
+
if (this._app._outlinePassError.selectedObjects.find((f) => {
|
|
62930
|
+
var p;
|
|
62931
|
+
return f.parent == ((p = u.device) == null ? void 0 : p.parent);
|
|
62924
62932
|
}))
|
|
62925
62933
|
return;
|
|
62926
62934
|
this._app._outlinePassError.selectedObjects = [
|
|
62927
|
-
|
|
62935
|
+
u.device,
|
|
62928
62936
|
...this._app._outlinePassError.selectedObjects
|
|
62929
62937
|
];
|
|
62930
62938
|
}
|
|
62931
62939
|
} else
|
|
62932
|
-
|
|
62933
|
-
var
|
|
62934
|
-
return
|
|
62940
|
+
u.device && (this._app._outlinePassError.selectedObjects = this._app._outlinePassError.selectedObjects.filter((h) => {
|
|
62941
|
+
var f;
|
|
62942
|
+
return h.parent != ((f = u.device) == null ? void 0 : f.parent);
|
|
62935
62943
|
}));
|
|
62936
|
-
}),
|
|
62944
|
+
}), u;
|
|
62937
62945
|
}
|
|
62938
62946
|
}
|
|
62939
62947
|
}
|