@tscircuit/core 0.0.1052 → 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;
package/dist/index.js CHANGED
@@ -7842,6 +7842,7 @@ var Port = class extends PrimitiveComponent2 {
7842
7842
  source_port_id = null;
7843
7843
  pcb_port_id = null;
7844
7844
  schematic_port_id = null;
7845
+ schematic_stem_line_id = null;
7845
7846
  schematicSymbolPortDef = null;
7846
7847
  matchedComponents;
7847
7848
  facingDirection = null;
@@ -8357,7 +8358,7 @@ var Port = class extends PrimitiveComponent2 {
8357
8358
  else if (direction === "left") x2 += schStemLength;
8358
8359
  else if (direction === "up") y2 -= schStemLength;
8359
8360
  else if (direction === "down") y2 += schStemLength;
8360
- db.schematic_line.insert({
8361
+ const stemLine = db.schematic_line.insert({
8361
8362
  schematic_component_id: parentNormalComponent?.schematic_component_id,
8362
8363
  x1: portCenter.x,
8363
8364
  y1: portCenter.y,
@@ -8367,6 +8368,41 @@ var Port = class extends PrimitiveComponent2 {
8367
8368
  color: SCHEMATIC_COMPONENT_OUTLINE_COLOR,
8368
8369
  is_dashed: false
8369
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
+ }
8370
8406
  }
8371
8407
  }
8372
8408
  _getSubcircuitConnectivityKey() {
@@ -18414,7 +18450,7 @@ import { identity as identity4 } from "transformation-matrix";
18414
18450
  var package_default = {
18415
18451
  name: "@tscircuit/core",
18416
18452
  type: "module",
18417
- version: "0.0.1051",
18453
+ version: "0.0.1052",
18418
18454
  types: "dist/index.d.ts",
18419
18455
  main: "dist/index.js",
18420
18456
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1052",
4
+ "version": "0.0.1053",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",