@tscircuit/pcb-viewer 1.11.270 → 1.11.271

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
@@ -7262,7 +7262,7 @@ var convertElementToPrimitives = (element, allElements) => {
7262
7262
  }
7263
7263
  case "pcb_smtpad": {
7264
7264
  if (element.shape === "rect" || element.shape === "rotated_rect") {
7265
- const { x, y, width, height, layer, rect_border_radius } = element;
7265
+ const { shape, x, y, width, height, layer, rect_border_radius } = element;
7266
7266
  const corner_radius = element.corner_radius ?? rect_border_radius ?? 0;
7267
7267
  const primitives = [
7268
7268
  {
@@ -7282,146 +7282,26 @@ var convertElementToPrimitives = (element, allElements) => {
7282
7282
  }
7283
7283
  ];
7284
7284
  if (element.is_covered_with_solder_mask) {
7285
- const rawMargin = element.soldermask_margin;
7286
7285
  const maskLayer = layer === "bottom" ? "soldermask_with_copper_bottom" : "soldermask_with_copper_top";
7287
- if (rawMargin === void 0 || rawMargin === null) {
7288
- const soldermask_margin2 = 0;
7289
- const openingWidth = Math.max(0.01, width + 2 * soldermask_margin2);
7290
- const openingHeight = Math.max(0.01, height + 2 * soldermask_margin2);
7291
- const openingPrimitive = {
7292
- _pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
7293
- pcb_drawing_type: "rect",
7294
- x,
7295
- y,
7296
- w: openingWidth,
7297
- h: openingHeight,
7298
- layer: maskLayer,
7299
- _element: element,
7300
- _parent_pcb_component,
7301
- _parent_source_component,
7302
- _source_port,
7303
- ccw_rotation: element.ccw_rotation,
7304
- roundness: corner_radius
7305
- };
7306
- if (element.solder_mask_color) {
7307
- openingPrimitive.color = element.solder_mask_color;
7308
- }
7309
- primitives.push(openingPrimitive);
7310
- const maskCoverageLayer = layer === "bottom" ? "soldermask_bottom" : "soldermask_top";
7311
- const fullMaskCoverage = {
7312
- _pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
7313
- pcb_drawing_type: "rect",
7314
- x,
7315
- y,
7316
- w: width,
7317
- h: height,
7318
- layer: maskCoverageLayer,
7319
- _element: element,
7320
- _parent_pcb_component,
7321
- _parent_source_component,
7322
- _source_port,
7323
- ccw_rotation: element.ccw_rotation,
7324
- roundness: corner_radius
7325
- };
7326
- primitives.push(fullMaskCoverage);
7327
- const cutoutOpening = {
7328
- _pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
7329
- pcb_drawing_type: "rect",
7330
- x,
7331
- y,
7332
- w: openingWidth,
7333
- h: openingHeight,
7334
- layer: maskCoverageLayer,
7335
- _element: element,
7336
- _parent_pcb_component,
7337
- _parent_source_component,
7338
- _source_port,
7339
- ccw_rotation: element.ccw_rotation,
7340
- roundness: corner_radius,
7341
- composite_mode: "destination-out"
7342
- };
7343
- primitives.push(cutoutOpening);
7344
- return primitives;
7345
- }
7346
- const soldermask_margin = rawMargin;
7347
- if (soldermask_margin === 0) {
7348
- return primitives;
7349
- }
7350
- if (soldermask_margin > 0) {
7351
- const marginRing = {
7352
- _pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
7353
- pcb_drawing_type: "rect",
7354
- x,
7355
- y,
7356
- w: width + 2 * soldermask_margin,
7357
- h: height + 2 * soldermask_margin,
7358
- layer: maskLayer,
7359
- _element: element,
7360
- _parent_pcb_component,
7361
- _parent_source_component,
7362
- _source_port,
7363
- ccw_rotation: element.ccw_rotation,
7364
- roundness: corner_radius,
7365
- color: "rgb(201, 162, 110)"
7366
- };
7367
- primitives.push(marginRing);
7368
- const cutout = {
7369
- _pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
7370
- pcb_drawing_type: "rect",
7371
- x,
7372
- y,
7373
- w: width,
7374
- h: height,
7375
- layer: maskLayer,
7376
- _element: element,
7377
- _parent_pcb_component,
7378
- _parent_source_component,
7379
- _source_port,
7380
- ccw_rotation: element.ccw_rotation,
7381
- roundness: corner_radius,
7382
- composite_mode: "destination-out"
7383
- };
7384
- primitives.push(cutout);
7385
- } else {
7386
- const openingWidth = Math.max(0.01, width + 2 * soldermask_margin);
7387
- const openingHeight = Math.max(0.01, height + 2 * soldermask_margin);
7388
- const innerRingBase = {
7389
- _pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
7390
- pcb_drawing_type: "rect",
7391
- x,
7392
- y,
7393
- w: width,
7394
- h: height,
7395
- layer: maskLayer,
7396
- _element: element,
7397
- _parent_pcb_component,
7398
- _parent_source_component,
7399
- _source_port,
7400
- ccw_rotation: element.ccw_rotation,
7401
- roundness: corner_radius
7402
- };
7403
- if (element.solder_mask_color) {
7404
- innerRingBase.color = element.solder_mask_color;
7405
- }
7406
- primitives.push(innerRingBase);
7407
- const innerCutout = {
7408
- _pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
7409
- pcb_drawing_type: "rect",
7410
- x,
7411
- y,
7412
- w: openingWidth,
7413
- h: openingHeight,
7414
- layer: maskLayer,
7415
- _element: element,
7416
- _parent_pcb_component,
7417
- _parent_source_component,
7418
- _source_port,
7419
- ccw_rotation: element.ccw_rotation,
7420
- roundness: corner_radius,
7421
- composite_mode: "destination-out"
7422
- };
7423
- primitives.push(innerCutout);
7286
+ const maskPrimitive = {
7287
+ _pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
7288
+ pcb_drawing_type: "rect",
7289
+ x,
7290
+ y,
7291
+ w: width,
7292
+ h: height,
7293
+ layer: maskLayer,
7294
+ _element: element,
7295
+ _parent_pcb_component,
7296
+ _parent_source_component,
7297
+ _source_port,
7298
+ ccw_rotation: element.ccw_rotation,
7299
+ roundness: corner_radius
7300
+ };
7301
+ if (element.solder_mask_color) {
7302
+ maskPrimitive.color = element.solder_mask_color;
7424
7303
  }
7304
+ primitives.push(maskPrimitive);
7425
7305
  }
7426
7306
  return primitives;
7427
7307
  } else if (element.shape === "circle") {
@@ -7441,123 +7321,23 @@ var convertElementToPrimitives = (element, allElements) => {
7441
7321
  }
7442
7322
  ];
7443
7323
  if (element.is_covered_with_solder_mask) {
7444
- const rawMargin = element.soldermask_margin;
7445
7324
  const maskLayer = layer === "bottom" ? "soldermask_with_copper_bottom" : "soldermask_with_copper_top";
7446
- if (rawMargin === void 0 || rawMargin === null) {
7447
- const soldermask_margin2 = 0;
7448
- const openingRadius = Math.max(0.01, radius + soldermask_margin2);
7449
- const openingPrimitive = {
7450
- _pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
7451
- pcb_drawing_type: "circle",
7452
- x,
7453
- y,
7454
- r: openingRadius,
7455
- layer: maskLayer,
7456
- _element: element,
7457
- _parent_pcb_component,
7458
- _parent_source_component,
7459
- _source_port
7460
- };
7461
- if (element.solder_mask_color) {
7462
- openingPrimitive.color = element.solder_mask_color;
7463
- }
7464
- primitives.push(openingPrimitive);
7465
- const maskCoverageLayer = layer === "bottom" ? "soldermask_bottom" : "soldermask_top";
7466
- const fullMaskCoverage = {
7467
- _pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
7468
- pcb_drawing_type: "circle",
7469
- x,
7470
- y,
7471
- r: radius,
7472
- layer: maskCoverageLayer,
7473
- _element: element,
7474
- _parent_pcb_component,
7475
- _parent_source_component,
7476
- _source_port
7477
- };
7478
- primitives.push(fullMaskCoverage);
7479
- const cutoutOpening = {
7480
- _pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
7481
- pcb_drawing_type: "circle",
7482
- x,
7483
- y,
7484
- r: openingRadius,
7485
- layer: maskCoverageLayer,
7486
- _element: element,
7487
- _parent_pcb_component,
7488
- _parent_source_component,
7489
- _source_port,
7490
- composite_mode: "destination-out"
7491
- };
7492
- primitives.push(cutoutOpening);
7493
- return primitives;
7494
- }
7495
- const soldermask_margin = rawMargin;
7496
- if (soldermask_margin === 0) {
7497
- return primitives;
7498
- }
7499
- if (soldermask_margin > 0) {
7500
- const marginRing = {
7501
- _pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
7502
- pcb_drawing_type: "circle",
7503
- x,
7504
- y,
7505
- r: radius + soldermask_margin,
7506
- layer: maskLayer,
7507
- _element: element,
7508
- _parent_pcb_component,
7509
- _parent_source_component,
7510
- _source_port,
7511
- color: "rgb(201, 162, 110)"
7512
- };
7513
- primitives.push(marginRing);
7514
- const cutout = {
7515
- _pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
7516
- pcb_drawing_type: "circle",
7517
- x,
7518
- y,
7519
- r: radius,
7520
- layer: maskLayer,
7521
- _element: element,
7522
- _parent_pcb_component,
7523
- _parent_source_component,
7524
- _source_port,
7525
- composite_mode: "destination-out"
7526
- };
7527
- primitives.push(cutout);
7528
- } else {
7529
- const openingRadius = Math.max(0.01, radius + soldermask_margin);
7530
- const innerRingBase = {
7531
- _pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
7532
- pcb_drawing_type: "circle",
7533
- x,
7534
- y,
7535
- r: radius,
7536
- layer: maskLayer,
7537
- _element: element,
7538
- _parent_pcb_component,
7539
- _parent_source_component,
7540
- _source_port
7541
- };
7542
- if (element.solder_mask_color) {
7543
- innerRingBase.color = element.solder_mask_color;
7544
- }
7545
- primitives.push(innerRingBase);
7546
- const innerCutout = {
7547
- _pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
7548
- pcb_drawing_type: "circle",
7549
- x,
7550
- y,
7551
- r: openingRadius,
7552
- layer: maskLayer,
7553
- _element: element,
7554
- _parent_pcb_component,
7555
- _parent_source_component,
7556
- _source_port,
7557
- composite_mode: "destination-out"
7558
- };
7559
- primitives.push(innerCutout);
7325
+ const maskPrimitive = {
7326
+ _pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
7327
+ pcb_drawing_type: "circle",
7328
+ x,
7329
+ y,
7330
+ r: radius,
7331
+ layer: maskLayer,
7332
+ _element: element,
7333
+ _parent_pcb_component,
7334
+ _parent_source_component,
7335
+ _source_port
7336
+ };
7337
+ if (element.solder_mask_color) {
7338
+ maskPrimitive.color = element.solder_mask_color;
7560
7339
  }
7340
+ primitives.push(maskPrimitive);
7561
7341
  }
7562
7342
  return primitives;
7563
7343
  } else if (element.shape === "polygon") {
@@ -7611,139 +7391,25 @@ var convertElementToPrimitives = (element, allElements) => {
7611
7391
  }
7612
7392
  ];
7613
7393
  if (element.is_covered_with_solder_mask) {
7614
- const rawMargin = element.soldermask_margin;
7615
7394
  const maskLayer = layer === "bottom" ? "soldermask_with_copper_bottom" : "soldermask_with_copper_top";
7616
- if (rawMargin === void 0 || rawMargin === null) {
7617
- const soldermask_margin2 = 0;
7618
- const openingWidth = Math.max(0.01, width + 2 * soldermask_margin2);
7619
- const openingHeight = Math.max(0.01, height + 2 * soldermask_margin2);
7620
- const openingPrimitive = {
7621
- _pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
7622
- pcb_drawing_type: "pill",
7623
- x,
7624
- y,
7625
- w: openingWidth,
7626
- h: openingHeight,
7627
- layer: maskLayer,
7628
- _element: element,
7629
- _parent_pcb_component,
7630
- _parent_source_component,
7631
- _source_port,
7632
- ccw_rotation: element.ccw_rotation
7633
- };
7634
- if (element.solder_mask_color) {
7635
- openingPrimitive.color = element.solder_mask_color;
7636
- }
7637
- primitives.push(openingPrimitive);
7638
- const maskCoverageLayer = layer === "bottom" ? "soldermask_bottom" : "soldermask_top";
7639
- const fullMaskCoverage = {
7640
- _pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
7641
- pcb_drawing_type: "pill",
7642
- x,
7643
- y,
7644
- w: width,
7645
- h: height,
7646
- layer: maskCoverageLayer,
7647
- _element: element,
7648
- _parent_pcb_component,
7649
- _parent_source_component,
7650
- _source_port,
7651
- ccw_rotation: element.ccw_rotation
7652
- };
7653
- primitives.push(fullMaskCoverage);
7654
- const cutoutOpening = {
7655
- _pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
7656
- pcb_drawing_type: "pill",
7657
- x,
7658
- y,
7659
- w: openingWidth,
7660
- h: openingHeight,
7661
- layer: maskCoverageLayer,
7662
- _element: element,
7663
- _parent_pcb_component,
7664
- _parent_source_component,
7665
- _source_port,
7666
- ccw_rotation: element.ccw_rotation,
7667
- composite_mode: "destination-out"
7668
- };
7669
- primitives.push(cutoutOpening);
7670
- return primitives;
7671
- }
7672
- const soldermask_margin = rawMargin;
7673
- if (soldermask_margin === 0) {
7674
- return primitives;
7675
- }
7676
- if (soldermask_margin > 0) {
7677
- const marginRing = {
7678
- _pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
7679
- pcb_drawing_type: "pill",
7680
- x,
7681
- y,
7682
- w: width + 2 * soldermask_margin,
7683
- h: height + 2 * soldermask_margin,
7684
- layer: maskLayer,
7685
- _element: element,
7686
- _parent_pcb_component,
7687
- _parent_source_component,
7688
- _source_port,
7689
- ccw_rotation: element.ccw_rotation,
7690
- color: "rgb(201, 162, 110)"
7691
- };
7692
- primitives.push(marginRing);
7693
- const cutout = {
7694
- _pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
7695
- pcb_drawing_type: "pill",
7696
- x,
7697
- y,
7698
- w: width,
7699
- h: height,
7700
- layer: maskLayer,
7701
- _element: element,
7702
- _parent_pcb_component,
7703
- _parent_source_component,
7704
- _source_port,
7705
- ccw_rotation: element.ccw_rotation,
7706
- composite_mode: "destination-out"
7707
- };
7708
- primitives.push(cutout);
7709
- } else {
7710
- const openingWidth = Math.max(0.01, width + 2 * soldermask_margin);
7711
- const openingHeight = Math.max(0.01, height + 2 * soldermask_margin);
7712
- const innerRingBase = {
7713
- _pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
7714
- pcb_drawing_type: "pill",
7715
- x,
7716
- y,
7717
- w: width,
7718
- h: height,
7719
- layer: maskLayer,
7720
- _element: element,
7721
- _parent_pcb_component,
7722
- _parent_source_component,
7723
- _source_port,
7724
- ccw_rotation: element.ccw_rotation
7725
- };
7726
- if (element.solder_mask_color) {
7727
- innerRingBase.color = element.solder_mask_color;
7728
- }
7729
- primitives.push(innerRingBase);
7730
- const innerCutout = {
7731
- _pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
7732
- pcb_drawing_type: "pill",
7733
- x,
7734
- y,
7735
- w: openingWidth,
7736
- h: openingHeight,
7737
- layer: maskLayer,
7738
- _element: element,
7739
- _parent_pcb_component,
7740
- _parent_source_component,
7741
- _source_port,
7742
- ccw_rotation: element.ccw_rotation,
7743
- composite_mode: "destination-out"
7744
- };
7745
- primitives.push(innerCutout);
7395
+ const maskPrimitive = {
7396
+ _pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
7397
+ pcb_drawing_type: "pill",
7398
+ x,
7399
+ y,
7400
+ w: width,
7401
+ h: height,
7402
+ layer: maskLayer,
7403
+ _element: element,
7404
+ _parent_pcb_component,
7405
+ _parent_source_component,
7406
+ _source_port,
7407
+ ccw_rotation: element.ccw_rotation
7408
+ };
7409
+ if (element.solder_mask_color) {
7410
+ maskPrimitive.color = element.solder_mask_color;
7746
7411
  }
7412
+ primitives.push(maskPrimitive);
7747
7413
  }
7748
7414
  return primitives;
7749
7415
  }
@@ -9252,7 +8918,6 @@ var Drawer = class {
9252
8918
  transform;
9253
8919
  foregroundLayer = "top";
9254
8920
  lastPoint;
9255
- _tempCompositeMode;
9256
8921
  constructor(canvasLayerMap) {
9257
8922
  this.canvasLayerMap = canvasLayerMap;
9258
8923
  this.ctxLayerMap = Object.fromEntries(
@@ -9593,9 +9258,6 @@ var Drawer = class {
9593
9258
  ctx.fillStyle = "rgba(0,0,0,1)";
9594
9259
  ctx.strokeStyle = "rgba(0,0,0,1)";
9595
9260
  }
9596
- if (this._tempCompositeMode) {
9597
- ctx.globalCompositeOperation = this._tempCompositeMode;
9598
- }
9599
9261
  ctx.font = `${scaleOnly(inverse(transform), fontSize)}px sans-serif`;
9600
9262
  }
9601
9263
  moveTo(x, y) {
@@ -9885,9 +9547,6 @@ var drawRect = (drawer, rect) => {
9885
9547
  layer: rect.layer,
9886
9548
  size: rect.stroke_width
9887
9549
  });
9888
- if (rect.composite_mode) {
9889
- drawer._tempCompositeMode = rect.composite_mode;
9890
- }
9891
9550
  drawer.rect({
9892
9551
  x: rect.x,
9893
9552
  y: rect.y,
@@ -9900,18 +9559,12 @@ var drawRect = (drawer, rect) => {
9900
9559
  stroke_width: rect.stroke_width,
9901
9560
  roundness: rect.roundness
9902
9561
  });
9903
- if (rect.composite_mode) {
9904
- drawer._tempCompositeMode = void 0;
9905
- }
9906
9562
  };
9907
9563
  var drawRotatedRect = (drawer, rect) => {
9908
9564
  drawer.equip({
9909
9565
  color: getColor(rect),
9910
9566
  layer: rect.layer
9911
9567
  });
9912
- if (rect.composite_mode) {
9913
- drawer._tempCompositeMode = rect.composite_mode;
9914
- }
9915
9568
  drawer.rotatedRect(
9916
9569
  rect.x,
9917
9570
  rect.y,
@@ -9921,35 +9574,20 @@ var drawRotatedRect = (drawer, rect) => {
9921
9574
  rect.roundness,
9922
9575
  rect.mesh_fill
9923
9576
  );
9924
- if (rect.composite_mode) {
9925
- drawer._tempCompositeMode = void 0;
9926
- }
9927
9577
  };
9928
9578
  var drawRotatedPill = (drawer, pill) => {
9929
9579
  drawer.equip({
9930
9580
  color: getColor(pill),
9931
9581
  layer: pill.layer
9932
9582
  });
9933
- if (pill.composite_mode) {
9934
- drawer._tempCompositeMode = pill.composite_mode;
9935
- }
9936
9583
  drawer.rotatedPill(pill.x, pill.y, pill.w, pill.h, pill.ccw_rotation);
9937
- if (pill.composite_mode) {
9938
- drawer._tempCompositeMode = void 0;
9939
- }
9940
9584
  };
9941
9585
  var drawCircle = (drawer, circle) => {
9942
9586
  drawer.equip({
9943
9587
  color: getColor(circle),
9944
9588
  layer: circle.layer
9945
9589
  });
9946
- if (circle.composite_mode) {
9947
- drawer._tempCompositeMode = circle.composite_mode;
9948
- }
9949
9590
  drawer.circle(circle.x, circle.y, circle.r, circle.mesh_fill);
9950
- if (circle.composite_mode) {
9951
- drawer._tempCompositeMode = void 0;
9952
- }
9953
9591
  };
9954
9592
  var drawOval = (drawer, oval) => {
9955
9593
  drawer.equip({
@@ -9963,13 +9601,7 @@ var drawPill = (drawer, pill) => {
9963
9601
  color: getColor(pill),
9964
9602
  layer: pill.layer
9965
9603
  });
9966
- if (pill.composite_mode) {
9967
- drawer._tempCompositeMode = pill.composite_mode;
9968
- }
9969
9604
  drawer.pill(pill.x, pill.y, pill.w, pill.h);
9970
- if (pill.composite_mode) {
9971
- drawer._tempCompositeMode = void 0;
9972
- }
9973
9605
  };
9974
9606
  var drawPolygon = (drawer, polygon) => {
9975
9607
  drawer.equip({
@@ -13629,7 +13261,7 @@ import { css as css3 } from "@emotion/css";
13629
13261
  // package.json
13630
13262
  var package_default = {
13631
13263
  name: "@tscircuit/pcb-viewer",
13632
- version: "1.11.269",
13264
+ version: "1.11.270",
13633
13265
  main: "dist/index.js",
13634
13266
  type: "module",
13635
13267
  repository: "tscircuit/pcb-viewer",
@@ -13682,7 +13314,7 @@ var package_default = {
13682
13314
  "@tscircuit/alphabet": "^0.0.3",
13683
13315
  "@tscircuit/math-utils": "^0.0.29",
13684
13316
  "@vitejs/plugin-react": "^5.0.2",
13685
- "circuit-json": "^0.0.325",
13317
+ "circuit-json": "^0.0.321",
13686
13318
  "circuit-to-svg": "^0.0.271",
13687
13319
  color: "^4.2.3",
13688
13320
  "react-supergrid": "^1.0.10",