shop-components 0.4.5 → 0.4.6

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.
@@ -9855,7 +9855,7 @@ const kn = new pn();
9855
9855
  kn.crossOrigin = "anonymous";
9856
9856
  class bc extends Bt {
9857
9857
  constructor(e) {
9858
- super(), this._props = e, this._emitter = new Ot(), this.addEventListener = this._emitter.addListener.bind(this._emitter), this._container = new ge(), this.lines = new ge(), this._clips = [], this._actionsMap = /* @__PURE__ */ new Map(), this._animationClock = new qi(), this.sizeBox = new yc(), this._goodsSize = new oc(0, 0, 0), this._slots = [], this._logos = [], this._skins = [], this._levels = /* @__PURE__ */ new Map(), this._bodyOpacity = 1, this._masts = /* @__PURE__ */ new Map(), this._liftMaxHeight = 0, this._jackMaxHeight = 0, this._forkMaxHeight = 0, this.controllers = [], this.goods = [], this._breathLights = [], this._shelves = /* @__PURE__ */ new Map(), this._shelfMaxLevel = 1, this._url = "", this._showController = !0, this._showSlots = !0, this._shapeKeys = /* @__PURE__ */ new Map(), this._shapeKeyTargets = /* @__PURE__ */ new Map(), this._shapeKeyTimer = 0, this._shapeKeyCache = "", this._materialsCache = /* @__PURE__ */ new Map(), this.opacityCache = void 0, this.actions = [], this._url = e.url || "", this._url && this.load(this._url).then(), this.add(this._container, this.lines), this._props.showSizeBox && this.add(this.sizeBox), this.showController = typeof e.showController == "boolean" ? e.showController : !0, this._showSlots = typeof e.showSlots == "boolean" ? e.showSlots : !0;
9858
+ super(), this._props = e, this._emitter = new Ot(), this.addEventListener = this._emitter.addListener.bind(this._emitter), this._container = new ge(), this.lines = new ge(), this._clips = [], this._actionsMap = /* @__PURE__ */ new Map(), this._animationClock = new qi(), this.sizeBox = new yc(), this._goodsSize = new oc(0, 0, 0), this._slots = [], this._logos = [], this._skins = [], this._levels = /* @__PURE__ */ new Map(), this._bodyOpacity = 1, this._masts = /* @__PURE__ */ new Map(), this._liftMaxHeight = 0, this._jackMaxHeight = 0, this._forkMaxHeight = 0, this.controllers = [], this.goods = [], this._breathLights = [], this._shelves = /* @__PURE__ */ new Map(), this._shelfMaxLevel = 1, this._url = "", this._showController = !0, this._showSlots = !0, this._shapeKeys = /* @__PURE__ */ new Map(), this._shapeKeyTargets = /* @__PURE__ */ new Map(), this._shapeKeyTimer = 0, this._shapeKeyCache = "", this._materialsCache = /* @__PURE__ */ new Map(), this.opacityCache = void 0, this.actions = [], this._currentAction = null, this._pendingFinishedCallback = null, this._url = e.url || "", this._url && this.load(this._url).then(), this.add(this._container, this.lines), this._props.showSizeBox && this.add(this.sizeBox), this.showController = typeof e.showController == "boolean" ? e.showController : !0, this._showSlots = typeof e.showSlots == "boolean" ? e.showSlots : !0;
9859
9859
  }
9860
9860
  get shapeKeys() {
9861
9861
  return this._shapeKeys;
@@ -10363,22 +10363,26 @@ class bc extends Bt {
10363
10363
  }
10364
10364
  }
10365
10365
  clean() {
10366
- this._emitter.removeAllListeners(), this.controllers.forEach((e) => e.dispose()), this.controllers = [], We(this._container), this._levels.forEach((e) => e.destroy()), this._levels.clear(), this._slots = [], this._logos = [], this._skins = [], this._materialsCache.clear(), this.opacityCache = void 0, this._breathLights.forEach((e) => e.stop()), this._breathLights = [], this.sizeBox.reset(), this._shapeKeyTargets.clear(), this._shapeKeys.clear(), this._mixer && this._mixer.stopAllAction(), this._mixer = void 0, this._clips = [], this._actionsMap.clear(), this.actions = [], this._app && this._onTicker && this._app.renderer.domElement.removeEventListener("ticker", this._onTicker), this._onTicker = void 0;
10366
+ this._emitter.removeAllListeners(), this.controllers.forEach((e) => e.dispose()), this.controllers = [], We(this._container), this._levels.forEach((e) => e.destroy()), this._levels.clear(), this._slots = [], this._logos = [], this._skins = [], this._materialsCache.clear(), this.opacityCache = void 0, this._breathLights.forEach((e) => e.stop()), this._breathLights = [], this.sizeBox.reset(), this._shapeKeyTargets.clear(), this._shapeKeys.clear(), this._currentAction = null, this._pendingFinishedCallback && this._mixer && (this._mixer.removeEventListener("finished", this._pendingFinishedCallback), this._pendingFinishedCallback = null), this._mixer && (this._mixer.stopAllAction(), this._modelRoot && this._mixer.uncacheRoot(this._modelRoot)), this._mixer = void 0, this._clips = [], this._actionsMap.clear(), this.actions = [], this._app && this._onTicker && this._app.renderer.domElement.removeEventListener("ticker", this._onTicker), this._onTicker = void 0;
10367
10367
  }
10368
10368
  destroy() {
10369
10369
  this.clean(), this.sizeBox.destroy();
10370
10370
  }
10371
10371
  playAction(e, t = !0, i) {
10372
10372
  const s = this._actionsMap.get(e);
10373
- return !s || !this._mixer ? Promise.reject(new Error(`Action "${e}" not found or mixer not initialized.`)) : (t && s.reset(), this._actionsMap.forEach((a, n) => {
10374
- n !== e && a.stop();
10375
- }), s.enabled = !0, s.paused = !1, s.setLoop(oo, 0), s.setEffectiveTimeScale((i == null ? void 0 : i.timeScale) ?? 1), s.setEffectiveWeight(1), s.clampWhenFinished = (i == null ? void 0 : i.clampWhenFinished) ?? !0, i != null && i.fadeIn && i.fadeIn > 0 && s.fadeIn(i.fadeIn), new Promise((a) => {
10376
- const n = (c) => {
10377
- var u;
10378
- c.action === s && ((u = this._mixer) == null || u.removeEventListener("finished", n), a());
10373
+ if (!s || !this._mixer)
10374
+ return Promise.reject(new Error(`Action "${e}" not found or mixer not initialized.`));
10375
+ const a = (i == null ? void 0 : i.fadeIn) ?? (i == null ? void 0 : i.fadeOut) ?? 0.3, n = this._currentAction, c = n && n !== s && n.isRunning();
10376
+ return this._actionsMap.forEach((u) => {
10377
+ u !== s && u !== n && (u.stopFading(), u.setEffectiveWeight(0), u.stop());
10378
+ }), s.enabled = !0, s.setEffectiveTimeScale((i == null ? void 0 : i.timeScale) ?? 1), s.setEffectiveWeight(1), s.time = 0, s.paused = !1, s.setLoop(oo, 0), s.clampWhenFinished = (i == null ? void 0 : i.clampWhenFinished) ?? !0, s.play(), c ? (n.stopFading(), n.enabled = !0, n.setEffectiveTimeScale(1), n.setEffectiveWeight(1), n.crossFadeTo(s, a, !0)) : a > 0 && s.fadeIn(a), this._currentAction = s, new Promise((u) => {
10379
+ this._pendingFinishedCallback && this._mixer && this._mixer.removeEventListener("finished", this._pendingFinishedCallback);
10380
+ const f = (d) => {
10381
+ var r;
10382
+ d.action === s && ((r = this._mixer) == null || r.removeEventListener("finished", f), this._pendingFinishedCallback = null, u());
10379
10383
  };
10380
- this._mixer.addEventListener("finished", n), s.play();
10381
- }));
10384
+ this._pendingFinishedCallback = f, this._mixer.addEventListener("finished", f);
10385
+ });
10382
10386
  }
10383
10387
  pauseAction(e) {
10384
10388
  const t = this._actionsMap.get(e);
@@ -13769,7 +13773,7 @@ class Nu {
13769
13773
  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;
13770
13774
  }
13771
13775
  }
13772
- const Gu = "shop-components", qu = "0.4.5", ju = "Shop components", Qu = "dist/shop-components.umd.js", Yu = "dist/shop-components.mjs", Zu = "dist/main.d.ts", Xu = {
13776
+ const Gu = "shop-components", qu = "0.4.6", ju = "Shop components", Qu = "dist/shop-components.umd.js", Yu = "dist/shop-components.mjs", Zu = "dist/main.d.ts", Xu = {
13773
13777
  dts: "tsc --emitDeclarationOnly & tsc & storybook build -o dist",
13774
13778
  dev: "vite dev",
13775
13779
  build: "vite build",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shop-components",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Shop components",
5
5
  "main": "dist/shop-components.umd.js",
6
6
  "module": "dist/shop-components.mjs",
package/dist/test.glb DELETED
Binary file