@tscircuit/pcb-viewer 1.11.141 → 1.11.143

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 CHANGED
@@ -28,6 +28,10 @@ __export(dist_exports, {
28
28
  pcb_autorouting_error: () => pcb_autorouting_error,
29
29
  pcb_board: () => pcb_board,
30
30
  pcb_component: () => pcb_component,
31
+ pcb_cutout: () => pcb_cutout,
32
+ pcb_cutout_circle: () => pcb_cutout_circle,
33
+ pcb_cutout_polygon: () => pcb_cutout_polygon,
34
+ pcb_cutout_rect: () => pcb_cutout_rect,
31
35
  pcb_fabrication_note_path: () => pcb_fabrication_note_path,
32
36
  pcb_fabrication_note_text: () => pcb_fabrication_note_text,
33
37
  pcb_group: () => pcb_group,
@@ -78,6 +82,7 @@ __export(dist_exports, {
78
82
  schematic_debug_point: () => schematic_debug_point,
79
83
  schematic_debug_rect: () => schematic_debug_rect,
80
84
  schematic_error: () => schematic_error,
85
+ schematic_group: () => schematic_group,
81
86
  schematic_line: () => schematic_line,
82
87
  schematic_manual_edit_conflict_warning: () => schematic_manual_edit_conflict_warning,
83
88
  schematic_net_label: () => schematic_net_label,
@@ -89,8 +94,10 @@ __export(dist_exports, {
89
94
  schematic_voltage_probe: () => schematic_voltage_probe,
90
95
  size: () => size,
91
96
  source_component_base: () => source_component_base,
97
+ source_failed_to_create_component_error: () => source_failed_to_create_component_error,
92
98
  source_group: () => source_group,
93
99
  source_led: () => source_led,
100
+ source_missing_property_error: () => source_missing_property_error,
94
101
  source_net: () => source_net,
95
102
  source_port: () => source_port,
96
103
  source_project_metadata: () => source_project_metadata,
@@ -4468,7 +4475,9 @@ var source_component_base = z.object({
4468
4475
  name: z.string(),
4469
4476
  manufacturer_part_number: z.string().optional(),
4470
4477
  supplier_part_numbers: z.record(supplier_name, z.array(z.string())).optional(),
4471
- display_value: z.string().optional()
4478
+ display_value: z.string().optional(),
4479
+ are_pins_interchangeable: z.boolean().optional(),
4480
+ internally_connected_source_port_ids: z.array(z.array(z.string())).optional()
4472
4481
  });
4473
4482
  expectTypesMatch(true);
4474
4483
  var source_simple_capacitor = source_component_base.extend({
@@ -4567,6 +4576,36 @@ var source_project_metadata = z.object({
4567
4576
  created_at: z.string().datetime().optional()
4568
4577
  });
4569
4578
  expectTypesMatch(true);
4579
+ var source_missing_property_error = z.object({
4580
+ type: z.literal("source_missing_property_error"),
4581
+ source_missing_property_error_id: getZodPrefixedIdWithDefault(
4582
+ "source_missing_property_error"
4583
+ ),
4584
+ source_component_id: z.string(),
4585
+ property_name: z.string(),
4586
+ error_type: z.literal("source_missing_property_error"),
4587
+ message: z.string()
4588
+ }).describe("The source code is missing a property");
4589
+ expectTypesMatch(true);
4590
+ var source_failed_to_create_component_error = z.object({
4591
+ type: z.literal("source_failed_to_create_component_error"),
4592
+ source_failed_to_create_component_error_id: getZodPrefixedIdWithDefault(
4593
+ "source_failed_to_create_component_error"
4594
+ ),
4595
+ component_name: z.string().optional(),
4596
+ subcircuit_id: z.string().optional(),
4597
+ parent_source_component_id: z.string().optional(),
4598
+ message: z.string(),
4599
+ pcb_center: z.object({
4600
+ x: z.number().optional(),
4601
+ y: z.number().optional()
4602
+ }).optional(),
4603
+ schematic_center: z.object({
4604
+ x: z.number().optional(),
4605
+ y: z.number().optional()
4606
+ }).optional()
4607
+ }).describe("Error emitted when a component fails to be constructed");
4608
+ expectTypesMatch(true);
4570
4609
  var any_source_component = z.union([
4571
4610
  source_simple_resistor,
4572
4611
  source_simple_capacitor,
@@ -4586,7 +4625,9 @@ var any_source_component = z.union([
4586
4625
  source_simple_switch,
4587
4626
  source_simple_transistor,
4588
4627
  source_simple_mosfet,
4589
- source_project_metadata
4628
+ source_project_metadata,
4629
+ source_missing_property_error,
4630
+ source_failed_to_create_component_error
4590
4631
  ]);
4591
4632
  var source_port = z.object({
4592
4633
  type: z.literal("source_port"),
@@ -4740,17 +4781,36 @@ var schematic_trace = z.object({
4740
4781
  )
4741
4782
  });
4742
4783
  expectTypesMatch(true);
4784
+ var ninePointAnchor = z.enum([
4785
+ "top_left",
4786
+ "top_center",
4787
+ "top_right",
4788
+ "center_left",
4789
+ "center",
4790
+ "center_right",
4791
+ "bottom_left",
4792
+ "bottom_center",
4793
+ "bottom_right"
4794
+ ]);
4795
+ var fivePointAnchor = z.enum([
4796
+ "center",
4797
+ "left",
4798
+ "right",
4799
+ "top",
4800
+ "bottom"
4801
+ ]);
4743
4802
  var schematic_text = z.object({
4744
4803
  type: z.literal("schematic_text"),
4745
- schematic_component_id: z.string(),
4804
+ schematic_component_id: z.string().optional(),
4746
4805
  schematic_text_id: z.string(),
4747
4806
  text: z.string(),
4807
+ font_size: z.number().default(1),
4748
4808
  position: z.object({
4749
4809
  x: distance,
4750
4810
  y: distance
4751
4811
  }),
4752
4812
  rotation: z.number().default(0),
4753
- anchor: z.enum(["center", "left", "right", "top", "bottom"]).default("center"),
4813
+ anchor: z.union([fivePointAnchor.describe("legacy"), ninePointAnchor]).default("center"),
4754
4814
  color: z.string().default("#000000")
4755
4815
  });
4756
4816
  expectTypesMatch(true);
@@ -4831,6 +4891,20 @@ var schematic_manual_edit_conflict_warning = z.object({
4831
4891
  "Warning emitted when a component has both manual placement and explicit schX/schY coordinates"
4832
4892
  );
4833
4893
  expectTypesMatch(true);
4894
+ var schematic_group = z.object({
4895
+ type: z.literal("schematic_group"),
4896
+ schematic_group_id: getZodPrefixedIdWithDefault("schematic_group"),
4897
+ source_group_id: z.string(),
4898
+ is_subcircuit: z.boolean().optional(),
4899
+ subcircuit_id: z.string().optional(),
4900
+ width: length,
4901
+ height: length,
4902
+ center: point,
4903
+ schematic_component_ids: z.array(z.string()),
4904
+ name: z.string().optional(),
4905
+ description: z.string().optional()
4906
+ }).describe("Defines a group of components on the schematic");
4907
+ expectTypesMatch(true);
4834
4908
  var all_layers = [
4835
4909
  "top",
4836
4910
  "bottom",
@@ -4981,13 +5055,15 @@ var pcb_pill_hole_with_rect_pad = z.object({
4981
5055
  var pcb_plated_hole = z.union([
4982
5056
  pcb_plated_hole_circle,
4983
5057
  pcb_plated_hole_oval,
4984
- pcb_circular_hole_with_rect_pad
5058
+ pcb_circular_hole_with_rect_pad,
5059
+ pcb_pill_hole_with_rect_pad
4985
5060
  ]);
4986
5061
  expectTypesMatch(
4987
5062
  true
4988
5063
  );
4989
5064
  expectTypesMatch(true);
4990
5065
  expectTypesMatch(true);
5066
+ expectTypesMatch(true);
4991
5067
  var pcb_port = z.object({
4992
5068
  type: z.literal("pcb_port"),
4993
5069
  pcb_port_id: getZodPrefixedIdWithDefault("pcb_port"),
@@ -5098,9 +5174,64 @@ var pcb_solder_paste_rect = z.object({
5098
5174
  pcb_component_id: z.string().optional(),
5099
5175
  pcb_smtpad_id: z.string().optional()
5100
5176
  });
5101
- var pcb_solder_paste = z.union([pcb_solder_paste_circle, pcb_solder_paste_rect]).describe("Defines solderpaste on the PCB");
5177
+ var pcb_solder_paste_pill = z.object({
5178
+ type: z.literal("pcb_solder_paste"),
5179
+ shape: z.literal("pill"),
5180
+ pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
5181
+ pcb_group_id: z.string().optional(),
5182
+ subcircuit_id: z.string().optional(),
5183
+ x: distance,
5184
+ y: distance,
5185
+ width: z.number(),
5186
+ height: z.number(),
5187
+ radius: z.number(),
5188
+ layer: layer_ref,
5189
+ pcb_component_id: z.string().optional(),
5190
+ pcb_smtpad_id: z.string().optional()
5191
+ });
5192
+ var pcb_solder_paste_rotated_rect = z.object({
5193
+ type: z.literal("pcb_solder_paste"),
5194
+ shape: z.literal("rotated_rect"),
5195
+ pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
5196
+ pcb_group_id: z.string().optional(),
5197
+ subcircuit_id: z.string().optional(),
5198
+ x: distance,
5199
+ y: distance,
5200
+ width: z.number(),
5201
+ height: z.number(),
5202
+ ccw_rotation: distance,
5203
+ layer: layer_ref,
5204
+ pcb_component_id: z.string().optional(),
5205
+ pcb_smtpad_id: z.string().optional()
5206
+ });
5207
+ var pcb_solder_paste_oval = z.object({
5208
+ type: z.literal("pcb_solder_paste"),
5209
+ shape: z.literal("oval"),
5210
+ pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
5211
+ pcb_group_id: z.string().optional(),
5212
+ subcircuit_id: z.string().optional(),
5213
+ x: distance,
5214
+ y: distance,
5215
+ width: z.number(),
5216
+ height: z.number(),
5217
+ layer: layer_ref,
5218
+ pcb_component_id: z.string().optional(),
5219
+ pcb_smtpad_id: z.string().optional()
5220
+ });
5221
+ var pcb_solder_paste = z.union([
5222
+ pcb_solder_paste_circle,
5223
+ pcb_solder_paste_rect,
5224
+ pcb_solder_paste_pill,
5225
+ pcb_solder_paste_rotated_rect,
5226
+ pcb_solder_paste_oval
5227
+ ]).describe("Defines solderpaste on the PCB");
5228
+ expectTypesMatch(true);
5102
5229
  expectTypesMatch(true);
5103
5230
  expectTypesMatch(true);
5231
+ expectTypesMatch(
5232
+ true
5233
+ );
5234
+ expectTypesMatch(true);
5104
5235
  var pcb_text = z.object({
5105
5236
  type: z.literal("pcb_text"),
5106
5237
  pcb_text_id: getZodPrefixedIdWithDefault("pcb_text"),
@@ -5129,6 +5260,8 @@ var pcb_trace_route_point_via = z.object({
5129
5260
  route_type: z.literal("via"),
5130
5261
  x: distance,
5131
5262
  y: distance,
5263
+ hole_diameter: distance.optional(),
5264
+ outer_diameter: distance.optional(),
5132
5265
  from_layer: z.string(),
5133
5266
  to_layer: z.string()
5134
5267
  });
@@ -5147,26 +5280,7 @@ var pcb_trace = z.object({
5147
5280
  route_order_index: z.number().optional(),
5148
5281
  should_round_corners: z.boolean().optional(),
5149
5282
  trace_length: z.number().optional(),
5150
- route: z.array(
5151
- z.union([
5152
- z.object({
5153
- route_type: z.literal("wire"),
5154
- x: distance,
5155
- y: distance,
5156
- width: distance,
5157
- start_pcb_port_id: z.string().optional(),
5158
- end_pcb_port_id: z.string().optional(),
5159
- layer: layer_ref
5160
- }),
5161
- z.object({
5162
- route_type: z.literal("via"),
5163
- x: distance,
5164
- y: distance,
5165
- from_layer: z.string(),
5166
- to_layer: z.string()
5167
- })
5168
- ])
5169
- )
5283
+ route: z.array(pcb_trace_route_point)
5170
5284
  }).describe("Defines a trace on the PCB");
5171
5285
  expectTypesMatch(true);
5172
5286
  expectTypesMatch(true);
@@ -5376,6 +5490,37 @@ var pcb_keepout = z.object({
5376
5490
  // Optional description of the keepout
5377
5491
  })
5378
5492
  );
5493
+ var pcb_cutout_base = z.object({
5494
+ type: z.literal("pcb_cutout"),
5495
+ pcb_cutout_id: getZodPrefixedIdWithDefault("pcb_cutout"),
5496
+ pcb_group_id: z.string().optional(),
5497
+ subcircuit_id: z.string().optional()
5498
+ });
5499
+ var pcb_cutout_rect = pcb_cutout_base.extend({
5500
+ shape: z.literal("rect"),
5501
+ center: point,
5502
+ width: length,
5503
+ height: length,
5504
+ rotation: rotation.optional()
5505
+ });
5506
+ expectTypesMatch(true);
5507
+ var pcb_cutout_circle = pcb_cutout_base.extend({
5508
+ shape: z.literal("circle"),
5509
+ center: point,
5510
+ radius: length
5511
+ });
5512
+ expectTypesMatch(true);
5513
+ var pcb_cutout_polygon = pcb_cutout_base.extend({
5514
+ shape: z.literal("polygon"),
5515
+ points: z.array(point)
5516
+ });
5517
+ expectTypesMatch(true);
5518
+ var pcb_cutout = z.discriminatedUnion("shape", [
5519
+ pcb_cutout_rect,
5520
+ pcb_cutout_circle,
5521
+ pcb_cutout_polygon
5522
+ ]).describe("Defines a cutout on the PCB, removing board material.");
5523
+ expectTypesMatch(true);
5379
5524
  var pcb_missing_footprint_error = z.object({
5380
5525
  type: z.literal("pcb_missing_footprint_error"),
5381
5526
  pcb_missing_footprint_error_id: getZodPrefixedIdWithDefault(
@@ -5490,6 +5635,7 @@ var any_circuit_element = z.union([
5490
5635
  pcb_fabrication_note_path,
5491
5636
  pcb_fabrication_note_text,
5492
5637
  pcb_autorouting_error,
5638
+ pcb_cutout,
5493
5639
  schematic_box,
5494
5640
  schematic_text,
5495
5641
  schematic_line,
@@ -5502,6 +5648,7 @@ var any_circuit_element = z.union([
5502
5648
  schematic_debug_object,
5503
5649
  schematic_voltage_probe,
5504
5650
  schematic_manual_edit_conflict_warning,
5651
+ schematic_group,
5505
5652
  cad_component
5506
5653
  ]);
5507
5654
  var any_soup_element = any_circuit_element;
@@ -6861,7 +7008,7 @@ var convertElementToPrimitives = (element, allElements) => {
6861
7008
  case "pcb_fabrication_note_text": {
6862
7009
  return [
6863
7010
  {
6864
- _pcb_drawing_object_id: `text_${globalPcbDrawingObjectCount++}`,
7011
+ _pcb_drawing_object_id: getNewPcbDrawingObjectId("text"),
6865
7012
  pcb_drawing_type: "text",
6866
7013
  x: element.anchor_position.x,
6867
7014
  y: element.anchor_position.y,
@@ -6872,6 +7019,58 @@ var convertElementToPrimitives = (element, allElements) => {
6872
7019
  }
6873
7020
  ];
6874
7021
  }
7022
+ case "pcb_cutout": {
7023
+ const cutoutElement = element;
7024
+ switch (cutoutElement.shape) {
7025
+ case "rect": {
7026
+ return [
7027
+ {
7028
+ _pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_cutout_rect"),
7029
+ pcb_drawing_type: "rect",
7030
+ x: cutoutElement.center.x,
7031
+ y: cutoutElement.center.y,
7032
+ w: cutoutElement.width,
7033
+ h: cutoutElement.height,
7034
+ layer: "drill",
7035
+ _element: element,
7036
+ _parent_pcb_component,
7037
+ _parent_source_component
7038
+ }
7039
+ ];
7040
+ }
7041
+ case "circle": {
7042
+ return [
7043
+ {
7044
+ _pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_cutout_circle"),
7045
+ pcb_drawing_type: "circle",
7046
+ x: cutoutElement.center.x,
7047
+ y: cutoutElement.center.y,
7048
+ r: cutoutElement.radius,
7049
+ layer: "drill",
7050
+ _element: element,
7051
+ _parent_pcb_component,
7052
+ _parent_source_component
7053
+ }
7054
+ ];
7055
+ }
7056
+ case "polygon": {
7057
+ return [
7058
+ {
7059
+ _pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_cutout_polygon"),
7060
+ pcb_drawing_type: "polygon",
7061
+ points: cutoutElement.points,
7062
+ layer: "drill",
7063
+ _element: element,
7064
+ _parent_pcb_component,
7065
+ _parent_source_component
7066
+ }
7067
+ ];
7068
+ }
7069
+ default:
7070
+ console.warn(`Unsupported pcb_cutout shape: ${cutoutElement.shape}`);
7071
+ return [];
7072
+ }
7073
+ }
6875
7074
  }
6876
7075
  return [];
6877
7076
  };
@@ -9512,7 +9711,7 @@ import { css as css3 } from "@emotion/css";
9512
9711
  // package.json
9513
9712
  var package_default = {
9514
9713
  name: "@tscircuit/pcb-viewer",
9515
- version: "1.11.140",
9714
+ version: "1.11.142",
9516
9715
  main: "dist/index.js",
9517
9716
  type: "module",
9518
9717
  repository: "tscircuit/pcb-viewer",
@@ -9539,12 +9738,12 @@ var package_default = {
9539
9738
  "@storybook/react": "^8.0.6",
9540
9739
  "@swc/core": "^1.4.12",
9541
9740
  "@tscircuit/eagle-xml-converter": "^1.0.0",
9542
- "@tscircuit/props": "^0.0.182",
9741
+ "@tscircuit/props": "^0.0.184",
9543
9742
  "@tscircuit/soup-util": "^0.0.41",
9544
9743
  "@types/color": "^3.0.6",
9545
9744
  "@types/node": "18.7.23",
9546
9745
  "@types/react": "^18.3.3",
9547
- "circuit-json": "^0.0.158",
9746
+ "circuit-json": "^0.0.180",
9548
9747
  next: "^14.1.4",
9549
9748
  "pixi.js": "^8.6.6",
9550
9749
  react: "^18.2.0",