circuit-to-svg 0.0.417 → 0.0.418

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
@@ -4688,8 +4688,43 @@ function normalize3(x, y) {
4688
4688
 
4689
4689
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
4690
4690
  import { applyToPoint as applyToPoint29 } from "transformation-matrix";
4691
+
4692
+ // lib/pcb/svg-object-fns/create-soldermask-overlay-element.ts
4693
+ function createSoldermaskOverlayElement({
4694
+ elementType,
4695
+ shapeAttributes,
4696
+ layer,
4697
+ fillColor,
4698
+ fillOpacity,
4699
+ className,
4700
+ additionalAttributes
4701
+ }) {
4702
+ const baseAttributes = {
4703
+ class: className,
4704
+ fill: fillColor,
4705
+ "fill-opacity": fillOpacity,
4706
+ "data-type": "pcb_soldermask",
4707
+ "data-pcb-layer": layer,
4708
+ ...shapeAttributes,
4709
+ ...additionalAttributes
4710
+ };
4711
+ return {
4712
+ name: elementType,
4713
+ type: "element",
4714
+ value: "",
4715
+ children: [],
4716
+ attributes: baseAttributes
4717
+ };
4718
+ }
4719
+
4720
+ // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
4691
4721
  function createSvgObjectsFromPcbVia(hole, ctx) {
4692
4722
  const { transform, colorMap: colorMap2 } = ctx;
4723
+ const layer = ctx.layer ?? "top";
4724
+ const showSolderMask = ctx.showSolderMask && (layer === "top" || layer === "bottom");
4725
+ if (showSolderMask && !hole.layers.includes(layer)) return [];
4726
+ const tenting = hole;
4727
+ const isTented = (layer === "top" ? tenting.tented_on_top : tenting.tented_on_bottom) ?? tenting.is_tented;
4693
4728
  const [x, y] = applyToPoint29(transform, [hole.x, hole.y]);
4694
4729
  const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
4695
4730
  const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
@@ -4697,9 +4732,10 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
4697
4732
  const scaledHoleHeight = hole.hole_diameter * Math.abs(transform.a);
4698
4733
  const outerRadius = Math.min(scaledOuterWidth, scaledOuterHeight) / 2;
4699
4734
  const innerRadius = Math.min(scaledHoleWidth, scaledHoleHeight) / 2;
4700
- return {
4735
+ const via = {
4701
4736
  name: "g",
4702
4737
  type: "element",
4738
+ value: "",
4703
4739
  attributes: {
4704
4740
  "data-type": "pcb_via",
4705
4741
  "data-pcb-layer": "through"
@@ -4708,19 +4744,23 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
4708
4744
  {
4709
4745
  name: "circle",
4710
4746
  type: "element",
4747
+ value: "",
4748
+ children: [],
4711
4749
  attributes: {
4712
4750
  class: "pcb-hole-outer",
4713
- fill: colorMap2.copper.top,
4751
+ fill: colorMap2.copper[showSolderMask ? layer : "top"],
4714
4752
  cx: x.toString(),
4715
4753
  cy: y.toString(),
4716
4754
  r: outerRadius.toString(),
4717
4755
  "data-type": "pcb_via",
4718
- "data-pcb-layer": "top"
4756
+ "data-pcb-layer": showSolderMask ? layer : "top"
4719
4757
  }
4720
4758
  },
4721
4759
  {
4722
4760
  name: "circle",
4723
4761
  type: "element",
4762
+ value: "",
4763
+ children: [],
4724
4764
  attributes: {
4725
4765
  class: "pcb-hole-inner",
4726
4766
  fill: colorMap2.drill,
@@ -4733,6 +4773,23 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
4733
4773
  }
4734
4774
  ]
4735
4775
  };
4776
+ if (showSolderMask && isTented) {
4777
+ via.children.push(
4778
+ createSoldermaskOverlayElement({
4779
+ elementType: "circle",
4780
+ shapeAttributes: {
4781
+ cx: x.toString(),
4782
+ cy: y.toString(),
4783
+ r: outerRadius.toString()
4784
+ },
4785
+ layer,
4786
+ fillColor: colorMap2.soldermaskWithCopperUnderneath[layer],
4787
+ fillOpacity: "1",
4788
+ className: "pcb-via-tenting"
4789
+ })
4790
+ );
4791
+ }
4792
+ return [via];
4736
4793
  }
4737
4794
 
4738
4795
  // lib/pcb/svg-object-fns/get-copper-pour-shape.ts
@@ -5060,7 +5117,7 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
5060
5117
  if (!point || point.route_type !== "via") continue;
5061
5118
  if (standaloneViaPositionKeys.has(getPositionKey(point))) continue;
5062
5119
  svgObjects.push(
5063
- createSvgObjectsFromPcbVia(
5120
+ ...createSvgObjectsFromPcbVia(
5064
5121
  createSyntheticViaFromRoutePoint(trace, point, index, ctx),
5065
5122
  ctx
5066
5123
  )
@@ -7237,34 +7294,6 @@ function createSoldermaskCutoutElement({
7237
7294
  };
7238
7295
  }
7239
7296
 
7240
- // lib/pcb/svg-object-fns/create-soldermask-overlay-element.ts
7241
- function createSoldermaskOverlayElement({
7242
- elementType,
7243
- shapeAttributes,
7244
- layer,
7245
- fillColor,
7246
- fillOpacity,
7247
- className,
7248
- additionalAttributes
7249
- }) {
7250
- const baseAttributes = {
7251
- class: className,
7252
- fill: fillColor,
7253
- "fill-opacity": fillOpacity,
7254
- "data-type": "pcb_soldermask",
7255
- "data-pcb-layer": layer,
7256
- ...shapeAttributes,
7257
- ...additionalAttributes
7258
- };
7259
- return {
7260
- name: elementType,
7261
- type: "element",
7262
- value: "",
7263
- children: [],
7264
- attributes: baseAttributes
7265
- };
7266
- }
7267
-
7268
7297
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
7269
7298
  function createSvgObjectsFromPcbCopperPour(pour, ctx) {
7270
7299
  const { transform, layer: layerFilter, colorMap: colorMap2, showSolderMask } = ctx;
@@ -7806,7 +7835,7 @@ function getSoftwareUsedString(circuitJson) {
7806
7835
  var package_default = {
7807
7836
  name: "circuit-to-svg",
7808
7837
  type: "module",
7809
- version: "0.0.416",
7838
+ version: "0.0.417",
7810
7839
  repository: {
7811
7840
  type: "git",
7812
7841
  url: "https://github.com/tscircuit/circuit-to-svg.git"
@@ -7836,7 +7865,7 @@ var package_default = {
7836
7865
  "@vitejs/plugin-react": "5.0.0",
7837
7866
  biome: "^0.3.3",
7838
7867
  "bun-match-svg": "^0.0.12",
7839
- "circuit-json": "^0.0.486",
7868
+ "circuit-json": "^0.0.487",
7840
7869
  esbuild: "^0.20.2",
7841
7870
  "format-si-unit": "^0.0.12",
7842
7871
  "performance-now": "^2.1.0",