schematic-symbols 0.0.24 → 0.0.26
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/README.md +13 -4
- package/dist/index.d.ts +9 -1
- package/dist/index.js +657 -104
- package/dist/index.js.map +1 -1
- package/drawing/getSvg.ts +5 -1
- package/drawing/types.ts +3 -0
- package/package.json +10 -6
- package/symbols/capacitor_horz.ts +2 -2
- package/symbols/diode_horz.ts +2 -2
- package/symbols/led_horz.ts +1 -1
- package/symbols/led_vert.ts +19 -1
- package/symbols/photodiode_horz.ts +32 -0
- package/symbols/photodiode_vert.ts +13 -0
- package/symbols/potentiometer2_horz.ts +5 -1
- package/symbols/push_button_normally_closed_momentary_horz.ts +18 -0
- package/symbols/push_button_normally_closed_momentary_vert.ts +23 -0
- package/symbols/volt_meter_horz.ts +31 -0
- package/symbols/volt_meter_vert.ts +4 -0
package/symbols/diode_horz.ts
CHANGED
@@ -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.top1, anchor: "
|
10
|
-
{ ...texts.bottom1, anchor: "
|
9
|
+
{ ...texts.top1, anchor: "middle_bottom" },
|
10
|
+
{ ...texts.bottom1, anchor: "middle_top" },
|
11
11
|
] as any,
|
12
12
|
ports: [
|
13
13
|
{ ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
|
package/symbols/led_horz.ts
CHANGED
@@ -6,7 +6,7 @@ const { paths, texts, bounds, refblocks } = svgJson
|
|
6
6
|
export default defineSymbol({
|
7
7
|
primitives: [
|
8
8
|
...Object.values(paths),
|
9
|
-
{ ...texts.bottom1, anchor: "
|
9
|
+
{ ...texts.bottom1, anchor: "middle_right" },
|
10
10
|
{ ...texts.right1, anchor: "middle_left" },
|
11
11
|
] as any,
|
12
12
|
ports: [
|
package/symbols/led_vert.ts
CHANGED
@@ -1,4 +1,22 @@
|
|
1
1
|
import { rotateSymbol } from "drawing/rotateSymbol"
|
2
2
|
import led_horz from "./led_horz"
|
3
|
+
import type { TextPrimitive } from "drawing"
|
3
4
|
|
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
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { defineSymbol } from "drawing/defineSymbol"
|
2
|
+
import svgJson from "assets/generated/photodiode.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,
|
15
|
+
y: -0.20318344999999938,
|
16
|
+
anchor: "middle_right",
|
17
|
+
} as TextPrimitive,
|
18
|
+
{
|
19
|
+
type: "text",
|
20
|
+
text: "{VAL}",
|
21
|
+
x: -0.00984920000000078,
|
22
|
+
y: 0.5,
|
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,13 @@
|
|
1
|
+
import { rotateSymbol } from "drawing/rotateSymbol"
|
2
|
+
import photodiode_horz from "./photodiode_horz"
|
3
|
+
|
4
|
+
const rotatedSymbol = rotateSymbol(photodiode_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.y = 0
|
11
|
+
ref.anchor = "middle_left"
|
12
|
+
|
13
|
+
export default rotatedSymbol
|
@@ -4,7 +4,11 @@ import { defineSymbol } from "drawing/defineSymbol"
|
|
4
4
|
const { paths, texts, bounds, refblocks } = svgJson
|
5
5
|
|
6
6
|
export default defineSymbol({
|
7
|
-
primitives: [
|
7
|
+
primitives: [
|
8
|
+
...Object.values(paths),
|
9
|
+
{ ...texts.bottom1, anchor: "middle_right" },
|
10
|
+
{ ...texts.top1, anchor: "middle_left" },
|
11
|
+
] as any,
|
8
12
|
ports: [
|
9
13
|
{ ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
|
10
14
|
{ ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { defineSymbol } from "drawing/defineSymbol"
|
2
|
+
import svgJson from "assets/generated/push_button_normally_closed_momentary.json"
|
3
|
+
|
4
|
+
const { paths, texts, bounds, refblocks } = svgJson
|
5
|
+
|
6
|
+
export default defineSymbol({
|
7
|
+
primitives: [
|
8
|
+
...Object.values(paths),
|
9
|
+
{ ...texts.top1, anchor: "middle_bottom" },
|
10
|
+
{ ...texts.bottom1, anchor: "middle_top" },
|
11
|
+
] as any,
|
12
|
+
ports: [
|
13
|
+
{ ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
|
14
|
+
{ ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
|
15
|
+
],
|
16
|
+
size: { width: bounds.width, height: bounds.height },
|
17
|
+
center: { x: bounds.centerX, y: bounds.centerY },
|
18
|
+
})
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { rotateSymbol } from "drawing/rotateSymbol"
|
2
|
+
import push_button_normally_closed_momentary_horz from "./push_button_normally_closed_momentary_horz"
|
3
|
+
import type { TextPrimitive } from "drawing"
|
4
|
+
|
5
|
+
const rotated = rotateSymbol(push_button_normally_closed_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,31 @@
|
|
1
|
+
import { defineSymbol } from "drawing/defineSymbol"
|
2
|
+
import svgJson from "assets/generated/volt_meter.json"
|
3
|
+
|
4
|
+
const { paths, texts, bounds, circles, refblocks } = 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,
|
14
|
+
y: -0.3594553499999995,
|
15
|
+
anchor: "middle_bottom",
|
16
|
+
},
|
17
|
+
{
|
18
|
+
type: "text",
|
19
|
+
text: "{VAL}",
|
20
|
+
x: 0,
|
21
|
+
y: 0.35,
|
22
|
+
anchor: "middle_top",
|
23
|
+
},
|
24
|
+
] as any,
|
25
|
+
ports: [
|
26
|
+
{ ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
|
27
|
+
{ ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
|
28
|
+
],
|
29
|
+
size: { width: bounds.width, height: bounds.height },
|
30
|
+
center: { x: bounds.centerX, y: bounds.centerY },
|
31
|
+
})
|