@tscircuit/core 0.0.54 → 0.0.56
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 +82 -2
- package/dist/index.js +70 -0
- package/lib/components/index.ts +2 -0
- package/lib/components/primitive-components/FabricationNotePath.ts +50 -0
- package/lib/components/primitive-components/FabricationNoteText.ts +25 -0
- package/lib/components/primitive-components/Trace.ts +4 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ReactElement } from 'react';
|
|
|
6
6
|
import { Matrix } from 'transformation-matrix';
|
|
7
7
|
import { SchSymbol, BaseSymbolName } from 'schematic-symbols';
|
|
8
8
|
import * as Props from '@tscircuit/props';
|
|
9
|
-
import { traceProps, groupProps, boardProps, footprintProps, smtPadProps, resistorProps, ledProps, diodeProps, capacitorProps, traceHintProps, chipProps, jumperProps, silkscreenPathProps, platedHoleProps, constraintProps, holeProps, silkscreenTextProps, pcbKeepoutProps } from '@tscircuit/props';
|
|
9
|
+
import { traceProps, groupProps, boardProps, footprintProps, smtPadProps, resistorProps, ledProps, diodeProps, capacitorProps, traceHintProps, chipProps, jumperProps, silkscreenPathProps, platedHoleProps, constraintProps, holeProps, silkscreenTextProps, pcbKeepoutProps, fabricationNoteTextProps, fabricationNotePathProps } from '@tscircuit/props';
|
|
10
10
|
|
|
11
11
|
declare class Circuit {
|
|
12
12
|
firstChild: PrimitiveComponent | null;
|
|
@@ -4106,6 +4106,86 @@ declare class Keepout extends PrimitiveComponent<typeof pcbKeepoutProps> {
|
|
|
4106
4106
|
doInitialPcbPrimitiveRender(): void;
|
|
4107
4107
|
}
|
|
4108
4108
|
|
|
4109
|
+
declare class FabricationNoteText extends PrimitiveComponent<typeof fabricationNoteTextProps> {
|
|
4110
|
+
doInitialPcbPrimitiveRender(): void;
|
|
4111
|
+
}
|
|
4112
|
+
|
|
4113
|
+
declare class FabricationNotePath extends PrimitiveComponent<typeof fabricationNotePathProps> {
|
|
4114
|
+
fabrication_note_path_id: string | null;
|
|
4115
|
+
get config(): {
|
|
4116
|
+
zodProps: zod.ZodObject<zod.objectUtil.extendShape<Omit<{
|
|
4117
|
+
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4118
|
+
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4119
|
+
pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4120
|
+
layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
4121
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
4122
|
+
}, "strip", zod.ZodTypeAny, {
|
|
4123
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4124
|
+
}, {
|
|
4125
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4126
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
4127
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4128
|
+
}>>;
|
|
4129
|
+
}, "pcbRotation" | "pcbX" | "pcbY">, {
|
|
4130
|
+
route: zod.ZodArray<zod.ZodObject<{
|
|
4131
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
4132
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
4133
|
+
via: zod.ZodOptional<zod.ZodBoolean>;
|
|
4134
|
+
to_layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
4135
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
4136
|
+
}, "strip", zod.ZodTypeAny, {
|
|
4137
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4138
|
+
}, {
|
|
4139
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4140
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
4141
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4142
|
+
}>>;
|
|
4143
|
+
trace_width: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4144
|
+
}, "strip", zod.ZodTypeAny, {
|
|
4145
|
+
x: number;
|
|
4146
|
+
y: number;
|
|
4147
|
+
trace_width?: number | undefined;
|
|
4148
|
+
via?: boolean | undefined;
|
|
4149
|
+
to_layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
4150
|
+
}, {
|
|
4151
|
+
x: string | number;
|
|
4152
|
+
y: string | number;
|
|
4153
|
+
trace_width?: string | number | undefined;
|
|
4154
|
+
via?: boolean | undefined;
|
|
4155
|
+
to_layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
4156
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4157
|
+
} | undefined;
|
|
4158
|
+
}>, "many">;
|
|
4159
|
+
strokeWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4160
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
4161
|
+
route: {
|
|
4162
|
+
x: number;
|
|
4163
|
+
y: number;
|
|
4164
|
+
trace_width?: number | undefined;
|
|
4165
|
+
via?: boolean | undefined;
|
|
4166
|
+
to_layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
4167
|
+
}[];
|
|
4168
|
+
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
4169
|
+
strokeWidth?: number | undefined;
|
|
4170
|
+
}, {
|
|
4171
|
+
route: {
|
|
4172
|
+
x: string | number;
|
|
4173
|
+
y: string | number;
|
|
4174
|
+
trace_width?: string | number | undefined;
|
|
4175
|
+
via?: boolean | undefined;
|
|
4176
|
+
to_layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
4177
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4178
|
+
} | undefined;
|
|
4179
|
+
}[];
|
|
4180
|
+
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
4181
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4182
|
+
} | undefined;
|
|
4183
|
+
strokeWidth?: string | number | undefined;
|
|
4184
|
+
}>;
|
|
4185
|
+
};
|
|
4186
|
+
doInitialPcbPrimitiveRender(): void;
|
|
4187
|
+
}
|
|
4188
|
+
|
|
4109
4189
|
declare global {
|
|
4110
4190
|
namespace JSX {
|
|
4111
4191
|
interface IntrinsicElements {
|
|
@@ -4152,4 +4232,4 @@ declare global {
|
|
|
4152
4232
|
}
|
|
4153
4233
|
}
|
|
4154
4234
|
|
|
4155
|
-
export { Board, Capacitor, Chip, Circuit, Constraint, Diode, Footprint, Group, Hole, type IRenderable, Jumper, Keepout, Led, Net, NormalComponent, PlatedHole, Port, PrimitiveComponent, Project, Renderable, Resistor, SilkscreenPath, SilkscreenText, SmtPad, Trace, TraceHint };
|
|
4235
|
+
export { Board, Capacitor, Chip, Circuit, Constraint, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Jumper, Keepout, Led, Net, NormalComponent, PlatedHole, Port, PrimitiveComponent, Project, Renderable, Resistor, SilkscreenPath, SilkscreenText, SmtPad, Trace, TraceHint };
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,8 @@ __export(components_exports, {
|
|
|
12
12
|
Chip: () => Chip,
|
|
13
13
|
Constraint: () => Constraint2,
|
|
14
14
|
Diode: () => Diode,
|
|
15
|
+
FabricationNotePath: () => FabricationNotePath,
|
|
16
|
+
FabricationNoteText: () => FabricationNoteText,
|
|
15
17
|
Footprint: () => Footprint,
|
|
16
18
|
Group: () => Group,
|
|
17
19
|
Hole: () => Hole,
|
|
@@ -2383,6 +2385,9 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
2383
2385
|
const { db } = this.root;
|
|
2384
2386
|
const { _parsedProps: props, parent } = this;
|
|
2385
2387
|
if (!parent) throw new Error("Trace has no parent");
|
|
2388
|
+
if (this.getSubcircuit()._parsedProps.routingDisabled) {
|
|
2389
|
+
return;
|
|
2390
|
+
}
|
|
2386
2391
|
const { allPortsFound, ports } = this._findConnectedPorts();
|
|
2387
2392
|
const portsConnectedOnPcbViaNet = [];
|
|
2388
2393
|
if (!allPortsFound) return;
|
|
@@ -3366,6 +3371,69 @@ var SilkscreenText = class extends PrimitiveComponent {
|
|
|
3366
3371
|
}
|
|
3367
3372
|
};
|
|
3368
3373
|
|
|
3374
|
+
// lib/components/primitive-components/FabricationNoteText.ts
|
|
3375
|
+
import "@tscircuit/props";
|
|
3376
|
+
var FabricationNoteText = class extends PrimitiveComponent {
|
|
3377
|
+
doInitialPcbPrimitiveRender() {
|
|
3378
|
+
const { db } = this.root;
|
|
3379
|
+
const { _parsedProps: props } = this;
|
|
3380
|
+
const container = this.getPrimitiveContainer();
|
|
3381
|
+
db.pcb_fabrication_note_text.insert({
|
|
3382
|
+
anchor_alignment: props.anchorAlignment,
|
|
3383
|
+
anchor_position: {
|
|
3384
|
+
x: props.pcbX ?? 0,
|
|
3385
|
+
y: props.pcbY ?? 0
|
|
3386
|
+
},
|
|
3387
|
+
font: props.font ?? "tscircuit2024",
|
|
3388
|
+
font_size: props.fontSize ?? 1,
|
|
3389
|
+
layer: "top",
|
|
3390
|
+
text: props.text ?? "",
|
|
3391
|
+
pcb_component_id: container.pcb_component_id
|
|
3392
|
+
});
|
|
3393
|
+
}
|
|
3394
|
+
};
|
|
3395
|
+
|
|
3396
|
+
// lib/components/primitive-components/FabricationNotePath.ts
|
|
3397
|
+
import { fabricationNotePathProps } from "@tscircuit/props";
|
|
3398
|
+
import { applyToPoint as applyToPoint5 } from "transformation-matrix";
|
|
3399
|
+
var FabricationNotePath = class extends PrimitiveComponent {
|
|
3400
|
+
fabrication_note_path_id = null;
|
|
3401
|
+
get config() {
|
|
3402
|
+
return {
|
|
3403
|
+
zodProps: fabricationNotePathProps
|
|
3404
|
+
};
|
|
3405
|
+
}
|
|
3406
|
+
doInitialPcbPrimitiveRender() {
|
|
3407
|
+
const { db } = this.root;
|
|
3408
|
+
const { _parsedProps: props } = this;
|
|
3409
|
+
const layer = props.layer ?? "top";
|
|
3410
|
+
if (layer !== "top" && layer !== "bottom") {
|
|
3411
|
+
throw new Error(
|
|
3412
|
+
`Invalid layer "${layer}" for SilkscreenPath. Must be "top" or "bottom".`
|
|
3413
|
+
);
|
|
3414
|
+
}
|
|
3415
|
+
const transform = this._computePcbGlobalTransformBeforeLayout();
|
|
3416
|
+
const fabrication_note_path = db.pcb_fabrication_note_path.insert({
|
|
3417
|
+
pcb_component_id: this.parent?.pcb_component_id,
|
|
3418
|
+
layer,
|
|
3419
|
+
route: props.route.map((p) => {
|
|
3420
|
+
const transformedPosition = applyToPoint5(transform, {
|
|
3421
|
+
x: p.x,
|
|
3422
|
+
y: p.y
|
|
3423
|
+
});
|
|
3424
|
+
return {
|
|
3425
|
+
...p,
|
|
3426
|
+
x: transformedPosition.x,
|
|
3427
|
+
y: transformedPosition.y
|
|
3428
|
+
};
|
|
3429
|
+
}),
|
|
3430
|
+
stroke_width: props.strokeWidth ?? 0.1,
|
|
3431
|
+
fabrication_note_path_id: `fabrication_note_${Math.random().toString()}`
|
|
3432
|
+
});
|
|
3433
|
+
this.fabrication_note_path_id = fabrication_note_path.fabrication_note_path_id;
|
|
3434
|
+
}
|
|
3435
|
+
};
|
|
3436
|
+
|
|
3369
3437
|
// lib/Project.ts
|
|
3370
3438
|
import { su } from "@tscircuit/soup-util";
|
|
3371
3439
|
import { isValidElement as isValidElement2 } from "react";
|
|
@@ -3471,6 +3539,8 @@ export {
|
|
|
3471
3539
|
Circuit,
|
|
3472
3540
|
Constraint2 as Constraint,
|
|
3473
3541
|
Diode,
|
|
3542
|
+
FabricationNotePath,
|
|
3543
|
+
FabricationNoteText,
|
|
3474
3544
|
Footprint,
|
|
3475
3545
|
Group,
|
|
3476
3546
|
Hole,
|
package/lib/components/index.ts
CHANGED
|
@@ -21,3 +21,5 @@ export { Constraint } from "./primitive-components/Constraint"
|
|
|
21
21
|
export { Hole } from "./primitive-components/Hole"
|
|
22
22
|
export { SilkscreenText } from "./primitive-components/SilkscreenText"
|
|
23
23
|
export { Keepout } from "./primitive-components/Keepout"
|
|
24
|
+
export { FabricationNoteText } from "./primitive-components/FabricationNoteText"
|
|
25
|
+
export { FabricationNotePath } from "./primitive-components/FabricationNotePath"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { fabricationNotePathProps } from "@tscircuit/props"
|
|
2
|
+
import { PrimitiveComponent } from "../base-components/PrimitiveComponent"
|
|
3
|
+
import { applyToPoint } from "transformation-matrix"
|
|
4
|
+
|
|
5
|
+
export class FabricationNotePath extends PrimitiveComponent<
|
|
6
|
+
typeof fabricationNotePathProps
|
|
7
|
+
> {
|
|
8
|
+
fabrication_note_path_id: string | null = null
|
|
9
|
+
|
|
10
|
+
get config() {
|
|
11
|
+
return {
|
|
12
|
+
zodProps: fabricationNotePathProps,
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
doInitialPcbPrimitiveRender(): void {
|
|
17
|
+
const { db } = this.root!
|
|
18
|
+
const { _parsedProps: props } = this
|
|
19
|
+
|
|
20
|
+
const layer = props.layer ?? "top"
|
|
21
|
+
if (layer !== "top" && layer !== "bottom") {
|
|
22
|
+
throw new Error(
|
|
23
|
+
`Invalid layer "${layer}" for SilkscreenPath. Must be "top" or "bottom".`,
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const transform = this._computePcbGlobalTransformBeforeLayout()
|
|
28
|
+
|
|
29
|
+
const fabrication_note_path = db.pcb_fabrication_note_path.insert({
|
|
30
|
+
pcb_component_id: this.parent?.pcb_component_id!,
|
|
31
|
+
layer,
|
|
32
|
+
route: props.route.map((p) => {
|
|
33
|
+
const transformedPosition = applyToPoint(transform, {
|
|
34
|
+
x: p.x,
|
|
35
|
+
y: p.y,
|
|
36
|
+
})
|
|
37
|
+
return {
|
|
38
|
+
...p,
|
|
39
|
+
x: transformedPosition.x,
|
|
40
|
+
y: transformedPosition.y,
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
43
|
+
stroke_width: props.strokeWidth ?? 0.1,
|
|
44
|
+
fabrication_note_path_id: `fabrication_note_${Math.random().toString()}`,
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
this.fabrication_note_path_id =
|
|
48
|
+
fabrication_note_path.fabrication_note_path_id
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PrimitiveComponent } from "../base-components/PrimitiveComponent"
|
|
2
|
+
import { fabricationNoteTextProps } from "@tscircuit/props"
|
|
3
|
+
|
|
4
|
+
export class FabricationNoteText extends PrimitiveComponent<
|
|
5
|
+
typeof fabricationNoteTextProps
|
|
6
|
+
> {
|
|
7
|
+
doInitialPcbPrimitiveRender(): void {
|
|
8
|
+
const { db } = this.root!
|
|
9
|
+
const { _parsedProps: props } = this
|
|
10
|
+
const container = this.getPrimitiveContainer()!
|
|
11
|
+
|
|
12
|
+
db.pcb_fabrication_note_text.insert({
|
|
13
|
+
anchor_alignment: props.anchorAlignment,
|
|
14
|
+
anchor_position: {
|
|
15
|
+
x: props.pcbX ?? 0,
|
|
16
|
+
y: props.pcbY ?? 0,
|
|
17
|
+
},
|
|
18
|
+
font: props.font ?? "tscircuit2024",
|
|
19
|
+
font_size: props.fontSize ?? 1,
|
|
20
|
+
layer: "top",
|
|
21
|
+
text: props.text ?? "",
|
|
22
|
+
pcb_component_id: container.pcb_component_id!,
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -251,6 +251,10 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
|
|
|
251
251
|
|
|
252
252
|
if (!parent) throw new Error("Trace has no parent")
|
|
253
253
|
|
|
254
|
+
if (this.getSubcircuit()._parsedProps.routingDisabled) {
|
|
255
|
+
return
|
|
256
|
+
}
|
|
257
|
+
|
|
254
258
|
const { allPortsFound, ports } = this._findConnectedPorts()
|
|
255
259
|
const portsConnectedOnPcbViaNet: Port[] = []
|
|
256
260
|
|