@tscircuit/pcb-viewer 1.8.0 → 1.8.2

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
@@ -9469,6 +9469,9 @@ var require_dist = __commonJS({
9469
9469
  schematic_path: function() {
9470
9470
  return schematic_path;
9471
9471
  },
9472
+ schematic_pin_styles: function() {
9473
+ return schematic_pin_styles;
9474
+ },
9472
9475
  schematic_port: function() {
9473
9476
  return schematic_port;
9474
9477
  },
@@ -9809,6 +9812,12 @@ var require_dist = __commonJS({
9809
9812
  points: import_zod22.z.array(point)
9810
9813
  });
9811
9814
  var import_zod23 = require_lib2();
9815
+ var schematic_pin_styles = import_zod23.z.record(import_zod23.z.object({
9816
+ left_margin: length.optional(),
9817
+ right_margin: length.optional(),
9818
+ top_margin: length.optional(),
9819
+ bottom_margin: length.optional()
9820
+ }));
9812
9821
  var schematic_component = import_zod23.z.object({
9813
9822
  type: import_zod23.z.literal("schematic_component"),
9814
9823
  rotation: rotation.default(0),
@@ -9817,6 +9826,7 @@ var require_dist = __commonJS({
9817
9826
  source_component_id: import_zod23.z.string(),
9818
9827
  schematic_component_id: import_zod23.z.string(),
9819
9828
  pin_spacing: length.optional(),
9829
+ pin_styles: schematic_pin_styles.optional(),
9820
9830
  box_width: length.optional(),
9821
9831
  symbol_name: import_zod23.z.string().optional(),
9822
9832
  port_arrangement: import_zod23.z.union([
@@ -10098,7 +10108,7 @@ var require_dist = __commonJS({
10098
10108
  route_thickness_mode: import_zod39.z.enum([
10099
10109
  "constant",
10100
10110
  "interpolated"
10101
- ]).default("interpolated"),
10111
+ ]).default("interpolated").optional(),
10102
10112
  should_round_corners: import_zod39.z.boolean().optional(),
10103
10113
  route: import_zod39.z.array(import_zod39.z.union([
10104
10114
  import_zod39.z.object({
@@ -10153,7 +10163,7 @@ var require_dist = __commonJS({
10153
10163
  var import_zod43 = require_lib2();
10154
10164
  var pcb_board = import_zod43.z.object({
10155
10165
  type: import_zod43.z.literal("pcb_board"),
10156
- pcb_board_id: import_zod43.z.string().default("pcb_board_0"),
10166
+ pcb_board_id: import_zod43.z.string().default("pcb_board_0").optional(),
10157
10167
  width: length,
10158
10168
  height: length,
10159
10169
  center: point,
@@ -12626,7 +12636,23 @@ var convertElementToPrimitives = function(element, allElements) {
12626
12636
  switch(element.type){
12627
12637
  case "pcb_board":
12628
12638
  {
12629
- var width = element.width, height = element.height, center = element.center;
12639
+ var width = element.width, height = element.height, center = element.center, outline = element.outline;
12640
+ if (outline && outline.length > 2) {
12641
+ return outline.map(function(point, index, array) {
12642
+ return {
12643
+ pcb_drawing_type: "line",
12644
+ x1: point.x,
12645
+ y1: point.y,
12646
+ x2: index === array.length - 1 ? array[0].x : array[index + 1].x,
12647
+ y2: index === array.length - 1 ? array[0].y : array[index + 1].y,
12648
+ width: 1,
12649
+ // Add the required width property
12650
+ zoomIndependent: true,
12651
+ layer: "board",
12652
+ _element: element
12653
+ };
12654
+ });
12655
+ }
12630
12656
  return [
12631
12657
  {
12632
12658
  pcb_drawing_type: "line",
@@ -12816,45 +12842,7 @@ var convertElementToPrimitives = function(element, allElements) {
12816
12842
  case "pcb_trace":
12817
12843
  {
12818
12844
  var primitives = [];
12819
- if (element.route_thickness_mode === "constant") {
12820
- var prevX = null;
12821
- var prevY = null;
12822
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
12823
- try {
12824
- for(var _iterator = element.route[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
12825
- var route = _step.value;
12826
- if (route.route_type === "wire") {
12827
- if (prevX !== null && prevY !== null) {
12828
- primitives.push({
12829
- pcb_drawing_type: "line",
12830
- x1: prevX,
12831
- y1: prevY,
12832
- x2: route.x,
12833
- y2: route.y,
12834
- width: route.width,
12835
- squareCap: false,
12836
- layer: route.layer
12837
- });
12838
- }
12839
- prevX = route.x;
12840
- prevY = route.y;
12841
- }
12842
- }
12843
- } catch (err) {
12844
- _didIteratorError = true;
12845
- _iteratorError = err;
12846
- } finally{
12847
- try {
12848
- if (!_iteratorNormalCompletion && _iterator.return != null) {
12849
- _iterator.return();
12850
- }
12851
- } finally{
12852
- if (_didIteratorError) {
12853
- throw _iteratorError;
12854
- }
12855
- }
12856
- }
12857
- } else if (element.route_thickness_mode === "interpolated") {
12845
+ if (element.route_thickness_mode === "interpolated") {
12858
12846
  var strokeInput = element.route.map(function(r) {
12859
12847
  return {
12860
12848
  x: r.x,
@@ -12880,6 +12868,44 @@ var convertElementToPrimitives = function(element, allElements) {
12880
12868
  });
12881
12869
  }
12882
12870
  });
12871
+ return primitives;
12872
+ }
12873
+ var prevX = null;
12874
+ var prevY = null;
12875
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
12876
+ try {
12877
+ for(var _iterator = element.route[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
12878
+ var route = _step.value;
12879
+ if (route.route_type === "wire") {
12880
+ if (prevX !== null && prevY !== null) {
12881
+ primitives.push({
12882
+ pcb_drawing_type: "line",
12883
+ x1: prevX,
12884
+ y1: prevY,
12885
+ x2: route.x,
12886
+ y2: route.y,
12887
+ width: route.width,
12888
+ squareCap: false,
12889
+ layer: route.layer
12890
+ });
12891
+ }
12892
+ prevX = route.x;
12893
+ prevY = route.y;
12894
+ }
12895
+ }
12896
+ } catch (err) {
12897
+ _didIteratorError = true;
12898
+ _iteratorError = err;
12899
+ } finally{
12900
+ try {
12901
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
12902
+ _iterator.return();
12903
+ }
12904
+ } finally{
12905
+ if (_didIteratorError) {
12906
+ throw _iteratorError;
12907
+ }
12908
+ }
12883
12909
  }
12884
12910
  return primitives;
12885
12911
  }
@@ -13541,7 +13567,7 @@ var import_soup2 = __toESM(require_dist());
13541
13567
  // package.json
13542
13568
  var package_default = {
13543
13569
  name: "@tscircuit/pcb-viewer",
13544
- version: "1.7.0",
13570
+ version: "1.8.1",
13545
13571
  main: "dist/index.js",
13546
13572
  repository: "tscircuit/pcb-viewer",
13547
13573
  license: "MIT",
@@ -13564,11 +13590,11 @@ var package_default = {
13564
13590
  "@storybook/nextjs": "^8.0.6",
13565
13591
  "@storybook/react": "^8.0.6",
13566
13592
  "@swc/core": "^1.4.12",
13567
- "@tscircuit/builder": "^1.11.0",
13593
+ "@tscircuit/builder": "^1.11.4",
13568
13594
  "@tscircuit/eagle-xml-converter": "^0.0.6",
13569
- "@tscircuit/props": "^0.0.31",
13595
+ "@tscircuit/props": "^0.0.46",
13570
13596
  "@tscircuit/react-fiber": "^1.1.25",
13571
- "@tscircuit/soup": "^0.0.56",
13597
+ "@tscircuit/soup": "^0.0.58",
13572
13598
  "@tscircuit/soup-util": "^0.0.13",
13573
13599
  "@types/node": "18.7.23",
13574
13600
  "@types/react": "^18.3.3",