schematic-symbols 0.0.70 → 0.0.72

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.70",
4
+ "version": "0.0.72",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -0,0 +1,32 @@
1
+ import { defineSymbol } from "drawing/defineSymbol"
2
+ import svgJson from "assets/generated/filled_diode.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.1,
15
+ y: -0.38,
16
+ anchor: "middle_bottom",
17
+ } as TextPrimitive,
18
+ {
19
+ type: "text",
20
+ text: "{VAL}",
21
+ x: -0.1,
22
+ y: 0.28,
23
+ anchor: "middle_top",
24
+ } as TextPrimitive,
25
+ ] as any,
26
+ ports: [
27
+ { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
28
+ { ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
29
+ ],
30
+ size: { width: bounds.width, height: bounds.height },
31
+ center: { x: bounds.centerX, y: bounds.centerY },
32
+ })
@@ -0,0 +1,4 @@
1
+ import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import filled_diode_horz from "./filled_diode_horz"
3
+
4
+ export default rotateSymbol(filled_diode_horz)
@@ -0,0 +1,32 @@
1
+ import svgJson from "assets/generated/npn_bipolar_transistor.json"
2
+ import { defineSymbol } from "drawing/defineSymbol"
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
+ {
11
+ type: "text",
12
+ text: "{REF}",
13
+ x: -0.07,
14
+ y: -0.3596647999999991,
15
+ anchor: "middle_right",
16
+ },
17
+ {
18
+ type: "text",
19
+ text: "{VAL}",
20
+ x: -0.0679100444999996,
21
+ y: 0.4129789000000006,
22
+ anchor: "middle_right",
23
+ },
24
+ ] as any,
25
+ ports: [
26
+ { ...refblocks.top1, labels: ["1", "collector"] },
27
+ { ...refblocks.bottom1, labels: ["2", "emitter"] },
28
+ { ...refblocks.left1, labels: ["3", "base"] },
29
+ ],
30
+ size: { width: bounds.width, height: bounds.height },
31
+ center: { x: bounds.centerX, y: bounds.centerY },
32
+ })
@@ -0,0 +1,12 @@
1
+ import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import npn_bipolar_transistor_horz from "./npn_bipolar_transistor_horz"
3
+
4
+ const rotatedSymbol = rotateSymbol(npn_bipolar_transistor_horz)
5
+
6
+ const texts = rotatedSymbol.primitives.filter((p) => p.type === "text")
7
+
8
+ const ref = texts.find((t) => t.text === "{REF}")!
9
+
10
+ ref.anchor = "middle_left"
11
+
12
+ export default rotatedSymbol