schematic-symbols 0.0.94 → 0.0.96

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.
@@ -40,13 +40,13 @@ const rotateAnchor = (
40
40
  case "left":
41
41
  switch (anchor) {
42
42
  case "middle_top":
43
- return "middle_left"
43
+ return "middle_bottom"
44
44
  case "middle_bottom":
45
- return "middle_right"
45
+ return "middle_top"
46
46
  case "middle_left":
47
- return "middle_bottom"
47
+ return "middle_right"
48
48
  case "middle_right":
49
- return "middle_top"
49
+ return "middle_left"
50
50
  }
51
51
  break
52
52
  case "right":
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.94",
4
+ "version": "0.0.96",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -0,0 +1,4 @@
1
+ import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import led_right from "./led_right"
3
+
4
+ export default rotateSymbol(led_right, "down")
@@ -0,0 +1,4 @@
1
+ import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import led_right from "./led_right"
3
+
4
+ export default rotateSymbol(led_right, "left")
@@ -0,0 +1,20 @@
1
+ import { defineSymbol } from "drawing/defineSymbol"
2
+ import svgJson from "assets/generated/led.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.bottom1, anchor: "middle_top" },
12
+ { ...texts.right1, anchor: "middle_bottom" },
13
+ ] as Primitive[],
14
+ ports: [
15
+ { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
16
+ { ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
17
+ ],
18
+ size: { width: bounds.width, height: bounds.height },
19
+ center: { x: bounds.centerX, y: bounds.centerY },
20
+ })
@@ -0,0 +1,4 @@
1
+ import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import led_right from "./led_right"
3
+
4
+ export default rotateSymbol(led_right, "up")
@@ -6,8 +6,8 @@ const { paths, texts, bounds, refblocks } = svgJson
6
6
  export default defineSymbol({
7
7
  primitives: [
8
8
  ...Object.values(paths),
9
- { ...texts.bottom1, anchor: "middle_right" },
10
- { ...texts.top1, anchor: "middle_left" },
9
+ { ...texts.bottom1, anchor: "middle_top" },
10
+ { ...texts.top1, anchor: "middle_bottom" },
11
11
  ] as any,
12
12
  ports: [
13
13
  { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
@@ -1,4 +1,14 @@
1
1
  import { rotateSymbol } from "drawing/rotateSymbol"
2
2
  import potentiometer2_horz from "./potentiometer2_horz"
3
3
 
4
- export default rotateSymbol(potentiometer2_horz)
4
+ const rotated = rotateSymbol(potentiometer2_horz)
5
+
6
+ const texts = rotated.primitives.filter((p) => p.type === "text")!
7
+
8
+ const val = texts.find((t) => t.text === "{VAL}")!
9
+ val.anchor = "middle_right"
10
+
11
+ const ref = texts.find((t) => t.text === "{REF}")!
12
+ ref.anchor = "middle_left"
13
+
14
+ export default rotated
@@ -1,18 +0,0 @@
1
- import svgJson from "assets/generated/led.json"
2
- import { defineSymbol } from "drawing/defineSymbol"
3
-
4
- const { paths, texts, bounds, refblocks } = svgJson
5
-
6
- export default defineSymbol({
7
- primitives: [
8
- ...Object.values(paths),
9
- { ...texts.bottom1, anchor: "middle_right" },
10
- { ...texts.right1, anchor: "middle_left" },
11
- ] as any,
12
- ports: [
13
- { ...refblocks.left1, labels: ["1", "anode", "pos"] },
14
- { ...refblocks.right1, labels: ["2", "cathode", "neg"] },
15
- ],
16
- size: { width: bounds.width, height: bounds.height },
17
- center: { x: bounds.centerX, y: bounds.centerY + 0.1 },
18
- })
@@ -1,22 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import led_horz from "./led_horz"
3
- import type { TextPrimitive } from "drawing"
4
-
5
- const rotated = rotateSymbol(led_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.1
18
- ref.y += 0.017
19
- val.y = ref.y
20
- val.x = -0.3
21
-
22
- export default rotated