@tscircuit/core 0.0.1326 → 0.0.1328

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 +81 -7
  2. package/dist/index.js +276 -153
  3. package/package.json +9 -10
package/dist/index.d.ts CHANGED
@@ -467,7 +467,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
467
467
  source_trace_id: string | null;
468
468
  pcb_trace_id: string | null;
469
469
  schematic_trace_id: string | null;
470
- _inflatedPcbTrace?: PcbTrace$1;
470
+ _inflatedPcbTraces?: PcbTrace$1[];
471
471
  _inflatedPcbVias?: PcbVia$1[];
472
472
  _portsRoutedOnPcb: Port[];
473
473
  subcircuit_connectivity_map_key: string | null;
@@ -60892,6 +60892,11 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
60892
60892
  waveShape: zod.ZodOptional<zod.ZodEnum<["sinewave", "square", "triangle", "sawtooth"]>>;
60893
60893
  phase: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
60894
60894
  dutyCycle: zod.ZodOptional<zod.ZodPipeline<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>, zod.ZodNumber>>;
60895
+ pulseDelay: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
60896
+ riseTime: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
60897
+ fallTime: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
60898
+ pulseWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
60899
+ period: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
60895
60900
  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">]>>>;
60896
60901
  }, "strip", zod.ZodTypeAny, {
60897
60902
  name: string;
@@ -61477,6 +61482,11 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
61477
61482
  waveShape?: "square" | "sinewave" | "triangle" | "sawtooth" | undefined;
61478
61483
  phase?: number | undefined;
61479
61484
  dutyCycle?: number | undefined;
61485
+ pulseDelay?: number | undefined;
61486
+ riseTime?: number | undefined;
61487
+ fallTime?: number | undefined;
61488
+ pulseWidth?: number | undefined;
61489
+ period?: number | undefined;
61480
61490
  }, {
61481
61491
  name: string;
61482
61492
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -62063,6 +62073,11 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
62063
62073
  waveShape?: "square" | "sinewave" | "triangle" | "sawtooth" | undefined;
62064
62074
  phase?: string | number | undefined;
62065
62075
  dutyCycle?: string | number | undefined;
62076
+ pulseDelay?: string | number | undefined;
62077
+ riseTime?: string | number | undefined;
62078
+ fallTime?: string | number | undefined;
62079
+ pulseWidth?: string | number | undefined;
62080
+ period?: string | number | undefined;
62066
62081
  }>;
62067
62082
  sourceFtype: Ftype;
62068
62083
  };
@@ -148082,21 +148097,52 @@ declare class SymbolComponent extends PrimitiveComponent<typeof symbolProps> imp
148082
148097
  declare class AnalogSimulation extends PrimitiveComponent<typeof analogSimulationProps> {
148083
148098
  get config(): {
148084
148099
  componentName: string;
148085
- zodProps: z.ZodObject<{
148086
- simulationType: z.ZodDefault<z.ZodLiteral<"spice_transient_analysis">>;
148087
- duration: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
148088
- timePerStep: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
148089
- spiceEngine: z.ZodOptional<z.ZodType<_tscircuit_props.AutocompleteString<"spicey" | "ngspice">, z.ZodTypeDef, _tscircuit_props.AutocompleteString<"spicey" | "ngspice">>>;
148090
- }, "strip", z.ZodTypeAny, {
148100
+ zodProps: zod.ZodObject<{
148101
+ simulationType: zod.ZodDefault<zod.ZodLiteral<"spice_transient_analysis">>;
148102
+ duration: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
148103
+ startTime: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
148104
+ timePerStep: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
148105
+ spiceEngine: zod.ZodOptional<zod.ZodType<_tscircuit_props.AutocompleteString<"spicey" | "ngspice">, zod.ZodTypeDef, _tscircuit_props.AutocompleteString<"spicey" | "ngspice">>>;
148106
+ spiceOptions: zod.ZodOptional<zod.ZodObject<{
148107
+ method: zod.ZodOptional<zod.ZodEnum<["trap", "gear"]>>;
148108
+ reltol: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
148109
+ abstol: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
148110
+ vntol: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
148111
+ }, "strip", zod.ZodTypeAny, {
148112
+ method?: "trap" | "gear" | undefined;
148113
+ reltol?: string | number | undefined;
148114
+ abstol?: string | number | undefined;
148115
+ vntol?: string | number | undefined;
148116
+ }, {
148117
+ method?: "trap" | "gear" | undefined;
148118
+ reltol?: string | number | undefined;
148119
+ abstol?: string | number | undefined;
148120
+ vntol?: string | number | undefined;
148121
+ }>>;
148122
+ }, "strip", zod.ZodTypeAny, {
148091
148123
  simulationType: "spice_transient_analysis";
148092
148124
  duration?: number | undefined;
148125
+ startTime?: number | undefined;
148093
148126
  timePerStep?: number | undefined;
148094
148127
  spiceEngine?: _tscircuit_props.AutocompleteString<"spicey" | "ngspice"> | undefined;
148128
+ spiceOptions?: {
148129
+ method?: "trap" | "gear" | undefined;
148130
+ reltol?: string | number | undefined;
148131
+ abstol?: string | number | undefined;
148132
+ vntol?: string | number | undefined;
148133
+ } | undefined;
148095
148134
  }, {
148096
148135
  duration?: string | number | undefined;
148097
148136
  simulationType?: "spice_transient_analysis" | undefined;
148137
+ startTime?: string | number | undefined;
148098
148138
  timePerStep?: string | number | undefined;
148099
148139
  spiceEngine?: _tscircuit_props.AutocompleteString<"spicey" | "ngspice"> | undefined;
148140
+ spiceOptions?: {
148141
+ method?: "trap" | "gear" | undefined;
148142
+ reltol?: string | number | undefined;
148143
+ abstol?: string | number | undefined;
148144
+ vntol?: string | number | undefined;
148145
+ } | undefined;
148100
148146
  }>;
148101
148147
  };
148102
148148
  doInitialSimulationRender(): void;
@@ -151472,6 +151518,22 @@ declare class VoltageProbe extends PrimitiveComponent<typeof voltageProbeProps>
151472
151518
  connectsTo: z.ZodString;
151473
151519
  referenceTo: z.ZodOptional<z.ZodString>;
151474
151520
  color: z.ZodOptional<z.ZodString>;
151521
+ display: z.ZodOptional<z.ZodObject<{
151522
+ label: z.ZodOptional<z.ZodString>;
151523
+ center: z.ZodOptional<z.ZodNumber>;
151524
+ offsetDivs: z.ZodOptional<z.ZodNumber>;
151525
+ unitsPerDiv: z.ZodOptional<z.ZodNumber>;
151526
+ }, "strip", z.ZodTypeAny, {
151527
+ center?: number | undefined;
151528
+ label?: string | undefined;
151529
+ offsetDivs?: number | undefined;
151530
+ unitsPerDiv?: number | undefined;
151531
+ }, {
151532
+ center?: number | undefined;
151533
+ label?: string | undefined;
151534
+ offsetDivs?: number | undefined;
151535
+ unitsPerDiv?: number | undefined;
151536
+ }>>;
151475
151537
  }, "strip", z.ZodTypeAny, {
151476
151538
  connectsTo: string;
151477
151539
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -152052,6 +152114,12 @@ declare class VoltageProbe extends PrimitiveComponent<typeof voltageProbeProps>
152052
152114
  schSectionName?: string | undefined;
152053
152115
  color?: string | undefined;
152054
152116
  referenceTo?: string | undefined;
152117
+ display?: {
152118
+ center?: number | undefined;
152119
+ label?: string | undefined;
152120
+ offsetDivs?: number | undefined;
152121
+ unitsPerDiv?: number | undefined;
152122
+ } | undefined;
152055
152123
  }, {
152056
152124
  connectsTo: string;
152057
152125
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -152634,6 +152702,12 @@ declare class VoltageProbe extends PrimitiveComponent<typeof voltageProbeProps>
152634
152702
  schSectionName?: string | undefined;
152635
152703
  color?: string | undefined;
152636
152704
  referenceTo?: string | undefined;
152705
+ display?: {
152706
+ center?: number | undefined;
152707
+ label?: string | undefined;
152708
+ offsetDivs?: number | undefined;
152709
+ unitsPerDiv?: number | undefined;
152710
+ } | undefined;
152637
152711
  }>;
152638
152712
  };
152639
152713
  doInitialSimulationRender(): void;
package/dist/index.js CHANGED
@@ -4676,8 +4676,9 @@ function Trace_doInitialPcbManualTraceRender(trace) {
4676
4676
  const subcircuit = trace.getSubcircuit();
4677
4677
  const hasPcbPath = props.pcbPath !== void 0;
4678
4678
  const wantsStraightLine = Boolean(props.pcbStraightLine);
4679
- const inflatedPcbTrace = trace._inflatedPcbTrace;
4680
- if (!hasPcbPath && !wantsStraightLine && !inflatedPcbTrace) return;
4679
+ const inflatedPcbTraces = trace._inflatedPcbTraces ?? [];
4680
+ if (!hasPcbPath && !wantsStraightLine && inflatedPcbTraces.length === 0)
4681
+ return;
4681
4682
  let allPortsFound;
4682
4683
  let ports;
4683
4684
  let portsWithSelectors;
@@ -4730,86 +4731,94 @@ function Trace_doInitialPcbManualTraceRender(trace) {
4730
4731
  return;
4731
4732
  }
4732
4733
  const width = trace._getExplicitTraceThickness() ?? trace.getSubcircuit()._parsedProps.minTraceWidth ?? jlcMinTolerances.min_trace_width;
4733
- if (inflatedPcbTrace) {
4734
+ if (inflatedPcbTraces.length > 0) {
4734
4735
  const { maybeFlipLayer } = trace._getPcbPrimitiveFlippedHelpers();
4735
4736
  const transform2 = trace._computePcbGlobalTransformBeforeLayout();
4736
- const transformedRoute = inflatedPcbTrace.route.map((point6) => {
4737
- if (point6.route_type === "wire") {
4738
- const { x, y, ...restOfPoint } = point6;
4739
- const transformedPoint = applyToPoint2(transform2, { x, y });
4740
- return {
4741
- ...restOfPoint,
4742
- ...transformedPoint,
4743
- layer: maybeFlipLayer(point6.layer)
4744
- };
4745
- }
4746
- if (point6.route_type === "via") {
4747
- const { x, y, ...restOfPoint } = point6;
4748
- const transformedPoint = applyToPoint2(transform2, { x, y });
4737
+ const insertedRoutes = [];
4738
+ for (const inflatedPcbTrace of inflatedPcbTraces) {
4739
+ const transformedRoute = inflatedPcbTrace.route.map((point6) => {
4740
+ if (point6.route_type === "wire") {
4741
+ const { x, y, ...restOfPoint } = point6;
4742
+ const transformedPoint = applyToPoint2(transform2, { x, y });
4743
+ return {
4744
+ ...restOfPoint,
4745
+ ...transformedPoint,
4746
+ layer: maybeFlipLayer(point6.layer)
4747
+ };
4748
+ }
4749
+ if (point6.route_type === "via") {
4750
+ const { x, y, ...restOfPoint } = point6;
4751
+ const transformedPoint = applyToPoint2(transform2, { x, y });
4752
+ return {
4753
+ ...restOfPoint,
4754
+ ...transformedPoint,
4755
+ from_layer: maybeFlipLayer(point6.from_layer),
4756
+ to_layer: maybeFlipLayer(point6.to_layer)
4757
+ };
4758
+ }
4749
4759
  return {
4750
- ...restOfPoint,
4751
- ...transformedPoint,
4752
- from_layer: maybeFlipLayer(point6.from_layer),
4753
- to_layer: maybeFlipLayer(point6.to_layer)
4760
+ ...point6,
4761
+ start: applyToPoint2(transform2, point6.start),
4762
+ end: applyToPoint2(transform2, point6.end),
4763
+ start_layer: maybeFlipLayer(point6.start_layer),
4764
+ end_layer: maybeFlipLayer(point6.end_layer)
4754
4765
  };
4766
+ });
4767
+ const pcb_trace2 = db.pcb_trace.insert({
4768
+ ...inflatedPcbTrace,
4769
+ route: transformedRoute,
4770
+ source_trace_id: trace.source_trace_id,
4771
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
4772
+ pcb_group_id: trace.getGroup()?.pcb_group_id ?? void 0
4773
+ });
4774
+ const pcbStyle2 = trace.getInheritedMergedProperty("pcbStyle");
4775
+ const { holeDiameter: holeDiameter2, padDiameter: padDiameter2 } = getViaDiameterDefaults(pcbStyle2);
4776
+ for (let index = 0; index < transformedRoute.length; index++) {
4777
+ const point6 = transformedRoute[index];
4778
+ if (point6.route_type === "via") {
4779
+ const originalPoint = inflatedPcbTrace.route[index];
4780
+ const inflatedPcbVia = findInflatedPcbViaForPoint(
4781
+ trace._inflatedPcbVias,
4782
+ originalPoint
4783
+ );
4784
+ const routePointViaDiameter = getViaDiameterFromRoutePoint(point6);
4785
+ const fromLayer = maybeFlipLayer(
4786
+ inflatedPcbVia?.from_layer ?? point6.from_layer
4787
+ );
4788
+ const toLayer = maybeFlipLayer(
4789
+ inflatedPcbVia?.to_layer ?? point6.to_layer
4790
+ );
4791
+ const layers = (inflatedPcbVia?.layers ?? [
4792
+ point6.from_layer,
4793
+ point6.to_layer
4794
+ ]).map((layer2) => maybeFlipLayer(layer2));
4795
+ db.pcb_via.insert({
4796
+ pcb_trace_id: pcb_trace2.pcb_trace_id,
4797
+ x: point6.x,
4798
+ y: point6.y,
4799
+ hole_diameter: inflatedPcbVia?.hole_diameter ?? routePointViaDiameter.holeDiameter ?? holeDiameter2,
4800
+ outer_diameter: inflatedPcbVia?.outer_diameter ?? routePointViaDiameter.outerDiameter ?? padDiameter2,
4801
+ layers,
4802
+ from_layer: fromLayer,
4803
+ to_layer: toLayer,
4804
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
4805
+ pcb_group_id: trace.getGroup()?.pcb_group_id ?? void 0,
4806
+ subcircuit_connectivity_map_key: inflatedPcbVia?.subcircuit_connectivity_map_key,
4807
+ net_is_assignable: inflatedPcbVia?.net_is_assignable,
4808
+ net_assigned: inflatedPcbVia?.net_assigned,
4809
+ is_tented: inflatedPcbVia?.is_tented
4810
+ });
4811
+ }
4755
4812
  }
4756
- return {
4757
- ...point6,
4758
- start: applyToPoint2(transform2, point6.start),
4759
- end: applyToPoint2(transform2, point6.end),
4760
- start_layer: maybeFlipLayer(point6.start_layer),
4761
- end_layer: maybeFlipLayer(point6.end_layer)
4762
- };
4763
- });
4764
- const pcb_trace2 = db.pcb_trace.insert({
4765
- ...inflatedPcbTrace,
4766
- route: transformedRoute,
4767
- source_trace_id: trace.source_trace_id,
4768
- subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
4769
- pcb_group_id: trace.getGroup()?.pcb_group_id ?? void 0
4770
- });
4771
- const pcbStyle2 = trace.getInheritedMergedProperty("pcbStyle");
4772
- const { holeDiameter: holeDiameter2, padDiameter: padDiameter2 } = getViaDiameterDefaults(pcbStyle2);
4773
- for (let index = 0; index < transformedRoute.length; index++) {
4774
- const point6 = transformedRoute[index];
4775
- if (point6.route_type === "via") {
4776
- const originalPoint = inflatedPcbTrace.route[index];
4777
- const inflatedPcbVia = findInflatedPcbViaForPoint(
4778
- trace._inflatedPcbVias,
4779
- originalPoint
4780
- );
4781
- const routePointViaDiameter = getViaDiameterFromRoutePoint(point6);
4782
- const fromLayer = maybeFlipLayer(
4783
- inflatedPcbVia?.from_layer ?? point6.from_layer
4784
- );
4785
- const toLayer = maybeFlipLayer(
4786
- inflatedPcbVia?.to_layer ?? point6.to_layer
4787
- );
4788
- const layers = (inflatedPcbVia?.layers ?? [
4789
- point6.from_layer,
4790
- point6.to_layer
4791
- ]).map((layer2) => maybeFlipLayer(layer2));
4792
- db.pcb_via.insert({
4793
- pcb_trace_id: pcb_trace2.pcb_trace_id,
4794
- x: point6.x,
4795
- y: point6.y,
4796
- hole_diameter: inflatedPcbVia?.hole_diameter ?? routePointViaDiameter.holeDiameter ?? holeDiameter2,
4797
- outer_diameter: inflatedPcbVia?.outer_diameter ?? routePointViaDiameter.outerDiameter ?? padDiameter2,
4798
- layers,
4799
- from_layer: fromLayer,
4800
- to_layer: toLayer,
4801
- subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
4802
- pcb_group_id: trace.getGroup()?.pcb_group_id ?? void 0,
4803
- subcircuit_connectivity_map_key: inflatedPcbVia?.subcircuit_connectivity_map_key,
4804
- net_is_assignable: inflatedPcbVia?.net_is_assignable,
4805
- net_assigned: inflatedPcbVia?.net_assigned,
4806
- is_tented: inflatedPcbVia?.is_tented
4807
- });
4813
+ if (!trace.pcb_trace_id) {
4814
+ trace.pcb_trace_id = pcb_trace2.pcb_trace_id;
4808
4815
  }
4816
+ insertedRoutes.push(pcb_trace2.route);
4817
+ }
4818
+ for (const route2 of insertedRoutes) {
4819
+ trace._insertErrorIfTraceIsOutsideBoard(route2, ports);
4809
4820
  }
4810
4821
  trace._portsRoutedOnPcb = ports;
4811
- trace.pcb_trace_id = pcb_trace2.pcb_trace_id;
4812
- trace._insertErrorIfTraceIsOutsideBoard(pcb_trace2.route, ports);
4813
4822
  return;
4814
4823
  }
4815
4824
  if (wantsStraightLine && !hasPcbPath) {
@@ -5178,7 +5187,7 @@ var Trace3 = class extends PrimitiveComponent2 {
5178
5187
  source_trace_id = null;
5179
5188
  pcb_trace_id = null;
5180
5189
  schematic_trace_id = null;
5181
- _inflatedPcbTrace;
5190
+ _inflatedPcbTraces;
5182
5191
  _inflatedPcbVias;
5183
5192
  _portsRoutedOnPcb;
5184
5193
  subcircuit_connectivity_map_key = null;
@@ -14752,6 +14761,55 @@ function inflateSourceDiode(sourceElm, inflatorContext) {
14752
14761
  }
14753
14762
  }
14754
14763
 
14764
+ // lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceFiducial.ts
14765
+ import { fiducialProps } from "@tscircuit/props";
14766
+ var InflatedFiducial = class extends NormalComponent3 {
14767
+ get config() {
14768
+ return {
14769
+ componentName: "Fiducial",
14770
+ zodProps: fiducialProps,
14771
+ sourceFtype: "simple_fiducial"
14772
+ };
14773
+ }
14774
+ doInitialSchematicComponentRender() {
14775
+ }
14776
+ };
14777
+ function inflateSourceFiducial(sourceElm, inflatorContext) {
14778
+ const { injectionDb, subcircuit, groupsMap } = inflatorContext;
14779
+ const pcbElm = injectionDb.pcb_component.getWhere({
14780
+ source_component_id: sourceElm.source_component_id
14781
+ });
14782
+ const { pcbX, pcbY } = getInflatedPcbPlacement({
14783
+ pcbComponent: pcbElm,
14784
+ sourceGroupId: sourceElm.source_group_id,
14785
+ inflatorContext
14786
+ });
14787
+ const fiducial = new InflatedFiducial({
14788
+ name: sourceElm.name,
14789
+ layer: pcbElm?.layer,
14790
+ pcbX,
14791
+ pcbY,
14792
+ pcbRotation: pcbElm?.rotation,
14793
+ doNotPlace: pcbElm?.do_not_place,
14794
+ obstructsWithinBounds: pcbElm?.obstructs_within_bounds
14795
+ });
14796
+ if (pcbElm) {
14797
+ const footprint = inflateFootprintComponent(pcbElm, {
14798
+ ...inflatorContext,
14799
+ normalComponent: fiducial
14800
+ });
14801
+ if (footprint) {
14802
+ fiducial.add(footprint);
14803
+ }
14804
+ }
14805
+ if (sourceElm.source_group_id && groupsMap?.has(sourceElm.source_group_id)) {
14806
+ const group = groupsMap.get(sourceElm.source_group_id);
14807
+ group.add(fiducial);
14808
+ } else {
14809
+ subcircuit.add(fiducial);
14810
+ }
14811
+ }
14812
+
14755
14813
  // lib/components/primitive-components/Group/Group.ts
14756
14814
  import {
14757
14815
  convertSrjToGraphicsObject,
@@ -22732,6 +22790,103 @@ function inflateSourceInductor(sourceElm, inflatorContext) {
22732
22790
  }
22733
22791
  }
22734
22792
 
22793
+ // lib/components/normal-components/Led.ts
22794
+ import { ledProps } from "@tscircuit/props";
22795
+ var Led = class extends NormalComponent3 {
22796
+ get config() {
22797
+ const symbolMap = {
22798
+ laser: "laser_diode"
22799
+ };
22800
+ const variantSymbol = this.props.laser ? "laser" : null;
22801
+ return {
22802
+ schematicSymbolName: variantSymbol ? symbolMap[variantSymbol] : this.props.symbolName ?? "led",
22803
+ componentName: "Led",
22804
+ zodProps: ledProps,
22805
+ sourceFtype: "simple_led"
22806
+ };
22807
+ }
22808
+ initPorts() {
22809
+ super.initPorts({
22810
+ additionalAliases: {
22811
+ pin1: ["anode", "pos", "left"],
22812
+ pin2: ["cathode", "neg", "right"]
22813
+ }
22814
+ });
22815
+ }
22816
+ _getSchematicSymbolDisplayValue() {
22817
+ return this._parsedProps.schDisplayValue || this._parsedProps.color || void 0;
22818
+ }
22819
+ getFootprinterString() {
22820
+ const baseFootprint = super.getFootprinterString();
22821
+ if (baseFootprint && this.props.color) {
22822
+ return `${baseFootprint}_color(${this.props.color})`;
22823
+ }
22824
+ return baseFootprint;
22825
+ }
22826
+ doInitialSourceRender() {
22827
+ const { db } = this.root;
22828
+ const { _parsedProps: props } = this;
22829
+ const source_component = db.source_component.insert({
22830
+ ftype: "simple_led",
22831
+ name: this.name,
22832
+ wave_length: props.wavelength,
22833
+ color: props.color,
22834
+ symbol_display_value: this._getSchematicSymbolDisplayValue(),
22835
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
22836
+ supplier_part_numbers: props.supplierPartNumbers,
22837
+ are_pins_interchangeable: false,
22838
+ display_name: props.displayName
22839
+ });
22840
+ this.source_component_id = source_component.source_component_id;
22841
+ }
22842
+ pos = this.portMap.pin1;
22843
+ anode = this.portMap.pin1;
22844
+ neg = this.portMap.pin2;
22845
+ cathode = this.portMap.pin2;
22846
+ };
22847
+
22848
+ // lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceLed.ts
22849
+ function inflateSourceLed(sourceElm, inflatorContext) {
22850
+ const { injectionDb, subcircuit, groupsMap } = inflatorContext;
22851
+ const pcbElm = injectionDb.pcb_component.getWhere({
22852
+ source_component_id: sourceElm.source_component_id
22853
+ });
22854
+ const cadElm = injectionDb.cad_component.getWhere({
22855
+ source_component_id: sourceElm.source_component_id
22856
+ });
22857
+ const { pcbX, pcbY } = getInflatedPcbPlacement({
22858
+ pcbComponent: pcbElm,
22859
+ sourceGroupId: sourceElm.source_group_id,
22860
+ inflatorContext
22861
+ });
22862
+ const led = new Led({
22863
+ name: sourceElm.name,
22864
+ color: sourceElm.color,
22865
+ wavelength: sourceElm.wavelength ?? sourceElm.wave_length,
22866
+ layer: pcbElm?.layer,
22867
+ pcbX,
22868
+ pcbY,
22869
+ pcbRotation: pcbElm?.rotation,
22870
+ doNotPlace: pcbElm?.do_not_place,
22871
+ obstructsWithinBounds: pcbElm?.obstructs_within_bounds
22872
+ });
22873
+ if (pcbElm) {
22874
+ const footprint = inflateFootprintComponent(pcbElm, {
22875
+ ...inflatorContext,
22876
+ normalComponent: led
22877
+ });
22878
+ if (footprint) {
22879
+ led.add(footprint);
22880
+ }
22881
+ }
22882
+ if (sourceElm.source_group_id && groupsMap?.has(sourceElm.source_group_id)) {
22883
+ const group = groupsMap.get(sourceElm.source_group_id);
22884
+ group.add(led);
22885
+ } else {
22886
+ subcircuit.add(led);
22887
+ }
22888
+ }
22889
+
22735
22890
  // lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourcePort.ts
22736
22891
  function inflateSourcePort(sourcePort, inflatorContext) {
22737
22892
  const { injectionDb, subcircuit } = inflatorContext;
@@ -23076,9 +23231,8 @@ function inflateSourceTrace(sourceTrace, inflatorContext) {
23076
23231
  if (connectedSelectors.length < 2) {
23077
23232
  return;
23078
23233
  }
23079
- const pcbTrace = injectionDb.pcb_trace.getWhere({
23080
- source_trace_id: sourceTrace.source_trace_id
23081
- });
23234
+ const pcbTraces = injectionDb.pcb_trace.list().filter((trace2) => trace2.source_trace_id === sourceTrace.source_trace_id);
23235
+ const pcbTrace = pcbTraces[0];
23082
23236
  let pcbPath;
23083
23237
  if (pcbTrace) {
23084
23238
  pcbPath = pcbTraceRouteToPcbPath(pcbTrace.route);
@@ -23102,8 +23256,10 @@ function inflateSourceTrace(sourceTrace, inflatorContext) {
23102
23256
  traceProps2.pcbStraightLine = true;
23103
23257
  }
23104
23258
  const trace = new Trace3(traceProps2);
23105
- trace._inflatedPcbTrace = pcbTrace ?? void 0;
23106
- trace._inflatedPcbVias = pcbTrace ? injectionDb.pcb_via.list().filter((via) => via.pcb_trace_id === pcbTrace.pcb_trace_id) : void 0;
23259
+ trace._inflatedPcbTraces = pcbTraces.length > 0 ? pcbTraces : void 0;
23260
+ trace._inflatedPcbVias = pcbTrace ? injectionDb.pcb_via.list().filter(
23261
+ (via) => pcbTraces.some((trace2) => via.pcb_trace_id === trace2.pcb_trace_id)
23262
+ ) : void 0;
23107
23263
  subcircuit.add(trace);
23108
23264
  }
23109
23265
 
@@ -23288,6 +23444,12 @@ var inflateCircuitJson = (target, circuitJson, children) => {
23288
23444
  case "simple_diode":
23289
23445
  inflateSourceDiode(sourceComponent, inflationCtx);
23290
23446
  break;
23447
+ case "simple_fiducial":
23448
+ inflateSourceFiducial(sourceComponent, inflationCtx);
23449
+ break;
23450
+ case "simple_led":
23451
+ inflateSourceLed(sourceComponent, inflationCtx);
23452
+ break;
23291
23453
  case "simple_chip":
23292
23454
  inflateSourceChip(sourceComponent, inflationCtx);
23293
23455
  break;
@@ -23566,7 +23728,7 @@ import { identity as identity5 } from "transformation-matrix";
23566
23728
  var package_default = {
23567
23729
  name: "@tscircuit/core",
23568
23730
  type: "module",
23569
- version: "0.0.1325",
23731
+ version: "0.0.1327",
23570
23732
  types: "dist/index.d.ts",
23571
23733
  main: "dist/index.js",
23572
23734
  module: "dist/index.js",
@@ -23613,8 +23775,8 @@ var package_default = {
23613
23775
  "@tscircuit/matchpack": "",
23614
23776
  "@tscircuit/math-utils": "^0.0.36",
23615
23777
  "@tscircuit/miniflex": "^0.0.4",
23616
- "@tscircuit/props": "^0.0.546",
23617
- "@tscircuit/ngspice-spice-engine": "^0.0.13",
23778
+ "@tscircuit/props": "^0.0.549",
23779
+ "@tscircuit/ngspice-spice-engine": "^0.0.15",
23618
23780
  "@tscircuit/schematic-match-adapt": "^0.0.18",
23619
23781
  "@tscircuit/solver-utils": "^0.0.16",
23620
23782
  "@tscircuit/schematic-trace-solver": "^0.0.69",
@@ -23628,22 +23790,21 @@ var package_default = {
23628
23790
  "bun-match-svg": "0.0.12",
23629
23791
  "calculate-elbow": "^0.0.12",
23630
23792
  "chokidar-cli": "^3.0.0",
23631
- "circuit-json": "^0.0.433",
23793
+ "circuit-json": "^0.0.435",
23632
23794
  "circuit-json-to-bpc": "^0.0.13",
23633
23795
  "circuit-json-to-connectivity-map": "^0.0.23",
23634
23796
  "circuit-json-to-gltf": "^0.0.102",
23635
23797
  "circuit-json-to-simple-3d": "^0.0.9",
23636
- "circuit-json-to-spice": "^0.0.37",
23637
- "circuit-to-svg": "^0.0.353",
23798
+ "circuit-json-to-spice": "^0.0.38",
23799
+ "circuit-to-svg": "^0.0.356",
23638
23800
  concurrently: "^9.1.2",
23639
23801
  "connectivity-map": "^1.0.0",
23640
23802
  debug: "^4.3.6",
23641
- "eecircuit-engine": "^1.5.6",
23642
23803
  flatbush: "^4.5.0",
23643
23804
  "graphics-debug": "^0.0.95",
23644
23805
  howfat: "^0.3.8",
23645
- "kicad-to-circuit-json": "^0.0.60",
23646
- kicadts: "^0.0.35",
23806
+ "kicad-to-circuit-json": "^0.0.97",
23807
+ kicadts: "^0.0.47",
23647
23808
  "live-server": "^1.2.2",
23648
23809
  "looks-same": "^9.0.1",
23649
23810
  minicssgrid: "^0.0.9",
@@ -23681,7 +23842,7 @@ var package_default = {
23681
23842
  "calculate-cell-boundaries": "^0.0.13",
23682
23843
  "calculate-packing": "0.0.73",
23683
23844
  "css-select": "5.1.0",
23684
- "format-si-unit": "^0.0.3",
23845
+ "format-si-unit": "^0.0.7",
23685
23846
  nanoid: "^5.0.7",
23686
23847
  "performance-now": "^2.1.0",
23687
23848
  "react-reconciler": "^0.32.0",
@@ -26006,61 +26167,6 @@ var SolderJumper = class extends NormalComponent3 {
26006
26167
  }
26007
26168
  };
26008
26169
 
26009
- // lib/components/normal-components/Led.ts
26010
- import { ledProps } from "@tscircuit/props";
26011
- var Led = class extends NormalComponent3 {
26012
- get config() {
26013
- const symbolMap = {
26014
- laser: "laser_diode"
26015
- };
26016
- const variantSymbol = this.props.laser ? "laser" : null;
26017
- return {
26018
- schematicSymbolName: variantSymbol ? symbolMap[variantSymbol] : this.props.symbolName ?? "led",
26019
- componentName: "Led",
26020
- zodProps: ledProps,
26021
- sourceFtype: "simple_led"
26022
- };
26023
- }
26024
- initPorts() {
26025
- super.initPorts({
26026
- additionalAliases: {
26027
- pin1: ["anode", "pos", "left"],
26028
- pin2: ["cathode", "neg", "right"]
26029
- }
26030
- });
26031
- }
26032
- _getSchematicSymbolDisplayValue() {
26033
- return this._parsedProps.schDisplayValue || this._parsedProps.color || void 0;
26034
- }
26035
- getFootprinterString() {
26036
- const baseFootprint = super.getFootprinterString();
26037
- if (baseFootprint && this.props.color) {
26038
- return `${baseFootprint}_color(${this.props.color})`;
26039
- }
26040
- return baseFootprint;
26041
- }
26042
- doInitialSourceRender() {
26043
- const { db } = this.root;
26044
- const { _parsedProps: props } = this;
26045
- const source_component = db.source_component.insert({
26046
- ftype: "simple_led",
26047
- name: this.name,
26048
- wave_length: props.wavelength,
26049
- color: props.color,
26050
- symbol_display_value: this._getSchematicSymbolDisplayValue(),
26051
- manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
26052
- supplier_part_numbers: props.supplierPartNumbers,
26053
- are_pins_interchangeable: false,
26054
- display_name: props.displayName
26055
- });
26056
- this.source_component_id = source_component.source_component_id;
26057
- }
26058
- pos = this.portMap.pin1;
26059
- anode = this.portMap.pin1;
26060
- neg = this.portMap.pin2;
26061
- cathode = this.portMap.pin2;
26062
- };
26063
-
26064
26170
  // lib/components/normal-components/PowerSource.ts
26065
26171
  import { powerSourceProps } from "@tscircuit/props";
26066
26172
  var PowerSource = class extends NormalComponent3 {
@@ -26164,6 +26270,11 @@ var VoltageSource = class extends NormalComponent3 {
26164
26270
  wave_shape: props.waveShape,
26165
26271
  phase: props.phase,
26166
26272
  duty_cycle: props.dutyCycle,
26273
+ pulse_delay: props.pulseDelay,
26274
+ rise_time: props.riseTime,
26275
+ fall_time: props.fallTime,
26276
+ pulse_width: props.pulseWidth,
26277
+ period: props.period,
26167
26278
  supplier_part_numbers: props.supplierPartNumbers,
26168
26279
  are_pins_interchangeable: true,
26169
26280
  display_name: props.displayName
@@ -26185,7 +26296,12 @@ var VoltageSource = class extends NormalComponent3 {
26185
26296
  peak_to_peak_voltage: props.peakToPeakVoltage,
26186
26297
  wave_shape: props.waveShape,
26187
26298
  phase: props.phase,
26188
- duty_cycle: props.dutyCycle
26299
+ duty_cycle: props.dutyCycle,
26300
+ pulse_delay: props.pulseDelay,
26301
+ rise_time: props.riseTime,
26302
+ fall_time: props.fallTime,
26303
+ pulse_width: props.pulseWidth,
26304
+ period: props.period
26189
26305
  });
26190
26306
  }
26191
26307
  terminal1 = this.portMap.terminal1;
@@ -27891,14 +28007,14 @@ var NetLabel = class extends PrimitiveComponent2 {
27891
28007
  // lib/components/primitive-components/Fiducial.ts
27892
28008
  import "zod";
27893
28009
  import { distance as distance18 } from "circuit-json";
27894
- import { fiducialProps } from "@tscircuit/props";
28010
+ import { fiducialProps as fiducialProps2 } from "@tscircuit/props";
27895
28011
  var Fiducial = class extends PrimitiveComponent2 {
27896
28012
  pcb_smtpad_id = null;
27897
28013
  isPcbPrimitive = true;
27898
28014
  get config() {
27899
28015
  return {
27900
28016
  componentName: "Fiducial",
27901
- zodProps: fiducialProps,
28017
+ zodProps: fiducialProps2,
27902
28018
  sourceFtype: "simple_fiducial"
27903
28019
  };
27904
28020
  }
@@ -29882,7 +29998,6 @@ var SchematicCell = class extends PrimitiveComponent2 {
29882
29998
  import {
29883
29999
  analogSimulationProps
29884
30000
  } from "@tscircuit/props";
29885
- import "zod";
29886
30001
  var AnalogSimulation = class extends PrimitiveComponent2 {
29887
30002
  get config() {
29888
30003
  return {
@@ -29892,14 +30007,16 @@ var AnalogSimulation = class extends PrimitiveComponent2 {
29892
30007
  }
29893
30008
  doInitialSimulationRender() {
29894
30009
  const { db } = this.root;
29895
- const { duration, timePerStep } = this._parsedProps;
30010
+ const { duration, startTime, timePerStep, spiceOptions } = this._parsedProps;
29896
30011
  const durationMs = duration || 10;
29897
30012
  const timePerStepMs = timePerStep || 0.01;
29898
30013
  db.simulation_experiment.insert({
29899
30014
  name: "spice_transient_analysis",
29900
30015
  experiment_type: "spice_transient_analysis",
29901
30016
  end_time_ms: durationMs,
29902
- time_per_step: timePerStepMs
30017
+ start_time_ms: startTime,
30018
+ time_per_step: timePerStepMs,
30019
+ spice_options: spiceOptions
29903
30020
  });
29904
30021
  }
29905
30022
  };
@@ -30041,7 +30158,7 @@ var VoltageProbe = class extends PrimitiveComponent2 {
30041
30158
  }
30042
30159
  doInitialSimulationRender() {
30043
30160
  const { db } = this.root;
30044
- const { connectsTo, name, referenceTo, color } = this._parsedProps;
30161
+ const { connectsTo, name, referenceTo, color, display } = this._parsedProps;
30045
30162
  const subcircuit = this.getSubcircuit();
30046
30163
  if (!subcircuit) {
30047
30164
  this.renderError("VoltageProbe must be inside a subcircuit");
@@ -30115,7 +30232,13 @@ var VoltageProbe = class extends PrimitiveComponent2 {
30115
30232
  reference_input_source_port_id: referencePort?.source_port_id ?? void 0,
30116
30233
  reference_input_source_net_id: referenceNet?.source_net_id ?? void 0,
30117
30234
  subcircuit_id: subcircuit.subcircuit_id || void 0,
30118
- color: this.color
30235
+ color: this.color,
30236
+ display_options: display ? {
30237
+ label: display.label,
30238
+ center: display.center,
30239
+ offset_divs: display.offsetDivs,
30240
+ units_per_div: display.unitsPerDiv
30241
+ } : void 0
30119
30242
  });
30120
30243
  this.simulation_voltage_probe_id = simulation_voltage_probe_id;
30121
30244
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1326",
4
+ "version": "0.0.1328",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -48,8 +48,8 @@
48
48
  "@tscircuit/matchpack": "",
49
49
  "@tscircuit/math-utils": "^0.0.36",
50
50
  "@tscircuit/miniflex": "^0.0.4",
51
- "@tscircuit/props": "^0.0.546",
52
- "@tscircuit/ngspice-spice-engine": "^0.0.13",
51
+ "@tscircuit/props": "^0.0.549",
52
+ "@tscircuit/ngspice-spice-engine": "^0.0.15",
53
53
  "@tscircuit/schematic-match-adapt": "^0.0.18",
54
54
  "@tscircuit/solver-utils": "^0.0.16",
55
55
  "@tscircuit/schematic-trace-solver": "^0.0.69",
@@ -63,22 +63,21 @@
63
63
  "bun-match-svg": "0.0.12",
64
64
  "calculate-elbow": "^0.0.12",
65
65
  "chokidar-cli": "^3.0.0",
66
- "circuit-json": "^0.0.433",
66
+ "circuit-json": "^0.0.435",
67
67
  "circuit-json-to-bpc": "^0.0.13",
68
68
  "circuit-json-to-connectivity-map": "^0.0.23",
69
69
  "circuit-json-to-gltf": "^0.0.102",
70
70
  "circuit-json-to-simple-3d": "^0.0.9",
71
- "circuit-json-to-spice": "^0.0.37",
72
- "circuit-to-svg": "^0.0.353",
71
+ "circuit-json-to-spice": "^0.0.38",
72
+ "circuit-to-svg": "^0.0.356",
73
73
  "concurrently": "^9.1.2",
74
74
  "connectivity-map": "^1.0.0",
75
75
  "debug": "^4.3.6",
76
- "eecircuit-engine": "^1.5.6",
77
76
  "flatbush": "^4.5.0",
78
77
  "graphics-debug": "^0.0.95",
79
78
  "howfat": "^0.3.8",
80
- "kicad-to-circuit-json": "^0.0.60",
81
- "kicadts": "^0.0.35",
79
+ "kicad-to-circuit-json": "^0.0.97",
80
+ "kicadts": "^0.0.47",
82
81
  "live-server": "^1.2.2",
83
82
  "looks-same": "^9.0.1",
84
83
  "minicssgrid": "^0.0.9",
@@ -116,7 +115,7 @@
116
115
  "calculate-cell-boundaries": "^0.0.13",
117
116
  "calculate-packing": "0.0.73",
118
117
  "css-select": "5.1.0",
119
- "format-si-unit": "^0.0.3",
118
+ "format-si-unit": "^0.0.7",
120
119
  "nanoid": "^5.0.7",
121
120
  "performance-now": "^2.1.0",
122
121
  "react-reconciler": "^0.32.0",