schematic-symbols 0.0.73 → 0.0.75

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.73",
4
+ "version": "0.0.75",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -0,0 +1,20 @@
1
+ import { defineSymbol } from "drawing/defineSymbol"
2
+ import svgJson from "assets/generated/mushroom_head_normally_open_momentary.json"
3
+ import { Primitive } 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
+ { ...texts.top1, anchor: "middle_bottom", x: 0 },
12
+ { ...texts.bottom1, anchor: "middle_top", x: 0 },
13
+ ] as Primitive[],
14
+ ports: [
15
+ { ...refblocks.left1, labels: ["1"] },
16
+ { ...refblocks.right1, labels: ["2"] },
17
+ ],
18
+ size: { width: bounds.width, height: bounds.height },
19
+ center: { x: bounds.centerX + 0.006, y: bounds.centerY + 0.06 },
20
+ })
@@ -0,0 +1,23 @@
1
+ import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import mushroom_head_normally_open_momentary_horz from "./mushroom_head_normally_open_momentary_horz"
3
+ import type { TextPrimitive } from "drawing"
4
+
5
+ const rotated = rotateSymbol(mushroom_head_normally_open_momentary_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 = ref.x - 0.03
18
+ ref.y = ref.y
19
+
20
+ val.x = val.x
21
+ val.y = 0
22
+
23
+ export default rotated
@@ -0,0 +1,33 @@
1
+ import svgJson from "assets/generated/pnp_bipolar_transistor.json"
2
+ import { defineSymbol } from "drawing/defineSymbol"
3
+ import { Primitive } 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.07,
15
+ y: -0.3596647999999991,
16
+ anchor: "middle_right",
17
+ },
18
+ {
19
+ type: "text",
20
+ text: "{VAL}",
21
+ x: -0.0679100444999996,
22
+ y: 0.4129789000000006,
23
+ anchor: "middle_right",
24
+ },
25
+ ] as Primitive[],
26
+ ports: [
27
+ { ...refblocks.top1, labels: ["1", "collector"] },
28
+ { ...refblocks.bottom1, labels: ["2", "emitter"] },
29
+ { ...refblocks.left1, labels: ["3", "base"] },
30
+ ],
31
+ size: { width: bounds.width, height: bounds.height },
32
+ center: { x: bounds.centerX, y: bounds.centerY },
33
+ })
@@ -0,0 +1,12 @@
1
+ import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import pnp_bipolar_transistor_horz from "./pnp_bipolar_transistor_horz"
3
+
4
+ const rotatedSymbol = rotateSymbol(pnp_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