shop-components 0.4.18 → 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.
@@ -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 c = (Date.now() - this._startAt) / 200;
9597
- c > 4 && (c = 4);
9598
- let h = this._initial + 5e-3 * c * this._direction;
9599
- if (h > this.props.max || h < this.props.min) {
9600
- this.mechanism && (h < this.props.min ? (this.mechanism.position.setZ(this.props.min), this._emitter.emit("change", this.props.min)) : h > this.props.max && (this.mechanism.position.setZ(this.props.max), this._emitter.emit("change", this.props.max)));
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 = h, !this.mechanism)
9603
+ if (this._initial = l, !this.mechanism)
9604
9604
  return;
9605
- this.mechanism.position.setZ(h), this._emitter.emit("change", h);
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((c) => {
9610
- c.name === e.userData.target.name && (this.mechanism = c);
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 = document.createElement("div");
9613
- a.style.position = "absolute", a.style.left = "0", a.style.transform = "translateX(-50%) rotate(-180deg)", a.style.marginBottom = "5px", a.style.width = a.style.height = s ? "34px" : "44px", a.style.background = `url(${Ur}) center no-repeat`, a.style.backgroundSize = "100% auto", a.setAttribute("data-direction", "up"), a.style.transition = "all .2s";
9614
- const n = document.createElement("div");
9615
- if (n.style.position = "absolute", n.style.left = "0", n.style.transform = "translateX(-50%)", a.style.bottom = n.style.top = "8px", n.style.width = n.style.height = a.style.width, n.style.background = `url(${Ur}) center no-repeat`, n.style.backgroundSize = "100% auto", n.style.transition = "all .2s", n.setAttribute("data-direction", "down"), Array.from([a, n]).forEach((c) => {
9616
- s || c.addEventListener("mousemove", () => {
9617
- c.style.filter = "invert(100%)";
9618
- }), c.addEventListener("mouseleave", () => {
9619
- c.style.filter = "";
9620
- }), c.addEventListener("pointerdown", () => {
9621
- this.mechanism && (c.style.filter = "invert(100%)", this._controlling = !0, this._startAt = Date.now(), this._initial = this.mechanism.position.z, this._direction = c.getAttribute("data-direction") === "up" ? 1 : -1, this._update());
9622
- }), c.addEventListener("pointerup", () => {
9623
- this._controlling = !1, cancelAnimationFrame(this._looper), c.style.filter = "";
9624
- }), c.addEventListener("pointerleave", () => {
9625
- this._controlling = !1, cancelAnimationFrame(this._looper), c.style.filter = "";
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: c, rotateDuration: h, rotateStep: f, rotateMax: d, rotateMin: r } = e.userData;
9629
- let l;
9630
- if (c && (t.traverse((u) => {
9631
- u.name === c.name && (l = u);
9632
- }), l)) {
9633
- const u = document.createElement("div");
9634
- u.style.background = `url(${fc}) center no-repeat`, u.style.backgroundSize = "100% auto", u.style.position = "absolute", u.style.top = "-50%", u.style.left = "-50%", u.style.width = s ? "140px" : "160px", u.style.height = s ? "70px" : "80px", u.style.transform = "translateX(-50%) translateY(-50%)", i.append(u);
9635
- const m = document.createElement("div");
9636
- m.style.background = `url(${uc}) center no-repeat`, m.style.backgroundSize = "100% auto", m.style.width = m.style.height = s ? "20px" : "26px", m.style.position = "absolute", m.style.top = "0", m.style.transform = "translateY(-50%)", m.style.marginBottom = "5px", m.setAttribute("data-direction", "left"), i.append(m);
9637
- const _ = document.createElement("div");
9638
- _.style.background = `url(${hc}) center no-repeat`, _.style.backgroundSize = "100% auto", _.style.width = _.style.height = s ? "20px" : "26px", _.style.position = "absolute", m.style.left = _.style.right = s ? "62px" : "69px", _.style.top = "0", _.style.transform = "translateY(-50%)", _.style.marginBottom = "5px", _.setAttribute("data-direction", "right"), i.append(_), Array.from([m, _]).forEach((p) => {
9639
- s || p.addEventListener("mousemove", () => {
9640
- p.style.filter = "invert(100%)";
9641
- }), p.addEventListener("mouseleave", () => {
9642
- p.style.filter = "";
9643
- }), p.addEventListener("pointerdown", () => {
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
- p.style.filter = "invert(100%)", this._controllingRotate = !0, this._startAt = Date.now(), this._direction = p.getAttribute("data-direction") === "left" ? 1 : -1;
9647
- let g = f / 180 * Math.PI * this._direction + l.rotation.z;
9648
- g > d / 180 * Math.PI ? g = d / 180 * Math.PI : g < r / 180 * Math.PI && (g = r / 180 * Math.PI), this._timer = new zi(l.rotation).to({
9649
- z: g
9650
- }).duration(h).start(), this._update();
9651
- }), p.addEventListener("pointerup", () => {
9652
- this._controllingRotate = !1, cancelAnimationFrame(this._looper), p.style.filter = "";
9653
- }), p.addEventListener("pointerleave", () => {
9654
- this._controllingRotate = !1, cancelAnimationFrame(this._looper), p.style.filter = "";
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(a, n), this.scale.set(0.01, 0.01, 0.01), this.matrixAutoUpdate = !1, this.updateMatrix();
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) => {
@@ -10262,7 +10297,7 @@ class gc extends oi {
10262
10297
  setGoodsSize(e) {
10263
10298
  this._goodsSize.length = e.length, this._goodsSize.width = e.width, this._goodsSize.height = e.height, this.setShelfLevel(this._shelfMaxLevel), this.setRoller(), this._rollerLevel.forEach((t) => {
10264
10299
  t.traverse((i) => {
10265
- i instanceof at && (console.log(i), i.updateSize(e.width, e.length, e.height));
10300
+ i instanceof at && i.updateSize(e.width, e.length, e.height);
10266
10301
  });
10267
10302
  });
10268
10303
  }
@@ -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.18", Hh = "Shop components", Wh = "dist/shop-components.umd.js", Nh = "dist/shop-components.mjs", Vh = "dist/main.d.ts", Gh = {
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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shop-components",
3
- "version": "0.4.18",
3
+ "version": "0.4.20",
4
4
  "description": "Shop components",
5
5
  "main": "dist/shop-components.umd.js",
6
6
  "module": "dist/shop-components.mjs",