@tscircuit/core 0.0.886 → 0.0.888

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
@@ -4491,6 +4491,7 @@ declare class Capacitor extends NormalComponent<typeof capacitorProps, Polarized
4491
4491
  bypassTo: zod.ZodOptional<zod.ZodString>;
4492
4492
  maxDecouplingTraceLength: zod.ZodOptional<zod.ZodNumber>;
4493
4493
  schOrientation: zod.ZodOptional<zod.ZodEnum<["vertical", "horizontal", "pos_top", "pos_bottom", "pos_left", "pos_right", "neg_top", "neg_bottom", "neg_left", "neg_right"]>>;
4494
+ schSize: zod.ZodOptional<zod.ZodUnion<[zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>, zod.ZodEnum<["xs", "sm", "default", "md"]>]>>;
4494
4495
  connections: zod.ZodOptional<zod.ZodRecord<zod.ZodEnum<["pin1", "pin2", "pos", "neg", "anode", "cathode"]>, zod.ZodUnion<[zod.ZodUnion<[zod.ZodString, zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>]>, zod.ZodArray<zod.ZodString, "many">]>>>;
4495
4496
  }, "strip", zod.ZodTypeAny, {
4496
4497
  name: string;
@@ -4691,6 +4692,7 @@ declare class Capacitor extends NormalComponent<typeof capacitorProps, Polarized
4691
4692
  showAsTranslucentModel?: boolean | undefined;
4692
4693
  connections?: Partial<Record<"pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
4693
4694
  schOrientation?: "vertical" | "horizontal" | "pos_top" | "pos_bottom" | "pos_left" | "pos_right" | "neg_top" | "neg_bottom" | "neg_left" | "neg_right" | undefined;
4695
+ schSize?: number | "xs" | "sm" | "default" | "md" | undefined;
4694
4696
  maxVoltageRating?: number | undefined;
4695
4697
  decouplingFor?: string | undefined;
4696
4698
  decouplingTo?: string | undefined;
@@ -4897,6 +4899,7 @@ declare class Capacitor extends NormalComponent<typeof capacitorProps, Polarized
4897
4899
  connections?: Partial<Record<"pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
4898
4900
  schShowRatings?: boolean | undefined;
4899
4901
  schOrientation?: "vertical" | "horizontal" | "pos_top" | "pos_bottom" | "pos_left" | "pos_right" | "neg_top" | "neg_bottom" | "neg_left" | "neg_right" | undefined;
4902
+ schSize?: string | number | undefined;
4900
4903
  maxVoltageRating?: string | number | undefined;
4901
4904
  polarized?: boolean | undefined;
4902
4905
  decouplingFor?: string | undefined;
@@ -17982,6 +17985,7 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
17982
17985
  pulldownFor: zod.ZodOptional<zod.ZodString>;
17983
17986
  pulldownTo: zod.ZodOptional<zod.ZodString>;
17984
17987
  schOrientation: zod.ZodOptional<zod.ZodEnum<["vertical", "horizontal", "pos_top", "pos_bottom", "pos_left", "pos_right", "neg_top", "neg_bottom", "neg_left", "neg_right"]>>;
17988
+ schSize: zod.ZodOptional<zod.ZodUnion<[zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>, zod.ZodEnum<["xs", "sm", "default", "md"]>]>>;
17985
17989
  connections: zod.ZodOptional<zod.ZodRecord<zod.ZodEnum<["pin1", "pin2", "pos", "neg"]>, zod.ZodUnion<[zod.ZodUnion<[zod.ZodString, zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>]>, zod.ZodArray<zod.ZodString, "many">]>>>;
17986
17990
  }, "strip", zod.ZodTypeAny, {
17987
17991
  name: string;
@@ -18184,6 +18188,7 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
18184
18188
  pullupTo?: string | undefined;
18185
18189
  pulldownFor?: string | undefined;
18186
18190
  pulldownTo?: string | undefined;
18191
+ schSize?: number | "xs" | "sm" | "default" | "md" | undefined;
18187
18192
  }, {
18188
18193
  name: string;
18189
18194
  resistance: string | number;
@@ -18387,6 +18392,7 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
18387
18392
  pullupTo?: string | undefined;
18388
18393
  pulldownFor?: string | undefined;
18389
18394
  pulldownTo?: string | undefined;
18395
+ schSize?: string | number | undefined;
18390
18396
  }>;
18391
18397
  sourceFtype: Ftype;
18392
18398
  };
@@ -40764,7 +40770,9 @@ interface TscircuitElements {
40764
40770
  custom: any;
40765
40771
  component: _tscircuit_props.ComponentProps;
40766
40772
  crystal: _tscircuit_props.CrystalProps;
40767
- footprint: any;
40773
+ footprint: _tscircuit_props.FootprintProps & {
40774
+ name?: string;
40775
+ };
40768
40776
  silkscreentext: _tscircuit_props.SilkscreenTextProps;
40769
40777
  cutout: _tscircuit_props.CutoutProps;
40770
40778
  silkscreenpath: _tscircuit_props.SilkscreenPathProps;
package/dist/index.js CHANGED
@@ -16436,17 +16436,29 @@ import "@tscircuit/props";
16436
16436
  import { cju } from "@tscircuit/circuit-json-util";
16437
16437
 
16438
16438
  // lib/components/primitive-components/Group/Subcircuit/inflators/inflatePcbComponent.ts
16439
+ import { compose as compose5, translate as translate6, rotate as rotate3, inverse } from "transformation-matrix";
16440
+ import { transformPCBElements as transformPCBElements2 } from "@tscircuit/circuit-json-util";
16439
16441
  var inflatePcbComponent = (pcbElm, inflatorContext) => {
16440
16442
  const { injectionDb, normalComponent } = inflatorContext;
16441
16443
  if (!normalComponent) return;
16444
+ const componentCenter = pcbElm.center || { x: 0, y: 0 };
16445
+ const componentRotation = pcbElm.rotation || 0;
16446
+ const absoluteToComponentRelativeTransform = inverse(
16447
+ compose5(
16448
+ translate6(componentCenter.x, componentCenter.y),
16449
+ rotate3(componentRotation * Math.PI / 180)
16450
+ )
16451
+ );
16452
+ const relativeElements = injectionDb.toArray().filter(
16453
+ (elm) => "pcb_component_id" in elm && elm.pcb_component_id === pcbElm.pcb_component_id
16454
+ );
16455
+ transformPCBElements2(relativeElements, absoluteToComponentRelativeTransform);
16442
16456
  const components = createComponentsFromCircuitJson(
16443
16457
  {
16444
16458
  componentName: normalComponent.name,
16445
16459
  componentRotation: "0deg"
16446
16460
  },
16447
- injectionDb.toArray().filter(
16448
- (elm) => "pcb_component_id" in elm && elm.pcb_component_id === pcbElm.pcb_component_id
16449
- )
16461
+ relativeElements
16450
16462
  );
16451
16463
  normalComponent.addAll(components);
16452
16464
  };
@@ -16462,7 +16474,13 @@ function inflateSourceResistor(sourceElm, inflatorContext) {
16462
16474
  });
16463
16475
  const resistor = new Resistor({
16464
16476
  name: sourceElm.name,
16465
- resistance: sourceElm.resistance
16477
+ resistance: sourceElm.resistance,
16478
+ layer: pcbElm?.layer,
16479
+ pcbX: pcbElm?.center?.x,
16480
+ pcbY: pcbElm?.center?.y,
16481
+ pcbRotation: pcbElm?.rotation,
16482
+ doNotPlace: pcbElm?.do_not_place,
16483
+ obstructsWithinBounds: pcbElm?.obstructs_within_bounds
16466
16484
  });
16467
16485
  if (pcbElm) {
16468
16486
  inflatePcbComponent(pcbElm, {
@@ -16609,7 +16627,13 @@ function inflateSourceCapacitor(sourceElm, inflatorContext) {
16609
16627
  });
16610
16628
  const capacitor = new Capacitor({
16611
16629
  name: sourceElm.name,
16612
- capacitance: sourceElm.capacitance
16630
+ capacitance: sourceElm.capacitance,
16631
+ layer: pcbElm?.layer,
16632
+ pcbX: pcbElm?.center?.x,
16633
+ pcbY: pcbElm?.center?.y,
16634
+ pcbRotation: pcbElm?.rotation,
16635
+ doNotPlace: pcbElm?.do_not_place,
16636
+ obstructsWithinBounds: pcbElm?.obstructs_within_bounds
16613
16637
  });
16614
16638
  if (pcbElm) {
16615
16639
  inflatePcbComponent(pcbElm, {
@@ -16674,7 +16698,13 @@ function inflateSourceInductor(sourceElm, inflatorContext) {
16674
16698
  });
16675
16699
  const inductor = new Inductor({
16676
16700
  name: sourceElm.name,
16677
- inductance: sourceElm.inductance
16701
+ inductance: sourceElm.inductance,
16702
+ layer: pcbElm?.layer,
16703
+ pcbX: pcbElm?.center?.x,
16704
+ pcbY: pcbElm?.center?.y,
16705
+ pcbRotation: pcbElm?.rotation,
16706
+ doNotPlace: pcbElm?.do_not_place,
16707
+ obstructsWithinBounds: pcbElm?.obstructs_within_bounds
16678
16708
  });
16679
16709
  if (pcbElm) {
16680
16710
  inflatePcbComponent(pcbElm, {
@@ -16700,7 +16730,13 @@ function inflateSourceDiode(sourceElm, inflatorContext) {
16700
16730
  source_component_id: sourceElm.source_component_id
16701
16731
  });
16702
16732
  const diode = new Diode({
16703
- name: sourceElm.name
16733
+ name: sourceElm.name,
16734
+ layer: pcbElm?.layer,
16735
+ pcbX: pcbElm?.center?.x,
16736
+ pcbY: pcbElm?.center?.y,
16737
+ pcbRotation: pcbElm?.rotation,
16738
+ doNotPlace: pcbElm?.do_not_place,
16739
+ obstructsWithinBounds: pcbElm?.obstructs_within_bounds
16704
16740
  });
16705
16741
  if (pcbElm) {
16706
16742
  inflatePcbComponent(pcbElm, {
@@ -16827,7 +16863,13 @@ function inflateSourceTransistor(sourceElm, inflatorContext) {
16827
16863
  });
16828
16864
  const transistor = new Transistor({
16829
16865
  name: sourceElm.name,
16830
- type: sourceElm.transistor_type
16866
+ type: sourceElm.transistor_type,
16867
+ layer: pcbElm?.layer,
16868
+ pcbX: pcbElm?.center?.x,
16869
+ pcbY: pcbElm?.center?.y,
16870
+ pcbRotation: pcbElm?.rotation,
16871
+ doNotPlace: pcbElm?.do_not_place,
16872
+ obstructsWithinBounds: pcbElm?.obstructs_within_bounds
16831
16873
  });
16832
16874
  if (pcbElm) {
16833
16875
  inflatePcbComponent(pcbElm, {
@@ -17035,7 +17077,7 @@ import { netLabelProps } from "@tscircuit/props";
17035
17077
  import {
17036
17078
  applyToPoint as applyToPoint17,
17037
17079
  identity as identity5,
17038
- translate as translate6
17080
+ translate as translate7
17039
17081
  } from "transformation-matrix";
17040
17082
  import { calculateElbow as calculateElbow2 } from "calculate-elbow";
17041
17083
  var NetLabel = class extends PrimitiveComponent2 {
@@ -17088,7 +17130,7 @@ var NetLabel = class extends PrimitiveComponent2 {
17088
17130
  this.parent?.computeSchematicGlobalTransform?.() ?? identity5(),
17089
17131
  { x: 0, y: 0 }
17090
17132
  );
17091
- return translate6(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
17133
+ return translate7(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
17092
17134
  }
17093
17135
  }
17094
17136
  return super.computeSchematicPropsTransform();
@@ -18820,7 +18862,7 @@ import { identity as identity6 } from "transformation-matrix";
18820
18862
  var package_default = {
18821
18863
  name: "@tscircuit/core",
18822
18864
  type: "module",
18823
- version: "0.0.885",
18865
+ version: "0.0.887",
18824
18866
  types: "dist/index.d.ts",
18825
18867
  main: "dist/index.js",
18826
18868
  module: "dist/index.js",
@@ -18864,7 +18906,7 @@ var package_default = {
18864
18906
  "@tscircuit/math-utils": "^0.0.29",
18865
18907
  "@tscircuit/miniflex": "^0.0.4",
18866
18908
  "@tscircuit/ngspice-spice-engine": "^0.0.4",
18867
- "@tscircuit/props": "^0.0.418",
18909
+ "@tscircuit/props": "^0.0.419",
18868
18910
  "@tscircuit/schematic-autolayout": "^0.0.6",
18869
18911
  "@tscircuit/schematic-match-adapt": "^0.0.16",
18870
18912
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.886",
4
+ "version": "0.0.888",
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.4",
48
- "@tscircuit/props": "^0.0.418",
48
+ "@tscircuit/props": "^0.0.419",
49
49
  "@tscircuit/schematic-autolayout": "^0.0.6",
50
50
  "@tscircuit/schematic-match-adapt": "^0.0.16",
51
51
  "@tscircuit/schematic-trace-solver": "^v0.0.45",