schematic-symbols 0.0.47 → 0.0.49

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.
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.47",
4
+ "version": "0.0.49",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -0,0 +1,33 @@
1
+ import { defineSymbol } from "drawing/defineSymbol"
2
+ import svgJson from "assets/generated/igbt_transistor.json"
3
+ import { TextPrimitive } from "drawing/types"
4
+
5
+ const { paths, texts, bounds, refblocks, circles } = svgJson
6
+
7
+ export default defineSymbol({
8
+ primitives: [
9
+ ...Object.values(paths),
10
+ ...Object.values(circles),
11
+ {
12
+ type: "text",
13
+ text: "{REF}",
14
+ x: 0,
15
+ y: -0.4,
16
+ anchor: "middle_right",
17
+ } as TextPrimitive,
18
+ {
19
+ type: "text",
20
+ text: "{VAL}",
21
+ x: 0,
22
+ y: 0.4,
23
+ anchor: "middle_right",
24
+ } as TextPrimitive,
25
+ ] as any,
26
+ ports: [
27
+ { ...refblocks.top1, labels: ["1"] }, // TODO add more "standard" labels
28
+ { ...refblocks.bottom1, labels: ["2"] }, // TODO add more "standard" labels
29
+ { ...refblocks.left1, labels: ["3"] }, // TODO add more "standard" labels
30
+ ],
31
+ size: { width: bounds.width, height: bounds.height },
32
+ center: { x: bounds.centerX + 0.06, y: bounds.centerY },
33
+ })
@@ -0,0 +1,21 @@
1
+ import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import igbt_transistor_horz from "./igbt_transistor_horz"
3
+ import type { TextPrimitive } from "drawing"
4
+
5
+ const rotated = rotateSymbol(igbt_transistor_horz)
6
+
7
+ const ref = rotated.primitives.find(
8
+ (p) => p.type === "text" && p.text === "{REF}",
9
+ )! as TextPrimitive
10
+ const val = rotated.primitives.find(
11
+ (p) => p.type === "text" && p.text === "{VAL}",
12
+ )! as TextPrimitive
13
+
14
+ ref.anchor = "middle_left"
15
+ val.anchor = "middle_right"
16
+
17
+ ref.x = 0.45
18
+ ref.y += 0.065
19
+ val.y += 0.065
20
+
21
+ export default rotated
@@ -0,0 +1,19 @@
1
+ import { defineSymbol } from "drawing/defineSymbol"
2
+ import svgJson from "assets/generated/laser_diode.json"
3
+
4
+ const { paths, texts, bounds, refblocks, circles } = svgJson
5
+
6
+ export default defineSymbol({
7
+ primitives: [
8
+ ...Object.values(paths),
9
+ ...Object.values(circles),
10
+ { ...texts.top1, anchor: "middle_left" },
11
+ { ...texts.bottom1, anchor: "middle_bottom" },
12
+ ] as any,
13
+ ports: [
14
+ { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
15
+ { ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
16
+ ],
17
+ size: { width: bounds.width, height: bounds.height },
18
+ center: { x: bounds.centerX, y: bounds.centerY },
19
+ })
@@ -0,0 +1,13 @@
1
+ import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import laser_diode_horz from "./laser_diode_horz"
3
+
4
+ const rotatedSymbol = rotateSymbol(laser_diode_horz)
5
+
6
+ const texts = rotatedSymbol.primitives.filter((p) => p.type === "text")
7
+
8
+ const ref = texts.find((t) => t.text === "{VAL}")!
9
+
10
+ ref.x = -0.52
11
+ ref.anchor = "middle_right"
12
+
13
+ export default rotatedSymbol