circuit-json 0.0.321 → 0.0.322

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/README.md CHANGED
@@ -2713,17 +2713,19 @@ interface SimulationUnknownExperimentError {
2713
2713
 
2714
2714
  [Source](https://github.com/tscircuit/circuit-json/blob/main/src/simulation/simulation_voltage_probe.ts)
2715
2715
 
2716
- Defines a voltage probe for simulation, connected to a port or a net.
2717
-
2718
2716
  ```typescript
2719
- /** Defines a voltage probe for simulation, connected to a port or a net. */
2717
+ /** Defines a voltage probe for simulation. If a reference input is not provided,
2718
+ * it measures against ground. If a reference input is provided, it measures
2719
+ * the differential voltage between two points. */
2720
2720
  interface SimulationVoltageProbe {
2721
2721
  type: "simulation_voltage_probe"
2722
2722
  simulation_voltage_probe_id: string
2723
2723
  source_component_id?: string
2724
2724
  name?: string
2725
- source_port_id?: string
2726
- source_net_id?: string
2725
+ signal_input_source_port_id?: string
2726
+ signal_input_source_net_id?: string
2727
+ reference_input_source_port_id?: string
2728
+ reference_input_source_net_id?: string
2727
2729
  subcircuit_id?: string
2728
2730
  color?: string
2729
2731
  }
package/dist/index.d.mts CHANGED
@@ -9713,8 +9713,10 @@ declare const simulation_voltage_probe: z.ZodEffects<z.ZodObject<{
9713
9713
  simulation_voltage_probe_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
9714
9714
  source_component_id: z.ZodOptional<z.ZodString>;
9715
9715
  name: z.ZodOptional<z.ZodString>;
9716
- source_port_id: z.ZodOptional<z.ZodString>;
9717
- source_net_id: z.ZodOptional<z.ZodString>;
9716
+ signal_input_source_port_id: z.ZodOptional<z.ZodString>;
9717
+ signal_input_source_net_id: z.ZodOptional<z.ZodString>;
9718
+ reference_input_source_port_id: z.ZodOptional<z.ZodString>;
9719
+ reference_input_source_net_id: z.ZodOptional<z.ZodString>;
9718
9720
  subcircuit_id: z.ZodOptional<z.ZodString>;
9719
9721
  color: z.ZodOptional<z.ZodString>;
9720
9722
  }, "strip", z.ZodTypeAny, {
@@ -9723,48 +9725,60 @@ declare const simulation_voltage_probe: z.ZodEffects<z.ZodObject<{
9723
9725
  name?: string | undefined;
9724
9726
  source_component_id?: string | undefined;
9725
9727
  subcircuit_id?: string | undefined;
9726
- source_port_id?: string | undefined;
9727
- source_net_id?: string | undefined;
9728
9728
  color?: string | undefined;
9729
+ signal_input_source_port_id?: string | undefined;
9730
+ signal_input_source_net_id?: string | undefined;
9731
+ reference_input_source_port_id?: string | undefined;
9732
+ reference_input_source_net_id?: string | undefined;
9729
9733
  }, {
9730
9734
  type: "simulation_voltage_probe";
9731
9735
  name?: string | undefined;
9732
9736
  source_component_id?: string | undefined;
9733
9737
  subcircuit_id?: string | undefined;
9734
- source_port_id?: string | undefined;
9735
- source_net_id?: string | undefined;
9736
9738
  color?: string | undefined;
9737
9739
  simulation_voltage_probe_id?: string | undefined;
9740
+ signal_input_source_port_id?: string | undefined;
9741
+ signal_input_source_net_id?: string | undefined;
9742
+ reference_input_source_port_id?: string | undefined;
9743
+ reference_input_source_net_id?: string | undefined;
9738
9744
  }>, {
9739
9745
  type: "simulation_voltage_probe";
9740
9746
  simulation_voltage_probe_id: string;
9741
9747
  name?: string | undefined;
9742
9748
  source_component_id?: string | undefined;
9743
9749
  subcircuit_id?: string | undefined;
9744
- source_port_id?: string | undefined;
9745
- source_net_id?: string | undefined;
9746
9750
  color?: string | undefined;
9751
+ signal_input_source_port_id?: string | undefined;
9752
+ signal_input_source_net_id?: string | undefined;
9753
+ reference_input_source_port_id?: string | undefined;
9754
+ reference_input_source_net_id?: string | undefined;
9747
9755
  }, {
9748
9756
  type: "simulation_voltage_probe";
9749
9757
  name?: string | undefined;
9750
9758
  source_component_id?: string | undefined;
9751
9759
  subcircuit_id?: string | undefined;
9752
- source_port_id?: string | undefined;
9753
- source_net_id?: string | undefined;
9754
9760
  color?: string | undefined;
9755
9761
  simulation_voltage_probe_id?: string | undefined;
9762
+ signal_input_source_port_id?: string | undefined;
9763
+ signal_input_source_net_id?: string | undefined;
9764
+ reference_input_source_port_id?: string | undefined;
9765
+ reference_input_source_net_id?: string | undefined;
9756
9766
  }>;
9757
9767
  type SimulationVoltageProbeInput = z.input<typeof simulation_voltage_probe>;
9758
9768
  /**
9759
- * Defines a voltage probe for simulation, connected to a port or a net.
9769
+ * Defines a voltage probe for simulation. If a reference input is not provided,
9770
+ * it measures against ground. If a reference input is provided, it measures
9771
+ * the differential voltage between two points.
9760
9772
  */
9761
9773
  interface SimulationVoltageProbe {
9762
9774
  type: "simulation_voltage_probe";
9763
9775
  simulation_voltage_probe_id: string;
9764
9776
  source_component_id?: string;
9765
9777
  name?: string;
9766
- source_port_id?: string;
9767
- source_net_id?: string;
9778
+ signal_input_source_port_id?: string;
9779
+ signal_input_source_net_id?: string;
9780
+ reference_input_source_port_id?: string;
9781
+ reference_input_source_net_id?: string;
9768
9782
  subcircuit_id?: string;
9769
9783
  color?: string;
9770
9784
  }
@@ -20621,8 +20635,10 @@ declare const any_circuit_element: z.ZodUnion<[z.ZodObject<{
20621
20635
  simulation_voltage_probe_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
20622
20636
  source_component_id: z.ZodOptional<z.ZodString>;
20623
20637
  name: z.ZodOptional<z.ZodString>;
20624
- source_port_id: z.ZodOptional<z.ZodString>;
20625
- source_net_id: z.ZodOptional<z.ZodString>;
20638
+ signal_input_source_port_id: z.ZodOptional<z.ZodString>;
20639
+ signal_input_source_net_id: z.ZodOptional<z.ZodString>;
20640
+ reference_input_source_port_id: z.ZodOptional<z.ZodString>;
20641
+ reference_input_source_net_id: z.ZodOptional<z.ZodString>;
20626
20642
  subcircuit_id: z.ZodOptional<z.ZodString>;
20627
20643
  color: z.ZodOptional<z.ZodString>;
20628
20644
  }, "strip", z.ZodTypeAny, {
@@ -20631,36 +20647,44 @@ declare const any_circuit_element: z.ZodUnion<[z.ZodObject<{
20631
20647
  name?: string | undefined;
20632
20648
  source_component_id?: string | undefined;
20633
20649
  subcircuit_id?: string | undefined;
20634
- source_port_id?: string | undefined;
20635
- source_net_id?: string | undefined;
20636
20650
  color?: string | undefined;
20651
+ signal_input_source_port_id?: string | undefined;
20652
+ signal_input_source_net_id?: string | undefined;
20653
+ reference_input_source_port_id?: string | undefined;
20654
+ reference_input_source_net_id?: string | undefined;
20637
20655
  }, {
20638
20656
  type: "simulation_voltage_probe";
20639
20657
  name?: string | undefined;
20640
20658
  source_component_id?: string | undefined;
20641
20659
  subcircuit_id?: string | undefined;
20642
- source_port_id?: string | undefined;
20643
- source_net_id?: string | undefined;
20644
20660
  color?: string | undefined;
20645
20661
  simulation_voltage_probe_id?: string | undefined;
20662
+ signal_input_source_port_id?: string | undefined;
20663
+ signal_input_source_net_id?: string | undefined;
20664
+ reference_input_source_port_id?: string | undefined;
20665
+ reference_input_source_net_id?: string | undefined;
20646
20666
  }>, {
20647
20667
  type: "simulation_voltage_probe";
20648
20668
  simulation_voltage_probe_id: string;
20649
20669
  name?: string | undefined;
20650
20670
  source_component_id?: string | undefined;
20651
20671
  subcircuit_id?: string | undefined;
20652
- source_port_id?: string | undefined;
20653
- source_net_id?: string | undefined;
20654
20672
  color?: string | undefined;
20673
+ signal_input_source_port_id?: string | undefined;
20674
+ signal_input_source_net_id?: string | undefined;
20675
+ reference_input_source_port_id?: string | undefined;
20676
+ reference_input_source_net_id?: string | undefined;
20655
20677
  }, {
20656
20678
  type: "simulation_voltage_probe";
20657
20679
  name?: string | undefined;
20658
20680
  source_component_id?: string | undefined;
20659
20681
  subcircuit_id?: string | undefined;
20660
- source_port_id?: string | undefined;
20661
- source_net_id?: string | undefined;
20662
20682
  color?: string | undefined;
20663
20683
  simulation_voltage_probe_id?: string | undefined;
20684
+ signal_input_source_port_id?: string | undefined;
20685
+ signal_input_source_net_id?: string | undefined;
20686
+ reference_input_source_port_id?: string | undefined;
20687
+ reference_input_source_net_id?: string | undefined;
20664
20688
  }>, z.ZodObject<{
20665
20689
  type: z.ZodLiteral<"simulation_unknown_experiment_error">;
20666
20690
  simulation_unknown_experiment_error_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -28558,8 +28582,10 @@ declare const any_soup_element: z.ZodUnion<[z.ZodObject<{
28558
28582
  simulation_voltage_probe_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
28559
28583
  source_component_id: z.ZodOptional<z.ZodString>;
28560
28584
  name: z.ZodOptional<z.ZodString>;
28561
- source_port_id: z.ZodOptional<z.ZodString>;
28562
- source_net_id: z.ZodOptional<z.ZodString>;
28585
+ signal_input_source_port_id: z.ZodOptional<z.ZodString>;
28586
+ signal_input_source_net_id: z.ZodOptional<z.ZodString>;
28587
+ reference_input_source_port_id: z.ZodOptional<z.ZodString>;
28588
+ reference_input_source_net_id: z.ZodOptional<z.ZodString>;
28563
28589
  subcircuit_id: z.ZodOptional<z.ZodString>;
28564
28590
  color: z.ZodOptional<z.ZodString>;
28565
28591
  }, "strip", z.ZodTypeAny, {
@@ -28568,36 +28594,44 @@ declare const any_soup_element: z.ZodUnion<[z.ZodObject<{
28568
28594
  name?: string | undefined;
28569
28595
  source_component_id?: string | undefined;
28570
28596
  subcircuit_id?: string | undefined;
28571
- source_port_id?: string | undefined;
28572
- source_net_id?: string | undefined;
28573
28597
  color?: string | undefined;
28598
+ signal_input_source_port_id?: string | undefined;
28599
+ signal_input_source_net_id?: string | undefined;
28600
+ reference_input_source_port_id?: string | undefined;
28601
+ reference_input_source_net_id?: string | undefined;
28574
28602
  }, {
28575
28603
  type: "simulation_voltage_probe";
28576
28604
  name?: string | undefined;
28577
28605
  source_component_id?: string | undefined;
28578
28606
  subcircuit_id?: string | undefined;
28579
- source_port_id?: string | undefined;
28580
- source_net_id?: string | undefined;
28581
28607
  color?: string | undefined;
28582
28608
  simulation_voltage_probe_id?: string | undefined;
28609
+ signal_input_source_port_id?: string | undefined;
28610
+ signal_input_source_net_id?: string | undefined;
28611
+ reference_input_source_port_id?: string | undefined;
28612
+ reference_input_source_net_id?: string | undefined;
28583
28613
  }>, {
28584
28614
  type: "simulation_voltage_probe";
28585
28615
  simulation_voltage_probe_id: string;
28586
28616
  name?: string | undefined;
28587
28617
  source_component_id?: string | undefined;
28588
28618
  subcircuit_id?: string | undefined;
28589
- source_port_id?: string | undefined;
28590
- source_net_id?: string | undefined;
28591
28619
  color?: string | undefined;
28620
+ signal_input_source_port_id?: string | undefined;
28621
+ signal_input_source_net_id?: string | undefined;
28622
+ reference_input_source_port_id?: string | undefined;
28623
+ reference_input_source_net_id?: string | undefined;
28592
28624
  }, {
28593
28625
  type: "simulation_voltage_probe";
28594
28626
  name?: string | undefined;
28595
28627
  source_component_id?: string | undefined;
28596
28628
  subcircuit_id?: string | undefined;
28597
- source_port_id?: string | undefined;
28598
- source_net_id?: string | undefined;
28599
28629
  color?: string | undefined;
28600
28630
  simulation_voltage_probe_id?: string | undefined;
28631
+ signal_input_source_port_id?: string | undefined;
28632
+ signal_input_source_net_id?: string | undefined;
28633
+ reference_input_source_port_id?: string | undefined;
28634
+ reference_input_source_net_id?: string | undefined;
28601
28635
  }>, z.ZodObject<{
28602
28636
  type: z.ZodLiteral<"simulation_unknown_experiment_error">;
28603
28637
  simulation_unknown_experiment_error_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
package/dist/index.mjs CHANGED
@@ -2891,18 +2891,48 @@ var simulation_voltage_probe = z130.object({
2891
2891
  ),
2892
2892
  source_component_id: z130.string().optional(),
2893
2893
  name: z130.string().optional(),
2894
- source_port_id: z130.string().optional(),
2895
- source_net_id: z130.string().optional(),
2894
+ signal_input_source_port_id: z130.string().optional(),
2895
+ signal_input_source_net_id: z130.string().optional(),
2896
+ reference_input_source_port_id: z130.string().optional(),
2897
+ reference_input_source_net_id: z130.string().optional(),
2896
2898
  subcircuit_id: z130.string().optional(),
2897
2899
  color: z130.string().optional()
2898
2900
  }).describe(
2899
- "Defines a voltage probe for simulation, connected to a port or a net"
2900
- ).refine(
2901
- (data) => Boolean(data.source_port_id) !== Boolean(data.source_net_id),
2902
- {
2903
- message: "Exactly one of source_port_id or source_net_id must be provided to simulation_voltage_probe"
2901
+ "Defines a voltage probe for simulation. If a reference input is not provided, it measures against ground. If a reference input is provided, it measures the differential voltage between two points."
2902
+ ).superRefine((data, ctx) => {
2903
+ const is_differential = data.reference_input_source_port_id || data.reference_input_source_net_id;
2904
+ if (is_differential) {
2905
+ const has_ports = !!data.signal_input_source_port_id || !!data.reference_input_source_port_id;
2906
+ const has_nets = !!data.signal_input_source_net_id || !!data.reference_input_source_net_id;
2907
+ if (has_ports && has_nets) {
2908
+ ctx.addIssue({
2909
+ code: z130.ZodIssueCode.custom,
2910
+ message: "Cannot mix port and net connections in a differential probe."
2911
+ });
2912
+ } else if (has_ports) {
2913
+ if (!data.signal_input_source_port_id || !data.reference_input_source_port_id) {
2914
+ ctx.addIssue({
2915
+ code: z130.ZodIssueCode.custom,
2916
+ message: "Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."
2917
+ });
2918
+ }
2919
+ } else if (has_nets) {
2920
+ if (!data.signal_input_source_net_id || !data.reference_input_source_net_id) {
2921
+ ctx.addIssue({
2922
+ code: z130.ZodIssueCode.custom,
2923
+ message: "Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."
2924
+ });
2925
+ }
2926
+ }
2927
+ } else {
2928
+ if (!!data.signal_input_source_port_id === !!data.signal_input_source_net_id) {
2929
+ ctx.addIssue({
2930
+ code: z130.ZodIssueCode.custom,
2931
+ message: "A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."
2932
+ });
2933
+ }
2904
2934
  }
2905
- );
2935
+ });
2906
2936
  expectTypesMatch(true);
2907
2937
 
2908
2938
  // src/simulation/simulation_unknown_experiment_error.ts