@tscircuit/core 0.0.1037 → 0.0.1038

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
@@ -1317,6 +1317,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
1317
1317
  declare const portProps: z.ZodObject<{
1318
1318
  name: z.ZodOptional<z.ZodString>;
1319
1319
  pinNumber: z.ZodOptional<z.ZodNumber>;
1320
+ schStemLength: z.ZodOptional<z.ZodNumber>;
1320
1321
  aliases: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1321
1322
  layer: z.ZodOptional<z.ZodString>;
1322
1323
  layers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -1329,6 +1330,7 @@ declare const portProps: z.ZodObject<{
1329
1330
  layers?: string[] | undefined;
1330
1331
  name?: string | undefined;
1331
1332
  pinNumber?: number | undefined;
1333
+ schStemLength?: number | undefined;
1332
1334
  aliases?: string[] | undefined;
1333
1335
  schX?: number | undefined;
1334
1336
  schY?: number | undefined;
@@ -1339,6 +1341,7 @@ declare const portProps: z.ZodObject<{
1339
1341
  layers?: string[] | undefined;
1340
1342
  name?: string | undefined;
1341
1343
  pinNumber?: number | undefined;
1344
+ schStemLength?: number | undefined;
1342
1345
  aliases?: string[] | undefined;
1343
1346
  schX?: number | undefined;
1344
1347
  schY?: number | undefined;
@@ -1358,6 +1361,7 @@ declare class Port extends PrimitiveComponent<typeof portProps> {
1358
1361
  zodProps: z.ZodObject<{
1359
1362
  name: z.ZodOptional<z.ZodString>;
1360
1363
  pinNumber: z.ZodOptional<z.ZodNumber>;
1364
+ schStemLength: z.ZodOptional<z.ZodNumber>;
1361
1365
  aliases: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1362
1366
  layer: z.ZodOptional<z.ZodString>;
1363
1367
  layers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -1370,6 +1374,7 @@ declare class Port extends PrimitiveComponent<typeof portProps> {
1370
1374
  layers?: string[] | undefined;
1371
1375
  name?: string | undefined;
1372
1376
  pinNumber?: number | undefined;
1377
+ schStemLength?: number | undefined;
1373
1378
  aliases?: string[] | undefined;
1374
1379
  schX?: number | undefined;
1375
1380
  schY?: number | undefined;
@@ -1380,6 +1385,7 @@ declare class Port extends PrimitiveComponent<typeof portProps> {
1380
1385
  layers?: string[] | undefined;
1381
1386
  name?: string | undefined;
1382
1387
  pinNumber?: number | undefined;
1388
+ schStemLength?: number | undefined;
1383
1389
  aliases?: string[] | undefined;
1384
1390
  schX?: number | undefined;
1385
1391
  schY?: number | undefined;
package/dist/index.js CHANGED
@@ -6943,6 +6943,17 @@ function getRelativeDirection(pointA, pointB) {
6943
6943
  return dy >= 0 ? "up" : "down";
6944
6944
  }
6945
6945
 
6946
+ // lib/utils/constants.ts
6947
+ var stringProxy = new Proxy(
6948
+ {},
6949
+ {
6950
+ get: (target, prop) => prop
6951
+ }
6952
+ );
6953
+ var FTYPE = stringProxy;
6954
+ var SCHEMATIC_COMPONENT_OUTLINE_COLOR = "rgba(132, 0, 0)";
6955
+ var SCHEMATIC_COMPONENT_OUTLINE_STROKE_WIDTH = 0.12;
6956
+
6946
6957
  // lib/components/primitive-components/Port/Port.ts
6947
6958
  import "schematic-symbols";
6948
6959
  import { applyToPoint as applyToPoint7, compose as compose3, translate as translate3 } from "transformation-matrix";
@@ -6999,6 +7010,7 @@ var getCenterOfPcbPrimitives = (pcbPrimitives) => {
6999
7010
  var portProps = z7.object({
7000
7011
  name: z7.string().optional(),
7001
7012
  pinNumber: z7.number().optional(),
7013
+ schStemLength: z7.number().optional(),
7002
7014
  aliases: z7.array(z7.string()).optional(),
7003
7015
  layer: z7.string().optional(),
7004
7016
  layers: z7.array(z7.string()).optional(),
@@ -7494,14 +7506,15 @@ var Port = class extends PrimitiveComponent2 {
7494
7506
  }
7495
7507
  const bestDisplayPinLabel = this._getBestDisplayPinLabel();
7496
7508
  const parentNormalComponent = this.getParentNormalComponent();
7509
+ const sideOfComponent = localPortInfo?.side ?? (props.direction === "up" ? "top" : props.direction === "down" ? "bottom" : props.direction);
7497
7510
  const schematicPortInsertProps = {
7498
7511
  type: "schematic_port",
7499
7512
  schematic_component_id: parentNormalComponent?.schematic_component_id,
7500
7513
  center: portCenter,
7501
7514
  source_port_id: this.source_port_id,
7502
7515
  facing_direction: this.facingDirection,
7503
- distance_from_component_edge: 0.4,
7504
- side_of_component: localPortInfo?.side,
7516
+ distance_from_component_edge: props.schStemLength ?? 0.4,
7517
+ side_of_component: sideOfComponent,
7505
7518
  pin_number: props.pinNumber,
7506
7519
  true_ccw_index: localPortInfo?.trueIndex,
7507
7520
  display_pin_label: bestDisplayPinLabel,
@@ -7517,6 +7530,25 @@ var Port = class extends PrimitiveComponent2 {
7517
7530
  }
7518
7531
  const schematic_port = db.schematic_port.insert(schematicPortInsertProps);
7519
7532
  this.schematic_port_id = schematic_port.schematic_port_id;
7533
+ if (props.schStemLength !== void 0 && props.schStemLength !== 0) {
7534
+ const { schStemLength, direction } = props;
7535
+ let x2 = portCenter.x;
7536
+ let y2 = portCenter.y;
7537
+ if (direction === "right") x2 -= schStemLength;
7538
+ else if (direction === "left") x2 += schStemLength;
7539
+ else if (direction === "up") y2 -= schStemLength;
7540
+ else if (direction === "down") y2 += schStemLength;
7541
+ db.schematic_line.insert({
7542
+ schematic_component_id: parentNormalComponent?.schematic_component_id,
7543
+ x1: portCenter.x,
7544
+ y1: portCenter.y,
7545
+ x2,
7546
+ y2,
7547
+ stroke_width: 0.02,
7548
+ color: SCHEMATIC_COMPONENT_OUTLINE_COLOR,
7549
+ is_dashed: false
7550
+ });
7551
+ }
7520
7552
  }
7521
7553
  _getSubcircuitConnectivityKey() {
7522
7554
  return this.root?.db.source_port.get(this.source_port_id)?.subcircuit_connectivity_map_key;
@@ -12547,7 +12579,7 @@ import { identity as identity4 } from "transformation-matrix";
12547
12579
  var package_default = {
12548
12580
  name: "@tscircuit/core",
12549
12581
  type: "module",
12550
- version: "0.0.1036",
12582
+ version: "0.0.1037",
12551
12583
  types: "dist/index.d.ts",
12552
12584
  main: "dist/index.js",
12553
12585
  module: "dist/index.js",
@@ -12611,7 +12643,7 @@ var package_default = {
12611
12643
  "circuit-json-to-gltf": "^0.0.65",
12612
12644
  "circuit-json-to-simple-3d": "^0.0.9",
12613
12645
  "circuit-json-to-spice": "^0.0.34",
12614
- "circuit-to-svg": "^0.0.327",
12646
+ "circuit-to-svg": "^0.0.328",
12615
12647
  concurrently: "^9.1.2",
12616
12648
  "connectivity-map": "^1.0.0",
12617
12649
  debug: "^4.3.6",
@@ -16473,19 +16505,6 @@ function inflatePcbBoard(pcbBoard, inflatorContext) {
16473
16505
 
16474
16506
  // lib/components/normal-components/Capacitor.ts
16475
16507
  import { capacitorProps } from "@tscircuit/props";
16476
-
16477
- // lib/utils/constants.ts
16478
- var stringProxy = new Proxy(
16479
- {},
16480
- {
16481
- get: (target, prop) => prop
16482
- }
16483
- );
16484
- var FTYPE = stringProxy;
16485
- var SCHEMATIC_COMPONENT_OUTLINE_COLOR = "rgba(132, 0, 0)";
16486
- var SCHEMATIC_COMPONENT_OUTLINE_STROKE_WIDTH = 0.12;
16487
-
16488
- // lib/components/normal-components/Capacitor.ts
16489
16508
  import { formatSiUnit } from "format-si-unit";
16490
16509
  var Capacitor = class extends NormalComponent3 {
16491
16510
  _adjustSilkscreenTextAutomatically = true;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1037",
4
+ "version": "0.0.1038",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -65,7 +65,7 @@
65
65
  "circuit-json-to-gltf": "^0.0.65",
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.327",
68
+ "circuit-to-svg": "^0.0.328",
69
69
  "concurrently": "^9.1.2",
70
70
  "connectivity-map": "^1.0.0",
71
71
  "debug": "^4.3.6",