shop-components 0.0.9 → 0.0.10
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.
|
@@ -11,11 +11,12 @@ import Stats from 'stats-fps.js';
|
|
|
11
11
|
import { Slot } from './slot';
|
|
12
12
|
import { DeviceLines } from './lines';
|
|
13
13
|
import './style.styl';
|
|
14
|
-
|
|
14
|
+
export { Slot };
|
|
15
|
+
export interface Logo {
|
|
15
16
|
name: string;
|
|
16
17
|
target: Mesh;
|
|
17
18
|
}
|
|
18
|
-
interface Skin {
|
|
19
|
+
export interface Skin {
|
|
19
20
|
name: string;
|
|
20
21
|
target: MeshStandardMaterial;
|
|
21
22
|
}
|
|
@@ -103,4 +104,3 @@ export declare class Scene3D {
|
|
|
103
104
|
ticker: () => void;
|
|
104
105
|
destroy(): void;
|
|
105
106
|
}
|
|
106
|
-
export {};
|
|
@@ -5,6 +5,12 @@ export interface SlotProps {
|
|
|
5
5
|
name: string;
|
|
6
6
|
slot: Object3D;
|
|
7
7
|
}
|
|
8
|
+
export interface DeviceInfo {
|
|
9
|
+
name: string;
|
|
10
|
+
id: string;
|
|
11
|
+
url: string;
|
|
12
|
+
logo?: string;
|
|
13
|
+
}
|
|
8
14
|
export declare class Slot extends CSS2DObject {
|
|
9
15
|
private props;
|
|
10
16
|
private _emitter;
|
|
@@ -13,8 +19,9 @@ export declare class Slot extends CSS2DObject {
|
|
|
13
19
|
removeEventListener: <T extends string | symbol>(event: T, fn: (...args: any[]) => void, context?: any) => EventEmitter<string | symbol, any>;
|
|
14
20
|
private _canInstall;
|
|
15
21
|
get hasDevice(): boolean;
|
|
16
|
-
deviceInfo:
|
|
22
|
+
deviceInfo: DeviceInfo | undefined;
|
|
17
23
|
constructor(props: SlotProps);
|
|
24
|
+
install(info: DeviceInfo): Promise<void>;
|
|
18
25
|
getWP: (target: import("three").Vector3) => import("three").Vector3;
|
|
19
26
|
clearSlot(): void;
|
|
20
27
|
enable(): void;
|
package/dist/shop-components.mjs
CHANGED
|
@@ -33566,7 +33566,7 @@ class nL {
|
|
|
33566
33566
|
class j0 extends gq {
|
|
33567
33567
|
constructor(e) {
|
|
33568
33568
|
const t = document.createElement("div");
|
|
33569
|
-
super(t), this.props = e, this._emitter = new $w(), this._slotContainer = new Ss(), this.addEventListener = this._emitter.on.bind(this._emitter), this.removeEventListener = this._emitter.on.bind(this._emitter), this._canInstall = !0, this.
|
|
33569
|
+
super(t), this.props = e, this._emitter = new $w(), this._slotContainer = new Ss(), this.addEventListener = this._emitter.on.bind(this._emitter), this.removeEventListener = this._emitter.on.bind(this._emitter), this._canInstall = !0, this.getWP = this._slotContainer.getWorldPosition.bind(this._slotContainer), this.name = e.name, t.className = "slot-item", t.setAttribute("data-name", this.props.name), this.add(this._slotContainer), this.props.slot.add(this), t.addEventListener("dragover", (i) => {
|
|
33570
33570
|
i.preventDefault();
|
|
33571
33571
|
}), t.addEventListener("click", () => {
|
|
33572
33572
|
this._emitter.emit("slot-on-select", this);
|
|
@@ -33581,24 +33581,27 @@ class j0 extends gq {
|
|
|
33581
33581
|
return;
|
|
33582
33582
|
const s = (r = i.dataTransfer) == null ? void 0 : r.getData("application/json");
|
|
33583
33583
|
if (s) {
|
|
33584
|
-
const o = JSON.parse(s)
|
|
33585
|
-
|
|
33586
|
-
const c = await new nL({ useCache: !0 }).loadAsync(l);
|
|
33587
|
-
if (!c.glb)
|
|
33588
|
-
return;
|
|
33589
|
-
const u = c.glb.clone(!0);
|
|
33590
|
-
this._slotContainer.add(u);
|
|
33584
|
+
const o = JSON.parse(s);
|
|
33585
|
+
await this.install(o);
|
|
33591
33586
|
}
|
|
33592
|
-
|
|
33587
|
+
this._emitter.emit("slot-on-drop", this);
|
|
33593
33588
|
});
|
|
33594
33589
|
}
|
|
33595
33590
|
get hasDevice() {
|
|
33596
33591
|
return this._slotContainer.children.length > 0;
|
|
33597
33592
|
}
|
|
33593
|
+
async install(e) {
|
|
33594
|
+
this.deviceInfo = e, this.clearSlot();
|
|
33595
|
+
const i = await new nL({ useCache: !0 }).loadAsync(e.url);
|
|
33596
|
+
if (!i.glb)
|
|
33597
|
+
return;
|
|
33598
|
+
const s = i.glb.clone(!0);
|
|
33599
|
+
this._slotContainer.add(s), this.element.classList.add("filled");
|
|
33600
|
+
}
|
|
33598
33601
|
clearSlot() {
|
|
33599
33602
|
this._slotContainer.children.forEach((e) => {
|
|
33600
33603
|
e.removeFromParent(), am(e);
|
|
33601
|
-
});
|
|
33604
|
+
}), this.element.classList.remove("filled"), this.deviceInfo = void 0;
|
|
33602
33605
|
}
|
|
33603
33606
|
enable() {
|
|
33604
33607
|
this.element.classList.remove("disable");
|
|
@@ -34351,8 +34354,8 @@ ja.styles = oL`
|
|
|
34351
34354
|
left: var(--left);
|
|
34352
34355
|
top: var(--top);
|
|
34353
34356
|
pointer-events: none;
|
|
34354
|
-
width: 100
|
|
34355
|
-
height: 100
|
|
34357
|
+
width: calc(100% - var(--left));
|
|
34358
|
+
height: calc(100% - var(--top));
|
|
34356
34359
|
}
|
|
34357
34360
|
|
|
34358
34361
|
svg {
|
|
@@ -34423,7 +34426,7 @@ class NZ {
|
|
|
34423
34426
|
), this._container = new Ss(), this._raycaster = new hE(), this._selected = [], this._pointerDownTimeout = 0, this.sceneInfo = {
|
|
34424
34427
|
materials: [],
|
|
34425
34428
|
textures: []
|
|
34426
|
-
}, this.css2dRenderer = new vq(), this._slots = [], this._logos = [], this._skins = [], this.maxSample = 1024, this.sampleCount = 0, this._usePathTracing = !1, this._fpsCache = [], this._fpsCacheMax = 20, this._bodyOpacity = 1, this.lines = new ja(new ge(
|
|
34429
|
+
}, this.css2dRenderer = new vq(), this._slots = [], this._logos = [], this._skins = [], this.maxSample = 1024, this.sampleCount = 0, this._usePathTracing = !1, this._fpsCache = [], this._fpsCacheMax = 20, this._bodyOpacity = 1, this.lines = new ja(new ge(-108, 0)), this._emitter = new $w(), this._sound = new Cq(), this._materialsCache = /* @__PURE__ */ new Map(), this.opacityCache = void 0, this.addEventListener = this._emitter.on.bind(this._emitter), this.removeEventListener = this._emitter.on.bind(this._emitter), this._pointermove = (t) => {
|
|
34427
34430
|
if (this._pointerDownTimeout)
|
|
34428
34431
|
return clearTimeout(this._pointerDownTimeout), this._pointerDownTimeout = 0;
|
|
34429
34432
|
const { top: i, left: s } = this.renderer.domElement.getBoundingClientRect();
|
|
@@ -59917,6 +59920,7 @@ export {
|
|
|
59917
59920
|
rd as Cropper,
|
|
59918
59921
|
nL as SGLBLoader,
|
|
59919
59922
|
NZ as Scene3D,
|
|
59923
|
+
j0 as Slot,
|
|
59920
59924
|
Az as SlotState,
|
|
59921
59925
|
W0 as arrayBufferToUrl,
|
|
59922
59926
|
xq as calculateArrayAverage,
|