@tscircuit/core 0.0.11 → 0.0.13
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 +7 -4
- package/lib/components/base-components/PrimitiveComponent.ts +5 -3
- package/lib/components/normal-components/Board.ts +6 -1
- package/lib/components/normal-components/Capacitor.ts +2 -1
- package/lib/components/primitive-components/Trace.ts +3 -2
- package/lib/components/primitive-components/TraceHint.ts +2 -2
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -248,7 +248,7 @@ var PrimitiveComponent = class extends Renderable {
|
|
|
248
248
|
}
|
|
249
249
|
const { config } = this;
|
|
250
250
|
if (!config.schematicSymbolName) return null;
|
|
251
|
-
return symbols[`${config.schematicSymbolName}_${variant}`];
|
|
251
|
+
return symbols[`${config.schematicSymbolName}_${variant}`] ?? null;
|
|
252
252
|
}
|
|
253
253
|
getGlobalPcbPosition() {
|
|
254
254
|
return applyToPoint(this.computePcbGlobalTransform(), { x: 0, y: 0 });
|
|
@@ -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,
|
|
@@ -1157,7 +1160,7 @@ var stringProxy = new Proxy(
|
|
|
1157
1160
|
var FTYPE = stringProxy;
|
|
1158
1161
|
|
|
1159
1162
|
// lib/components/normal-components/Capacitor.ts
|
|
1160
|
-
var Capacitor = class extends
|
|
1163
|
+
var Capacitor = class extends NormalComponent {
|
|
1161
1164
|
get config() {
|
|
1162
1165
|
return {
|
|
1163
1166
|
// schematicSymbolName: BASE_SYMBOLS.capacitor,
|
|
@@ -1417,8 +1420,8 @@ searched component ${targetComponent.getString()}, which has ports:${targetCompo
|
|
|
1417
1420
|
}
|
|
1418
1421
|
if (pcbRouteHints.length === 0) {
|
|
1419
1422
|
const { solution } = autoroute(pcbElements.concat([source_trace]));
|
|
1420
|
-
const
|
|
1421
|
-
db.pcb_trace.insert(
|
|
1423
|
+
const inputPcbTrace = solution[0];
|
|
1424
|
+
const pcb_trace2 = db.pcb_trace.insert(inputPcbTrace);
|
|
1422
1425
|
this.pcb_trace_id = pcb_trace2.pcb_trace_id;
|
|
1423
1426
|
return;
|
|
1424
1427
|
}
|
|
@@ -136,9 +136,11 @@ export abstract class PrimitiveComponent<
|
|
|
136
136
|
}
|
|
137
137
|
const { config } = this
|
|
138
138
|
if (!config.schematicSymbolName) return null
|
|
139
|
-
return
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
return (
|
|
140
|
+
symbols[
|
|
141
|
+
`${config.schematicSymbolName}_${variant}` as keyof typeof symbols
|
|
142
|
+
] ?? null
|
|
143
|
+
)
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
getGlobalPcbPosition(): { x: number; y: number } {
|
|
@@ -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,
|
|
@@ -172,8 +172,9 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
|
|
|
172
172
|
if (pcbRouteHints.length === 0) {
|
|
173
173
|
const { solution } = autoroute(pcbElements.concat([source_trace]))
|
|
174
174
|
// TODO for some reason, the solution gets duplicated inside ijump-astar
|
|
175
|
-
const
|
|
176
|
-
db.pcb_trace.insert(
|
|
175
|
+
const inputPcbTrace = solution[0]
|
|
176
|
+
const pcb_trace = db.pcb_trace.insert(inputPcbTrace as any)
|
|
177
|
+
|
|
177
178
|
this.pcb_trace_id = pcb_trace.pcb_trace_id
|
|
178
179
|
return
|
|
179
180
|
}
|
|
@@ -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.13",
|
|
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",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"typescript": "^5.0.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tscircuit/infgrid-ijump-astar": "0.0.
|
|
30
|
+
"@tscircuit/infgrid-ijump-astar": "0.0.5",
|
|
31
31
|
"@tscircuit/props": "^0.0.46",
|
|
32
32
|
"@tscircuit/soup": "^0.0.58",
|
|
33
33
|
"@tscircuit/soup-util": "0.0.18",
|
|
34
34
|
"footprinter": "^0.0.44",
|
|
35
35
|
"react": "^18.3.1",
|
|
36
36
|
"react-reconciler": "^0.29.2",
|
|
37
|
-
"schematic-symbols": "0.0.
|
|
37
|
+
"schematic-symbols": "0.0.15",
|
|
38
38
|
"transformation-matrix": "^2.16.1",
|
|
39
39
|
"zod": "^3.23.8"
|
|
40
40
|
}
|