schematic-symbols 0.0.25 → 0.0.27
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 +705 -81
- package/dist/index.js.map +1 -1
- package/drawing/getSvg.ts +5 -1
- package/drawing/types.ts +3 -0
- package/package.json +9 -5
- package/symbols/photodiode_horz.ts +32 -0
- package/symbols/photodiode_vert.ts +13 -0
- package/symbols/schottky_diode_horz.ts +19 -0
- package/symbols/schottky_diode_vert.ts +18 -0
- package/symbols/volt_meter_horz.ts +31 -0
- package/symbols/volt_meter_vert.ts +4 -0
package/README.md
CHANGED
@@ -4,6 +4,9 @@
|
|
4
4
|
|
5
5
|
Schematic symbols for tscircuit
|
6
6
|
|
7
|
+
> [!TIP]
|
8
|
+
> Looking to contribute to this repo? Take a look at [How to Contribute to Schematic Symbols](https://blog.tscircuit.com/p/how-to-contribute-to-schematic-symbols)!
|
9
|
+
|
7
10
|
## Usage
|
8
11
|
|
9
12
|
```ts
|
@@ -15,7 +18,7 @@ console.log(symbols.resistor.size)
|
|
15
18
|
// { width: 1, height: 0.6 }
|
16
19
|
|
17
20
|
getSvg(resistor)
|
18
|
-
// <svg><path d="M0 0L1 0...
|
21
|
+
// <svg><path d="M0 0L1 0... ..."</svg>
|
19
22
|
|
20
23
|
// You can easily resize symbols
|
21
24
|
console.log(resize(symbols.resistor, { width: 100 }).size)
|
@@ -24,9 +27,12 @@ console.log(resize(symbols.resistor, { width: 100 }).size)
|
|
24
27
|
|
25
28
|
## Adding New Symbols
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
+
1. Add a new svg file to the `./assets/symbols` directory (copy volt_meter.svg to a new file named `<symbol_name>.svg`)
|
31
|
+
2. Run `bun run generate` to generate the new symbol
|
32
|
+
3. Run `bun run dev` to start the dev server and verify the new symbol
|
33
|
+
4. Run `bun run build` to build all the symbols into the `./generated` directory
|
34
|
+
|
35
|
+
Here's an example of a generated symbol file:
|
30
36
|
|
31
37
|
```ts
|
32
38
|
// boxresistor.ts
|
@@ -46,6 +52,8 @@ export const boxresistor = defineSymbol({
|
|
46
52
|
})
|
47
53
|
```
|
48
54
|
|
55
|
+
> These files are used to generate an
|
56
|
+
|
49
57
|
### Primitives
|
50
58
|
|
51
59
|
Various primitive JSON elements are defined to represent components, each primitive has
|
@@ -77,6 +85,7 @@ in the same schematic.
|
|
77
85
|
### Development
|
78
86
|
|
79
87
|
Software needed to edit this project:
|
88
|
+
|
80
89
|
- VS Code
|
81
90
|
- Inkscape
|
82
91
|
|
package/dist/index.d.ts
CHANGED
@@ -11,6 +11,8 @@ declare const _default: {
|
|
11
11
|
led_vert: undefined;
|
12
12
|
mosfet_depletion_normally_on_horz: undefined;
|
13
13
|
mosfet_depletion_normally_on_vert: undefined;
|
14
|
+
photodiode_horz: undefined;
|
15
|
+
photodiode_vert: undefined;
|
14
16
|
potentiometer_horz: undefined;
|
15
17
|
potentiometer_vert: undefined;
|
16
18
|
potentiometer2_horz: undefined;
|
@@ -19,8 +21,12 @@ declare const _default: {
|
|
19
21
|
push_button_normally_closed_momentary_vert: undefined;
|
20
22
|
push_button_normally_open_momentary_horz: undefined;
|
21
23
|
push_button_normally_open_momentary_vert: undefined;
|
24
|
+
schottky_diode_horz: undefined;
|
25
|
+
schottky_diode_vert: undefined;
|
22
26
|
varistor_horz: undefined;
|
23
27
|
varistor_vert: undefined;
|
28
|
+
volt_meter_horz: undefined;
|
29
|
+
volt_meter_vert: undefined;
|
24
30
|
};
|
25
31
|
|
26
32
|
interface Point {
|
@@ -52,6 +58,8 @@ interface CirclePrimitive {
|
|
52
58
|
x: number;
|
53
59
|
y: number;
|
54
60
|
radius: number;
|
61
|
+
fill: boolean;
|
62
|
+
color: string;
|
55
63
|
}
|
56
64
|
interface BoxPrimitive {
|
57
65
|
type: "box";
|
@@ -89,7 +97,7 @@ declare function resizeSymbol(symbol: SchSymbol, newSize: {
|
|
89
97
|
height?: number;
|
90
98
|
}): SchSymbol;
|
91
99
|
|
92
|
-
type BaseSymbolName = "boxresistor | capacitor | diode | fuse | led | mosfet_depletion_normally_on | potentiometer | potentiometer2 | push_button_normally_closed_momentary | push_button_normally_open_momentary | varistor";
|
100
|
+
type BaseSymbolName = "boxresistor | capacitor | diode | fuse | led | mosfet_depletion_normally_on | photodiode | potentiometer | potentiometer2 | push_button_normally_closed_momentary | push_button_normally_open_momentary | schottky_diode | varistor | volt_meter";
|
93
101
|
|
94
102
|
/**
|
95
103
|
* Utility for easier autocomplete:
|