@tscircuit/core 0.0.1111 → 0.0.1113

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 (3) hide show
  1. package/dist/index.d.ts +9827 -929
  2. package/dist/index.js +42 -26
  3. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -5458,6 +5458,7 @@ var CourtyardOutline = class extends PrimitiveComponent2 {
5458
5458
  };
5459
5459
 
5460
5460
  // lib/components/primitive-components/CourtyardRect.ts
5461
+ import { decomposeTSR } from "transformation-matrix";
5461
5462
  import { courtyardRectProps } from "@tscircuit/props";
5462
5463
  var CourtyardRect = class extends PrimitiveComponent2 {
5463
5464
  pcb_courtyard_rect_id = null;
@@ -5482,6 +5483,10 @@ var CourtyardRect = class extends PrimitiveComponent2 {
5482
5483
  }
5483
5484
  const subcircuit = this.getSubcircuit();
5484
5485
  const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
5486
+ const decomposedTransform = decomposeTSR(
5487
+ this._computePcbGlobalTransformBeforeLayout()
5488
+ );
5489
+ const ccw_rotation = decomposedTransform.rotation.angle * 180 / Math.PI;
5485
5490
  const pcb_courtyard_rect = db.pcb_courtyard_rect.insert({
5486
5491
  pcb_component_id,
5487
5492
  layer,
@@ -5491,6 +5496,7 @@ var CourtyardRect = class extends PrimitiveComponent2 {
5491
5496
  },
5492
5497
  width: props.width,
5493
5498
  height: props.height,
5499
+ ccw_rotation: ccw_rotation || void 0,
5494
5500
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
5495
5501
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
5496
5502
  });
@@ -6148,7 +6154,7 @@ var Hole = class extends PrimitiveComponent2 {
6148
6154
 
6149
6155
  // lib/components/primitive-components/Keepout.ts
6150
6156
  import { pcbKeepoutProps } from "@tscircuit/props";
6151
- import { decomposeTSR } from "transformation-matrix";
6157
+ import { decomposeTSR as decomposeTSR2 } from "transformation-matrix";
6152
6158
  var Keepout = class extends PrimitiveComponent2 {
6153
6159
  pcb_keepout_id = null;
6154
6160
  isPcbPrimitive = true;
@@ -6164,7 +6170,7 @@ var Keepout = class extends PrimitiveComponent2 {
6164
6170
  const { db } = this.root;
6165
6171
  const { _parsedProps: props } = this;
6166
6172
  const position = this._getGlobalPcbPositionBeforeLayout();
6167
- const decomposedMat = decomposeTSR(
6173
+ const decomposedMat = decomposeTSR2(
6168
6174
  this._computePcbGlobalTransformBeforeLayout()
6169
6175
  );
6170
6176
  const isRotated90 = Math.abs(decomposedMat.rotation.angle * (180 / Math.PI) - 90) % 180 < 0.01;
@@ -6548,7 +6554,7 @@ var PcbTrace = class extends PrimitiveComponent2 {
6548
6554
  // lib/components/primitive-components/PlatedHole.ts
6549
6555
  import { platedHoleProps } from "@tscircuit/props";
6550
6556
  import "circuit-json";
6551
- import { decomposeTSR as decomposeTSR2 } from "transformation-matrix";
6557
+ import { decomposeTSR as decomposeTSR3 } from "transformation-matrix";
6552
6558
  var PlatedHole = class extends PrimitiveComponent2 {
6553
6559
  pcb_plated_hole_id = null;
6554
6560
  matchedPort = null;
@@ -6647,7 +6653,7 @@ var PlatedHole = class extends PrimitiveComponent2 {
6647
6653
  const soldermaskMargin = props.solderMaskMargin;
6648
6654
  const isCoveredWithSolderMask = props.coveredWithSolderMask ?? false;
6649
6655
  this.emitSolderMaskMarginWarning(isCoveredWithSolderMask, soldermaskMargin);
6650
- const decomposedTransform = decomposeTSR2(
6656
+ const decomposedTransform = decomposeTSR3(
6651
6657
  this._computePcbGlobalTransformBeforeLayout()
6652
6658
  );
6653
6659
  const rotationDegrees = decomposedTransform.rotation.angle * 180 / Math.PI;
@@ -7101,7 +7107,7 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
7101
7107
 
7102
7108
  // lib/components/primitive-components/SilkscreenRect.ts
7103
7109
  import { silkscreenRectProps } from "@tscircuit/props";
7104
- import { decomposeTSR as decomposeTSR3 } from "transformation-matrix";
7110
+ import { decomposeTSR as decomposeTSR4 } from "transformation-matrix";
7105
7111
  var SilkscreenRect = class extends PrimitiveComponent2 {
7106
7112
  pcb_silkscreen_rect_id = null;
7107
7113
  isPcbPrimitive = true;
@@ -7117,7 +7123,7 @@ var SilkscreenRect = class extends PrimitiveComponent2 {
7117
7123
  */
7118
7124
  _isRotated90Degrees() {
7119
7125
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
7120
- const decomposedTransform = decomposeTSR3(globalTransform);
7126
+ const decomposedTransform = decomposeTSR4(globalTransform);
7121
7127
  const rotationDegrees = decomposedTransform.rotation.angle * 180 / Math.PI;
7122
7128
  const normalizedRotationDegrees = (rotationDegrees % 360 + 360) % 360;
7123
7129
  const rotationTolerance = 0.01;
@@ -7189,7 +7195,7 @@ import { silkscreenTextProps } from "@tscircuit/props";
7189
7195
  import {
7190
7196
  applyToPoint as applyToPoint14,
7191
7197
  compose as compose3,
7192
- decomposeTSR as decomposeTSR4,
7198
+ decomposeTSR as decomposeTSR5,
7193
7199
  flipY as flipY2,
7194
7200
  identity as identity4
7195
7201
  } from "transformation-matrix";
@@ -7215,7 +7221,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
7215
7221
  rotation4 = props.pcbRotation;
7216
7222
  } else {
7217
7223
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
7218
- const decomposedTransform = decomposeTSR4(globalTransform);
7224
+ const decomposedTransform = decomposeTSR5(globalTransform);
7219
7225
  rotation4 = decomposedTransform.rotation.angle * 180 / Math.PI;
7220
7226
  }
7221
7227
  if (isFlipped) {
@@ -7330,7 +7336,7 @@ import { smtPadProps } from "@tscircuit/props";
7330
7336
  import {
7331
7337
  distance as distance5
7332
7338
  } from "circuit-json";
7333
- import { applyToPoint as applyToPoint15, decomposeTSR as decomposeTSR5 } from "transformation-matrix";
7339
+ import { applyToPoint as applyToPoint15, decomposeTSR as decomposeTSR6 } from "transformation-matrix";
7334
7340
  var SmtPad = class extends PrimitiveComponent2 {
7335
7341
  pcb_smtpad_id = null;
7336
7342
  matchedPort = null;
@@ -7401,7 +7407,7 @@ var SmtPad = class extends PrimitiveComponent2 {
7401
7407
  const subcircuit = this.getSubcircuit();
7402
7408
  const position = this._getGlobalPcbPositionBeforeLayout();
7403
7409
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
7404
- const decomposedTransform = decomposeTSR5(
7410
+ const decomposedTransform = decomposeTSR6(
7405
7411
  this._computePcbGlobalTransformBeforeLayout()
7406
7412
  );
7407
7413
  const rotationDegrees = decomposedTransform.rotation.angle * 180 / Math.PI;
@@ -9315,7 +9321,7 @@ import {
9315
9321
  isValidElement
9316
9322
  } from "react";
9317
9323
  import { symbols as symbols2 } from "schematic-symbols";
9318
- import { decomposeTSR as decomposeTSR7 } from "transformation-matrix";
9324
+ import { decomposeTSR as decomposeTSR8 } from "transformation-matrix";
9319
9325
  import { z as z9 } from "zod";
9320
9326
 
9321
9327
  // lib/components/primitive-components/CadAssembly.ts
@@ -9334,7 +9340,7 @@ var CadAssembly = class extends PrimitiveComponent2 {
9334
9340
  import { cadmodelProps, point3 } from "@tscircuit/props";
9335
9341
  import { z as z8 } from "zod";
9336
9342
  import { distance as distance6 } from "circuit-json";
9337
- import { decomposeTSR as decomposeTSR6 } from "transformation-matrix";
9343
+ import { decomposeTSR as decomposeTSR7 } from "transformation-matrix";
9338
9344
 
9339
9345
  // lib/components/base-components/NormalComponent/utils/getFileExtension.ts
9340
9346
  var getFileExtension = (filename) => {
@@ -9395,13 +9401,14 @@ var CadModel = class extends PrimitiveComponent2 {
9395
9401
  if (!props || typeof props.modelUrl !== "string" && typeof props.stepUrl !== "string")
9396
9402
  return;
9397
9403
  const parentTransform = parent._computePcbGlobalTransformBeforeLayout();
9398
- const decomposedTransform = decomposeTSR6(parentTransform);
9404
+ const decomposedTransform = decomposeTSR7(parentTransform);
9399
9405
  const accumulatedRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
9406
+ const sourceRotationOffset = props.pcbRotationOffset ?? props.rotationOffset;
9400
9407
  const rotationOffset = rotation3.parse({ x: 0, y: 0, z: 0 });
9401
- if (typeof props.rotationOffset === "number") {
9402
- rotationOffset.z = Number(props.rotationOffset);
9403
- } else if (typeof props.rotationOffset === "object") {
9404
- const parsed = rotation3.parse(props.rotationOffset);
9408
+ if (typeof sourceRotationOffset === "number") {
9409
+ rotationOffset.z = Number(sourceRotationOffset);
9410
+ } else if (typeof sourceRotationOffset === "object") {
9411
+ const parsed = rotation3.parse(sourceRotationOffset);
9405
9412
  rotationOffset.x = Number(parsed.x);
9406
9413
  rotationOffset.y = Number(parsed.y);
9407
9414
  rotationOffset.z = Number(parsed.z);
@@ -9462,6 +9469,10 @@ var CadModel = class extends PrimitiveComponent2 {
9462
9469
  z: layer === "bottom" ? -(accumulatedRotation + Number(rotationOffset.z)) + 180 : accumulatedRotation + Number(rotationOffset.z)
9463
9470
  },
9464
9471
  pcb_component_id: parent.pcb_component_id,
9472
+ model_board_normal_direction: props.modelBoardNormalDirection,
9473
+ model_origin_alignment: "center_of_component_on_board_surface",
9474
+ anchor_alignment: "center_of_component_on_board_surface",
9475
+ model_origin_position: props.modelOriginPosition,
9465
9476
  source_component_id: parent.source_component_id,
9466
9477
  model_unit_to_mm_scale_factor: typeof props.modelUnitToMmScale === "number" ? props.modelUnitToMmScale : void 0,
9467
9478
  show_as_translucent_model: props.showAsTranslucentModel ?? parent._parsedProps.showAsTranslucentModel,
@@ -10802,7 +10813,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
10802
10813
  db.pcb_component_invalid_layer_error.insert(error);
10803
10814
  }
10804
10815
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
10805
- const decomposedTransform = decomposeTSR7(globalTransform);
10816
+ const decomposedTransform = decomposeTSR8(globalTransform);
10806
10817
  const accumulatedRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
10807
10818
  const pcb_component = db.pcb_component.insert({
10808
10819
  center: this._getGlobalPcbPositionBeforeLayout(),
@@ -11272,11 +11283,12 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
11272
11283
  if (typeof cadModel === "string") {
11273
11284
  throw new Error("String cadModel not yet implemented");
11274
11285
  }
11286
+ const sourceRotationOffset = cadModel?.pcbRotationOffset ?? cadModel?.rotationOffset;
11275
11287
  const rotationOffset = rotation32.parse({
11276
11288
  x: 0,
11277
11289
  y: 0,
11278
- z: typeof cadModel?.rotationOffset === "number" ? cadModel.rotationOffset : 0,
11279
- ...typeof cadModel?.rotationOffset === "object" ? cadModel.rotationOffset ?? {} : {}
11290
+ z: typeof sourceRotationOffset === "number" ? sourceRotationOffset : 0,
11291
+ ...typeof sourceRotationOffset === "object" ? sourceRotationOffset : {}
11280
11292
  });
11281
11293
  const positionOffset = point32.parse({
11282
11294
  x: 0,
@@ -11289,7 +11301,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
11289
11301
  ) : 0 : 0;
11290
11302
  const computedLayer = this.props.layer === "bottom" ? "bottom" : "top";
11291
11303
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
11292
- const decomposedTransform = decomposeTSR7(globalTransform);
11304
+ const decomposedTransform = decomposeTSR8(globalTransform);
11293
11305
  const totalRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
11294
11306
  const isBottomLayer = computedLayer === "bottom";
11295
11307
  const rotationWithOffset = totalRotation + (rotationOffset.z ?? 0);
@@ -11317,6 +11329,10 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
11317
11329
  model_wrl_url: "wrlUrl" in (cadModel ?? {}) ? this._addCachebustToModelUrl(cadModel.wrlUrl) : void 0,
11318
11330
  model_jscad: "jscad" in (cadModel ?? {}) ? cadModel.jscad : void 0,
11319
11331
  model_unit_to_mm_scale_factor: typeof cadModel?.modelUnitToMmScale === "number" ? cadModel.modelUnitToMmScale : void 0,
11332
+ model_board_normal_direction: cadModel?.modelBoardNormalDirection,
11333
+ model_origin_alignment: "center_of_component_on_board_surface",
11334
+ anchor_alignment: "center_of_component_on_board_surface",
11335
+ model_origin_position: cadModel?.modelOriginPosition,
11320
11336
  footprinter_string: typeof footprint === "string" && !cadModel ? footprint : void 0,
11321
11337
  show_as_translucent_model: this._parsedProps.showAsTranslucentModel
11322
11338
  });
@@ -18642,7 +18658,7 @@ import { identity as identity5 } from "transformation-matrix";
18642
18658
  var package_default = {
18643
18659
  name: "@tscircuit/core",
18644
18660
  type: "module",
18645
- version: "0.0.1110",
18661
+ version: "0.0.1112",
18646
18662
  types: "dist/index.d.ts",
18647
18663
  main: "dist/index.js",
18648
18664
  module: "dist/index.js",
@@ -18687,7 +18703,7 @@ var package_default = {
18687
18703
  "@tscircuit/math-utils": "^0.0.36",
18688
18704
  "@tscircuit/miniflex": "^0.0.4",
18689
18705
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
18690
- "@tscircuit/props": "^0.0.495",
18706
+ "@tscircuit/props": "^0.0.497",
18691
18707
  "@tscircuit/schematic-match-adapt": "^0.0.16",
18692
18708
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
18693
18709
  "@tscircuit/solver-utils": "^0.0.3",
@@ -18701,13 +18717,13 @@ var package_default = {
18701
18717
  "bun-match-svg": "0.0.12",
18702
18718
  "calculate-elbow": "^0.0.12",
18703
18719
  "chokidar-cli": "^3.0.0",
18704
- "circuit-json": "^0.0.402",
18720
+ "circuit-json": "^0.0.403",
18705
18721
  "circuit-json-to-bpc": "^0.0.13",
18706
18722
  "circuit-json-to-connectivity-map": "^0.0.23",
18707
- "circuit-json-to-gltf": "^0.0.73",
18723
+ "circuit-json-to-gltf": "^0.0.84",
18708
18724
  "circuit-json-to-simple-3d": "^0.0.9",
18709
18725
  "circuit-json-to-spice": "^0.0.34",
18710
- "circuit-to-svg": "^0.0.336",
18726
+ "circuit-to-svg": "^0.0.337",
18711
18727
  concurrently: "^9.1.2",
18712
18728
  "connectivity-map": "^1.0.0",
18713
18729
  debug: "^4.3.6",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1111",
4
+ "version": "0.0.1113",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -46,7 +46,7 @@
46
46
  "@tscircuit/math-utils": "^0.0.36",
47
47
  "@tscircuit/miniflex": "^0.0.4",
48
48
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
49
- "@tscircuit/props": "^0.0.495",
49
+ "@tscircuit/props": "^0.0.497",
50
50
  "@tscircuit/schematic-match-adapt": "^0.0.16",
51
51
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
52
52
  "@tscircuit/solver-utils": "^0.0.3",
@@ -60,13 +60,13 @@
60
60
  "bun-match-svg": "0.0.12",
61
61
  "calculate-elbow": "^0.0.12",
62
62
  "chokidar-cli": "^3.0.0",
63
- "circuit-json": "^0.0.402",
63
+ "circuit-json": "^0.0.403",
64
64
  "circuit-json-to-bpc": "^0.0.13",
65
65
  "circuit-json-to-connectivity-map": "^0.0.23",
66
- "circuit-json-to-gltf": "^0.0.73",
66
+ "circuit-json-to-gltf": "^0.0.84",
67
67
  "circuit-json-to-simple-3d": "^0.0.9",
68
68
  "circuit-json-to-spice": "^0.0.34",
69
- "circuit-to-svg": "^0.0.336",
69
+ "circuit-to-svg": "^0.0.337",
70
70
  "concurrently": "^9.1.2",
71
71
  "connectivity-map": "^1.0.0",
72
72
  "debug": "^4.3.6",