@tscircuit/core 0.0.10 → 0.0.12
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 +2544 -0
- package/dist/index.js +17 -1
- package/lib/components/normal-components/Board.ts +6 -1
- package/lib/components/normal-components/Capacitor.ts +2 -1
- package/lib/components/normal-components/Resistor.ts +16 -0
- package/lib/components/primitive-components/TraceHint.ts +2 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1081,6 +1081,9 @@ var Board = class extends NormalComponent {
|
|
|
1081
1081
|
doInitialPcbComponentRender() {
|
|
1082
1082
|
const { db } = this.project;
|
|
1083
1083
|
const { _parsedProps: props } = this;
|
|
1084
|
+
if (!props.width || !props.height) {
|
|
1085
|
+
throw new Error("Board width and height or an outline are required");
|
|
1086
|
+
}
|
|
1084
1087
|
const pcb_board = db.pcb_board.insert({
|
|
1085
1088
|
center: { x: props.pcbX, y: props.pcbY },
|
|
1086
1089
|
width: props.width,
|
|
@@ -1111,6 +1114,19 @@ var Resistor = class extends NormalComponent {
|
|
|
1111
1114
|
}
|
|
1112
1115
|
pin1 = this.portMap.pin1;
|
|
1113
1116
|
pin2 = this.portMap.pin2;
|
|
1117
|
+
doInitialSourceRender() {
|
|
1118
|
+
const { db } = this.project;
|
|
1119
|
+
const { _parsedProps: props } = this;
|
|
1120
|
+
const source_component = db.source_component.insert({
|
|
1121
|
+
ftype: "simple_resistor",
|
|
1122
|
+
name: props.name,
|
|
1123
|
+
// @ts-ignore
|
|
1124
|
+
manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
|
|
1125
|
+
supplier_part_numbers: props.supplierPartNumbers,
|
|
1126
|
+
resistance: props.resistance
|
|
1127
|
+
});
|
|
1128
|
+
this.source_component_id = source_component.source_component_id;
|
|
1129
|
+
}
|
|
1114
1130
|
};
|
|
1115
1131
|
|
|
1116
1132
|
// lib/components/normal-components/Led.ts
|
|
@@ -1144,7 +1160,7 @@ var stringProxy = new Proxy(
|
|
|
1144
1160
|
var FTYPE = stringProxy;
|
|
1145
1161
|
|
|
1146
1162
|
// lib/components/normal-components/Capacitor.ts
|
|
1147
|
-
var Capacitor = class extends
|
|
1163
|
+
var Capacitor = class extends NormalComponent {
|
|
1148
1164
|
get config() {
|
|
1149
1165
|
return {
|
|
1150
1166
|
// schematicSymbolName: BASE_SYMBOLS.capacitor,
|
|
@@ -16,13 +16,18 @@ export class Board extends NormalComponent<typeof boardProps> {
|
|
|
16
16
|
const { db } = this.project!
|
|
17
17
|
const { _parsedProps: props } = this
|
|
18
18
|
|
|
19
|
+
if (!props.width || !props.height) {
|
|
20
|
+
throw new Error("Board width and height or an outline are required")
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
const pcb_board = db.pcb_board.insert({
|
|
20
24
|
center: { x: props.pcbX, y: props.pcbY },
|
|
25
|
+
|
|
21
26
|
width: props.width,
|
|
22
27
|
height: props.height,
|
|
23
28
|
})
|
|
24
29
|
|
|
25
|
-
this.pcb_board_id = pcb_board.pcb_board_id
|
|
30
|
+
this.pcb_board_id = pcb_board.pcb_board_id!
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
removePcbComponentRender(): void {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ledProps } from "@tscircuit/props"
|
|
2
2
|
import { PrimitiveComponent } from "../base-components/PrimitiveComponent"
|
|
3
3
|
import { FTYPE, SYMBOL } from "lib/utils/constants"
|
|
4
|
+
import { NormalComponent } from "../base-components/NormalComponent"
|
|
4
5
|
|
|
5
6
|
type PortNames =
|
|
6
7
|
| "1"
|
|
@@ -12,7 +13,7 @@ type PortNames =
|
|
|
12
13
|
| "anode"
|
|
13
14
|
| "cathode"
|
|
14
15
|
|
|
15
|
-
export class Capacitor extends
|
|
16
|
+
export class Capacitor extends NormalComponent<typeof ledProps, PortNames> {
|
|
16
17
|
get config() {
|
|
17
18
|
return {
|
|
18
19
|
// schematicSymbolName: BASE_SYMBOLS.capacitor,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { resistorProps } from "@tscircuit/props"
|
|
2
2
|
import type { PassivePorts, Ftype, BaseSymbolName } from "lib/utils/constants"
|
|
3
3
|
import { NormalComponent } from "../base-components/NormalComponent"
|
|
4
|
+
import type { SourceSimpleResistorInput } from "@tscircuit/soup"
|
|
4
5
|
|
|
5
6
|
export class Resistor extends NormalComponent<
|
|
6
7
|
typeof resistorProps,
|
|
@@ -16,4 +17,19 @@ export class Resistor extends NormalComponent<
|
|
|
16
17
|
|
|
17
18
|
pin1 = this.portMap.pin1
|
|
18
19
|
pin2 = this.portMap.pin2
|
|
20
|
+
|
|
21
|
+
doInitialSourceRender() {
|
|
22
|
+
const { db } = this.project!
|
|
23
|
+
const { _parsedProps: props } = this
|
|
24
|
+
const source_component = db.source_component.insert({
|
|
25
|
+
ftype: "simple_resistor",
|
|
26
|
+
name: props.name,
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
|
|
29
|
+
supplier_part_numbers: props.supplierPartNumbers,
|
|
30
|
+
|
|
31
|
+
resistance: props.resistance,
|
|
32
|
+
} as SourceSimpleResistorInput)
|
|
33
|
+
this.source_component_id = source_component.source_component_id
|
|
34
|
+
}
|
|
19
35
|
}
|
|
@@ -52,8 +52,8 @@ export class TraceHint extends PrimitiveComponent<typeof traceHintProps> {
|
|
|
52
52
|
(offset): RouteHintPoint => ({
|
|
53
53
|
...applyToPoint(globalTransform, offset),
|
|
54
54
|
via: offset.via,
|
|
55
|
-
to_layer: offset.to_layer,
|
|
56
|
-
trace_width: offset.trace_width,
|
|
55
|
+
to_layer: (offset as any).to_layer,
|
|
56
|
+
trace_width: (offset as any).trace_width,
|
|
57
57
|
}),
|
|
58
58
|
)
|
|
59
59
|
}
|
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"module": "index.ts",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"version": "0.0.12",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"files": [
|
|
9
9
|
"index.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "tsup-node index.ts --format esm"
|
|
14
|
+
"build": "tsup-node index.ts --format esm --dts"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@biomejs/biome": "^1.8.3",
|