schematic-symbols 0.0.118 → 0.0.120

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "schematic-symbols",
3
3
  "main": "./dist/index.js",
4
- "version": "0.0.118",
4
+ "version": "0.0.120",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -0,0 +1,4 @@
1
+ import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import icled_right from "./icled_right"
3
+
4
+ export default rotateSymbol(icled_right, "down")
@@ -0,0 +1,4 @@
1
+ import { flipSymbolOverYAxis } from "drawing/rotateSymbol"
2
+ import icled_right from "./icled_right"
3
+
4
+ export default flipSymbolOverYAxis(icled_right)
@@ -0,0 +1,11 @@
1
+ import svgJson from "assets/generated/icled.json"
2
+ import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
+
4
+ export default modifySymbol(svgJson)
5
+ .labelPort("left1", ["1", "DIN"])
6
+ .labelPort("left2", ["2", "POWER"])
7
+ .labelPort("right1", ["4", "GND"])
8
+ .labelPort("right2", ["3", "DOUT"])
9
+ .changeTextAnchor("{REF}", "middle_bottom")
10
+ .changeTextAnchor("{VAL}", "middle_top")
11
+ .build()
@@ -0,0 +1,27 @@
1
+ import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import icled_right from "./icled_right"
3
+
4
+ const baseSymbol = rotateSymbol(icled_right, "up")
5
+
6
+ // Flip path25-0 and path78 over X axis
7
+ const modifiedSymbol = {
8
+ ...baseSymbol,
9
+ primitives: baseSymbol.primitives.map((primitive) => {
10
+ if (
11
+ primitive.type === "path" &&
12
+ (primitive.points.length === 3 || primitive.points.length === 4)
13
+ ) {
14
+ // This matches both the triangle shape (path25-0) and path78
15
+ return {
16
+ ...primitive,
17
+ points: primitive.points.map((point) => ({
18
+ x: point.x,
19
+ y: -point.y + 2 * baseSymbol.center.y,
20
+ })),
21
+ }
22
+ }
23
+ return primitive
24
+ }),
25
+ }
26
+
27
+ export default modifiedSymbol