Skip to content

Commit 012d1f0

Browse files
authored
feat: add relay (KS2E-M-DC5)
* feat: add relay (KS2E-M-DC5) * Fixed requested changes
1 parent 14c2cd1 commit 012d1f0

File tree

4 files changed

+161
-0
lines changed

4 files changed

+161
-0
lines changed

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ export { MicrosdCardElement } from './microsd-card-element';
4949
export { DipSwitch8Element } from './dip-switch-8-element';
5050
export { StepperMotorElement } from './stepper-motor-element';
5151
export { HX711Element } from './hx711-element';
52+
export { KS2EMDC5Element } from './ks2e-m-dc5-element';

src/ks2e-m-dc5-element.stories.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { html } from 'lit';
2+
import './ks2e-m-dc5-element';
3+
4+
export default {
5+
title: 'KS2E-M-DC5',
6+
component: 'wokwi-ks2e-m-dc5',
7+
};
8+
9+
const Template = () => html`<wokwi-ks2e-m-dc5></wokwi-ks2e-m-dc5>`;
10+
11+
export const Default = Template.bind({});

src/ks2e-m-dc5-element.ts

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
import { html, LitElement } from 'lit';
2+
import { customElement } from 'lit/decorators.js';
3+
import { ElementPin } from './pin';
4+
5+
const y1Pos = 5.1;
6+
const y2Pos = 32.7;
7+
const x1Pos = 7.6;
8+
const x2Pos = 25.75;
9+
const x3Pos = 44;
10+
const x4Pos = 71.8;
11+
12+
@customElement('wokwi-ks2e-m-dc5')
13+
export class KS2EMDC5Element extends LitElement {
14+
get pinInfo(): ElementPin[] {
15+
return [
16+
{ name: 'NO2', x: x1Pos, y: y1Pos, signals: [], number: 8 },
17+
{ name: 'NC2', x: x2Pos, y: y1Pos, signals: [], number: 6 },
18+
{ name: 'P2', x: x3Pos, y: y1Pos, signals: [], number: 4 },
19+
{ name: 'COIL2', x: x4Pos, y: y1Pos, signals: [{ type: 'power', signal: 'GND' }], number: 1 },
20+
{ name: 'NO1', x: x1Pos, y: y2Pos, signals: [], number: 9 },
21+
{ name: 'NC1', x: x2Pos, y: y2Pos, signals: [], number: 11 },
22+
{ name: 'P1', x: x3Pos, y: y2Pos, signals: [], number: 13 },
23+
{ name: 'COIL1', x: x4Pos, y: y2Pos, signals: [], number: 16 },
24+
];
25+
}
26+
27+
render() {
28+
return html`
29+
<svg
30+
width="21mm"
31+
height="10mm"
32+
version="1.1"
33+
viewBox="0 0 21 10"
34+
xmlns="http://www.w3.org/2000/svg"
35+
>
36+
<rect
37+
x=".19797"
38+
y=".19797"
39+
width="20.604"
40+
height="9.6041"
41+
ry=".58463"
42+
fill="#f7b93c"
43+
stroke="#dda137"
44+
stroke-linecap="square"
45+
stroke-linejoin="round"
46+
stroke-width=".39594"
47+
style="paint-order:markers stroke fill"
48+
/>
49+
<g fill="none" stroke="#dda137" stroke-linecap="square" stroke-linejoin="round">
50+
<ellipse
51+
cx="2"
52+
cy="1.35"
53+
rx=".76317"
54+
ry=".76317"
55+
stroke-width=".47366"
56+
style="paint-order:markers stroke fill"
57+
/>
58+
<g stroke-width=".47362">
59+
<ellipse
60+
cx="6.8244"
61+
cy="1.35"
62+
rx=".76319"
63+
ry=".76319"
64+
style="paint-order:markers stroke fill"
65+
/>
66+
<ellipse
67+
cx="11.649"
68+
cy="1.35"
69+
rx=".76319"
70+
ry=".76319"
71+
style="paint-order:markers stroke fill"
72+
/>
73+
<ellipse
74+
cx="19"
75+
cy="1.35"
76+
rx=".76319"
77+
ry=".76319"
78+
style="paint-order:markers stroke fill"
79+
/>
80+
</g>
81+
</g>
82+
<g
83+
transform="translate(-1.1921e-7 7.3)"
84+
fill="none"
85+
stroke="#dda137"
86+
stroke-linecap="square"
87+
stroke-linejoin="round"
88+
>
89+
<ellipse
90+
cx="2"
91+
cy="1.35"
92+
rx=".76317"
93+
ry=".76317"
94+
stroke-width=".47366"
95+
style="paint-order:markers stroke fill"
96+
/>
97+
<g stroke-width=".47362">
98+
<ellipse
99+
cx="6.8244"
100+
cy="1.35"
101+
rx=".76319"
102+
ry=".76319"
103+
style="paint-order:markers stroke fill"
104+
/>
105+
<ellipse
106+
cx="11.649"
107+
cy="1.35"
108+
rx=".76319"
109+
ry=".76319"
110+
style="paint-order:markers stroke fill"
111+
/>
112+
<ellipse
113+
cx="19"
114+
cy="1.35"
115+
rx=".76319"
116+
ry=".76319"
117+
style="paint-order:markers stroke fill"
118+
/>
119+
</g>
120+
</g>
121+
<rect
122+
x="20.208"
123+
y="4.4984"
124+
width=".40327"
125+
height="1.0033"
126+
fill="#dda137"
127+
stroke="#dda137"
128+
stroke-linecap="square"
129+
stroke-width=".39673"
130+
style="paint-order:markers stroke fill"
131+
/>
132+
<text
133+
x="1.0733131"
134+
y="6.0273261"
135+
fill="#000000"
136+
font-family="sans-serif"
137+
font-size="2.8222px"
138+
stroke-width=".26458"
139+
style="line-height:1.25"
140+
xml:space="preserve"
141+
>
142+
<tspan x="1.0733131" y="6.0273261">KS2E-M-DC5</tspan>
143+
</text>
144+
</svg>
145+
`;
146+
}
147+
}

src/react-types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import { MicrosdCardElement } from './microsd-card-element';
4848
import { DipSwitch8Element } from './dip-switch-8-element';
4949
import { StepperMotorElement } from './stepper-motor-element';
5050
import { HX711Element } from './hx711-element';
51+
import { KS2EMDC5Element } from './ks2e-m-dc5-element';
5152

5253
type WokwiElement<T> = Partial<T> & React.ClassAttributes<T>;
5354

@@ -101,6 +102,7 @@ declare global {
101102
'wokwi-dip-switch-8': WokwiElement<DipSwitch8Element>;
102103
'wokwi-stepper-motor': WokwiElement<StepperMotorElement>;
103104
'wokwi-hx711': WokwiElement<HX711Element>;
105+
'wokwi-ks2e-m-dc5': WokwiElement<KS2EMDC5Element>;
104106
}
105107
}
106108
}

0 commit comments

Comments
 (0)