shop-components 0.1.65 → 0.1.67

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.
@@ -73,7 +73,7 @@ export declare class Amr extends Object3D {
73
73
  set bodyOpacity(o: number);
74
74
  constructor(_props: AmrProps);
75
75
  init(app: Scene3D): void;
76
- load(url: string): Promise<void>;
76
+ load(url: string, type?: string): Promise<void>;
77
77
  changeSkin(skin: Skin, value: string): void;
78
78
  changeLogo(logo: Logo, configs: CropperConfigs): void;
79
79
  setShapeKey(key: string, value: number): void;
@@ -45,7 +45,6 @@ export declare class DeviceViewer extends LitElement {
45
45
  addAMR: () => void;
46
46
  clean: () => void;
47
47
  recreate: () => void;
48
- generateEdges: () => void;
49
48
  setShapeKey: (key: string, val: any) => void;
50
49
  cancel: () => void;
51
50
  changeShelfLevel: (e: any) => void;
@@ -1,7 +1,6 @@
1
1
  import { DeviceViewer, Props } from './index';
2
2
  declare const _default: {
3
3
  title: string;
4
- tags: string[];
5
4
  render: (args: Props) => DeviceViewer;
6
5
  argTypes: {
7
6
  test: {
@@ -0,0 +1,4 @@
1
+ import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer';
2
+ export default class Pin extends CSS2DObject {
3
+ constructor();
4
+ }
@@ -123,7 +123,7 @@ export declare class Scene3D {
123
123
  exportAMR(): Promise<ArrayBuffer | {
124
124
  [key: string]: any;
125
125
  }>;
126
- addAMR(url: string): Promise<void>;
126
+ addAMR(url: string, type?: string): Promise<void>;
127
127
  fit: () => void;
128
128
  select(obj: string | Object3D | Object3D[]): void;
129
129
  appendTo(parent: HTMLElement): void;
@@ -0,0 +1,5 @@
1
+ import { LitElement } from 'lit';
2
+ export default class ShopDevices extends LitElement {
3
+ constructor();
4
+ protected render(): unknown;
5
+ }
@@ -1,8 +1,7 @@
1
- import { TestViewer, Props } from './index';
1
+ import ShopDevices from '../../../../../../../stories/devices/index';
2
2
  declare const _default: {
3
3
  title: string;
4
- tags: string[];
5
- render: (args: Props) => TestViewer;
4
+ render: (args: any) => ShopDevices;
6
5
  argTypes: {};
7
6
  };
8
7
  export default _default;
@@ -0,0 +1,8 @@
1
+ import Pin from '../../../../../../../../stories/devices/src/pin';
2
+ export default class Connector {
3
+ readonly uuid: string;
4
+ connections: Pin[];
5
+ constructor(uuid?: string);
6
+ addConnection(pin: Pin): void;
7
+ describe(): void;
8
+ }
@@ -0,0 +1,16 @@
1
+ export interface ConstraintExecResult {
2
+ valid: boolean;
3
+ message?: string;
4
+ }
5
+ export declare abstract class Constraintable {
6
+ protected _valid: boolean;
7
+ protected constructor();
8
+ get isValid(): boolean;
9
+ abstract exec(): ConstraintExecResult;
10
+ }
11
+ export default class Constraint extends Constraintable {
12
+ constructor();
13
+ exec(): ConstraintExecResult;
14
+ addConnection(): void;
15
+ describe(): void;
16
+ }
@@ -0,0 +1,9 @@
1
+ import { ConstraintExecResult, Constraintable } from '../../../../../../../../../stories/devices/src/constraints/constraint';
2
+ import Pin from '../../../../../../../../../stories/devices/src/pin';
3
+ export default class SameDeviceConstraint extends Constraintable {
4
+ source: Pin;
5
+ target: Pin;
6
+ constructor(source: Pin, target: Pin);
7
+ setTarget(target: Pin): this;
8
+ exec(): ConstraintExecResult;
9
+ }
@@ -0,0 +1,9 @@
1
+ import { Constraintable, ConstraintExecResult } from '../../../../../../../../../stories/devices/src/constraints/constraint';
2
+ import Pin from '../../../../../../../../../stories/devices/src/pin';
3
+ export default class SingleConnectionConstraint extends Constraintable {
4
+ source: Pin;
5
+ target: Pin;
6
+ constructor(source: Pin, target: Pin);
7
+ setTarget(target: Pin): this;
8
+ exec(): ConstraintExecResult;
9
+ }
@@ -0,0 +1,11 @@
1
+ import Pin from '../../../../../../../../stories/devices/src/pin';
2
+ export default class Device {
3
+ private _deviceId;
4
+ private _name;
5
+ pins: Pin[];
6
+ get deviceId(): string;
7
+ get name(): string;
8
+ constructor(_deviceId: string, _name: string);
9
+ addPin(pin: Pin): void;
10
+ describe(): void;
11
+ }
@@ -0,0 +1,43 @@
1
+ export declare enum PIN_TYPES {
2
+ VCC = "VCC",
3
+ '24VDC IN-' = "24VDC IN-",
4
+ GND = "GND",
5
+ 'DI-NPN' = "DI-NPN",
6
+ PDO = "PDO",
7
+ '485-B' = "485-B",
8
+ '485-A' = "485-A",
9
+ '232-T' = "232-T",
10
+ '232-R' = "232-R",
11
+ 'CAN-L' = "CAN-L",
12
+ 'CAN-H' = "CAN-H",
13
+ 'SWITCH-N' = "SWITCH-N",
14
+ 'SWITCH-O' = "SWITCH-O",
15
+ 'BOOT-KEY' = "BOOT-KEY",
16
+ 'BOOT-LIGHT' = "BOOT-LIGHT",
17
+ 'MANUAL-CHARGING' = "MANUAL-CHARGING",
18
+ 'EMC IN' = "EMC IN",
19
+ 'EMC P-' = "EMC P-",
20
+ 'EMC P+' = "EMC P+",
21
+ LAN = "LAN",
22
+ USB = "USB",
23
+ HDMI = "HDMI",
24
+ SPK = "SPK",
25
+ MIC = "MIC",
26
+ WIFI = "WIFI",
27
+ 'Contactor O' = "Contactor O",
28
+ 'Contactor N' = "Contactor N"
29
+ }
30
+ export default class Pin {
31
+ private pinID;
32
+ private pinType;
33
+ private group;
34
+ private voltageMin;
35
+ private voltageMax;
36
+ private currentMax;
37
+ private _deviceId;
38
+ private _constraints;
39
+ get deviceId(): string;
40
+ set deviceId(deviceId: string);
41
+ constructor(pinID: string, pinType: PIN_TYPES, group: any, voltageMin: number, voltageMax: number, currentMax: number);
42
+ describe(): void;
43
+ }
@@ -57462,7 +57462,7 @@ class kx extends V0 {
57462
57462
  const i = this.props.follows.get(A);
57463
57463
  if (i) {
57464
57464
  let r = "x";
57465
- A === "height" ? r = "y" : ["width", "liftOuterWidth"].includes(A) && (r = "z");
57465
+ ["height", "mast"].includes(A) ? r = "y" : ["width", "liftOuterWidth"].includes(A) && (r = "z");
57466
57466
  const s = ((t = this.props.slot) == null ? void 0 : t.position[r]) > 0 ? 1 : -1;
57467
57467
  this._wrapper.position[r] = (e - i.origin) * i.scale * s;
57468
57468
  }
@@ -62047,11 +62047,18 @@ class Vu extends Ie {
62047
62047
  this._textWrapper.lookAt(A);
62048
62048
  }
62049
62049
  updateSize(A) {
62050
- var i;
62051
- const e = (i = this.parent) == null ? void 0 : i.position.clone();
62050
+ var r;
62051
+ const e = (r = this.parent) == null ? void 0 : r.position.clone();
62052
62052
  e == null || e.setY(this.position.y);
62053
62053
  let t = (e == null ? void 0 : e.distanceTo(A)) || 1;
62054
- t *= 1, t < 3 && (t = 3), this._tw && this._tw.isPlaying() && this._tw.stop(), this._tw = new Is.Tween(this._text).to({ fontSize: t / 100 }).duration(300).easing(Is.Easing.Quintic.InOut).start();
62054
+ if (this._tw && this._tw.isPlaying()) {
62055
+ this._tw.stop();
62056
+ return;
62057
+ }
62058
+ let i = t / 80;
62059
+ i > 0.25 && (i = 0.25), i < 0.025 && (i = 0.025), this._tw = new Is.Tween(this._text).to({ fontSize: i }).duration(300).easing(Is.Easing.Quintic.InOut).onComplete(() => {
62060
+ this._text.sync();
62061
+ }).start();
62055
62062
  }
62056
62063
  destroy() {
62057
62064
  this._text.dispose(), this.children.forEach((A) => Oi(A)), this.removeFromParent();
@@ -62588,18 +62595,18 @@ class Pj extends Ie {
62588
62595
  }), this.sizeBox.translateCache = this.sizeBox.originOffset, this.sizeBox.generate(this._container))) : this.sizeBox.generate(this._container), ["width", "length", "height"].includes(e) && this._emitter.emit("size-changed", e, t);
62589
62596
  });
62590
62597
  }
62591
- async load(A) {
62598
+ async load(A, e = "") {
62592
62599
  this._url = A, this.name || (this.name = A.substring(A.lastIndexOf("/") + 1, A.lastIndexOf("."))), !A.startsWith("blob") && A.endsWith(".sglb");
62593
- let e;
62594
- if (A.endsWith(".glb"))
62595
- e = (await _c.loadAsync(A)).scene;
62600
+ let t;
62601
+ if (e === "glb" || A.endsWith(".glb"))
62602
+ t = (await _c.loadAsync(A)).scene;
62596
62603
  else {
62597
- const i = await new Of({ useCache: !0 }).loadAsync(A);
62598
- if (!i.glb)
62604
+ const r = await new Of({ useCache: !0 }).loadAsync(A);
62605
+ if (!r.glb)
62599
62606
  return;
62600
- e = i.glb;
62607
+ t = r.glb;
62601
62608
  }
62602
- this._generateAmr(e.clone(!0)), e = null, this._emitter.emit("amr-loaded");
62609
+ this._generateAmr(t.clone(!0)), t = null, this._emitter.emit("amr-loaded");
62603
62610
  }
62604
62611
  changeSkin(A, e) {
62605
62612
  A && (A.change(e), this._app && this._app.usePathTracing && (this._app.sampleCount = 0, this._app.usePathTracing && (this._app.pathTracer.pausePathTracing = !1, this._app.pathTracer.updateMaterials())));
@@ -64965,7 +64972,7 @@ class nG {
64965
64972
  let u = Math.max(a.x, a.y, a.z) + Math.max(a.x, a.y);
64966
64973
  const c = b9(this.camera.fov, 0.8) * 3 - 1.2;
64967
64974
  u += c;
64968
- const h = Math.min(a.x, a.y, a.z) + 0.5, p = this.camera.position.clone().normalize().multiplyScalar(u);
64975
+ const h = Math.min(a.x, a.y, a.z) + 0.2, p = this.camera.position.clone().normalize().multiplyScalar(u);
64969
64976
  p.setY(u * Math.sin(30 / 180 * Math.PI)), this._fitAnimation = new Jf(this.camera.position).to(p, 600).easing(Is.Easing.Quintic.InOut).onStart(() => {
64970
64977
  this.controls.enabled = !1;
64971
64978
  }).onComplete(() => {
@@ -65025,7 +65032,7 @@ class nG {
65025
65032
  const i = new LK(A.workerUrl), r = typeof navigator < "u" ? navigator.hardwareConcurrency : 4;
65026
65033
  i.maxWorkerCount = r, this.pathTracer.setBVHWorker(i), this.orthographicCamera.left = -20, this.orthographicCamera.right = 20, this.orthographicCamera.top = -20, this.orthographicCamera.bottom = 20, this.controls.addEventListener("change", () => {
65027
65034
  var o;
65028
- this.sampleCount = 0, this.orthographicCamera.position.copy(this.camera.position), this.orthographicCamera.lookAt(this.controls.target), this.usePathTracing && (this.pathTracer.pausePathTracing = !1, (o = this.pathTracer) == null || o.updateCamera()), this._updateCamera(), !(Math.abs(this.camera.position.x) < 1e-3 || Math.abs(this.camera.position.z) < 1e-3) && (this._axisMoving || (this.mainCamera = this.camera));
65035
+ this.sampleCount = 0, this.orthographicCamera.position.copy(this.camera.position), this.orthographicCamera.lookAt(this.controls.target), this.usePathTracing && (this.pathTracer.pausePathTracing = !1, (o = this.pathTracer) == null || o.updateCamera()), this._updateCamera(), !(Math.abs(this.camera.position.x) < 1e-3 || Math.abs(this.camera.position.z) < 1e-3) && (this._axisMoving || (this.mainCamera = this.camera, this.usePathTracing && this.generateBVH().then()));
65029
65036
  }), this._mainCamera = this.camera, this._composer = new X7(this.renderer), this._composer.setPixelRatio(window.devicePixelRatio);
65030
65037
  const s = new VD(this.scene, this.camera);
65031
65038
  this._composer.addPass(s), this._composer.addPass(new iE()), this._outlinePass = new Wn(new uA(window.innerWidth, window.innerHeight), this.scene, this.camera), this._outlinePass.visibleEdgeColor.set(26367), this._outlinePass.edgeThickness = 0.5, this._outlinePass.hiddenEdgeColor.set(26367), this._outlinePass.edgeStrength = 3, this._outlinePass.edgeGlow = 0, this._composer.addPass(this._outlinePass), this._outlinePassError = new Wn(new uA(window.innerWidth, window.innerHeight), this.scene, this.camera), this._outlinePassError.visibleEdgeColor.set(16711680), this._outlinePassError.edgeThickness = 0.5, this._outlinePassError.hiddenEdgeColor.set(16711680), this._outlinePassError.edgeStrength = 3, this._outlinePassError.edgeGlow = 0, this._composer.addPass(this._outlinePassError), this._composer.renderTarget1.texture.colorSpace = ze, this._composer.renderTarget2.texture.colorSpace = ze, this._fxaaPass = new d2($D), this._composer.addPass(this._fxaaPass), this._container.add(this.amr), this.scene.add(this._container), this.ticker(), this._loadEnv(), this._initEvents(), this._ground.rotateX(-Math.PI / 2), this.scene.add(this._ground), (typeof A.useAxisBall != "boolean" || A.useAxisBall) && (this._controlsGizmo = new OK(this.controls, {
@@ -65036,7 +65043,7 @@ class nG {
65036
65043
  bubbleSizePrimary: 18,
65037
65044
  bubbleSizeSecondary: 14
65038
65045
  }), this._controlsGizmo.addListener("axis-select-start", () => {
65039
- this._axisMoving = !0, this.mainCamera = this.orthographicCamera;
65046
+ this._axisMoving = !0, this.mainCamera = this.orthographicCamera, this.usePathTracing && this.generateBVH().then();
65040
65047
  }), this._controlsGizmo.addListener("axis-select-end", () => {
65041
65048
  this._axisMoving = !1;
65042
65049
  }));
@@ -65071,7 +65078,7 @@ class nG {
65071
65078
  }
65072
65079
  _loadEnv() {
65073
65080
  new JD(new c2()).load(_9, (e) => {
65074
- e.mapping = Ia, e.minFilter = ye, e.magFilter = ye, e.colorSpace = ze, e.format = _e, e.needsUpdate = !0, this._usePathTracing || (this.scene.environment = e, this.overlayScene.environment = e, this.scene.environmentRotation.y = Math.PI * 0.1, this.scene.environmentIntensity = 1, this.overlayScene.environmentIntensity = 1), this.pathTracer.updateEnvironment();
65081
+ e.mapping = Ia, e.minFilter = ye, e.magFilter = ye, e.colorSpace = ze, e.format = _e, e.needsUpdate = !0, this._usePathTracing || (this.scene.environment = e, this.overlayScene.environment = e, this.scene.environmentRotation.y = Math.PI * 0.2, this.scene.environmentIntensity = 1.4, this.overlayScene.environmentIntensity = 1.4), this.pathTracer.updateEnvironment();
65075
65082
  }, () => {
65076
65083
  }, () => {
65077
65084
  });
@@ -65120,15 +65127,15 @@ class nG {
65120
65127
  binary: !0
65121
65128
  });
65122
65129
  }
65123
- async addAMR(A) {
65124
- this.amr.init(this), await this.amr.load(A), this.amr.addEventListener("shape-key-changed", (e, t) => {
65125
- this.pathTracer.reset(), this.sampleCount = 0, this.pathTracer.setScene(this.scene, this.camera), this.overlayScene.traverse((i) => {
65126
- if (!Object.keys(i.morphTargetDictionary || {}).includes(e))
65130
+ async addAMR(A, e = "") {
65131
+ this.amr.init(this), await this.amr.load(A, e), this.amr.addEventListener("shape-key-changed", (t, i) => {
65132
+ this.pathTracer.reset(), this.sampleCount = 0, this.pathTracer.setScene(this.scene, this.camera), this.overlayScene.traverse((r) => {
65133
+ if (!Object.keys(r.morphTargetDictionary || {}).includes(t))
65127
65134
  return;
65128
- let r = t;
65129
- i.userData[`origin_${e}`] && (r -= i.userData[`origin_${e}`]);
65130
- const s = i.morphTargetDictionary[e];
65131
- i.morphTargetInfluences && (i.morphTargetInfluences[s] = r), i instanceof Pe && i.geometry.translate(0, 0, 1e-5);
65135
+ let s = i;
65136
+ r.userData[`origin_${t}`] && (s -= r.userData[`origin_${t}`]);
65137
+ const o = r.morphTargetDictionary[t];
65138
+ r.morphTargetInfluences && (r.morphTargetInfluences[o] = s), r instanceof Pe && r.geometry.translate(0, 0, 1e-5);
65132
65139
  });
65133
65140
  });
65134
65141
  }