@tscircuit/core 0.0.362 → 0.0.363

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
@@ -11430,6 +11430,12 @@ declare const applyPcbEditEventsToManualEditsFile: ({ circuitJson, editEvents, m
11430
11430
  manualEditsFile: z.infer<typeof manual_edits_file>;
11431
11431
  }) => z.infer<typeof manual_edits_file>;
11432
11432
 
11433
+ declare const applySchematicEditEventsToManualEditsFile: ({ circuitJson, editEvents, manualEditsFile, }: {
11434
+ circuitJson: CircuitJson;
11435
+ editEvents: ManualEditEvent[];
11436
+ manualEditsFile: z.infer<typeof manual_edits_file>;
11437
+ }) => z.infer<typeof manual_edits_file>;
11438
+
11433
11439
  interface TscircuitElements {
11434
11440
  resistor: _tscircuit_props.ResistorProps;
11435
11441
  capacitor: _tscircuit_props.CapacitorProps;
@@ -11495,4 +11501,4 @@ declare module "react/jsx-runtime" {
11495
11501
  }
11496
11502
  }
11497
11503
 
11498
- 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 };
11504
+ 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, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -7362,7 +7362,7 @@ import { identity as identity4 } from "transformation-matrix";
7362
7362
  var package_default = {
7363
7363
  name: "@tscircuit/core",
7364
7364
  type: "module",
7365
- version: "0.0.361",
7365
+ version: "0.0.362",
7366
7366
  types: "dist/index.d.ts",
7367
7367
  main: "dist/index.js",
7368
7368
  module: "dist/index.js",
@@ -7807,6 +7807,47 @@ var applyPcbEditEventsToManualEditsFile = ({
7807
7807
  return updatedManualEditsFile;
7808
7808
  };
7809
7809
 
7810
+ // lib/utils/edit-events/apply-schematic-edit-events-to-manual-edits-file.ts
7811
+ import { su as su5 } from "@tscircuit/soup-util";
7812
+ import "zod";
7813
+ var applySchematicEditEventsToManualEditsFile = ({
7814
+ circuitJson,
7815
+ editEvents,
7816
+ manualEditsFile
7817
+ }) => {
7818
+ const updatedManualEditsFile = {
7819
+ ...manualEditsFile,
7820
+ schematic_placements: [...manualEditsFile.schematic_placements ?? []]
7821
+ };
7822
+ for (const editEvent of editEvents) {
7823
+ if (editEvent.edit_event_type === "edit_schematic_component_location") {
7824
+ const { schematic_component_id, new_center } = editEvent;
7825
+ const schematic_component2 = su5(circuitJson).schematic_component.get(
7826
+ schematic_component_id
7827
+ );
7828
+ if (!schematic_component2) continue;
7829
+ const source_component = su5(circuitJson).source_component.get(
7830
+ schematic_component2.source_component_id
7831
+ );
7832
+ if (!source_component) continue;
7833
+ const existingPlacementIndex = updatedManualEditsFile.schematic_placements?.findIndex(
7834
+ (p) => p.selector === source_component.name
7835
+ );
7836
+ const newPlacement = {
7837
+ selector: source_component.name,
7838
+ center: new_center,
7839
+ relative_to: "group_center"
7840
+ };
7841
+ if (existingPlacementIndex >= 0) {
7842
+ updatedManualEditsFile.schematic_placements[existingPlacementIndex] = newPlacement;
7843
+ } else {
7844
+ updatedManualEditsFile.schematic_placements.push(newPlacement);
7845
+ }
7846
+ }
7847
+ }
7848
+ return updatedManualEditsFile;
7849
+ };
7850
+
7810
7851
  // lib/index.ts
7811
7852
  import { createElement } from "react";
7812
7853
 
@@ -7863,6 +7904,7 @@ export {
7863
7904
  Via,
7864
7905
  applyEditEventsToManualEditsFile,
7865
7906
  applyPcbEditEventsToManualEditsFile,
7907
+ applySchematicEditEventsToManualEditsFile,
7866
7908
  createElement,
7867
7909
  createUseComponent,
7868
7910
  getPhaseTimingsFromRenderEvents,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.362",
4
+ "version": "0.0.363",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",