circuit-to-svg 0.0.430 → 0.0.431
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 +59 -35
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8017,7 +8017,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
8017
8017
|
var package_default = {
|
|
8018
8018
|
name: "circuit-to-svg",
|
|
8019
8019
|
type: "module",
|
|
8020
|
-
version: "0.0.
|
|
8020
|
+
version: "0.0.430",
|
|
8021
8021
|
repository: {
|
|
8022
8022
|
type: "git",
|
|
8023
8023
|
url: "https://github.com/tscircuit/circuit-to-svg.git"
|
|
@@ -8172,61 +8172,84 @@ function getTypePriority(type) {
|
|
|
8172
8172
|
return TYPE_PRIORITY[type] ?? DEFAULT_TYPE_PRIORITY;
|
|
8173
8173
|
}
|
|
8174
8174
|
|
|
8175
|
-
// lib/pcb/create-
|
|
8176
|
-
function
|
|
8175
|
+
// lib/pcb/create-soldermask-opening-masks.ts
|
|
8176
|
+
function createSoldermaskOpeningMasks({
|
|
8177
8177
|
objects,
|
|
8178
8178
|
layer,
|
|
8179
8179
|
width,
|
|
8180
|
-
height
|
|
8180
|
+
height,
|
|
8181
|
+
showSolderMask = false
|
|
8181
8182
|
}) {
|
|
8182
8183
|
const openings = objects.filter(
|
|
8183
8184
|
(object) => object.attributes["data-pcb-layer"] === layer && (object.attributes.class === "pcb-pad" || object.attributes.class === "pcb-pad-exposed" || object.attributes["data-type"] === "pcb_soldermask_opening")
|
|
8184
8185
|
);
|
|
8185
8186
|
if (openings.length === 0) return null;
|
|
8186
8187
|
const tenting = objects.filter((object) => object.attributes["data-type"] === "pcb_via").flatMap((object) => object.children).filter((object) => object.attributes.class === "pcb-via-tenting");
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8188
|
+
const pours = objects.filter(
|
|
8189
|
+
(object) => showSolderMask && object.attributes["data-pcb-layer"] === layer && (object.attributes["data-type"] === "pcb_copper_pour" || object.attributes.class === "pcb-soldermask-covered-pour")
|
|
8190
|
+
);
|
|
8191
|
+
const padOpenings = openings.filter(
|
|
8192
|
+
(object) => object.attributes.class === "pcb-pad" || object.attributes.class === "pcb-pad-exposed"
|
|
8193
|
+
);
|
|
8194
|
+
const masks = [];
|
|
8195
|
+
for (const { targets, cutouts, maskId } of [
|
|
8196
|
+
{
|
|
8197
|
+
targets: tenting,
|
|
8198
|
+
cutouts: openings,
|
|
8199
|
+
maskId: `via-tenting-mask-${layer}`
|
|
8200
|
+
},
|
|
8201
|
+
{
|
|
8202
|
+
targets: pours,
|
|
8203
|
+
cutouts: padOpenings,
|
|
8204
|
+
maskId: `copper-pour-pad-opening-mask-${layer}`
|
|
8205
|
+
}
|
|
8206
|
+
]) {
|
|
8207
|
+
if (targets.length === 0 || cutouts.length === 0) continue;
|
|
8208
|
+
for (const object of targets) {
|
|
8209
|
+
object.attributes.mask = `url(#${maskId})`;
|
|
8210
|
+
}
|
|
8211
|
+
masks.push(createOpeningMask(maskId, cutouts, width, height));
|
|
8191
8212
|
}
|
|
8213
|
+
if (masks.length === 0) return null;
|
|
8192
8214
|
return {
|
|
8193
8215
|
name: "defs",
|
|
8194
8216
|
type: "element",
|
|
8195
8217
|
value: "",
|
|
8196
8218
|
attributes: {},
|
|
8219
|
+
children: masks
|
|
8220
|
+
};
|
|
8221
|
+
}
|
|
8222
|
+
function createOpeningMask(maskId, openings, width, height) {
|
|
8223
|
+
return {
|
|
8224
|
+
name: "mask",
|
|
8225
|
+
type: "element",
|
|
8226
|
+
value: "",
|
|
8227
|
+
attributes: {
|
|
8228
|
+
id: maskId,
|
|
8229
|
+
maskUnits: "userSpaceOnUse",
|
|
8230
|
+
x: "0",
|
|
8231
|
+
y: "0",
|
|
8232
|
+
width: String(width),
|
|
8233
|
+
height: String(height)
|
|
8234
|
+
},
|
|
8197
8235
|
children: [
|
|
8198
8236
|
{
|
|
8199
|
-
name: "
|
|
8237
|
+
name: "rect",
|
|
8200
8238
|
type: "element",
|
|
8201
8239
|
value: "",
|
|
8202
8240
|
attributes: {
|
|
8203
|
-
id: maskId,
|
|
8204
|
-
maskUnits: "userSpaceOnUse",
|
|
8205
8241
|
x: "0",
|
|
8206
8242
|
y: "0",
|
|
8207
8243
|
width: String(width),
|
|
8208
|
-
height: String(height)
|
|
8244
|
+
height: String(height),
|
|
8245
|
+
fill: "white"
|
|
8209
8246
|
},
|
|
8210
|
-
children: [
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
x: "0",
|
|
8217
|
-
y: "0",
|
|
8218
|
-
width: String(width),
|
|
8219
|
-
height: String(height),
|
|
8220
|
-
fill: "white"
|
|
8221
|
-
},
|
|
8222
|
-
children: []
|
|
8223
|
-
},
|
|
8224
|
-
...openings.map((opening) => ({
|
|
8225
|
-
...opening,
|
|
8226
|
-
attributes: { ...opening.attributes, fill: "black" }
|
|
8227
|
-
}))
|
|
8228
|
-
]
|
|
8229
|
-
}
|
|
8247
|
+
children: []
|
|
8248
|
+
},
|
|
8249
|
+
...openings.map((opening) => ({
|
|
8250
|
+
...opening,
|
|
8251
|
+
attributes: { ...opening.attributes, fill: "black" }
|
|
8252
|
+
}))
|
|
8230
8253
|
]
|
|
8231
8254
|
};
|
|
8232
8255
|
}
|
|
@@ -9694,14 +9717,15 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
9694
9717
|
if (copperPourTraceMaskDefs) {
|
|
9695
9718
|
children.push(copperPourTraceMaskDefs);
|
|
9696
9719
|
}
|
|
9697
|
-
const
|
|
9720
|
+
const soldermaskOpeningMasks = createSoldermaskOpeningMasks({
|
|
9721
|
+
showSolderMask: ctx.showSolderMask,
|
|
9698
9722
|
objects: unsortedSvgObjects,
|
|
9699
9723
|
layer: layer ?? "top",
|
|
9700
9724
|
width: svgWidth,
|
|
9701
9725
|
height: svgHeight
|
|
9702
9726
|
});
|
|
9703
|
-
if (
|
|
9704
|
-
children.push(
|
|
9727
|
+
if (soldermaskOpeningMasks) {
|
|
9728
|
+
children.push(soldermaskOpeningMasks);
|
|
9705
9729
|
}
|
|
9706
9730
|
children.push({
|
|
9707
9731
|
name: "rect",
|