@tscircuit/pcb-viewer 1.11.166 → 1.11.167
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.js +83 -10
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -83,6 +83,7 @@ __export(dist_exports, {
|
|
|
83
83
|
schematic_debug_rect: () => schematic_debug_rect,
|
|
84
84
|
schematic_error: () => schematic_error,
|
|
85
85
|
schematic_group: () => schematic_group,
|
|
86
|
+
schematic_layout_error: () => schematic_layout_error,
|
|
86
87
|
schematic_line: () => schematic_line,
|
|
87
88
|
schematic_manual_edit_conflict_warning: () => schematic_manual_edit_conflict_warning,
|
|
88
89
|
schematic_net_label: () => schematic_net_label,
|
|
@@ -4652,7 +4653,8 @@ var source_port = z.object({
|
|
|
4652
4653
|
name: z.string(),
|
|
4653
4654
|
source_port_id: z.string(),
|
|
4654
4655
|
source_component_id: z.string(),
|
|
4655
|
-
subcircuit_id: z.string().optional()
|
|
4656
|
+
subcircuit_id: z.string().optional(),
|
|
4657
|
+
subcircuit_connectivity_map_key: z.string().optional()
|
|
4656
4658
|
});
|
|
4657
4659
|
expectTypesMatch(true);
|
|
4658
4660
|
var source_trace = z.object({
|
|
@@ -4685,7 +4687,8 @@ var source_net = z.object({
|
|
|
4685
4687
|
is_digital_signal: z.boolean().optional(),
|
|
4686
4688
|
is_analog_signal: z.boolean().optional(),
|
|
4687
4689
|
trace_width: z.number().optional(),
|
|
4688
|
-
subcircuit_id: z.string().optional()
|
|
4690
|
+
subcircuit_id: z.string().optional(),
|
|
4691
|
+
subcircuit_connectivity_map_key: z.string().optional()
|
|
4689
4692
|
});
|
|
4690
4693
|
var schematic_box = z.object({
|
|
4691
4694
|
type: z.literal("schematic_box"),
|
|
@@ -4868,6 +4871,16 @@ var schematic_error = z.object({
|
|
|
4868
4871
|
message: z.string()
|
|
4869
4872
|
}).describe("Defines a schematic error on the schematic");
|
|
4870
4873
|
expectTypesMatch(true);
|
|
4874
|
+
var schematic_layout_error = z.object({
|
|
4875
|
+
type: z.literal("schematic_layout_error"),
|
|
4876
|
+
schematic_layout_error_id: getZodPrefixedIdWithDefault(
|
|
4877
|
+
"schematic_layout_error"
|
|
4878
|
+
),
|
|
4879
|
+
message: z.string(),
|
|
4880
|
+
source_group_id: z.string(),
|
|
4881
|
+
schematic_group_id: z.string()
|
|
4882
|
+
}).describe("Error emitted when schematic layout fails for a group");
|
|
4883
|
+
expectTypesMatch(true);
|
|
4871
4884
|
var schematic_debug_object_base = z.object({
|
|
4872
4885
|
type: z.literal("schematic_debug_object"),
|
|
4873
4886
|
label: z.string().optional()
|
|
@@ -5423,7 +5436,10 @@ var pcb_silkscreen_rect = z.object({
|
|
|
5423
5436
|
width: length,
|
|
5424
5437
|
height: length,
|
|
5425
5438
|
layer: layer_ref,
|
|
5426
|
-
stroke_width: length.default("1mm")
|
|
5439
|
+
stroke_width: length.default("1mm"),
|
|
5440
|
+
is_filled: z.boolean().default(true).optional(),
|
|
5441
|
+
has_stroke: z.boolean().optional(),
|
|
5442
|
+
is_stroke_dashed: z.boolean().optional()
|
|
5427
5443
|
}).describe("Defines a silkscreen rect on the PCB");
|
|
5428
5444
|
expectTypesMatch(true);
|
|
5429
5445
|
var pcb_silkscreen_circle = z.object({
|
|
@@ -5669,6 +5685,7 @@ var any_circuit_element = z.union([
|
|
|
5669
5685
|
schematic_trace,
|
|
5670
5686
|
schematic_path,
|
|
5671
5687
|
schematic_error,
|
|
5688
|
+
schematic_layout_error,
|
|
5672
5689
|
schematic_net_label,
|
|
5673
5690
|
schematic_debug_object,
|
|
5674
5691
|
schematic_voltage_probe,
|
|
@@ -6979,7 +6996,12 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
6979
6996
|
y: element.center.y,
|
|
6980
6997
|
w: element.width,
|
|
6981
6998
|
h: element.height,
|
|
6982
|
-
layer: element.layer === "bottom" ? "bottom_silkscreen" : "top_silkscreen"
|
|
6999
|
+
layer: element.layer === "bottom" ? "bottom_silkscreen" : "top_silkscreen",
|
|
7000
|
+
stroke_width: element.stroke_width,
|
|
7001
|
+
is_filled: element.is_filled,
|
|
7002
|
+
has_stroke: element.has_stroke,
|
|
7003
|
+
is_stroke_dashed: element.is_stroke_dashed,
|
|
7004
|
+
_element: element
|
|
6983
7005
|
}
|
|
6984
7006
|
];
|
|
6985
7007
|
}
|
|
@@ -7532,11 +7554,22 @@ var Drawer = class {
|
|
|
7532
7554
|
drawLines(angle * Math.PI / 180);
|
|
7533
7555
|
drawLines((angle + 90) * Math.PI / 180);
|
|
7534
7556
|
}
|
|
7535
|
-
rect(
|
|
7557
|
+
rect({
|
|
7558
|
+
x,
|
|
7559
|
+
y,
|
|
7560
|
+
w,
|
|
7561
|
+
h,
|
|
7562
|
+
mesh_fill,
|
|
7563
|
+
is_filled = true,
|
|
7564
|
+
has_stroke,
|
|
7565
|
+
is_stroke_dashed,
|
|
7566
|
+
stroke_width
|
|
7567
|
+
}) {
|
|
7536
7568
|
const [x1$, y1$] = applyToPoint3(this.transform, [x - w / 2, y - h / 2]);
|
|
7537
7569
|
const [x2$, y2$] = applyToPoint3(this.transform, [x + w / 2, y + h / 2]);
|
|
7538
7570
|
this.applyAperture();
|
|
7539
7571
|
const ctx = this.getLayerCtx();
|
|
7572
|
+
const shouldDrawStroke = has_stroke === void 0 ? is_filled === false : has_stroke;
|
|
7540
7573
|
if (mesh_fill) {
|
|
7541
7574
|
ctx.save();
|
|
7542
7575
|
ctx.beginPath();
|
|
@@ -7546,7 +7579,35 @@ var Drawer = class {
|
|
|
7546
7579
|
ctx.restore();
|
|
7547
7580
|
ctx.strokeRect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
7548
7581
|
} else {
|
|
7549
|
-
|
|
7582
|
+
if (is_filled !== false) {
|
|
7583
|
+
ctx.fillRect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
7584
|
+
}
|
|
7585
|
+
if (shouldDrawStroke) {
|
|
7586
|
+
const originalLineWidth = ctx.lineWidth;
|
|
7587
|
+
if (stroke_width !== void 0) {
|
|
7588
|
+
ctx.lineWidth = scaleOnly(this.transform, stroke_width);
|
|
7589
|
+
}
|
|
7590
|
+
if (is_stroke_dashed) {
|
|
7591
|
+
let dashPattern = [];
|
|
7592
|
+
const scale4 = Math.abs(this.transform.a);
|
|
7593
|
+
if (scale4 > 0) {
|
|
7594
|
+
const SEGMENT_LENGTH = 0.1;
|
|
7595
|
+
const dash = SEGMENT_LENGTH * scale4;
|
|
7596
|
+
const gap = dash * 1.3;
|
|
7597
|
+
if (dash > 0.5) {
|
|
7598
|
+
dashPattern = [dash, gap];
|
|
7599
|
+
}
|
|
7600
|
+
}
|
|
7601
|
+
ctx.setLineDash(dashPattern);
|
|
7602
|
+
}
|
|
7603
|
+
ctx.strokeRect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
7604
|
+
if (is_stroke_dashed) {
|
|
7605
|
+
ctx.setLineDash([]);
|
|
7606
|
+
}
|
|
7607
|
+
if (stroke_width !== void 0) {
|
|
7608
|
+
ctx.lineWidth = originalLineWidth;
|
|
7609
|
+
}
|
|
7610
|
+
}
|
|
7550
7611
|
}
|
|
7551
7612
|
}
|
|
7552
7613
|
rotatedRect(x, y, w, h, ccw_rotation, mesh_fill) {
|
|
@@ -7988,9 +8049,20 @@ var drawText = (drawer, text) => {
|
|
|
7988
8049
|
var drawRect = (drawer, rect) => {
|
|
7989
8050
|
drawer.equip({
|
|
7990
8051
|
color: getColor(rect),
|
|
7991
|
-
layer: rect.layer
|
|
8052
|
+
layer: rect.layer,
|
|
8053
|
+
size: rect.stroke_width
|
|
8054
|
+
});
|
|
8055
|
+
drawer.rect({
|
|
8056
|
+
x: rect.x,
|
|
8057
|
+
y: rect.y,
|
|
8058
|
+
w: rect.w,
|
|
8059
|
+
h: rect.h,
|
|
8060
|
+
mesh_fill: rect.mesh_fill,
|
|
8061
|
+
is_filled: rect.is_filled,
|
|
8062
|
+
has_stroke: rect.has_stroke,
|
|
8063
|
+
is_stroke_dashed: rect.is_stroke_dashed,
|
|
8064
|
+
stroke_width: rect.stroke_width
|
|
7992
8065
|
});
|
|
7993
|
-
drawer.rect(rect.x, rect.y, rect.w, rect.h, rect.mesh_fill);
|
|
7994
8066
|
};
|
|
7995
8067
|
var drawRotatedRect = (drawer, rect) => {
|
|
7996
8068
|
drawer.equip({
|
|
@@ -9852,7 +9924,7 @@ import { css as css3 } from "@emotion/css";
|
|
|
9852
9924
|
// package.json
|
|
9853
9925
|
var package_default = {
|
|
9854
9926
|
name: "@tscircuit/pcb-viewer",
|
|
9855
|
-
version: "1.11.
|
|
9927
|
+
version: "1.11.166",
|
|
9856
9928
|
main: "dist/index.js",
|
|
9857
9929
|
type: "module",
|
|
9858
9930
|
repository: "tscircuit/pcb-viewer",
|
|
@@ -9886,7 +9958,8 @@ var package_default = {
|
|
|
9886
9958
|
"@types/color": "^3.0.6",
|
|
9887
9959
|
"@types/node": "18.7.23",
|
|
9888
9960
|
"@types/react": "^18.3.3",
|
|
9889
|
-
"circuit-json": "^0.0.
|
|
9961
|
+
"circuit-json": "^0.0.194",
|
|
9962
|
+
next: "^14.1.4",
|
|
9890
9963
|
"pixi.js": "^8.6.6",
|
|
9891
9964
|
react: "^18.2.0",
|
|
9892
9965
|
"react-cosmos": "7.0.0-beta.4",
|