shop-components 0.1.53 → 0.1.56

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.
@@ -57314,13 +57314,12 @@ let qt = class extends Yr {
57314
57314
  <img alt="" src="${rj}">
57315
57315
  <div class="name">
57316
57316
  <div class="name-wrapper">${(n = this.slot) == null ? void 0 : n.name}</div>
57317
-
57318
- ${this.allFunctions.length ? Zi`
57319
- <div class="functions-wrapper">
57320
- <div class="device-name ${!this.deviceName && "empty"}">
57321
- <span>${this.deviceName}</span>
57322
- <i class="btn btn-close" @click=${this.removeDevice}></i>
57323
- </div>
57317
+ <div class="functions-wrapper">
57318
+ <div class="device-name ${!this.deviceName && "empty"}">
57319
+ <span>${this.deviceName}</span>
57320
+ <i class="btn btn-close" @click=${this.removeDevice}></i>
57321
+ </div>
57322
+ ${this.allFunctions.length ? Zi`
57324
57323
  <div class="functions">
57325
57324
  ${this.functions.map((A) => Zi`
57326
57325
  <div class="function"><span>${A}</span><i class="btn btn-remove"
@@ -57334,27 +57333,26 @@ let qt = class extends Yr {
57334
57333
  this._showDialog = !this._showDialog;
57335
57334
  }}>+添加
57336
57335
  </div>`}
57337
-
57338
57336
  </div>
57339
- ${this.hasMoreFunctions ? Zi`
57340
- <div class="all-functions ${this._showDialog && "show"}">
57341
- <label>添加功能
57342
- <i class="btn btn-close" @click=${() => {
57337
+ ` : Zi``}
57338
+
57339
+ ${this.hasMoreFunctions && this.allFunctions.length ? Zi`
57340
+ <div class="all-functions ${this._showDialog && "show"}">
57341
+ <label>添加功能
57342
+ <i class="btn btn-close" @click=${() => {
57343
57343
  this._showDialog = !1;
57344
57344
  }}></i>
57345
- </label>
57346
- <div class="functions">
57347
- ${this.allFunctions.map((A) => this.functions.includes(A) ? Zi`` : Zi`
57348
- <div class="function">
57349
- <span>${A}</span>
57350
- <i class="btn btn-add" @click=${() => this.addFunction(A)}>+</i>
57351
- </div>
57352
- `)}
57353
- </div>
57354
- </div>` : Zi``}
57355
- </div>
57356
- ` : Zi``}
57357
-
57345
+ </label>
57346
+ <div class="functions">
57347
+ ${this.allFunctions.map((A) => this.functions.includes(A) ? Zi`` : Zi`
57348
+ <div class="function">
57349
+ <span>${A}</span>
57350
+ <i class="btn btn-add" @click=${() => this.addFunction(A)}>+</i>
57351
+ </div>
57352
+ `)}
57353
+ </div>
57354
+ </div>` : Zi``}
57355
+ </div>
57358
57356
  </div>
57359
57357
  </div>
57360
57358
  </div>
@@ -57565,7 +57563,7 @@ class lI extends Iv {
57565
57563
  return this._selected;
57566
57564
  }
57567
57565
  set selected(A) {
57568
- A && this._emitter.emit(Rt.ON_BEFORE_SELECTED, A), this._selected = A, this._slotUI.selected = A, this._emitter.emit(Rt.ON_SELECTED, A);
57566
+ A && this._emitter.emit(Rt.ON_BEFORE_SELECTED, A), this._selected = A, this._slotUI.selected = A, this._emitter.emit(Rt.ON_SELECTED, A), this.element.style.zIndex = "100", this.selected ? this.renderOrder = 1 / 0 : this.renderOrder = 1;
57569
57567
  }
57570
57568
  get deviceSelected() {
57571
57569
  return this._deviceSelected;
@@ -9527,13 +9527,12 @@ void main(void)\r
9527
9527
  <img alt="" src="${fk}">
9528
9528
  <div class="name">
9529
9529
  <div class="name-wrapper">${(n=this.slot)==null?void 0:n.name}</div>
9530
-
9531
- ${this.allFunctions.length?An`
9532
- <div class="functions-wrapper">
9533
- <div class="device-name ${!this.deviceName&&"empty"}">
9534
- <span>${this.deviceName}</span>
9535
- <i class="btn btn-close" @click=${this.removeDevice}></i>
9536
- </div>
9530
+ <div class="functions-wrapper">
9531
+ <div class="device-name ${!this.deviceName&&"empty"}">
9532
+ <span>${this.deviceName}</span>
9533
+ <i class="btn btn-close" @click=${this.removeDevice}></i>
9534
+ </div>
9535
+ ${this.allFunctions.length?An`
9537
9536
  <div class="functions">
9538
9537
  ${this.functions.map(A=>An`
9539
9538
  <div class="function"><span>${A}</span><i class="btn btn-remove"
@@ -9543,29 +9542,28 @@ void main(void)\r
9543
9542
  ${An`
9544
9543
  <div class="btn btn-add ${!this.hasMoreFunctions&&"btn-not-allowed"}" @click=${()=>{this._showDialog=!this._showDialog}}>+添加
9545
9544
  </div>`}
9546
-
9547
9545
  </div>
9548
- ${this.hasMoreFunctions?An`
9549
- <div class="all-functions ${this._showDialog&&"show"}">
9550
- <label>添加功能
9551
- <i class="btn btn-close" @click=${()=>{this._showDialog=!1}}></i>
9552
- </label>
9553
- <div class="functions">
9554
- ${this.allFunctions.map(A=>this.functions.includes(A)?An``:An`
9555
- <div class="function">
9556
- <span>${A}</span>
9557
- <i class="btn btn-add" @click=${()=>this.addFunction(A)}>+</i>
9558
- </div>
9559
- `)}
9560
- </div>
9561
- </div>`:An``}
9562
- </div>
9563
- `:An``}
9564
-
9546
+ `:An``}
9547
+
9548
+ ${this.hasMoreFunctions&&this.allFunctions.length?An`
9549
+ <div class="all-functions ${this._showDialog&&"show"}">
9550
+ <label>添加功能
9551
+ <i class="btn btn-close" @click=${()=>{this._showDialog=!1}}></i>
9552
+ </label>
9553
+ <div class="functions">
9554
+ ${this.allFunctions.map(A=>this.functions.includes(A)?An``:An`
9555
+ <div class="function">
9556
+ <span>${A}</span>
9557
+ <i class="btn btn-add" @click=${()=>this.addFunction(A)}>+</i>
9558
+ </div>
9559
+ `)}
9560
+ </div>
9561
+ </div>`:An``}
9562
+ </div>
9565
9563
  </div>
9566
9564
  </div>
9567
9565
  </div>
9568
- `}};qt.styles=Nf([uk]),hi([qa()],qt.prototype,"_size",2),hi([qa()],qt.prototype,"_showDialog",2),hi([en({type:Boolean})],qt.prototype,"selected",2),hi([en({type:Boolean})],qt.prototype,"hasError",2),hi([en({type:Boolean})],qt.prototype,"canInstall",2),hi([en({type:Boolean})],qt.prototype,"hide",2),hi([en({type:Boolean})],qt.prototype,"disable",2),hi([en({type:Boolean})],qt.prototype,"filled",2),hi([en({type:Object})],qt.prototype,"allFunctions",2),hi([en({type:Object})],qt.prototype,"functions",2),hi([en({type:String})],qt.prototype,"deviceName",2),hi([en()],qt.prototype,"slot",2),qt=hi([kf("slot-item")],qt);const Nt={ON_DROP:"slot-on-drop",ON_DEVICE_DELETED:"slot-on-device-deleted",ON_DEVICE_REPLACED:"slot-on-device-replaced",ON_BEFORE_SELECTED:"slot-on-before-selected",ON_SELECTED:"slot-on-selected",ON_DEVICE_SELECTED:"slot-on-device-selected",ON_DROP_ERROR:"slot-on-drop-error",ON_ERROR_STATE_CHANGE:"slot-on-error-state-change",ON_FUNCTION_REMOVED:"slot-on-function-removed",ON_FUNCTION_ADDED:"slot-on-function-added"};class $0 extends zg{constructor(A){const e=document.createElement("div");super(e),this.props=A,this._emitter=new br,this._slotContainer=new It,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=new Set,this._functions=new Set,this._timer=0,this._parentPos=new O,this._wrapper=new It,this._showSlot=!0,this._preventDefaults=t=>{t.preventDefault(),t.stopPropagation()},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({name:A.name,onRemove:()=>{this.clearSlot(),this._emitter.emit(Nt.ON_DEVICE_DELETED)}}),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})=>{this.removeFunction(t)}),this._slotUI.addEventListener("function-added",({detail:t})=>{this.addFunction(t)}),this.add(this._slotContainer),this.props.slot.add(this),setTimeout(()=>{var t;(t=this.props.slot.parent)==null||t.add(this._wrapper),this._wrapper.add(this.props.slot)},10),["dragenter","dragover","dragleave","drop"].forEach(t=>{e.addEventListener(t,this._preventDefaults,!1)}),e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.selected=!this.selected}),e.addEventListener("dragover",t=>{if(t.preventDefault(),t.dataTransfer.dropEffect="copy",!this._canInstall){t.dataTransfer&&(t.dataTransfer.dropEffect="none");return}}),e.addEventListener("drop",async t=>{var r;if(t.preventDefault(),t.stopPropagation(),!this._canInstall)return;const i=(r=t.dataTransfer)==null?void 0:r.getData("application/json");if(i){const s=JSON.parse(i);try{await this.install(s),this._emitter.emit(Nt.ON_DROP,this)}catch(o){this._emitter.emit(Nt.ON_DROP_ERROR,o)}}else this._emitter.emit(Nt.ON_DROP_ERROR,new Error("No device info"))})}get hasDevice(){return this._slotContainer.children.length>0}shapeKeyChanged(A,e){var t;if(this.props.follows.has(A)){const i=this.props.follows.get(A);if(i){let r="x";A==="height"?r="y":["width","liftOuterWidth"].includes(A)&&(r="z");const s=((t=this.props.slot)==null?void 0:t.position[r])>0?1:-1;this._wrapper.position[r]=(e-i.origin)*i.scale*s}}}async loadGlb(A){const t=await new dc({useCache:!0}).loadAsync(A);if(t.glb)return t.glb.clone(!0)}async installBracket(A){const t=await new dc({useCache:!0}).loadAsync(A);if(!t.glb)return;const i=t.glb.clone(!0);i.traverse(r=>{r.userData.isBracket=!0}),this.useBracket=!0,this._slotContainer.add(i)}async install(A){if(!this._loading){this._loading=!0;try{const e=await this.loadGlb(A.url);if(!e)throw new Error(`Fail to load device from: ${A.url}`);if(e.traverse(t=>{t.userData.isDevice=!0}),A.bracketUrl){const t=await this.loadGlb(A.bracketUrl);if(t)this.clearSlot(),this._emitter.emit(Nt.ON_DEVICE_REPLACED),t.traverse(i=>{i.name.startsWith("Slot")&&this._bracketSlots.push(i),i.userData.isBracket=!0}),this._slotContainer.add(t);else throw new Error(`Fail to load bracket from: ${A.bracketUrl}`);this._bracketSlots.forEach(i=>{i.add(e)})}else this.clearSlot(),this._emitter.emit(Nt.ON_DEVICE_REPLACED),this._slotContainer.add(e);this.deviceInfo=A,this._slotUI.deviceName=A.name,this._slotUI.filled=!0,this.holeTarget&&(this.holeTarget.visible=!1)}catch(e){throw e}finally{this._loading=!1}}}get device(){return this._slotContainer.children.length?this._slotContainer.children[0]:null}get allFunctions(){return[...this._allFunctions]}set allFunctions(A){this._functions.forEach(e=>{A.includes(e)||this._functions.delete(e)}),this._allFunctions=new Set(A),this._slotUI.allFunctions=A}get functions(){return[...this._functions]}addFunction(A){this._allFunctions.has(A)&&(this._functions.add(A),this._slotUI.functions=[...this.functions],this._emitter.emit(Nt.ON_FUNCTION_ADDED,A))}removeFunction(A){this._functions.has(A)&&(this._functions.delete(A),this._slotUI.functions=[...this.functions],this._emitter.emit(Nt.ON_FUNCTION_REMOVED,A))}clearFunctions(){this._functions.forEach(A=>this.removeFunction(A))}addFunctions(A){A.forEach(e=>this.addFunction(e)),this._slotUI.functions=this.functions}changeName(A){var e;this.name=A,this.props.slot.userData.name=A,this.props.name=A,(e=this.element)==null||e.setAttribute("data-name",this.props.name)}clearSlot(){this._bracketSlots=[],this._slotContainer.children.forEach(A=>{A.removeFromParent(),Si(A)}),this._slotUI.filled=!1,this.deviceInfo=void 0,this._slotUI.deviceName="",this.holeTarget&&(this.holeTarget.visible=!0)}enable(){this._slotUI.disable=!1}disable(){this._slotUI.disable=!0}hide(){this._slotUI.hide=!0}show(){this._slotUI.hide=!1}get selected(){return this._selected}set selected(A){A&&this._emitter.emit(Nt.ON_BEFORE_SELECTED,A),this._selected=A,this._slotUI.selected=A,this._emitter.emit(Nt.ON_SELECTED,A)}get deviceSelected(){return this._deviceSelected}set deviceSelected(A){this._deviceSelected=A,this._emitter.emit(Nt.ON_DEVICE_SELECTED,A)}get error(){return this._hasError}set error(A){this._loading&&setTimeout(()=>{this.error=A},100),this._hasError=A,this._slotUI.hasError=A,this._emitter.emit(Nt.ON_ERROR_STATE_CHANGE,A)}getCanInstall(){return this._canInstall}canInstall(A){this._canInstall=A,this._slotUI.canInstall=A}dispose(){cancelAnimationFrame(this._timer),["dragenter","dragover","dragleave","drop"].forEach(A=>{this.element.addEventListener(A,this._preventDefaults,!1)}),this.clearSlot(),this._emitter.removeAllListeners(),Si(this._slotContainer),this.element.remove()}render(A){const e=this.element.style.transform,t=/translate\(-?\d*\.?\d*%?,?\s-?\d*\.?\d*%?\)\s*translate\((-?\d*\.?\d*)px,\s*(-?\d*\.?\d*)px\)/.exec(e);if(!t)return;const i=new uA(parseFloat(t[1]),parseFloat(t[2])),r=A.mousePos.distanceTo(i);let s=12,o=24,a=30;if(this._canInstall&&(s=34,o=60,a=60),r<a){let l=(a-r)*1+s;r<20&&(l=o),l>o&&(l=o),this._slotUI.setSize(l)}else this._slotUI.setSize(s)}clone(A){return new It}}var gk=Object.defineProperty,mk=Object.getOwnPropertyDescriptor,Av=(n,A,e,t)=>{for(var i=t>1?void 0:t?mk(A,e):A,r=n.length-1,s;r>=0;r--)(s=n[r])&&(i=(t?s(A,e,i):s(i))||i);return t&&i&&gk(A,e,i),i};class vk{constructor(A,e,t,i){this.name=A,this.slot=e,this.start=t,this.end=i,this.split="--",this.uuid="",this.valid=!1,this.editable=!1,this.highlight=!1,this.uuid=A+this.split+e}update(A,e){this.start=A.clone(),this.end=e.clone()}}oe.DeviceLines=class extends Gr{constructor(A,e=0){super(),this.offset=A,this.heightOffset=e,this.lines=new Map,this.setOffset(this.offset.x,this.offset.y)}setOffset(A,e){this.offset.set(A,e),this.style.setProperty("--left",this.offset.x+"px"),this.style.setProperty("--top",this.offset.y+"px")}setHeightOffset(A){this.heightOffset=A,this.style.setProperty("--heightOffset",this.heightOffset+"px")}hide(){var A;(A=this.container)==null||A.classList.add("hidden")}show(){var A;(A=this.container)==null||A.classList.remove("hidden")}addLine(A){this.lines.has(A.uuid)||this.lines.set(A.uuid,A)}clear(){this.lines.clear()}removeLine(A){this.lines.delete(A.uuid)}getLineByName(A){const e=[];return this.lines.forEach((t,i)=>{t.name===A&&e.push(t)}),e}getLineBySlot(A){const e=[];return this.lines.forEach((t,i)=>{t.slot===A&&e.push(t)}),e}getPath(A){const e=A.end.clone();e.set(e.x-this.offset.x,e.y-this.offset.y);const t=A.start.clone().add(e).multiplyScalar(.5),i=A.start.clone().add(e).multiplyScalar(.7);return`M${A.start.x} ${A.start.y}
9566
+ `}};qt.styles=Nf([uk]),hi([qa()],qt.prototype,"_size",2),hi([qa()],qt.prototype,"_showDialog",2),hi([en({type:Boolean})],qt.prototype,"selected",2),hi([en({type:Boolean})],qt.prototype,"hasError",2),hi([en({type:Boolean})],qt.prototype,"canInstall",2),hi([en({type:Boolean})],qt.prototype,"hide",2),hi([en({type:Boolean})],qt.prototype,"disable",2),hi([en({type:Boolean})],qt.prototype,"filled",2),hi([en({type:Object})],qt.prototype,"allFunctions",2),hi([en({type:Object})],qt.prototype,"functions",2),hi([en({type:String})],qt.prototype,"deviceName",2),hi([en()],qt.prototype,"slot",2),qt=hi([kf("slot-item")],qt);const Nt={ON_DROP:"slot-on-drop",ON_DEVICE_DELETED:"slot-on-device-deleted",ON_DEVICE_REPLACED:"slot-on-device-replaced",ON_BEFORE_SELECTED:"slot-on-before-selected",ON_SELECTED:"slot-on-selected",ON_DEVICE_SELECTED:"slot-on-device-selected",ON_DROP_ERROR:"slot-on-drop-error",ON_ERROR_STATE_CHANGE:"slot-on-error-state-change",ON_FUNCTION_REMOVED:"slot-on-function-removed",ON_FUNCTION_ADDED:"slot-on-function-added"};class $0 extends zg{constructor(A){const e=document.createElement("div");super(e),this.props=A,this._emitter=new br,this._slotContainer=new It,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=new Set,this._functions=new Set,this._timer=0,this._parentPos=new O,this._wrapper=new It,this._showSlot=!0,this._preventDefaults=t=>{t.preventDefault(),t.stopPropagation()},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({name:A.name,onRemove:()=>{this.clearSlot(),this._emitter.emit(Nt.ON_DEVICE_DELETED)}}),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})=>{this.removeFunction(t)}),this._slotUI.addEventListener("function-added",({detail:t})=>{this.addFunction(t)}),this.add(this._slotContainer),this.props.slot.add(this),setTimeout(()=>{var t;(t=this.props.slot.parent)==null||t.add(this._wrapper),this._wrapper.add(this.props.slot)},10),["dragenter","dragover","dragleave","drop"].forEach(t=>{e.addEventListener(t,this._preventDefaults,!1)}),e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.selected=!this.selected}),e.addEventListener("dragover",t=>{if(t.preventDefault(),t.dataTransfer.dropEffect="copy",!this._canInstall){t.dataTransfer&&(t.dataTransfer.dropEffect="none");return}}),e.addEventListener("drop",async t=>{var r;if(t.preventDefault(),t.stopPropagation(),!this._canInstall)return;const i=(r=t.dataTransfer)==null?void 0:r.getData("application/json");if(i){const s=JSON.parse(i);try{await this.install(s),this._emitter.emit(Nt.ON_DROP,this)}catch(o){this._emitter.emit(Nt.ON_DROP_ERROR,o)}}else this._emitter.emit(Nt.ON_DROP_ERROR,new Error("No device info"))})}get hasDevice(){return this._slotContainer.children.length>0}shapeKeyChanged(A,e){var t;if(this.props.follows.has(A)){const i=this.props.follows.get(A);if(i){let r="x";A==="height"?r="y":["width","liftOuterWidth"].includes(A)&&(r="z");const s=((t=this.props.slot)==null?void 0:t.position[r])>0?1:-1;this._wrapper.position[r]=(e-i.origin)*i.scale*s}}}async loadGlb(A){const t=await new dc({useCache:!0}).loadAsync(A);if(t.glb)return t.glb.clone(!0)}async installBracket(A){const t=await new dc({useCache:!0}).loadAsync(A);if(!t.glb)return;const i=t.glb.clone(!0);i.traverse(r=>{r.userData.isBracket=!0}),this.useBracket=!0,this._slotContainer.add(i)}async install(A){if(!this._loading){this._loading=!0;try{const e=await this.loadGlb(A.url);if(!e)throw new Error(`Fail to load device from: ${A.url}`);if(e.traverse(t=>{t.userData.isDevice=!0}),A.bracketUrl){const t=await this.loadGlb(A.bracketUrl);if(t)this.clearSlot(),this._emitter.emit(Nt.ON_DEVICE_REPLACED),t.traverse(i=>{i.name.startsWith("Slot")&&this._bracketSlots.push(i),i.userData.isBracket=!0}),this._slotContainer.add(t);else throw new Error(`Fail to load bracket from: ${A.bracketUrl}`);this._bracketSlots.forEach(i=>{i.add(e)})}else this.clearSlot(),this._emitter.emit(Nt.ON_DEVICE_REPLACED),this._slotContainer.add(e);this.deviceInfo=A,this._slotUI.deviceName=A.name,this._slotUI.filled=!0,this.holeTarget&&(this.holeTarget.visible=!1)}catch(e){throw e}finally{this._loading=!1}}}get device(){return this._slotContainer.children.length?this._slotContainer.children[0]:null}get allFunctions(){return[...this._allFunctions]}set allFunctions(A){this._functions.forEach(e=>{A.includes(e)||this._functions.delete(e)}),this._allFunctions=new Set(A),this._slotUI.allFunctions=A}get functions(){return[...this._functions]}addFunction(A){this._allFunctions.has(A)&&(this._functions.add(A),this._slotUI.functions=[...this.functions],this._emitter.emit(Nt.ON_FUNCTION_ADDED,A))}removeFunction(A){this._functions.has(A)&&(this._functions.delete(A),this._slotUI.functions=[...this.functions],this._emitter.emit(Nt.ON_FUNCTION_REMOVED,A))}clearFunctions(){this._functions.forEach(A=>this.removeFunction(A))}addFunctions(A){A.forEach(e=>this.addFunction(e)),this._slotUI.functions=this.functions}changeName(A){var e;this.name=A,this.props.slot.userData.name=A,this.props.name=A,(e=this.element)==null||e.setAttribute("data-name",this.props.name)}clearSlot(){this._bracketSlots=[],this._slotContainer.children.forEach(A=>{A.removeFromParent(),Si(A)}),this._slotUI.filled=!1,this.deviceInfo=void 0,this._slotUI.deviceName="",this.holeTarget&&(this.holeTarget.visible=!0)}enable(){this._slotUI.disable=!1}disable(){this._slotUI.disable=!0}hide(){this._slotUI.hide=!0}show(){this._slotUI.hide=!1}get selected(){return this._selected}set selected(A){A&&this._emitter.emit(Nt.ON_BEFORE_SELECTED,A),this._selected=A,this._slotUI.selected=A,this._emitter.emit(Nt.ON_SELECTED,A),this.element.style.zIndex="100",this.selected?this.renderOrder=1/0:this.renderOrder=1}get deviceSelected(){return this._deviceSelected}set deviceSelected(A){this._deviceSelected=A,this._emitter.emit(Nt.ON_DEVICE_SELECTED,A)}get error(){return this._hasError}set error(A){this._loading&&setTimeout(()=>{this.error=A},100),this._hasError=A,this._slotUI.hasError=A,this._emitter.emit(Nt.ON_ERROR_STATE_CHANGE,A)}getCanInstall(){return this._canInstall}canInstall(A){this._canInstall=A,this._slotUI.canInstall=A}dispose(){cancelAnimationFrame(this._timer),["dragenter","dragover","dragleave","drop"].forEach(A=>{this.element.addEventListener(A,this._preventDefaults,!1)}),this.clearSlot(),this._emitter.removeAllListeners(),Si(this._slotContainer),this.element.remove()}render(A){const e=this.element.style.transform,t=/translate\(-?\d*\.?\d*%?,?\s-?\d*\.?\d*%?\)\s*translate\((-?\d*\.?\d*)px,\s*(-?\d*\.?\d*)px\)/.exec(e);if(!t)return;const i=new uA(parseFloat(t[1]),parseFloat(t[2])),r=A.mousePos.distanceTo(i);let s=12,o=24,a=30;if(this._canInstall&&(s=34,o=60,a=60),r<a){let l=(a-r)*1+s;r<20&&(l=o),l>o&&(l=o),this._slotUI.setSize(l)}else this._slotUI.setSize(s)}clone(A){return new It}}var gk=Object.defineProperty,mk=Object.getOwnPropertyDescriptor,Av=(n,A,e,t)=>{for(var i=t>1?void 0:t?mk(A,e):A,r=n.length-1,s;r>=0;r--)(s=n[r])&&(i=(t?s(A,e,i):s(i))||i);return t&&i&&gk(A,e,i),i};class vk{constructor(A,e,t,i){this.name=A,this.slot=e,this.start=t,this.end=i,this.split="--",this.uuid="",this.valid=!1,this.editable=!1,this.highlight=!1,this.uuid=A+this.split+e}update(A,e){this.start=A.clone(),this.end=e.clone()}}oe.DeviceLines=class extends Gr{constructor(A,e=0){super(),this.offset=A,this.heightOffset=e,this.lines=new Map,this.setOffset(this.offset.x,this.offset.y)}setOffset(A,e){this.offset.set(A,e),this.style.setProperty("--left",this.offset.x+"px"),this.style.setProperty("--top",this.offset.y+"px")}setHeightOffset(A){this.heightOffset=A,this.style.setProperty("--heightOffset",this.heightOffset+"px")}hide(){var A;(A=this.container)==null||A.classList.add("hidden")}show(){var A;(A=this.container)==null||A.classList.remove("hidden")}addLine(A){this.lines.has(A.uuid)||this.lines.set(A.uuid,A)}clear(){this.lines.clear()}removeLine(A){this.lines.delete(A.uuid)}getLineByName(A){const e=[];return this.lines.forEach((t,i)=>{t.name===A&&e.push(t)}),e}getLineBySlot(A){const e=[];return this.lines.forEach((t,i)=>{t.slot===A&&e.push(t)}),e}getPath(A){const e=A.end.clone();e.set(e.x-this.offset.x,e.y-this.offset.y);const t=A.start.clone().add(e).multiplyScalar(.5),i=A.start.clone().add(e).multiplyScalar(.7);return`M${A.start.x} ${A.start.y}
9569
9567
  C${t.x} ${A.start.y}
9570
9568
  ${i.x} ${A.end.y}
9571
9569
  ${e.x} ${e.y}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shop-components",
3
- "version": "0.1.53",
3
+ "version": "0.1.56",
4
4
  "description": "Shop components",
5
5
  "main": "dist/shop-components.umd.js",
6
6
  "module": "dist/shop-components.mjs",