circuit-to-svg 0.0.246 → 0.0.248

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
@@ -2490,7 +2490,7 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
2490
2490
  attributes: {
2491
2491
  class: "pcb-panel",
2492
2492
  d: path,
2493
- fill: shouldRenderSolderMask ? colorMap2.soldermask.top : "none",
2493
+ fill: "none",
2494
2494
  stroke: colorMap2.boardOutline,
2495
2495
  "stroke-width": (0.1 * Math.abs(transform.a)).toString(),
2496
2496
  "data-type": "pcb_panel",
@@ -3204,6 +3204,43 @@ var DEFAULT_STROKE_WIDTH = 0.1;
3204
3204
  function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
3205
3205
  const { transform } = ctx;
3206
3206
  const { center, width, height } = pcbGroup;
3207
+ const outline = Array.isArray(pcbGroup.outline) ? pcbGroup.outline : void 0;
3208
+ const transformedStrokeWidth = DEFAULT_STROKE_WIDTH * Math.abs(transform.a);
3209
+ const dashLength = 0.3 * Math.abs(transform.a);
3210
+ const gapLength = 0.15 * Math.abs(transform.a);
3211
+ const baseAttributes = {
3212
+ class: "pcb-group",
3213
+ fill: "none",
3214
+ stroke: DEFAULT_GROUP_COLOR,
3215
+ "stroke-width": transformedStrokeWidth.toString(),
3216
+ "stroke-dasharray": `${dashLength} ${gapLength}`,
3217
+ "data-type": "pcb_group",
3218
+ "data-pcb-group-id": pcbGroup.pcb_group_id,
3219
+ "data-pcb-layer": "overlay"
3220
+ };
3221
+ if (pcbGroup.name) {
3222
+ baseAttributes["data-group-name"] = pcbGroup.name;
3223
+ }
3224
+ if (outline && outline.length >= 3 && outline.every(
3225
+ (point) => point && typeof point.x === "number" && typeof point.y === "number"
3226
+ )) {
3227
+ const path = outline.map((point, index) => {
3228
+ const [x, y] = applyToPoint29(transform, [point.x, point.y]);
3229
+ return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
3230
+ }).join(" ");
3231
+ return [
3232
+ {
3233
+ name: "path",
3234
+ type: "element",
3235
+ value: "",
3236
+ children: [],
3237
+ attributes: {
3238
+ ...baseAttributes,
3239
+ d: `${path} Z`
3240
+ }
3241
+ }
3242
+ ];
3243
+ }
3207
3244
  if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
3208
3245
  console.error("Invalid pcb_group data", { center, width, height });
3209
3246
  return [];
@@ -3222,31 +3259,17 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
3222
3259
  const rectY = Math.min(topLeftY, bottomRightY);
3223
3260
  const rectWidth = Math.abs(bottomRightX - topLeftX);
3224
3261
  const rectHeight = Math.abs(bottomRightY - topLeftY);
3225
- const transformedStrokeWidth = DEFAULT_STROKE_WIDTH * Math.abs(transform.a);
3226
- const dashLength = 0.3 * Math.abs(transform.a);
3227
- const gapLength = 0.15 * Math.abs(transform.a);
3228
- const attributes = {
3229
- x: rectX.toString(),
3230
- y: rectY.toString(),
3231
- width: rectWidth.toString(),
3232
- height: rectHeight.toString(),
3233
- class: "pcb-group",
3234
- fill: "none",
3235
- stroke: DEFAULT_GROUP_COLOR,
3236
- "stroke-width": transformedStrokeWidth.toString(),
3237
- "stroke-dasharray": `${dashLength} ${gapLength}`,
3238
- "data-type": "pcb_group",
3239
- "data-pcb-group-id": pcbGroup.pcb_group_id,
3240
- "data-pcb-layer": "overlay"
3241
- };
3242
- if (pcbGroup.name) {
3243
- attributes["data-group-name"] = pcbGroup.name;
3244
- }
3245
3262
  const svgObject = {
3246
3263
  name: "rect",
3247
3264
  type: "element",
3248
3265
  value: "",
3249
- attributes,
3266
+ attributes: {
3267
+ ...baseAttributes,
3268
+ x: rectX.toString(),
3269
+ y: rectY.toString(),
3270
+ width: rectWidth.toString(),
3271
+ height: rectHeight.toString()
3272
+ },
3250
3273
  children: []
3251
3274
  };
3252
3275
  return [svgObject];
@@ -3264,7 +3287,7 @@ function getSoftwareUsedString(circuitJson) {
3264
3287
  var package_default = {
3265
3288
  name: "circuit-to-svg",
3266
3289
  type: "module",
3267
- version: "0.0.245",
3290
+ version: "0.0.247",
3268
3291
  description: "Convert Circuit JSON to SVG",
3269
3292
  main: "dist/index.js",
3270
3293
  files: [