schematic-symbols 0.0.101 → 0.0.104
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/dist/index.d.ts +5 -1
- package/dist/index.js +3462 -2207
- package/dist/index.js.map +1 -1
- package/drawing/arc.ts +1 -1
- package/drawing/cubicBezierCurveArc.ts +28 -0
- package/drawing/svgPathToPoints.ts +15 -5
- package/package.json +1 -1
- package/symbols/SPDT_switch_horz.ts +1 -0
- package/symbols/SPST_switch_horz.ts +10 -18
- package/symbols/capacitor_polarized_down.ts +10 -0
- package/symbols/capacitor_polarized_left.ts +10 -0
- package/symbols/capacitor_polarized_right.ts +10 -0
- package/symbols/capacitor_polarized_up.ts +10 -0
- package/symbols/constant_current_diode_horz.ts +7 -17
- package/symbols/constant_current_diode_vert.ts +9 -18
- package/symbols/crystal_horz.ts +7 -31
- package/symbols/crystal_vert.ts +9 -9
- package/symbols/darlington_pair_transistor_horz.ts +8 -19
- package/symbols/darlington_pair_transistor_vert.ts +11 -3
- package/symbols/dc_ammeter_horz.ts +3 -3
- package/symbols/dc_voltmeter_horz.ts +2 -2
- package/symbols/diac_horz.ts +7 -17
- package/symbols/diac_vert.ts +0 -1
- package/symbols/diode_right.ts +0 -1
- package/symbols/dpst_switch_horz.ts +1 -0
- package/symbols/filled_diode_horz.ts +7 -30
- package/symbols/frequency_meter_horz.ts +3 -3
- package/symbols/ground_vert.ts +0 -3
- package/symbols/gunn_diode_horz.ts +7 -21
- package/symbols/gunn_diode_vert.ts +10 -11
- package/symbols/igbt_transistor_horz.ts +8 -31
- package/symbols/illuminated_push_button_normally_open_horz.ts +7 -18
- package/symbols/laser_diode_horz.ts +8 -17
- package/symbols/npn_bipolar_transistor_horz.ts +8 -29
- package/symbols/npn_bipolar_transistor_vert.ts +10 -1
- package/symbols/photodiode_horz.ts +7 -30
- package/symbols/pnp_bipolar_transistor_horz.ts +8 -31
- package/symbols/pnp_bipolar_transistor_vert.ts +10 -2
- package/symbols/power_factor_meter_horz.ts +4 -4
- package/symbols/power_factor_meter_vert.ts +5 -2
- package/symbols/push_button_normally_closed_momentary_horz.ts +6 -4
- package/symbols/push_button_normally_closed_momentary_vert.ts +1 -20
- package/symbols/push_button_normally_open_momentary_horz.ts +6 -4
- package/symbols/push_button_normally_open_momentary_vert.ts +1 -20
- package/symbols/schottky_diode_horz.ts +2 -2
- package/symbols/silicon_controlled_rectifier_horz.ts +8 -16
- package/symbols/step_recovery_diode_horz.ts +7 -29
- package/symbols/tachometer_horz.ts +3 -3
- package/symbols/triac_horz.ts +8 -16
- package/symbols/var_meter_horz.ts +3 -3
- package/symbols/varmeter_horz.ts +3 -3
- package/symbols/volt_meter_horz.ts +7 -28
- package/symbols/watt_hour_meter_horz.ts +3 -3
- package/symbols/wattmeter_horz.ts +3 -3
package/drawing/arc.ts
CHANGED
@@ -12,7 +12,7 @@ export function approximateArc(
|
|
12
12
|
): Point[] {
|
13
13
|
// This is a simplified approximation. For a more accurate representation,
|
14
14
|
// you might want to use a dedicated SVG path library.
|
15
|
-
const steps =
|
15
|
+
const steps = 40
|
16
16
|
const points: Point[] = []
|
17
17
|
for (let i = 1; i < steps; i++) {
|
18
18
|
const t = i / steps
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import type { Point } from "./types"
|
2
|
+
|
3
|
+
export function approximateBezier(
|
4
|
+
p0: Point,
|
5
|
+
p1: Point,
|
6
|
+
p2: Point,
|
7
|
+
p3: Point,
|
8
|
+
): Point[] {
|
9
|
+
const points: Point[] = []
|
10
|
+
const steps = 30
|
11
|
+
for (let t = 0; t <= 1; t += 1 / steps) {
|
12
|
+
const x =
|
13
|
+
Math.pow(1 - t, 3) * p0.x +
|
14
|
+
3 * Math.pow(1 - t, 2) * t * p1.x +
|
15
|
+
3 * (1 - t) * Math.pow(t, 2) * p2.x +
|
16
|
+
Math.pow(t, 3) * p3.x
|
17
|
+
|
18
|
+
const y =
|
19
|
+
Math.pow(1 - t, 3) * p0.y +
|
20
|
+
3 * Math.pow(1 - t, 2) * t * p1.y +
|
21
|
+
3 * (1 - t) * Math.pow(t, 2) * p2.y +
|
22
|
+
Math.pow(t, 3) * p3.y
|
23
|
+
|
24
|
+
points.push({ x, y })
|
25
|
+
}
|
26
|
+
|
27
|
+
return points
|
28
|
+
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { Point } from "./types"
|
2
2
|
import { approximateArc } from "./arc"
|
3
|
+
import { approximateBezier } from "./cubicBezierCurveArc"
|
3
4
|
|
4
5
|
export function svgPathToPoints(pathString: string): Point[] {
|
5
6
|
const points: Point[] = []
|
@@ -35,12 +36,21 @@ export function svgPathToPoints(pathString: string): Point[] {
|
|
35
36
|
case "V":
|
36
37
|
addPoint(currentX, args[0])
|
37
38
|
break
|
38
|
-
case "C":
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
case "C": {
|
40
|
+
const [x1, y1, x2, y2, x, y] = args
|
41
|
+
|
42
|
+
// Approximate the cubic Bézier curve
|
43
|
+
const bezierPoints = approximateBezier(
|
44
|
+
{ x: currentX, y: currentY }, // Start point
|
45
|
+
{ x: x1, y: y1 }, // Control point 1
|
46
|
+
{ x: x2, y: y2 }, // Control point 2
|
47
|
+
{ x, y }, // End point
|
48
|
+
)
|
49
|
+
|
50
|
+
points.push(...bezierPoints)
|
51
|
+
addPoint(x, y) // Update the current position
|
43
52
|
break
|
53
|
+
}
|
44
54
|
case "Q":
|
45
55
|
// For Q command, we add both the control point and the end point
|
46
56
|
points.push({ x: args[0], y: args[1] }) // Control point
|
package/package.json
CHANGED
@@ -2,6 +2,7 @@ import { defineSymbol } from "drawing/defineSymbol"
|
|
2
2
|
import svgJson from "assets/generated/SPDT_switch.json"
|
3
3
|
import { Primitive } from "drawing/types"
|
4
4
|
|
5
|
+
svgJson.bounds.width += 0.2
|
5
6
|
const { paths, texts, bounds, refblocks, circles } = svgJson
|
6
7
|
|
7
8
|
export default defineSymbol({
|
@@ -1,20 +1,12 @@
|
|
1
|
-
import { defineSymbol } from "drawing/defineSymbol"
|
2
1
|
import svgJson from "assets/generated/SPST_switch.json"
|
3
|
-
import {
|
2
|
+
import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
})
|
4
|
+
delete (svgJson.refblocks as any).left1
|
5
|
+
delete (svgJson.refblocks as any).right1
|
6
|
+
svgJson.bounds.width += 0.2
|
7
|
+
export default modifySymbol(svgJson)
|
8
|
+
.changeTextAnchor("{VAL}", "middle_top")
|
9
|
+
.labelPort("left2", ["1"])
|
10
|
+
.labelPort("right2", ["2"])
|
11
|
+
.changeTextAnchor("{REF}", "middle_bottom")
|
12
|
+
.build()
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { modifySymbol } from "../drawing/modify-symbol/modify-symbol"
|
2
|
+
import svgJson from "./capacitor_polarized_right"
|
3
|
+
|
4
|
+
export default modifySymbol(svgJson)
|
5
|
+
.changeTextAnchor("{VAL}", "middle_top")
|
6
|
+
.rotateRightFacingSymbol("down")
|
7
|
+
.labelPort("left1", ["1"])
|
8
|
+
.labelPort("right1", ["2"])
|
9
|
+
.changeTextAnchor("{REF}", "middle_left")
|
10
|
+
.build()
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { modifySymbol } from "../drawing/modify-symbol/modify-symbol"
|
2
|
+
import svgJson from "./capacitor_polarized_right"
|
3
|
+
|
4
|
+
export default modifySymbol(svgJson)
|
5
|
+
.changeTextAnchor("{VAL}", "middle_top")
|
6
|
+
.rotateRightFacingSymbol("left")
|
7
|
+
.labelPort("left1", ["1"])
|
8
|
+
.labelPort("right1", ["2"])
|
9
|
+
.changeTextAnchor("{REF}", "middle_top")
|
10
|
+
.build()
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { modifySymbol } from "../drawing/modify-symbol/modify-symbol"
|
2
|
+
import svgJson from "assets/generated/capacitor_polarized.json"
|
3
|
+
|
4
|
+
export default modifySymbol(svgJson)
|
5
|
+
.changeTextAnchor("{VAL}", "middle_top")
|
6
|
+
.rotateRightFacingSymbol("right")
|
7
|
+
.labelPort("left1", ["1"])
|
8
|
+
.labelPort("right1", ["2"])
|
9
|
+
.changeTextAnchor("{REF}", "middle_bottom")
|
10
|
+
.build()
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { modifySymbol } from "../drawing/modify-symbol/modify-symbol"
|
2
|
+
import svgJson from "./capacitor_polarized_right"
|
3
|
+
|
4
|
+
export default modifySymbol(svgJson)
|
5
|
+
.changeTextAnchor("{VAL}", "middle_top")
|
6
|
+
.rotateRightFacingSymbol("up")
|
7
|
+
.labelPort("left1", ["1"])
|
8
|
+
.labelPort("right1", ["2"])
|
9
|
+
.changeTextAnchor("{REF}", "middle_right")
|
10
|
+
.build()
|
@@ -1,19 +1,9 @@
|
|
1
|
-
import { defineSymbol } from "drawing/defineSymbol"
|
2
1
|
import svgJson from "assets/generated/constant_current_diode.json"
|
2
|
+
import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
{ ...texts.top1, anchor: "middle_left", x: -0.15, y: -0.4 },
|
11
|
-
{ ...texts.bottom1, anchor: "middle_left", x: -0.15 },
|
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
|
-
})
|
4
|
+
export default modifySymbol(svgJson)
|
5
|
+
.changeTextAnchor("{VAL}", "middle_top")
|
6
|
+
.labelPort("left1", ["1"])
|
7
|
+
.labelPort("right1", ["2"])
|
8
|
+
.changeTextAnchor("{REF}", "middle_bottom")
|
9
|
+
.build()
|
@@ -1,20 +1,11 @@
|
|
1
|
-
import
|
2
|
-
import constant_current_diode_horz from "./constant_current_diode_horz"
|
1
|
+
import svgJson from "assets/generated/constant_current_diode.json"
|
3
2
|
|
4
|
-
|
3
|
+
import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
const ref = texts.find((t) => t.text === "{REF}")!
|
15
|
-
|
16
|
-
ref.y = 0
|
17
|
-
ref.x = 0.35
|
18
|
-
ref.anchor = "middle_left"
|
19
|
-
|
20
|
-
export default rotatedSymbol
|
5
|
+
export default modifySymbol(svgJson)
|
6
|
+
.rotateRightFacingSymbol("down")
|
7
|
+
.changeTextAnchor("{VAL}", "middle_right")
|
8
|
+
.labelPort("left1", ["1"])
|
9
|
+
.labelPort("right1", ["2"])
|
10
|
+
.changeTextAnchor("{REF}", "middle_left")
|
11
|
+
.build()
|
package/symbols/crystal_horz.ts
CHANGED
@@ -1,33 +1,9 @@
|
|
1
|
-
import { defineSymbol } from "drawing/defineSymbol"
|
2
1
|
import svgJson from "assets/generated/crystal.json"
|
2
|
+
import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
// { ...texts.top1, anchor: "middle_left" },
|
11
|
-
// { ...texts.bottom1, anchor: "middle_left" },
|
12
|
-
{
|
13
|
-
type: "text",
|
14
|
-
text: "{REF}",
|
15
|
-
x: -0.012864500000000056,
|
16
|
-
y: -0.4150086999999978,
|
17
|
-
anchor: "middle_top",
|
18
|
-
},
|
19
|
-
{
|
20
|
-
type: "text",
|
21
|
-
text: "{VAL}",
|
22
|
-
x: -0.003850500000000423,
|
23
|
-
y: 0.4250087000000011,
|
24
|
-
anchor: "middle_bottom",
|
25
|
-
},
|
26
|
-
] as any,
|
27
|
-
ports: [
|
28
|
-
{ ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
|
29
|
-
{ ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
|
30
|
-
],
|
31
|
-
size: { width: bounds.width, height: bounds.height },
|
32
|
-
center: { x: bounds.centerX, y: bounds.centerY },
|
33
|
-
})
|
4
|
+
export default modifySymbol(svgJson)
|
5
|
+
.changeTextAnchor("{VAL}", "middle_bottom")
|
6
|
+
.labelPort("left1", ["1"])
|
7
|
+
.labelPort("right1", ["2"])
|
8
|
+
.changeTextAnchor("{REF}", "middle_top")
|
9
|
+
.build()
|
package/symbols/crystal_vert.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
import
|
2
|
-
import
|
1
|
+
import svgJson from "assets/generated/crystal.json"
|
2
|
+
import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
export default modifySymbol(svgJson)
|
5
|
+
.rotateRightFacingSymbol("down")
|
6
|
+
.changeTextAnchor("{VAL}", "middle_left")
|
7
|
+
.labelPort("left1", ["1"])
|
8
|
+
.labelPort("right1", ["2"])
|
9
|
+
.changeTextAnchor("{REF}", "middle_right")
|
10
|
+
.build()
|
@@ -1,21 +1,10 @@
|
|
1
|
-
import { defineSymbol } from "drawing/defineSymbol"
|
2
1
|
import svgJson from "assets/generated/darlington_pair_transistor.json"
|
3
|
-
import {
|
2
|
+
import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
{ ...texts.right1, anchor: "middle_bottom" },
|
13
|
-
] as Primitive[],
|
14
|
-
ports: [
|
15
|
-
{ ...refblocks.right1, labels: ["3"] }, // TODO add more "standard" labels
|
16
|
-
{ ...refblocks.right2, labels: ["1"] }, // TODO add more "standard" labels
|
17
|
-
{ ...refblocks.right3, labels: ["2"] }, // TODO add more "standard" labels
|
18
|
-
],
|
19
|
-
size: { width: bounds.width, height: bounds.height },
|
20
|
-
center: { x: bounds.centerX, y: bounds.centerY },
|
21
|
-
})
|
4
|
+
export default modifySymbol(svgJson)
|
5
|
+
.changeTextAnchor("{VAL}", "middle_top")
|
6
|
+
.labelPort("right2", ["1"])
|
7
|
+
.labelPort("right3", ["2"])
|
8
|
+
.labelPort("right1", ["3"])
|
9
|
+
.changeTextAnchor("{REF}", "middle_bottom")
|
10
|
+
.build()
|
@@ -1,4 +1,12 @@
|
|
1
|
-
import
|
2
|
-
import
|
1
|
+
import svgJson from "assets/generated/darlington_pair_transistor.json"
|
2
|
+
import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
|
3
3
|
|
4
|
-
|
4
|
+
svgJson.bounds.width += 0.3
|
5
|
+
export default modifySymbol(svgJson)
|
6
|
+
.rotateRightFacingSymbol("down")
|
7
|
+
.changeTextAnchor("{VAL}", "middle_right")
|
8
|
+
.labelPort("right2", ["1"])
|
9
|
+
.labelPort("right3", ["2"])
|
10
|
+
.labelPort("right1", ["3"])
|
11
|
+
.changeTextAnchor("{REF}", "middle_left")
|
12
|
+
.build()
|
@@ -12,16 +12,16 @@ export default defineSymbol({
|
|
12
12
|
text: "{REF}",
|
13
13
|
x: 0,
|
14
14
|
y: -0.3594553499999995,
|
15
|
-
anchor: "
|
15
|
+
anchor: "middle_top",
|
16
16
|
},
|
17
17
|
{
|
18
18
|
type: "text",
|
19
19
|
text: "{VAL}",
|
20
20
|
x: 0,
|
21
21
|
y: 0.35,
|
22
|
-
anchor: "
|
22
|
+
anchor: "middle_bottom",
|
23
23
|
},
|
24
|
-
{ ...texts.left1, anchor: "center", fontSize: 0.3 },
|
24
|
+
{ ...texts.left1, x: 0, y: 0.01, anchor: "center", fontSize: 0.3 },
|
25
25
|
] as any,
|
26
26
|
ports: [
|
27
27
|
{ ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
|
@@ -12,14 +12,14 @@ export default defineSymbol({
|
|
12
12
|
text: "{REF}",
|
13
13
|
x: 0,
|
14
14
|
y: -0.3594553499999995,
|
15
|
-
anchor: "
|
15
|
+
anchor: "middle_top",
|
16
16
|
},
|
17
17
|
{
|
18
18
|
type: "text",
|
19
19
|
text: "{VAL}",
|
20
20
|
x: 0,
|
21
21
|
y: 0.35,
|
22
|
-
anchor: "
|
22
|
+
anchor: "middle_bottom",
|
23
23
|
},
|
24
24
|
] as any,
|
25
25
|
ports: [
|
package/symbols/diac_horz.ts
CHANGED
@@ -1,19 +1,9 @@
|
|
1
|
-
import { defineSymbol } from "drawing/defineSymbol"
|
2
1
|
import svgJson from "assets/generated/diac.json"
|
2
|
+
import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
{ ...texts.top1, anchor: "middle_bottom" },
|
11
|
-
{ ...texts.bottom1, anchor: "middle_top" },
|
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
|
-
})
|
4
|
+
export default modifySymbol(svgJson)
|
5
|
+
.changeTextAnchor("{VAL}", "middle_top")
|
6
|
+
.labelPort("left1", ["1"])
|
7
|
+
.labelPort("right1", ["2"])
|
8
|
+
.changeTextAnchor("{REF}", "middle_bottom")
|
9
|
+
.build()
|
package/symbols/diac_vert.ts
CHANGED
package/symbols/diode_right.ts
CHANGED
@@ -2,6 +2,7 @@ import { defineSymbol } from "drawing/defineSymbol"
|
|
2
2
|
import svgJson from "assets/generated/dpst_switch.json"
|
3
3
|
import { Primitive } from "drawing/types"
|
4
4
|
|
5
|
+
svgJson.bounds.width += 0.2
|
5
6
|
const { paths, texts, bounds, refblocks, circles } = svgJson
|
6
7
|
|
7
8
|
export default defineSymbol({
|
@@ -1,32 +1,9 @@
|
|
1
|
-
import { defineSymbol } from "drawing/defineSymbol"
|
2
1
|
import svgJson from "assets/generated/filled_diode.json"
|
3
|
-
import {
|
2
|
+
import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
})
|
4
|
+
export default modifySymbol(svgJson)
|
5
|
+
.changeTextAnchor("{VAL}", "middle_top")
|
6
|
+
.labelPort("left1", ["1"])
|
7
|
+
.labelPort("right1", ["2"])
|
8
|
+
.changeTextAnchor("{REF}", "middle_bottom")
|
9
|
+
.build()
|
@@ -12,16 +12,16 @@ export default defineSymbol({
|
|
12
12
|
text: "{REF}",
|
13
13
|
x: 0,
|
14
14
|
y: -0.3594553499999995,
|
15
|
-
anchor: "
|
15
|
+
anchor: "middle_top",
|
16
16
|
},
|
17
17
|
{
|
18
18
|
type: "text",
|
19
19
|
text: "{VAL}",
|
20
20
|
x: 0,
|
21
21
|
y: 0.35,
|
22
|
-
anchor: "
|
22
|
+
anchor: "middle_bottom",
|
23
23
|
},
|
24
|
-
{ ...texts.left1, anchor: "center", fontSize: 0.2 },
|
24
|
+
{ ...texts.left1, x: 0, y: 0.01, anchor: "center", fontSize: 0.2 },
|
25
25
|
] as any,
|
26
26
|
ports: [
|
27
27
|
{ ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
|
package/symbols/ground_vert.ts
CHANGED
@@ -1,25 +1,11 @@
|
|
1
|
-
import { defineSymbol } from "drawing/defineSymbol"
|
2
1
|
import svgJson from "assets/generated/gunn_diode.json"
|
2
|
+
import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
|
3
3
|
|
4
4
|
const { paths, texts, bounds, refblocks, circles } = svgJson
|
5
5
|
|
6
|
-
export default
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
type: "text",
|
13
|
-
text: "{VAL}",
|
14
|
-
x: -0.11,
|
15
|
-
y: 0.38773544999999987,
|
16
|
-
},
|
17
|
-
// { ...texts.bottom1, anchor: "middle_left" },
|
18
|
-
] as any,
|
19
|
-
ports: [
|
20
|
-
{ ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
|
21
|
-
{ ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
|
22
|
-
],
|
23
|
-
size: { width: bounds.width, height: bounds.height },
|
24
|
-
center: { x: bounds.centerX, y: bounds.centerY },
|
25
|
-
})
|
6
|
+
export default modifySymbol(svgJson)
|
7
|
+
.changeTextAnchor("{VAL}", "middle_top")
|
8
|
+
.labelPort("left1", ["1"])
|
9
|
+
.labelPort("right1", ["2"])
|
10
|
+
.changeTextAnchor("{REF}", "middle_bottom")
|
11
|
+
.build()
|
@@ -1,12 +1,11 @@
|
|
1
|
-
import {
|
2
|
-
import gunn_diode_horz from "./gunn_diode_horz"
|
1
|
+
import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
import svgJson from "assets/generated/gunn_diode.json"
|
4
|
+
|
5
|
+
export default modifySymbol(svgJson)
|
6
|
+
.rotateRightFacingSymbol("down")
|
7
|
+
.changeTextAnchor("{VAL}", "middle_right")
|
8
|
+
.labelPort("left1", ["1"])
|
9
|
+
.labelPort("right1", ["2"])
|
10
|
+
.changeTextAnchor("{REF}", "middle_left")
|
11
|
+
.build()
|
@@ -1,33 +1,10 @@
|
|
1
|
-
import { defineSymbol } from "drawing/defineSymbol"
|
2
1
|
import svgJson from "assets/generated/igbt_transistor.json"
|
3
|
-
import {
|
2
|
+
import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
})
|
4
|
+
export default modifySymbol(svgJson)
|
5
|
+
.changeTextAnchor("{VAL}", "middle_right")
|
6
|
+
.labelPort("left1", ["3"])
|
7
|
+
.labelPort("top1", ["2"])
|
8
|
+
.labelPort("bottom1", ["1"])
|
9
|
+
.changeTextAnchor("{REF}", "middle_right")
|
10
|
+
.build()
|
@@ -1,20 +1,9 @@
|
|
1
|
-
import { defineSymbol } from "drawing/defineSymbol"
|
2
1
|
import svgJson from "assets/generated/illuminated_push_button_normally_open.json"
|
3
|
-
import {
|
2
|
+
import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
{ ...texts.top1, anchor: "middle_right", x: 0, y: -0.4 },
|
12
|
-
{ ...texts.bottom1, anchor: "middle_right", x: 0 },
|
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
|
-
})
|
4
|
+
export default modifySymbol(svgJson)
|
5
|
+
.changeTextAnchor("{VAL}", "middle_top")
|
6
|
+
.labelPort("left1", ["1"])
|
7
|
+
.labelPort("right1", ["2"])
|
8
|
+
.changeTextAnchor("{REF}", "middle_bottom")
|
9
|
+
.build()
|