schematic-symbols 0.0.120 → 0.0.122

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. package/dist/index.d.ts +25 -5
  2. package/dist/index.js +1658 -704
  3. package/dist/index.js.map +1 -1
  4. package/package.json +2 -5
  5. package/drawing/arc.ts +0 -31
  6. package/drawing/arrow.ts +0 -41
  7. package/drawing/box.ts +0 -5
  8. package/drawing/circle.ts +0 -7
  9. package/drawing/cubicBezierCurveArc.ts +0 -28
  10. package/drawing/defineSymbol.ts +0 -16
  11. package/drawing/getSvg.ts +0 -199
  12. package/drawing/index.ts +0 -10
  13. package/drawing/mapColor.ts +0 -10
  14. package/drawing/modify-symbol/modify-symbol.ts +0 -97
  15. package/drawing/ninePointAnchorToSvgAnchor.ts +0 -11
  16. package/drawing/path.ts +0 -5
  17. package/drawing/pathToSvgD.ts +0 -22
  18. package/drawing/resizeSymbol.ts +0 -67
  19. package/drawing/rotateSymbol.ts +0 -324
  20. package/drawing/svgPathToPoints.ts +0 -109
  21. package/drawing/text.ts +0 -8
  22. package/drawing/typeguards.ts +0 -155
  23. package/drawing/types.ts +0 -93
  24. package/drawing/utils/getBoundsOfPrimitives.ts +0 -51
  25. package/drawing/utils/makeYUpPositive.ts +0 -46
  26. package/index.ts +0 -24
  27. package/symbols/SPDT_switch_horz.ts +0 -22
  28. package/symbols/SPDT_switch_vert.ts +0 -20
  29. package/symbols/SPST_switch_horz.ts +0 -12
  30. package/symbols/SPST_switch_vert.ts +0 -20
  31. package/symbols/ac_voltmeter_horz.ts +0 -31
  32. package/symbols/ac_voltmeter_vert.ts +0 -8
  33. package/symbols/avalanche_diode_horz.ts +0 -19
  34. package/symbols/avalanche_diode_vert.ts +0 -10
  35. package/symbols/battery_horz.ts +0 -20
  36. package/symbols/battery_vert.ts +0 -6
  37. package/symbols/boxresistor_down.ts +0 -33
  38. package/symbols/boxresistor_left.ts +0 -33
  39. package/symbols/boxresistor_right.ts +0 -33
  40. package/symbols/boxresistor_up.ts +0 -33
  41. package/symbols/capacitor_down.ts +0 -34
  42. package/symbols/capacitor_left.ts +0 -11
  43. package/symbols/capacitor_polarized_down.ts +0 -34
  44. package/symbols/capacitor_polarized_left.ts +0 -10
  45. package/symbols/capacitor_polarized_right.ts +0 -10
  46. package/symbols/capacitor_polarized_up.ts +0 -34
  47. package/symbols/capacitor_right.ts +0 -10
  48. package/symbols/capacitor_up.ts +0 -34
  49. package/symbols/constant_current_diode_horz.ts +0 -9
  50. package/symbols/constant_current_diode_vert.ts +0 -11
  51. package/symbols/crystal_4pin_horz.ts +0 -11
  52. package/symbols/crystal_4pin_vert.ts +0 -10
  53. package/symbols/crystal_horz.ts +0 -9
  54. package/symbols/crystal_vert.ts +0 -10
  55. package/symbols/darlington_pair_transistor_horz.ts +0 -10
  56. package/symbols/darlington_pair_transistor_vert.ts +0 -12
  57. package/symbols/dc_ammeter_horz.ts +0 -32
  58. package/symbols/dc_ammeter_vert.ts +0 -51
  59. package/symbols/dc_voltmeter_horz.ts +0 -31
  60. package/symbols/dc_voltmeter_vert.ts +0 -19
  61. package/symbols/diac_horz.ts +0 -9
  62. package/symbols/diac_vert.ts +0 -16
  63. package/symbols/diode_down.ts +0 -4
  64. package/symbols/diode_left.ts +0 -4
  65. package/symbols/diode_right.ts +0 -9
  66. package/symbols/diode_up.ts +0 -4
  67. package/symbols/dpdt_switch_horz.ts +0 -26
  68. package/symbols/dpdt_switch_vert.ts +0 -20
  69. package/symbols/dpst_switch_horz.ts +0 -23
  70. package/symbols/dpst_switch_vert.ts +0 -20
  71. package/symbols/filled_diode_horz.ts +0 -9
  72. package/symbols/filled_diode_vert.ts +0 -4
  73. package/symbols/frequency_meter_horz.ts +0 -32
  74. package/symbols/frequency_meter_vert.ts +0 -19
  75. package/symbols/fuse_horz.ts +0 -24
  76. package/symbols/fuse_vert.ts +0 -4
  77. package/symbols/ground_horz.ts +0 -37
  78. package/symbols/ground_vert.ts +0 -4
  79. package/symbols/gunn_diode_horz.ts +0 -11
  80. package/symbols/gunn_diode_vert.ts +0 -11
  81. package/symbols/icled_down.ts +0 -4
  82. package/symbols/icled_left.ts +0 -4
  83. package/symbols/icled_right.ts +0 -11
  84. package/symbols/icled_up.ts +0 -27
  85. package/symbols/igbt_transistor_horz.ts +0 -10
  86. package/symbols/igbt_transistor_vert.ts +0 -21
  87. package/symbols/illuminated_push_button_normally_open_horz.ts +0 -9
  88. package/symbols/illuminated_push_button_normally_open_vert.ts +0 -20
  89. package/symbols/inductor_down.ts +0 -4
  90. package/symbols/inductor_left.ts +0 -4
  91. package/symbols/inductor_right.ts +0 -20
  92. package/symbols/inductor_up.ts +0 -4
  93. package/symbols/laser_diode_horz.ts +0 -10
  94. package/symbols/laser_diode_vert.ts +0 -13
  95. package/symbols/led_down.ts +0 -4
  96. package/symbols/led_left.ts +0 -4
  97. package/symbols/led_right.ts +0 -20
  98. package/symbols/led_up.ts +0 -27
  99. package/symbols/light_dependent_resistor_horz.ts +0 -20
  100. package/symbols/light_dependent_resistor_vert.ts +0 -20
  101. package/symbols/mosfet_depletion_normally_on_horz.ts +0 -19
  102. package/symbols/mosfet_depletion_normally_on_vert.ts +0 -21
  103. package/symbols/mushroom_head_normally_open_momentary_horz.ts +0 -20
  104. package/symbols/mushroom_head_normally_open_momentary_vert.ts +0 -23
  105. package/symbols/n_channel_d_mosfet_transistor_horz.ts +0 -20
  106. package/symbols/n_channel_d_mosfet_transistor_vert.ts +0 -20
  107. package/symbols/n_channel_e_mosfet_transistor_horz.ts +0 -21
  108. package/symbols/n_channel_e_mosfet_transistor_vert.ts +0 -20
  109. package/symbols/njfet_transistor_horz.ts +0 -20
  110. package/symbols/njfet_transistor_vert.ts +0 -20
  111. package/symbols/npn_bipolar_transistor_horz.ts +0 -11
  112. package/symbols/npn_bipolar_transistor_vert.ts +0 -21
  113. package/symbols/opamp_no_power_down.ts +0 -4
  114. package/symbols/opamp_no_power_left.ts +0 -4
  115. package/symbols/opamp_no_power_right.ts +0 -10
  116. package/symbols/opamp_no_power_up.ts +0 -4
  117. package/symbols/opamp_with_power_down.ts +0 -4
  118. package/symbols/opamp_with_power_left.ts +0 -4
  119. package/symbols/opamp_with_power_right.ts +0 -12
  120. package/symbols/opamp_with_power_up.ts +0 -4
  121. package/symbols/p_channel_d_mosfet_transistor_horz.ts +0 -20
  122. package/symbols/p_channel_d_mosfet_transistor_vert.ts +0 -20
  123. package/symbols/p_channel_e_mosfet_transistor_horz.ts +0 -20
  124. package/symbols/p_channel_e_mosfet_transistor_vert.ts +0 -20
  125. package/symbols/photodiode_horz.ts +0 -9
  126. package/symbols/photodiode_vert.ts +0 -13
  127. package/symbols/pjfet_transistor_horz.ts +0 -20
  128. package/symbols/pjfet_transistor_vert.ts +0 -20
  129. package/symbols/pnp_bipolar_transistor_horz.ts +0 -10
  130. package/symbols/pnp_bipolar_transistor_vert.ts +0 -20
  131. package/symbols/potentiometer2_horz.ts +0 -18
  132. package/symbols/potentiometer2_vert.ts +0 -14
  133. package/symbols/potentiometer3_down.ts +0 -4
  134. package/symbols/potentiometer3_left.ts +0 -4
  135. package/symbols/potentiometer3_right.ts +0 -10
  136. package/symbols/potentiometer3_up.ts +0 -4
  137. package/symbols/potentiometer_horz.ts +0 -18
  138. package/symbols/potentiometer_vert.ts +0 -6
  139. package/symbols/power_factor_meter_horz.ts +0 -42
  140. package/symbols/power_factor_meter_vert.ts +0 -19
  141. package/symbols/push_button_normally_closed_momentary_horz.ts +0 -20
  142. package/symbols/push_button_normally_closed_momentary_vert.ts +0 -4
  143. package/symbols/push_button_normally_open_momentary_horz.ts +0 -20
  144. package/symbols/push_button_normally_open_momentary_vert.ts +0 -4
  145. package/symbols/rectifier_diode_horz.ts +0 -21
  146. package/symbols/rectifier_diode_vert.ts +0 -17
  147. package/symbols/resonator_horz.ts +0 -34
  148. package/symbols/resonator_vert.ts +0 -4
  149. package/symbols/schottky_diode_horz.ts +0 -10
  150. package/symbols/schottky_diode_vert.ts +0 -18
  151. package/symbols/silicon_controlled_rectifier_horz.ts +0 -13
  152. package/symbols/silicon_controlled_rectifier_vert.ts +0 -15
  153. package/symbols/step_recovery_diode_horz.ts +0 -11
  154. package/symbols/step_recovery_diode_vert.ts +0 -4
  155. package/symbols/tachometer_horz.ts +0 -32
  156. package/symbols/tachometer_vert.ts +0 -19
  157. package/symbols/triac_horz.ts +0 -13
  158. package/symbols/triac_vert.ts +0 -16
  159. package/symbols/tunnel_diode_horz.ts +0 -19
  160. package/symbols/tunnel_diode_vert.ts +0 -18
  161. package/symbols/unijunction_transistor_horz.ts +0 -20
  162. package/symbols/unijunction_transistor_vert.ts +0 -19
  163. package/symbols/var_meter_horz.ts +0 -30
  164. package/symbols/var_meter_vert.ts +0 -4
  165. package/symbols/varactor_diode_horz.ts +0 -19
  166. package/symbols/varactor_diode_vert.ts +0 -18
  167. package/symbols/varistor_horz.ts +0 -24
  168. package/symbols/varistor_vert.ts +0 -4
  169. package/symbols/varmeter_horz.ts +0 -32
  170. package/symbols/varmeter_vert.ts +0 -19
  171. package/symbols/volt_meter_horz.ts +0 -10
  172. package/symbols/volt_meter_vert.ts +0 -4
  173. package/symbols/watt_hour_meter_horz.ts +0 -32
  174. package/symbols/watt_hour_meter_vert.ts +0 -19
  175. package/symbols/wattmeter_horz.ts +0 -32
  176. package/symbols/wattmeter_vert.ts +0 -19
  177. package/symbols/zener_diode_horz.ts +0 -19
  178. package/symbols/zener_diode_vert.ts +0 -17
@@ -1,10 +0,0 @@
1
- import crystal_4pin_horz from "./crystal_4pin_horz"
2
- import { rotateRightFacingSymbol } from "drawing/rotateSymbol"
3
- import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
4
- import svgJson from "assets/generated/crystal_4pin.json"
5
-
6
- export default modifySymbol(crystal_4pin_horz)
7
- .rotateRightFacingSymbol("up")
8
- .changeTextAnchor("{REF}", "top_right")
9
- .changeTextAnchor("{VAL}", "bottom_left")
10
- .build()
@@ -1,9 +0,0 @@
1
- import svgJson from "assets/generated/crystal.json"
2
- import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
-
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()
@@ -1,10 +0,0 @@
1
- import svgJson from "assets/generated/crystal.json"
2
- import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
-
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,10 +0,0 @@
1
- import svgJson from "assets/generated/darlington_pair_transistor.json"
2
- import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
-
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,12 +0,0 @@
1
- import svgJson from "assets/generated/darlington_pair_transistor.json"
2
- import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
-
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()
@@ -1,32 +0,0 @@
1
- import { defineSymbol } from "drawing/defineSymbol"
2
- import svgJson from "assets/generated/dc_ammeter.json"
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,
14
- y: -0.3594553499999995,
15
- anchor: "middle_top",
16
- },
17
- {
18
- type: "text",
19
- text: "{VAL}",
20
- x: 0,
21
- y: 0.35,
22
- anchor: "middle_bottom",
23
- },
24
- { ...texts.left1, x: 0, y: 0.01, anchor: "center", fontSize: 0.3 },
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
- })
@@ -1,51 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import dc_ammeter_horz from "./dc_ammeter_horz"
3
- import { PathPrimitive, Primitive, TextPrimitive } from "drawing/types"
4
-
5
- function isPathPrimitive(value: any): value is PathPrimitive {
6
- return (
7
- typeof value === "object" &&
8
- value !== null &&
9
- value.type === "path" &&
10
- Array.isArray(value.points) &&
11
- typeof value.color === "string"
12
- )
13
- }
14
-
15
- function isTextPrimitive(value: any): value is TextPrimitive {
16
- return (
17
- typeof value === "object" &&
18
- value !== null &&
19
- value.type === "text" &&
20
- typeof value.text === "string" &&
21
- typeof value.x === "number" &&
22
- typeof value.y === "number" &&
23
- typeof value.anchor === "string"
24
- )
25
- }
26
-
27
- const { 6: letter, 2: underline, ...rest } = dc_ammeter_horz.primitives
28
-
29
- if (isPathPrimitive(underline)) {
30
- underline.points.map((p) => {
31
- p.y += 0.05
32
- })
33
- }
34
-
35
- if (isTextPrimitive(letter)) {
36
- letter.y += 0.025
37
- }
38
-
39
- function isPrimitive(value: any): value is Primitive {
40
- return typeof value === "object"
41
- }
42
-
43
- const rotatedSymbol = rotateSymbol({
44
- ...dc_ammeter_horz,
45
- primitives: Object.values(rest).filter(isPrimitive),
46
- })
47
-
48
- export default {
49
- ...rotatedSymbol,
50
- primitives: [...rotatedSymbol.primitives, letter, underline],
51
- }
@@ -1,31 +0,0 @@
1
- import { defineSymbol } from "drawing/defineSymbol"
2
- import svgJson from "assets/generated/dc_voltmeter.json"
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,
14
- y: -0.3594553499999995,
15
- anchor: "middle_top",
16
- },
17
- {
18
- type: "text",
19
- text: "{VAL}",
20
- x: 0,
21
- y: 0.35,
22
- anchor: "middle_bottom",
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
- })
@@ -1,19 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import dc_voltmeter_horz from "./dc_voltmeter_horz"
3
- import { Primitive } from "drawing/types"
4
-
5
- const { 2: letter, 3: underline, ...rest } = dc_voltmeter_horz.primitives
6
-
7
- function isPrimitive(value: any): value is Primitive {
8
- return typeof value === "object"
9
- }
10
-
11
- const rotatedSymbol = rotateSymbol({
12
- ...dc_voltmeter_horz,
13
- primitives: Object.values(rest).filter(isPrimitive),
14
- })
15
-
16
- export default {
17
- ...rotatedSymbol,
18
- primitives: [...rotatedSymbol.primitives, letter, underline],
19
- }
@@ -1,9 +0,0 @@
1
- import svgJson from "assets/generated/diac.json"
2
- import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
-
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,16 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import diac_horz from "./diac_horz"
3
-
4
- const rotatedSymbol = rotateSymbol(diac_horz)
5
-
6
- const texts = rotatedSymbol.primitives.filter(
7
- (primitive) => primitive.type === "text",
8
- )
9
-
10
- const ref = texts.find((text) => text.text === "{REF}")!
11
- const val = texts.find((text) => text.text === "{VAL}")!
12
-
13
- ref.y = 0
14
- val.y = 0
15
-
16
- export default rotatedSymbol
@@ -1,4 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import diode_right from "./diode_right"
3
-
4
- export default rotateSymbol(diode_right, "down")
@@ -1,4 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import diode_right from "./diode_right"
3
-
4
- export default rotateSymbol(diode_right, "left")
@@ -1,9 +0,0 @@
1
- import svgJson from "assets/generated/diode.json"
2
- import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
-
4
- export default modifySymbol(svgJson)
5
- .labelPort("left1", ["1", "pos"])
6
- .labelPort("right1", ["2", "neg"])
7
- .changeTextAnchor("{REF}", "middle_bottom")
8
- .changeTextAnchor("{VAL}", "middle_top")
9
- .build()
@@ -1,4 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import diode_right from "./diode_right"
3
-
4
- export default rotateSymbol(diode_right, "up")
@@ -1,26 +0,0 @@
1
- import { defineSymbol } from "drawing/defineSymbol"
2
- import svgJson from "assets/generated/dpdt_switch.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" },
12
- { ...texts.bottom1, anchor: "middle_top" },
13
- ] as Primitive[],
14
-
15
- ports: [
16
- { ...refblocks.left1, labels: ["1"] },
17
- { ...refblocks.left2, labels: ["4"] },
18
- { ...refblocks.right1, labels: ["3"] },
19
- { ...refblocks.right2, labels: ["2"] },
20
- { ...refblocks.right3, labels: ["6"] },
21
- { ...refblocks.right5, labels: ["5"] },
22
- ],
23
-
24
- size: { width: bounds.width, height: bounds.height },
25
- center: { x: bounds.centerX, y: bounds.centerY },
26
- })
@@ -1,20 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import dpdp_switch_horz from "./dpdt_switch_horz"
3
-
4
- const rotatedSymbol = rotateSymbol(dpdp_switch_horz)
5
-
6
- const texts = rotatedSymbol.primitives.filter((p) => p.type === "text")!
7
-
8
- const val = texts.find((t) => t.text === "{VAL}")!
9
-
10
- val.anchor = "middle_right"
11
- val.x = -0.37
12
- val.y = 0.12
13
-
14
- const ref = texts.find((t) => t.text === "{REF}")!
15
-
16
- ref.anchor = "middle_left"
17
- ref.x = 0.37
18
- ref.y = 0.12
19
-
20
- export default rotatedSymbol
@@ -1,23 +0,0 @@
1
- import { defineSymbol } from "drawing/defineSymbol"
2
- import svgJson from "assets/generated/dpst_switch.json"
3
- import { Primitive } from "drawing/types"
4
-
5
- svgJson.bounds.width += 0.2
6
- const { paths, texts, bounds, refblocks, circles } = svgJson
7
-
8
- export default defineSymbol({
9
- primitives: [
10
- ...Object.values(paths),
11
- ...Object.values(circles),
12
- { ...texts.top1, anchor: "middle_bottom", x: 0 },
13
- { ...texts.bottom1, anchor: "middle_top", x: 0 },
14
- ] as Primitive[],
15
- ports: [
16
- { ...refblocks.left1, labels: ["1", "left1"] }, // TODO add more "standard" labels
17
- { ...refblocks.left3, labels: ["3", "left3"] }, // TODO add more "standard" labels
18
- { ...refblocks.right1, labels: ["2", "right1"] }, // TODO add more "standard" labels
19
- { ...refblocks.right3, labels: ["4", "right3"] }, // TODO add more "standard" labels
20
- ],
21
- size: { width: bounds.width, height: bounds.height },
22
- center: { x: bounds.centerX, y: bounds.centerY },
23
- })
@@ -1,20 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import dpst_switch_horz from "./dpst_switch_horz"
3
-
4
- const rotatedSymbol = rotateSymbol(dpst_switch_horz)
5
-
6
- const texts = rotatedSymbol.primitives.filter((p) => p.type === "text")!
7
-
8
- const val = texts.find((t) => t.text === "{VAL}")!
9
-
10
- val.anchor = "middle_right"
11
- val.x = -0.35
12
- val.y = 0
13
-
14
- const ref = texts.find((t) => t.text === "{REF}")!
15
-
16
- ref.anchor = "middle_left"
17
- ref.x = 0.3
18
- ref.y = 0
19
-
20
- export default rotatedSymbol
@@ -1,9 +0,0 @@
1
- import svgJson from "assets/generated/filled_diode.json"
2
- import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
-
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,4 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import filled_diode_horz from "./filled_diode_horz"
3
-
4
- export default rotateSymbol(filled_diode_horz)
@@ -1,32 +0,0 @@
1
- import { defineSymbol } from "drawing/defineSymbol"
2
- import svgJson from "assets/generated/frequency_meter.json"
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,
14
- y: -0.3594553499999995,
15
- anchor: "middle_top",
16
- },
17
- {
18
- type: "text",
19
- text: "{VAL}",
20
- x: 0,
21
- y: 0.35,
22
- anchor: "middle_bottom",
23
- },
24
- { ...texts.left1, x: 0, y: 0.01, anchor: "center", fontSize: 0.2 },
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
- })
@@ -1,19 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import frequency_meter_horz from "./frequency_meter_horz"
3
- import { Primitive } from "drawing/types"
4
-
5
- const { 5: letter, ...rest } = frequency_meter_horz.primitives
6
-
7
- function isPrimitive(value: any): value is Primitive {
8
- return typeof value === "object"
9
- }
10
-
11
- const rotatedSymbol = rotateSymbol({
12
- ...frequency_meter_horz,
13
- primitives: Object.values(rest).filter(isPrimitive),
14
- })
15
-
16
- export default {
17
- ...rotatedSymbol,
18
- primitives: [...rotatedSymbol.primitives, letter],
19
- }
@@ -1,24 +0,0 @@
1
- import svgJson from "assets/generated/fuse.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.top1, anchor: "middle_bottom" },
10
- {
11
- type: "text",
12
- text: "{VAL}",
13
- x: 0,
14
- y: -0.2,
15
- anchor: "middle_top",
16
- },
17
- ] as any,
18
- ports: [
19
- { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
20
- { ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
21
- ],
22
- size: { width: bounds.width, height: bounds.height },
23
- center: { x: bounds.centerX, y: bounds.centerY },
24
- })
@@ -1,4 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import fuse_horz from "./fuse_horz"
3
-
4
- export default rotateSymbol(fuse_horz)
@@ -1,37 +0,0 @@
1
- import { defineSymbol } from "drawing/defineSymbol"
2
- import svgJson from "assets/generated/ground.json"
3
- import { Primitive } from "drawing/types"
4
- import { rotateSymbol } from "drawing/rotateSymbol"
5
-
6
- // Extract paths, bounds, etc.
7
- const { paths, circles, bounds, refblocks } = svgJson
8
-
9
- // Horizontal orientation symbol
10
- export const horizontalSymbol = defineSymbol({
11
- primitives: [
12
- ...Object.values(paths),
13
- ...Object.values(circles),
14
- {
15
- type: "text",
16
- text: "{REF}", // REF label for horizontal
17
- x: -0.1, // Adjust this for the horizontal positioning of REF
18
- y: 0.8, // Adjust this for the vertical positioning of REF
19
- anchor: "middle_bottom", // Horizontal anchor for REF
20
- },
21
- {
22
- type: "text",
23
- text: "{VAL}", // VAL label for horizontal
24
- x: -0.1, // Adjust for horizontal positioning of VAL
25
- y: 0.1, // Adjust for vertical positioning of VAL
26
- anchor: "middle_top", // Horizontal anchor for VAL
27
- },
28
- ] as Primitive[],
29
- ports: [{ ...refblocks.top1, labels: ["1"] }],
30
- size: { width: 1, height: 1 },
31
- center: { x: 0, y: 0.4 },
32
- })
33
-
34
- // Vertical orientation symbol
35
-
36
- // Export vertical symbol (rotated 90 degrees from original)
37
- export default horizontalSymbol
@@ -1,4 +0,0 @@
1
- import groundHorz from "./ground_horz"
2
- import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
-
4
- export default modifySymbol(groundHorz).rotateRightFacingSymbol("down").build()
@@ -1,11 +0,0 @@
1
- import svgJson from "assets/generated/gunn_diode.json"
2
- import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
-
4
- const { paths, texts, bounds, refblocks, circles } = svgJson
5
-
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,11 +0,0 @@
1
- import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
2
-
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,4 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import icled_right from "./icled_right"
3
-
4
- export default rotateSymbol(icled_right, "down")
@@ -1,4 +0,0 @@
1
- import { flipSymbolOverYAxis } from "drawing/rotateSymbol"
2
- import icled_right from "./icled_right"
3
-
4
- export default flipSymbolOverYAxis(icled_right)
@@ -1,11 +0,0 @@
1
- import svgJson from "assets/generated/icled.json"
2
- import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
-
4
- export default modifySymbol(svgJson)
5
- .labelPort("left1", ["1", "DIN"])
6
- .labelPort("left2", ["2", "POWER"])
7
- .labelPort("right1", ["4", "GND"])
8
- .labelPort("right2", ["3", "DOUT"])
9
- .changeTextAnchor("{REF}", "middle_bottom")
10
- .changeTextAnchor("{VAL}", "middle_top")
11
- .build()
@@ -1,27 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import icled_right from "./icled_right"
3
-
4
- const baseSymbol = rotateSymbol(icled_right, "up")
5
-
6
- // Flip path25-0 and path78 over X axis
7
- const modifiedSymbol = {
8
- ...baseSymbol,
9
- primitives: baseSymbol.primitives.map((primitive) => {
10
- if (
11
- primitive.type === "path" &&
12
- (primitive.points.length === 3 || primitive.points.length === 4)
13
- ) {
14
- // This matches both the triangle shape (path25-0) and path78
15
- return {
16
- ...primitive,
17
- points: primitive.points.map((point) => ({
18
- x: point.x,
19
- y: -point.y + 2 * baseSymbol.center.y,
20
- })),
21
- }
22
- }
23
- return primitive
24
- }),
25
- }
26
-
27
- export default modifiedSymbol
@@ -1,10 +0,0 @@
1
- import svgJson from "assets/generated/igbt_transistor.json"
2
- import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
-
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,21 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import igbt_transistor_horz from "./igbt_transistor_horz"
3
- import type { TextPrimitive } from "drawing"
4
-
5
- const rotated = rotateSymbol(igbt_transistor_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.45
18
- ref.y += 0.065
19
- val.y += 0.065
20
-
21
- export default rotated
@@ -1,9 +0,0 @@
1
- import svgJson from "assets/generated/illuminated_push_button_normally_open.json"
2
- import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
-
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 +0,0 @@
1
- import { rotateSymbol } from "drawing/rotateSymbol"
2
- import illuminated_push_button_normally_open_horz from "./illuminated_push_button_normally_open_horz"
3
-
4
- const rotatedSymbol = rotateSymbol(illuminated_push_button_normally_open_horz)
5
-
6
- const texts = rotatedSymbol.primitives.filter((p) => p.type === "text")!
7
-
8
- const val = texts.find((t) => t.text === "{VAL}")!
9
-
10
- val.x = -0.35
11
- val.y = 0
12
- val.anchor = "middle_right"
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
@@ -1,4 +0,0 @@
1
- import { flipSymbolOverXAxis } from "drawing/rotateSymbol"
2
- import inductor_up from "./inductor_up"
3
-
4
- export default flipSymbolOverXAxis(inductor_up)
@@ -1,4 +0,0 @@
1
- import { flipSymbolOverYAxis } from "drawing/rotateSymbol"
2
- import inductor_right from "./inductor_right"
3
-
4
- export default flipSymbolOverYAxis(inductor_right)