@tscircuit/core 0.0.355 → 0.0.356

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
@@ -11556,6 +11556,12 @@ interface GenericLocalAutorouter {
11556
11556
  solveSync(): SimplifiedPcbTrace[];
11557
11557
  }
11558
11558
 
11559
+ declare const applyPcbEditEventsToManualEditsFile: ({ circuitJson, editEvents, manualEditsFile, }: {
11560
+ circuitJson: CircuitJson;
11561
+ editEvents: ManualEditEvent[];
11562
+ manualEditsFile: z.infer<typeof manual_edits_file>;
11563
+ }) => z.infer<typeof manual_edits_file>;
11564
+
11559
11565
  interface TscircuitElements {
11560
11566
  resistor: _tscircuit_props.ResistorProps;
11561
11567
  capacitor: _tscircuit_props.CapacitorProps;
@@ -11621,4 +11627,4 @@ declare module "react/jsx-runtime" {
11621
11627
  }
11622
11628
  }
11623
11629
 
11624
- export { type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Mosfet, Net, NetAlias, NormalComponent, type Obstacle, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, Subcircuit, Switch, Trace, TraceHint, Transistor, Via, applyEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
11630
+ export { type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Mosfet, Net, NetAlias, NormalComponent, type Obstacle, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, Subcircuit, Switch, Trace, TraceHint, Transistor, Via, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -7321,7 +7321,7 @@ import { identity as identity4 } from "transformation-matrix";
7321
7321
  var package_default = {
7322
7322
  name: "@tscircuit/core",
7323
7323
  type: "module",
7324
- version: "0.0.354",
7324
+ version: "0.0.355",
7325
7325
  types: "dist/index.d.ts",
7326
7326
  main: "dist/index.js",
7327
7327
  module: "dist/index.js",
@@ -7725,6 +7725,45 @@ var sel = new Proxy(
7725
7725
  }
7726
7726
  );
7727
7727
 
7728
+ // lib/utils/edit-events/apply-pcb-edit-events-to-manual-edits-file.ts
7729
+ import "zod";
7730
+ import { su as su4 } from "@tscircuit/soup-util";
7731
+ var applyPcbEditEventsToManualEditsFile = ({
7732
+ circuitJson,
7733
+ editEvents,
7734
+ manualEditsFile
7735
+ }) => {
7736
+ const updatedManualEditsFile = {
7737
+ ...manualEditsFile,
7738
+ pcb_placements: [...manualEditsFile.pcb_placements ?? []]
7739
+ };
7740
+ for (const editEvent of editEvents) {
7741
+ if (editEvent.edit_event_type === "edit_pcb_component_location") {
7742
+ const { pcb_component_id, new_center } = editEvent;
7743
+ const pcb_component = su4(circuitJson).pcb_component.get(pcb_component_id);
7744
+ if (!pcb_component) continue;
7745
+ const source_component = su4(circuitJson).source_component.get(
7746
+ pcb_component.source_component_id
7747
+ );
7748
+ if (!source_component) continue;
7749
+ const existingPlacementIndex = updatedManualEditsFile.pcb_placements?.findIndex(
7750
+ (p) => p.selector === source_component.name
7751
+ );
7752
+ const newPlacement = {
7753
+ selector: source_component.name,
7754
+ center: new_center,
7755
+ relative_to: "group_center"
7756
+ };
7757
+ if (existingPlacementIndex >= 0) {
7758
+ updatedManualEditsFile.pcb_placements[existingPlacementIndex] = newPlacement;
7759
+ } else {
7760
+ updatedManualEditsFile.pcb_placements.push(newPlacement);
7761
+ }
7762
+ }
7763
+ }
7764
+ return updatedManualEditsFile;
7765
+ };
7766
+
7728
7767
  // lib/index.ts
7729
7768
  import { createElement } from "react";
7730
7769
 
@@ -7780,6 +7819,7 @@ export {
7780
7819
  Transistor,
7781
7820
  Via,
7782
7821
  applyEditEventsToManualEditsFile,
7822
+ applyPcbEditEventsToManualEditsFile,
7783
7823
  createElement,
7784
7824
  createUseComponent,
7785
7825
  getPhaseTimingsFromRenderEvents,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.355",
4
+ "version": "0.0.356",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",