@tscircuit/core 0.0.1051 → 0.0.1053

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.d.ts CHANGED
@@ -1365,6 +1365,7 @@ declare class Port extends PrimitiveComponent<typeof portProps> {
1365
1365
  source_port_id: string | null;
1366
1366
  pcb_port_id: string | null;
1367
1367
  schematic_port_id: string | null;
1368
+ schematic_stem_line_id: string | null;
1368
1369
  schematicSymbolPortDef: SchSymbol["ports"][number] | null;
1369
1370
  matchedComponents: PrimitiveComponent[];
1370
1371
  facingDirection: "up" | "down" | "left" | "right" | null;
@@ -1484,6 +1485,7 @@ declare class Port extends PrimitiveComponent<typeof portProps> {
1484
1485
  */
1485
1486
  _getBestDisplayPinLabel(): string | undefined;
1486
1487
  doInitialSchematicPortRender(): void;
1488
+ doInitialSchematicSymbolResize(): void;
1487
1489
  _getSubcircuitConnectivityKey(): string | undefined;
1488
1490
  _setPositionFromLayout(newCenter: {
1489
1491
  x: number;
@@ -68191,7 +68193,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
68191
68193
  pcbSx: zod.ZodOptional<zod.ZodType<_tscircuit_props.PcbSx, zod.ZodTypeDef, _tscircuit_props.PcbSx>>;
68192
68194
  pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
68193
68195
  relative: zod.ZodOptional<zod.ZodBoolean>;
68194
- }, "layer" | "pcbRotation"> & {
68196
+ }, "layer"> & {
68195
68197
  name: zod.ZodOptional<zod.ZodString>;
68196
68198
  connectsTo: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodArray<zod.ZodString, "many">]>>;
68197
68199
  shape: zod.ZodLiteral<"circular_hole_with_rect_pad">;
@@ -68220,6 +68222,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
68220
68222
  pcbBottomEdgeY?: string | number | undefined;
68221
68223
  pcbOffsetX?: number | undefined;
68222
68224
  pcbOffsetY?: number | undefined;
68225
+ pcbRotation?: number | undefined;
68223
68226
  pcbPositionAnchor?: string | undefined;
68224
68227
  pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
68225
68228
  pcbMarginTop?: number | undefined;
@@ -68264,6 +68267,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
68264
68267
  pcbBottomEdgeY?: string | number | undefined;
68265
68268
  pcbOffsetX?: string | number | undefined;
68266
68269
  pcbOffsetY?: string | number | undefined;
68270
+ pcbRotation?: string | number | undefined;
68267
68271
  pcbPositionAnchor?: string | undefined;
68268
68272
  pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
68269
68273
  pcbMarginTop?: string | number | undefined;
@@ -68358,7 +68362,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
68358
68362
  pcbSx: zod.ZodOptional<zod.ZodType<_tscircuit_props.PcbSx, zod.ZodTypeDef, _tscircuit_props.PcbSx>>;
68359
68363
  pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
68360
68364
  relative: zod.ZodOptional<zod.ZodBoolean>;
68361
- }, "layer" | "pcbRotation"> & {
68365
+ }, "layer"> & {
68362
68366
  name: zod.ZodOptional<zod.ZodString>;
68363
68367
  connectsTo: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodArray<zod.ZodString, "many">]>>;
68364
68368
  shape: zod.ZodLiteral<"pill_hole_with_rect_pad">;
@@ -68388,6 +68392,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
68388
68392
  pcbBottomEdgeY?: string | number | undefined;
68389
68393
  pcbOffsetX?: number | undefined;
68390
68394
  pcbOffsetY?: number | undefined;
68395
+ pcbRotation?: number | undefined;
68391
68396
  pcbPositionAnchor?: string | undefined;
68392
68397
  pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
68393
68398
  pcbMarginTop?: number | undefined;
@@ -68432,6 +68437,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
68432
68437
  pcbBottomEdgeY?: string | number | undefined;
68433
68438
  pcbOffsetX?: string | number | undefined;
68434
68439
  pcbOffsetY?: string | number | undefined;
68440
+ pcbRotation?: string | number | undefined;
68435
68441
  pcbPositionAnchor?: string | undefined;
68436
68442
  pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
68437
68443
  pcbMarginTop?: string | number | undefined;
@@ -68782,6 +68788,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
68782
68788
  pcbBottomEdgeY?: string | number | undefined;
68783
68789
  pcbOffsetX?: number | undefined;
68784
68790
  pcbOffsetY?: number | undefined;
68791
+ pcbRotation?: number | undefined;
68785
68792
  pcbPositionAnchor?: string | undefined;
68786
68793
  pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
68787
68794
  pcbMarginTop?: number | undefined;
@@ -68827,6 +68834,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
68827
68834
  pcbBottomEdgeY?: string | number | undefined;
68828
68835
  pcbOffsetX?: number | undefined;
68829
68836
  pcbOffsetY?: number | undefined;
68837
+ pcbRotation?: number | undefined;
68830
68838
  pcbPositionAnchor?: string | undefined;
68831
68839
  pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
68832
68840
  pcbMarginTop?: number | undefined;
@@ -69044,6 +69052,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
69044
69052
  pcbBottomEdgeY?: string | number | undefined;
69045
69053
  pcbOffsetX?: string | number | undefined;
69046
69054
  pcbOffsetY?: string | number | undefined;
69055
+ pcbRotation?: string | number | undefined;
69047
69056
  pcbPositionAnchor?: string | undefined;
69048
69057
  pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
69049
69058
  pcbMarginTop?: string | number | undefined;
@@ -69089,6 +69098,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
69089
69098
  pcbBottomEdgeY?: string | number | undefined;
69090
69099
  pcbOffsetX?: string | number | undefined;
69091
69100
  pcbOffsetY?: string | number | undefined;
69101
+ pcbRotation?: string | number | undefined;
69092
69102
  pcbPositionAnchor?: string | undefined;
69093
69103
  pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
69094
69104
  pcbMarginTop?: string | number | undefined;
package/dist/index.js CHANGED
@@ -6021,6 +6021,7 @@ var PcbTrace = class extends PrimitiveComponent2 {
6021
6021
  // lib/components/primitive-components/PlatedHole.ts
6022
6022
  import { platedHoleProps } from "@tscircuit/props";
6023
6023
  import "circuit-json";
6024
+ import { decomposeTSR as decomposeTSR2 } from "transformation-matrix";
6024
6025
  var PlatedHole = class extends PrimitiveComponent2 {
6025
6026
  pcb_plated_hole_id = null;
6026
6027
  matchedPort = null;
@@ -6119,6 +6120,12 @@ var PlatedHole = class extends PrimitiveComponent2 {
6119
6120
  const soldermaskMargin = props.solderMaskMargin;
6120
6121
  const isCoveredWithSolderMask = props.coveredWithSolderMask ?? false;
6121
6122
  this.emitSolderMaskMarginWarning(isCoveredWithSolderMask, soldermaskMargin);
6123
+ const decomposedTransform = decomposeTSR2(
6124
+ this._computePcbGlobalTransformBeforeLayout()
6125
+ );
6126
+ const rotationDegrees = decomposedTransform.rotation.angle * 180 / Math.PI;
6127
+ const normalizedRotationDegrees = (rotationDegrees % 360 + 360) % 360;
6128
+ const finalRotationDegrees = normalizedRotationDegrees;
6122
6129
  if (props.shape === "circle") {
6123
6130
  const pcb_plated_hole = db.pcb_plated_hole.insert({
6124
6131
  pcb_component_id,
@@ -6247,7 +6254,8 @@ var PlatedHole = class extends PrimitiveComponent2 {
6247
6254
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
6248
6255
  hole_offset_x: props.holeOffsetX,
6249
6256
  hole_offset_y: props.holeOffsetY,
6250
- rect_border_radius: props.rectBorderRadius ?? 0
6257
+ rect_border_radius: props.rectBorderRadius ?? 0,
6258
+ rect_ccw_rotation: finalRotationDegrees
6251
6259
  });
6252
6260
  this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
6253
6261
  } else if (props.shape === "pill_hole_with_rect_pad") {
@@ -6566,7 +6574,7 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
6566
6574
 
6567
6575
  // lib/components/primitive-components/SilkscreenRect.ts
6568
6576
  import { silkscreenRectProps } from "@tscircuit/props";
6569
- import { decomposeTSR as decomposeTSR2 } from "transformation-matrix";
6577
+ import { decomposeTSR as decomposeTSR3 } from "transformation-matrix";
6570
6578
  var SilkscreenRect = class extends PrimitiveComponent2 {
6571
6579
  pcb_silkscreen_rect_id = null;
6572
6580
  isPcbPrimitive = true;
@@ -6582,7 +6590,7 @@ var SilkscreenRect = class extends PrimitiveComponent2 {
6582
6590
  */
6583
6591
  _isRotated90Degrees() {
6584
6592
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
6585
- const decomposedTransform = decomposeTSR2(globalTransform);
6593
+ const decomposedTransform = decomposeTSR3(globalTransform);
6586
6594
  const rotationDegrees = decomposedTransform.rotation.angle * 180 / Math.PI;
6587
6595
  const normalizedRotationDegrees = (rotationDegrees % 360 + 360) % 360;
6588
6596
  const rotationTolerance = 0.01;
@@ -6651,7 +6659,7 @@ var SilkscreenRect = class extends PrimitiveComponent2 {
6651
6659
 
6652
6660
  // lib/components/primitive-components/SilkscreenText.ts
6653
6661
  import { silkscreenTextProps } from "@tscircuit/props";
6654
- import { decomposeTSR as decomposeTSR3 } from "transformation-matrix";
6662
+ import { decomposeTSR as decomposeTSR4 } from "transformation-matrix";
6655
6663
 
6656
6664
  // lib/utils/pcbSx/resolve-pcb-property.ts
6657
6665
  function parseSegment(seg) {
@@ -6752,7 +6760,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
6752
6760
  rotation4 = props.pcbRotation;
6753
6761
  } else {
6754
6762
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
6755
- const decomposedTransform = decomposeTSR3(globalTransform);
6763
+ const decomposedTransform = decomposeTSR4(globalTransform);
6756
6764
  rotation4 = decomposedTransform.rotation.angle * 180 / Math.PI;
6757
6765
  }
6758
6766
  if (isFlipped) {
@@ -6838,7 +6846,7 @@ import { smtPadProps } from "@tscircuit/props";
6838
6846
  import {
6839
6847
  distance as distance5
6840
6848
  } from "circuit-json";
6841
- import { applyToPoint as applyToPoint13, decomposeTSR as decomposeTSR4 } from "transformation-matrix";
6849
+ import { applyToPoint as applyToPoint13, decomposeTSR as decomposeTSR5 } from "transformation-matrix";
6842
6850
  var SmtPad = class extends PrimitiveComponent2 {
6843
6851
  pcb_smtpad_id = null;
6844
6852
  matchedPort = null;
@@ -6909,7 +6917,7 @@ var SmtPad = class extends PrimitiveComponent2 {
6909
6917
  const subcircuit = this.getSubcircuit();
6910
6918
  const position = this._getGlobalPcbPositionBeforeLayout();
6911
6919
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
6912
- const decomposedTransform = decomposeTSR4(
6920
+ const decomposedTransform = decomposeTSR5(
6913
6921
  this._computePcbGlobalTransformBeforeLayout()
6914
6922
  );
6915
6923
  const rotationDegrees = decomposedTransform.rotation.angle * 180 / Math.PI;
@@ -7834,6 +7842,7 @@ var Port = class extends PrimitiveComponent2 {
7834
7842
  source_port_id = null;
7835
7843
  pcb_port_id = null;
7836
7844
  schematic_port_id = null;
7845
+ schematic_stem_line_id = null;
7837
7846
  schematicSymbolPortDef = null;
7838
7847
  matchedComponents;
7839
7848
  facingDirection = null;
@@ -8349,7 +8358,7 @@ var Port = class extends PrimitiveComponent2 {
8349
8358
  else if (direction === "left") x2 += schStemLength;
8350
8359
  else if (direction === "up") y2 -= schStemLength;
8351
8360
  else if (direction === "down") y2 += schStemLength;
8352
- db.schematic_line.insert({
8361
+ const stemLine = db.schematic_line.insert({
8353
8362
  schematic_component_id: parentNormalComponent?.schematic_component_id,
8354
8363
  x1: portCenter.x,
8355
8364
  y1: portCenter.y,
@@ -8359,6 +8368,41 @@ var Port = class extends PrimitiveComponent2 {
8359
8368
  color: SCHEMATIC_COMPONENT_OUTLINE_COLOR,
8360
8369
  is_dashed: false
8361
8370
  });
8371
+ this.schematic_stem_line_id = stemLine.schematic_line_id;
8372
+ }
8373
+ }
8374
+ doInitialSchematicSymbolResize() {
8375
+ if (this.root?.schematicDisabled) return;
8376
+ if (!this.schematic_port_id) return;
8377
+ const symbol = this._getSymbolAncestor();
8378
+ const transform = symbol?.getUserCoordinateToResizedSymbolTransform();
8379
+ if (!transform) return;
8380
+ const { db } = this.root;
8381
+ const schPort = db.schematic_port.get(this.schematic_port_id);
8382
+ if (schPort) {
8383
+ const newCenter = applyToPoint14(transform, schPort.center);
8384
+ db.schematic_port.update(this.schematic_port_id, {
8385
+ center: newCenter
8386
+ });
8387
+ if (this.schematic_stem_line_id) {
8388
+ const line = db.schematic_line.get(this.schematic_stem_line_id);
8389
+ if (line) {
8390
+ const p1 = applyToPoint14(transform, { x: line.x1, y: line.y1 });
8391
+ const p2 = applyToPoint14(transform, { x: line.x2, y: line.y2 });
8392
+ db.schematic_line.update(this.schematic_stem_line_id, {
8393
+ x1: p1.x,
8394
+ y1: p1.y,
8395
+ x2: p2.x,
8396
+ y2: p2.y
8397
+ });
8398
+ const scaledStemLength = Math.sqrt(
8399
+ (p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2
8400
+ );
8401
+ db.schematic_port.update(this.schematic_port_id, {
8402
+ distance_from_component_edge: scaledStemLength
8403
+ });
8404
+ }
8405
+ }
8362
8406
  }
8363
8407
  }
8364
8408
  _getSubcircuitConnectivityKey() {
@@ -8743,7 +8787,7 @@ import {
8743
8787
  isValidElement
8744
8788
  } from "react";
8745
8789
  import { symbols as symbols2 } from "schematic-symbols";
8746
- import { decomposeTSR as decomposeTSR6 } from "transformation-matrix";
8790
+ import { decomposeTSR as decomposeTSR7 } from "transformation-matrix";
8747
8791
  import { z as z9 } from "zod";
8748
8792
 
8749
8793
  // lib/components/primitive-components/CadAssembly.ts
@@ -8762,7 +8806,7 @@ var CadAssembly = class extends PrimitiveComponent2 {
8762
8806
  import { cadmodelProps, point3 } from "@tscircuit/props";
8763
8807
  import { z as z8 } from "zod";
8764
8808
  import { distance as distance6 } from "circuit-json";
8765
- import { decomposeTSR as decomposeTSR5 } from "transformation-matrix";
8809
+ import { decomposeTSR as decomposeTSR6 } from "transformation-matrix";
8766
8810
 
8767
8811
  // lib/components/base-components/NormalComponent/utils/getFileExtension.ts
8768
8812
  var getFileExtension = (filename) => {
@@ -8823,7 +8867,7 @@ var CadModel = class extends PrimitiveComponent2 {
8823
8867
  if (!props || typeof props.modelUrl !== "string" && typeof props.stepUrl !== "string")
8824
8868
  return;
8825
8869
  const parentTransform = parent._computePcbGlobalTransformBeforeLayout();
8826
- const decomposedTransform = decomposeTSR5(parentTransform);
8870
+ const decomposedTransform = decomposeTSR6(parentTransform);
8827
8871
  const accumulatedRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
8828
8872
  const rotationOffset = rotation3.parse({ x: 0, y: 0, z: 0 });
8829
8873
  if (typeof props.rotationOffset === "number") {
@@ -10218,7 +10262,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
10218
10262
  db.pcb_component_invalid_layer_error.insert(error);
10219
10263
  }
10220
10264
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
10221
- const decomposedTransform = decomposeTSR6(globalTransform);
10265
+ const decomposedTransform = decomposeTSR7(globalTransform);
10222
10266
  const accumulatedRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
10223
10267
  const pcb_component = db.pcb_component.insert({
10224
10268
  center: this._getGlobalPcbPositionBeforeLayout(),
@@ -10669,7 +10713,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
10669
10713
  ) : 0 : 0;
10670
10714
  const computedLayer = this.props.layer === "bottom" ? "bottom" : "top";
10671
10715
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
10672
- const decomposedTransform = decomposeTSR6(globalTransform);
10716
+ const decomposedTransform = decomposeTSR7(globalTransform);
10673
10717
  const totalRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
10674
10718
  const isBottomLayer = computedLayer === "bottom";
10675
10719
  const rotationWithOffset = totalRotation + (rotationOffset.z ?? 0);
@@ -18406,7 +18450,7 @@ import { identity as identity4 } from "transformation-matrix";
18406
18450
  var package_default = {
18407
18451
  name: "@tscircuit/core",
18408
18452
  type: "module",
18409
- version: "0.0.1050",
18453
+ version: "0.0.1052",
18410
18454
  types: "dist/index.d.ts",
18411
18455
  main: "dist/index.js",
18412
18456
  module: "dist/index.js",
@@ -18450,7 +18494,7 @@ var package_default = {
18450
18494
  "@tscircuit/math-utils": "^0.0.29",
18451
18495
  "@tscircuit/miniflex": "^0.0.4",
18452
18496
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
18453
- "@tscircuit/props": "^0.0.478",
18497
+ "@tscircuit/props": "^0.0.479",
18454
18498
  "@tscircuit/schematic-match-adapt": "^0.0.16",
18455
18499
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
18456
18500
  "@tscircuit/solver-utils": "^0.0.3",
@@ -18464,13 +18508,13 @@ var package_default = {
18464
18508
  "bun-match-svg": "0.0.12",
18465
18509
  "calculate-elbow": "^0.0.12",
18466
18510
  "chokidar-cli": "^3.0.0",
18467
- "circuit-json": "^0.0.383",
18511
+ "circuit-json": "^0.0.384",
18468
18512
  "circuit-json-to-bpc": "^0.0.13",
18469
18513
  "circuit-json-to-connectivity-map": "^0.0.23",
18470
18514
  "circuit-json-to-gltf": "^0.0.73",
18471
18515
  "circuit-json-to-simple-3d": "^0.0.9",
18472
18516
  "circuit-json-to-spice": "^0.0.34",
18473
- "circuit-to-svg": "^0.0.328",
18517
+ "circuit-to-svg": "^0.0.330",
18474
18518
  concurrently: "^9.1.2",
18475
18519
  "connectivity-map": "^1.0.0",
18476
18520
  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.1051",
4
+ "version": "0.0.1053",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "@tscircuit/math-utils": "^0.0.29",
46
46
  "@tscircuit/miniflex": "^0.0.4",
47
47
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
48
- "@tscircuit/props": "^0.0.478",
48
+ "@tscircuit/props": "^0.0.479",
49
49
  "@tscircuit/schematic-match-adapt": "^0.0.16",
50
50
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
51
51
  "@tscircuit/solver-utils": "^0.0.3",
@@ -59,13 +59,13 @@
59
59
  "bun-match-svg": "0.0.12",
60
60
  "calculate-elbow": "^0.0.12",
61
61
  "chokidar-cli": "^3.0.0",
62
- "circuit-json": "^0.0.383",
62
+ "circuit-json": "^0.0.384",
63
63
  "circuit-json-to-bpc": "^0.0.13",
64
64
  "circuit-json-to-connectivity-map": "^0.0.23",
65
65
  "circuit-json-to-gltf": "^0.0.73",
66
66
  "circuit-json-to-simple-3d": "^0.0.9",
67
67
  "circuit-json-to-spice": "^0.0.34",
68
- "circuit-to-svg": "^0.0.328",
68
+ "circuit-to-svg": "^0.0.330",
69
69
  "concurrently": "^9.1.2",
70
70
  "connectivity-map": "^1.0.0",
71
71
  "debug": "^4.3.6",