@tscircuit/core 0.0.431 → 0.0.433

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.
Files changed (2) hide show
  1. package/dist/index.js +28 -15
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -2291,7 +2291,8 @@ var SilkscreenText = class extends PrimitiveComponent2 {
2291
2291
  var createPinrowSilkscreenText = ({
2292
2292
  elm,
2293
2293
  pinLabels,
2294
- readableRotation
2294
+ readableRotation,
2295
+ anchorAlignment
2295
2296
  }) => {
2296
2297
  const pinNum = elm.text.replace(/[{}]/g, "").toLowerCase();
2297
2298
  let label = pinNum;
@@ -2302,7 +2303,7 @@ var createPinrowSilkscreenText = ({
2302
2303
  label = pinLabels[pinNum]?.[0] ?? pinNum;
2303
2304
  }
2304
2305
  return new SilkscreenText({
2305
- anchorAlignment: "center",
2306
+ anchorAlignment: anchorAlignment || "center",
2306
2307
  text: label ?? pinNum,
2307
2308
  fontSize: elm.font_size + 0.2,
2308
2309
  pcbX: isNaN(elm.anchor_position.x) ? 0 : elm.anchor_position.x,
@@ -2312,6 +2313,13 @@ var createPinrowSilkscreenText = ({
2312
2313
  };
2313
2314
 
2314
2315
  // lib/utils/createComponentsFromCircuitJson.ts
2316
+ var calculateCcwRotation = (componentRotationStr, elementCcwRotation) => {
2317
+ const componentAngle = parseInt(componentRotationStr || "0", 10);
2318
+ const baseRotation = -componentAngle;
2319
+ const totalRotation = baseRotation + (elementCcwRotation ?? 0);
2320
+ const normalizedRotation = (totalRotation % 360 + 360) % 360;
2321
+ return normalizedRotation;
2322
+ };
2315
2323
  var createComponentsFromCircuitJson = ({
2316
2324
  componentName,
2317
2325
  componentRotation,
@@ -2404,23 +2412,28 @@ var createComponentsFromCircuitJson = ({
2404
2412
  })
2405
2413
  );
2406
2414
  } else if (elm.type === "pcb_silkscreen_text") {
2407
- let readableRotation = componentRotation ? parseInt(componentRotation) : 0;
2408
- const normalizedRotation = (readableRotation % 360 + 360) % 360;
2409
- const isUpsideDown = normalizedRotation > 90 && normalizedRotation <= 270;
2410
- readableRotation = isUpsideDown ? (normalizedRotation + 180) % 360 : normalizedRotation;
2411
- if (footprint.includes("pinrow") && elm.text.includes("PIN") && pinLabels) {
2415
+ const ccwRotation = calculateCcwRotation(
2416
+ componentRotation,
2417
+ elm.ccw_rotation
2418
+ );
2419
+ if (footprint.includes("pinrow") && elm.text.includes("PIN")) {
2412
2420
  components.push(
2413
- createPinrowSilkscreenText({ elm, pinLabels, readableRotation })
2421
+ createPinrowSilkscreenText({
2422
+ elm,
2423
+ pinLabels,
2424
+ readableRotation: ccwRotation,
2425
+ anchorAlignment: elm.anchor_alignment
2426
+ })
2414
2427
  );
2415
- } else if (elm.text === "{REF}") {
2428
+ } else {
2416
2429
  components.push(
2417
2430
  new SilkscreenText({
2418
- anchorAlignment: "center",
2431
+ anchorAlignment: elm.anchor_alignment || "center",
2419
2432
  text: componentName,
2420
2433
  fontSize: elm.font_size + 0.2,
2421
2434
  pcbX: isNaN(elm.anchor_position.x) ? 0 : elm.anchor_position.x,
2422
2435
  pcbY: elm.anchor_position.y,
2423
- pcbRotation: readableRotation ?? 0
2436
+ pcbRotation: ccwRotation ?? 0
2424
2437
  })
2425
2438
  );
2426
2439
  }
@@ -8692,7 +8705,7 @@ import { identity as identity4 } from "transformation-matrix";
8692
8705
  var package_default = {
8693
8706
  name: "@tscircuit/core",
8694
8707
  type: "module",
8695
- version: "0.0.430",
8708
+ version: "0.0.432",
8696
8709
  types: "dist/index.d.ts",
8697
8710
  main: "dist/index.js",
8698
8711
  module: "dist/index.js",
@@ -8718,7 +8731,7 @@ var package_default = {
8718
8731
  "@tscircuit/capacity-autorouter": "^0.0.67",
8719
8732
  "@tscircuit/checks": "^0.0.46",
8720
8733
  "@tscircuit/circuit-json-util": "^0.0.47",
8721
- "@tscircuit/footprinter": "^0.0.169",
8734
+ "@tscircuit/footprinter": "^0.0.171",
8722
8735
  "@tscircuit/import-snippet": "^0.0.4",
8723
8736
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
8724
8737
  "@tscircuit/layout": "^0.0.28",
@@ -8726,6 +8739,7 @@ var package_default = {
8726
8739
  "@tscircuit/math-utils": "^0.0.18",
8727
8740
  "@tscircuit/props": "^0.0.195",
8728
8741
  "@tscircuit/schematic-autolayout": "^0.0.6",
8742
+ "@tscircuit/simple-3d-svg": "^0.0.6",
8729
8743
  "@types/bun": "latest",
8730
8744
  "@types/debug": "^4.1.12",
8731
8745
  "@types/react": "^19.0.1",
@@ -8736,14 +8750,13 @@ var package_default = {
8736
8750
  "circuit-json": "^0.0.190",
8737
8751
  "circuit-json-to-connectivity-map": "^0.0.22",
8738
8752
  "circuit-json-to-simple-3d": "^0.0.2",
8739
- "circuit-to-svg": "^0.0.132",
8753
+ "circuit-to-svg": "^0.0.136",
8740
8754
  concurrently: "^9.1.2",
8741
8755
  debug: "^4.3.6",
8742
8756
  "graphics-debug": "^0.0.4",
8743
8757
  howfat: "^0.3.8",
8744
8758
  "live-server": "^1.2.2",
8745
8759
  "looks-same": "^9.0.1",
8746
- "@tscircuit/simple-3d-svg": "^0.0.6",
8747
8760
  "pkg-pr-new": "^0.0.37",
8748
8761
  react: "^19.0.0",
8749
8762
  "react-dom": "^19.0.0",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.431",
4
+ "version": "0.0.433",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -27,7 +27,7 @@
27
27
  "@tscircuit/capacity-autorouter": "^0.0.67",
28
28
  "@tscircuit/checks": "^0.0.46",
29
29
  "@tscircuit/circuit-json-util": "^0.0.47",
30
- "@tscircuit/footprinter": "^0.0.169",
30
+ "@tscircuit/footprinter": "^0.0.171",
31
31
  "@tscircuit/import-snippet": "^0.0.4",
32
32
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
33
33
  "@tscircuit/layout": "^0.0.28",
@@ -35,6 +35,7 @@
35
35
  "@tscircuit/math-utils": "^0.0.18",
36
36
  "@tscircuit/props": "^0.0.195",
37
37
  "@tscircuit/schematic-autolayout": "^0.0.6",
38
+ "@tscircuit/simple-3d-svg": "^0.0.6",
38
39
  "@types/bun": "latest",
39
40
  "@types/debug": "^4.1.12",
40
41
  "@types/react": "^19.0.1",
@@ -45,14 +46,13 @@
45
46
  "circuit-json": "^0.0.190",
46
47
  "circuit-json-to-connectivity-map": "^0.0.22",
47
48
  "circuit-json-to-simple-3d": "^0.0.2",
48
- "circuit-to-svg": "^0.0.132",
49
+ "circuit-to-svg": "^0.0.136",
49
50
  "concurrently": "^9.1.2",
50
51
  "debug": "^4.3.6",
51
52
  "graphics-debug": "^0.0.4",
52
53
  "howfat": "^0.3.8",
53
54
  "live-server": "^1.2.2",
54
55
  "looks-same": "^9.0.1",
55
- "@tscircuit/simple-3d-svg": "^0.0.6",
56
56
  "pkg-pr-new": "^0.0.37",
57
57
  "react": "^19.0.0",
58
58
  "react-dom": "^19.0.0",