shop-components 0.4.19 → 0.4.20
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/dev/src/scene.d.ts +2 -0
- package/dist/shop-components.cjs +32 -28
- package/dist/shop-components.mjs +104 -54
- package/package.json +1 -1
package/dist/shop-components.mjs
CHANGED
|
@@ -9185,7 +9185,7 @@ class zr extends ze {
|
|
|
9185
9185
|
const t = document.createElement("div");
|
|
9186
9186
|
super(t), this.props = e, this._emitter = new kt(), this._slotContainer = new me(), 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._focused = !1, this._toBeInstalled = !1, this._toBeReplaced = !1, this._allFunctions = /* @__PURE__ */ new Set(), this._functions = /* @__PURE__ */ new Set(), this._timer = 0, this._parentPos = new b(), this._wrapper = new me(), this._showSlot = !0, this._isMirror = !1, this.beforeInstall = void 0, this._preventDefaults = (i) => {
|
|
9187
9187
|
i.preventDefault(), i.stopPropagation();
|
|
9188
|
-
}, this.getWP = this._slotContainer.getWorldPosition.bind(this._slotContainer), this._showSlot = typeof e.show == "boolean" ? e.show : !0, this.name = e.name, this._isMirror = e.isMirror, this._slotUI = new Pn({
|
|
9188
|
+
}, this.getWP = this._slotContainer.getWorldPosition.bind(this._slotContainer), t.setAttribute("data-ui-type", "slot"), this._showSlot = typeof e.show == "boolean" ? e.show : !0, this.name = e.name, this._isMirror = e.isMirror, this._slotUI = new Pn({
|
|
9189
9189
|
name: e.name,
|
|
9190
9190
|
isMobile: e.isMobile,
|
|
9191
9191
|
onRemove: () => {
|
|
@@ -9593,70 +9593,105 @@ class Hr extends ze {
|
|
|
9593
9593
|
const i = document.createElement("div");
|
|
9594
9594
|
super(i), this.props = e, this.amr = t, this._direction = 1, this._controllingRotate = !1, this._controlling = !1, this._startAt = 0, this._looper = 0, this._initial = 0, this._canRotate = !1, this._emitter = new kt(), this.addListener = this._emitter.addListener.bind(this._emitter), this.removeListener = this._emitter.removeListener.bind(this._emitter), this._update = () => {
|
|
9595
9595
|
if (this._looper = requestAnimationFrame(this._update), this._controlling) {
|
|
9596
|
-
let
|
|
9597
|
-
|
|
9598
|
-
let
|
|
9599
|
-
if (
|
|
9600
|
-
this.mechanism && (
|
|
9596
|
+
let r = (Date.now() - this._startAt) / 200;
|
|
9597
|
+
r > 4 && (r = 4);
|
|
9598
|
+
let l = this._initial + 5e-3 * r * this._direction;
|
|
9599
|
+
if (l > this.props.max || l < this.props.min) {
|
|
9600
|
+
this.mechanism && (l < this.props.min ? (this.mechanism.position.setZ(this.props.min), this._emitter.emit("change", this.props.min)) : l > this.props.max && (this.mechanism.position.setZ(this.props.max), this._emitter.emit("change", this.props.max)));
|
|
9601
9601
|
return;
|
|
9602
9602
|
}
|
|
9603
|
-
if (this._initial =
|
|
9603
|
+
if (this._initial = l, !this.mechanism)
|
|
9604
9604
|
return;
|
|
9605
|
-
this.mechanism.position.setZ(
|
|
9605
|
+
this.mechanism.position.setZ(l), this._emitter.emit("change", l);
|
|
9606
9606
|
}
|
|
9607
|
-
};
|
|
9607
|
+
}, i.setAttribute("data-ui-type", "mechanism");
|
|
9608
9608
|
const s = Qs();
|
|
9609
|
-
e.userData && e.userData.target && (this.name = e.userData.target.name, t.traverse((
|
|
9610
|
-
|
|
9609
|
+
e.userData && e.userData.target && (this.name = e.userData.target.name, t.traverse((r) => {
|
|
9610
|
+
r.name === e.userData.target.name && (this.mechanism = r);
|
|
9611
9611
|
})), i.style.fontSize = "30px", i.style.color = "#0066FF", i.style.cursor = "pointer", i.style.pointerEvents = "auto";
|
|
9612
|
-
const a =
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9612
|
+
const a = (r) => {
|
|
9613
|
+
r.stopPropagation();
|
|
9614
|
+
}, n = (r) => {
|
|
9615
|
+
r.preventDefault(), r.stopPropagation();
|
|
9616
|
+
}, c = {
|
|
9617
|
+
capture: !1,
|
|
9618
|
+
passive: !0
|
|
9619
|
+
}, h = {
|
|
9620
|
+
capture: !1,
|
|
9621
|
+
passive: !1
|
|
9622
|
+
};
|
|
9623
|
+
[
|
|
9624
|
+
"pointerdown",
|
|
9625
|
+
"pointerup",
|
|
9626
|
+
"pointermove",
|
|
9627
|
+
"pointercancel",
|
|
9628
|
+
"click",
|
|
9629
|
+
"dblclick",
|
|
9630
|
+
"contextmenu",
|
|
9631
|
+
"mousemove"
|
|
9632
|
+
].forEach((r) => {
|
|
9633
|
+
i.addEventListener(r, a, c);
|
|
9634
|
+
}), [
|
|
9635
|
+
"wheel",
|
|
9636
|
+
"dragenter",
|
|
9637
|
+
"dragover",
|
|
9638
|
+
"dragleave",
|
|
9639
|
+
"drop"
|
|
9640
|
+
].forEach((r) => {
|
|
9641
|
+
i.addEventListener(
|
|
9642
|
+
r,
|
|
9643
|
+
n,
|
|
9644
|
+
h
|
|
9645
|
+
);
|
|
9646
|
+
});
|
|
9647
|
+
const f = document.createElement("div");
|
|
9648
|
+
f.style.position = "absolute", f.style.left = "0", f.style.transform = "translateX(-50%) rotate(-180deg)", f.style.marginBottom = "5px", f.style.width = f.style.height = s ? "34px" : "44px", f.style.background = `url(${Ur}) center no-repeat`, f.style.backgroundSize = "100% auto", f.setAttribute("data-direction", "up"), f.style.transition = "all .2s";
|
|
9649
|
+
const d = document.createElement("div");
|
|
9650
|
+
if (d.style.position = "absolute", d.style.left = "0", d.style.transform = "translateX(-50%)", f.style.bottom = d.style.top = "8px", d.style.width = d.style.height = f.style.width, d.style.background = `url(${Ur}) center no-repeat`, d.style.backgroundSize = "100% auto", d.style.transition = "all .2s", d.setAttribute("data-direction", "down"), Array.from([f, d]).forEach((r) => {
|
|
9651
|
+
s || r.addEventListener("mousemove", () => {
|
|
9652
|
+
r.style.filter = "invert(100%)";
|
|
9653
|
+
}), r.addEventListener("mouseleave", () => {
|
|
9654
|
+
r.style.filter = "";
|
|
9655
|
+
}), r.addEventListener("pointerdown", () => {
|
|
9656
|
+
this.mechanism && (r.style.filter = "invert(100%)", this._controlling = !0, this._startAt = Date.now(), this._initial = this.mechanism.position.z, this._direction = r.getAttribute("data-direction") === "up" ? 1 : -1, this._update());
|
|
9657
|
+
}), r.addEventListener("pointerup", () => {
|
|
9658
|
+
this._controlling = !1, cancelAnimationFrame(this._looper), r.style.filter = "";
|
|
9659
|
+
}), r.addEventListener("pointerleave", () => {
|
|
9660
|
+
this._controlling = !1, cancelAnimationFrame(this._looper), r.style.filter = "";
|
|
9626
9661
|
});
|
|
9627
9662
|
}), e.userData && (this._canRotate = e.userData.canRotate, this._canRotate)) {
|
|
9628
|
-
const { rotateTarget:
|
|
9629
|
-
let
|
|
9630
|
-
if (
|
|
9631
|
-
|
|
9632
|
-
}),
|
|
9633
|
-
const
|
|
9634
|
-
|
|
9635
|
-
const
|
|
9636
|
-
|
|
9637
|
-
const
|
|
9638
|
-
|
|
9639
|
-
s ||
|
|
9640
|
-
|
|
9641
|
-
}),
|
|
9642
|
-
|
|
9643
|
-
}),
|
|
9663
|
+
const { rotateTarget: r, rotateDuration: l, rotateStep: u, rotateMax: m, rotateMin: _ } = e.userData;
|
|
9664
|
+
let p;
|
|
9665
|
+
if (r && (t.traverse((g) => {
|
|
9666
|
+
g.name === r.name && (p = g);
|
|
9667
|
+
}), p)) {
|
|
9668
|
+
const g = document.createElement("div");
|
|
9669
|
+
g.style.background = `url(${fc}) center no-repeat`, g.style.backgroundSize = "100% auto", g.style.position = "absolute", g.style.top = "-50%", g.style.left = "-50%", g.style.width = s ? "140px" : "160px", g.style.height = s ? "70px" : "80px", g.style.transform = "translateX(-50%) translateY(-50%)", i.append(g);
|
|
9670
|
+
const v = document.createElement("div");
|
|
9671
|
+
v.style.background = `url(${uc}) center no-repeat`, v.style.backgroundSize = "100% auto", v.style.width = v.style.height = s ? "20px" : "26px", v.style.position = "absolute", v.style.top = "0", v.style.transform = "translateY(-50%)", v.style.marginBottom = "5px", v.setAttribute("data-direction", "left"), i.append(v);
|
|
9672
|
+
const y = document.createElement("div");
|
|
9673
|
+
y.style.background = `url(${hc}) center no-repeat`, y.style.backgroundSize = "100% auto", y.style.width = y.style.height = s ? "20px" : "26px", y.style.position = "absolute", v.style.left = y.style.right = s ? "62px" : "69px", y.style.top = "0", y.style.transform = "translateY(-50%)", y.style.marginBottom = "5px", y.setAttribute("data-direction", "right"), i.append(y), Array.from([v, y]).forEach((x) => {
|
|
9674
|
+
s || x.addEventListener("mousemove", () => {
|
|
9675
|
+
x.style.filter = "invert(100%)";
|
|
9676
|
+
}), x.addEventListener("mouseleave", () => {
|
|
9677
|
+
x.style.filter = "";
|
|
9678
|
+
}), x.addEventListener("pointerdown", () => {
|
|
9644
9679
|
if (this._timer && this._timer.isPlaying())
|
|
9645
9680
|
return;
|
|
9646
|
-
|
|
9647
|
-
let
|
|
9648
|
-
|
|
9649
|
-
z:
|
|
9650
|
-
}).duration(
|
|
9651
|
-
}),
|
|
9652
|
-
this._controllingRotate = !1, cancelAnimationFrame(this._looper),
|
|
9653
|
-
}),
|
|
9654
|
-
this._controllingRotate = !1, cancelAnimationFrame(this._looper),
|
|
9681
|
+
x.style.filter = "invert(100%)", this._controllingRotate = !0, this._startAt = Date.now(), this._direction = x.getAttribute("data-direction") === "left" ? 1 : -1;
|
|
9682
|
+
let w = u / 180 * Math.PI * this._direction + p.rotation.z;
|
|
9683
|
+
w > m / 180 * Math.PI ? w = m / 180 * Math.PI : w < _ / 180 * Math.PI && (w = _ / 180 * Math.PI), this._timer = new zi(p.rotation).to({
|
|
9684
|
+
z: w
|
|
9685
|
+
}).duration(l).start(), this._update();
|
|
9686
|
+
}), x.addEventListener("pointerup", () => {
|
|
9687
|
+
this._controllingRotate = !1, cancelAnimationFrame(this._looper), x.style.filter = "";
|
|
9688
|
+
}), x.addEventListener("pointerleave", () => {
|
|
9689
|
+
this._controllingRotate = !1, cancelAnimationFrame(this._looper), x.style.filter = "";
|
|
9655
9690
|
});
|
|
9656
9691
|
});
|
|
9657
9692
|
}
|
|
9658
9693
|
}
|
|
9659
|
-
i.append(
|
|
9694
|
+
i.append(f, d), this.scale.set(0.01, 0.01, 0.01), this.matrixAutoUpdate = !1, this.updateMatrix();
|
|
9660
9695
|
}
|
|
9661
9696
|
hide() {
|
|
9662
9697
|
this.element.style.display = "none", this.traverse((e) => {
|
|
@@ -13412,7 +13447,7 @@ class Mu {
|
|
|
13412
13447
|
-this.d,
|
|
13413
13448
|
0.1,
|
|
13414
13449
|
1e3
|
|
13415
|
-
), this._axisMoving = !1, this._container = new me(), this._raycaster = new fo(), this._selected = [], this._pointerDownTimeout = 0, this._dragging = !1, this.maxSample = 1024 * 2, this.sampleCount = 0, this._usePathTracing = !1, this._fpsCache = [], this._fpsCacheMax = 20, this._emitter = new kt(), this.sound = new Kl(), this._rafId = null, this._destroyed = !1, this._ground = new X(
|
|
13450
|
+
), this._axisMoving = !1, this._container = new me(), this._raycaster = new fo(), this._selected = [], this._pointerDownTimeout = 0, this._dragging = !1, this.maxSample = 1024 * 2, this.sampleCount = 0, this._usePathTracing = !1, this._fpsCache = [], this._fpsCacheMax = 20, this._emitter = new kt(), this.sound = new Kl(), this._rafId = null, this._destroyed = !1, this._css2dUiStyleInjected = !1, this._ground = new X(
|
|
13416
13451
|
new Oi(100, 100),
|
|
13417
13452
|
new po({
|
|
13418
13453
|
color: new J("#eee"),
|
|
@@ -13646,7 +13681,7 @@ class Mu {
|
|
|
13646
13681
|
}
|
|
13647
13682
|
this.stats.end();
|
|
13648
13683
|
}
|
|
13649
|
-
}, this.stats.showPanel(0), this.hideState(), e.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix()), Cn(Et, this.renderer), this._ground.visible = !1, this.controls = new vo(this.camera, this.renderer.domElement), this.controls.enablePan = !0, this.controls.rotateSpeed = this.props.isMobile ? 0.6 : 0.5, this.controls.dampingFactor = sn, this.controls.enableDamping = !0, this.controls.maxDistance = 10, this.controls.minDistance = 1, this.controls.zoomSpeed = this.props.isMobile ? 0.3 : Yl() ? 0.2 : 1, this._cameraPositionUI = new Sh(this.controls), this.renderer.setPixelRatio(window.devicePixelRatio || 1), this.renderer.autoClear = !0, this.renderer.toneMapping = mo, this.renderer.toneMappingExposure = 1.4, this.renderer.outputColorSpace = si, this.renderer.localClippingEnabled = !0, this.renderer.shadowMap.enabled = !0, this.css2dRenderer.domElement.style.pointerEvents = "none", this.css2dRenderer.domElement.style.position = "absolute", this.css2dRenderer.domElement.style.top = "0px", this.camera.position.set(10, -10, 5), this.camera.lookAt(new b());
|
|
13684
|
+
}, this.stats.showPanel(0), this.hideState(), e.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix()), Cn(Et, this.renderer), this._ground.visible = !1, this.controls = new vo(this.camera, this.renderer.domElement), this.controls.enablePan = !0, this.controls.rotateSpeed = this.props.isMobile ? 0.6 : 0.5, this.controls.dampingFactor = sn, this.controls.enableDamping = !0, this.controls.maxDistance = 10, this.controls.minDistance = 1, this.controls.zoomSpeed = this.props.isMobile ? 0.3 : Yl() ? 0.2 : 1, this._cameraPositionUI = new Sh(this.controls), this.renderer.setPixelRatio(window.devicePixelRatio || 1), this.renderer.autoClear = !0, this.renderer.toneMapping = mo, this.renderer.toneMappingExposure = 1.4, this.renderer.outputColorSpace = si, this.renderer.localClippingEnabled = !0, this.renderer.shadowMap.enabled = !0, this.css2dRenderer.domElement.style.pointerEvents = "none", this.css2dRenderer.domElement.style.position = "absolute", this.css2dRenderer.domElement.style.top = "0px", this.css2dRenderer.domElement.setAttribute("data-css2d-root", "1"), this._ensureCss2dUiStyle(), this.camera.position.set(10, -10, 5), this.camera.lookAt(new b());
|
|
13650
13685
|
const { tiles: t } = Jl();
|
|
13651
13686
|
this.pathTracer = new pl(this.renderer), this.pathTracer.multipleImportanceSampling = !0, this.pathTracer.filterGlossyFactor = 0.6;
|
|
13652
13687
|
let i = window.devicePixelRatio;
|
|
@@ -13897,6 +13932,21 @@ class Mu {
|
|
|
13897
13932
|
add(e) {
|
|
13898
13933
|
this._container.add(e);
|
|
13899
13934
|
}
|
|
13935
|
+
_ensureCss2dUiStyle() {
|
|
13936
|
+
if (this._css2dUiStyleInjected)
|
|
13937
|
+
return;
|
|
13938
|
+
const e = "ms-css2d-ui-style";
|
|
13939
|
+
if (document.getElementById(e)) {
|
|
13940
|
+
this._css2dUiStyleInjected = !0;
|
|
13941
|
+
return;
|
|
13942
|
+
}
|
|
13943
|
+
const t = document.createElement("style");
|
|
13944
|
+
t.id = e, t.textContent = `
|
|
13945
|
+
[data-css2d-root="1"] [data-ui-type="mechanism"] {
|
|
13946
|
+
z-index: 2147483647 !important;
|
|
13947
|
+
}
|
|
13948
|
+
`, document.head.append(t), this._css2dUiStyleInjected = !0;
|
|
13949
|
+
}
|
|
13900
13950
|
updatePosition() {
|
|
13901
13951
|
}
|
|
13902
13952
|
removeFromParent() {
|
|
@@ -14102,7 +14152,7 @@ class Oh {
|
|
|
14102
14152
|
return this.canvas || (this.canvas = document.createElement("canvas")), (this.canvas.width !== e || this.canvas.height !== t) && (this.canvas.width = e, this.canvas.height = t), this.canvas;
|
|
14103
14153
|
}
|
|
14104
14154
|
}
|
|
14105
|
-
const zh = "shop-components", Uh = "0.4.
|
|
14155
|
+
const zh = "shop-components", Uh = "0.4.20", Hh = "Shop components", Wh = "dist/shop-components.umd.js", Nh = "dist/shop-components.mjs", Vh = "dist/main.d.ts", Gh = {
|
|
14106
14156
|
dts: "tsc --emitDeclarationOnly & tsc & storybook build -o dist",
|
|
14107
14157
|
dev: "vite dev",
|
|
14108
14158
|
build: "vite build",
|