@tscircuit/core 0.0.364 → 0.0.366
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 +123 -19
- package/dist/index.js +97 -94
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tscircuit_props from '@tscircuit/props';
|
|
2
|
-
import { subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, diodeProps, jumperProps, ledProps, powerSourceProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, holeProps, pcbKeepoutProps, netAliasProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent,
|
|
2
|
+
import { subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, diodeProps, jumperProps, ledProps, powerSourceProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, holeProps, pcbKeepoutProps, netAliasProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
3
3
|
import React, { ReactElement, DetailedHTMLProps, SVGProps } from 'react';
|
|
4
4
|
export { createElement } from 'react';
|
|
5
5
|
import * as zod from 'zod';
|
|
@@ -5596,7 +5596,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
5596
5596
|
isPcbPrimitive: boolean;
|
|
5597
5597
|
get config(): {
|
|
5598
5598
|
componentName: string;
|
|
5599
|
-
zodProps: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<Omit<{
|
|
5599
|
+
zodProps: zod.ZodEffects<zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<Omit<{
|
|
5600
5600
|
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
5601
5601
|
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
5602
5602
|
pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
@@ -5649,19 +5649,23 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
5649
5649
|
shape: zod.ZodLiteral<"oval">;
|
|
5650
5650
|
outerWidth: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
5651
5651
|
outerHeight: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
5652
|
-
holeWidth: zod.ZodEffects<zod.
|
|
5653
|
-
holeHeight: zod.ZodEffects<zod.
|
|
5652
|
+
holeWidth: zod.ZodEffects<zod.ZodType<string | number, zod.ZodTypeDef, string | number>, number | undefined, string | number>;
|
|
5653
|
+
holeHeight: zod.ZodEffects<zod.ZodType<string | number, zod.ZodTypeDef, string | number>, number | undefined, string | number>;
|
|
5654
|
+
innerWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
5655
|
+
innerHeight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
5654
5656
|
portHints: zod.ZodOptional<zod.ZodArray<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, "many">>;
|
|
5655
5657
|
}>, "strip", zod.ZodTypeAny, {
|
|
5656
5658
|
shape: "oval";
|
|
5657
5659
|
outerWidth: number;
|
|
5658
5660
|
outerHeight: number;
|
|
5659
|
-
holeWidth: number;
|
|
5660
|
-
holeHeight: number;
|
|
5661
5661
|
pcbX?: number | undefined;
|
|
5662
5662
|
pcbY?: number | undefined;
|
|
5663
5663
|
name?: string | undefined;
|
|
5664
5664
|
portHints?: (string | number)[] | undefined;
|
|
5665
|
+
holeWidth?: number | undefined;
|
|
5666
|
+
holeHeight?: number | undefined;
|
|
5667
|
+
innerWidth?: number | undefined;
|
|
5668
|
+
innerHeight?: number | undefined;
|
|
5665
5669
|
}, {
|
|
5666
5670
|
shape: "oval";
|
|
5667
5671
|
outerWidth: string | number;
|
|
@@ -5672,6 +5676,8 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
5672
5676
|
pcbY?: string | number | undefined;
|
|
5673
5677
|
name?: string | undefined;
|
|
5674
5678
|
portHints?: (string | number)[] | undefined;
|
|
5679
|
+
innerWidth?: string | number | undefined;
|
|
5680
|
+
innerHeight?: string | number | undefined;
|
|
5675
5681
|
}>, zod.ZodObject<zod.objectUtil.extendShape<Omit<{
|
|
5676
5682
|
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
5677
5683
|
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
@@ -5690,19 +5696,23 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
5690
5696
|
shape: zod.ZodLiteral<"pill">;
|
|
5691
5697
|
outerWidth: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
5692
5698
|
outerHeight: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
5693
|
-
holeWidth: zod.ZodEffects<zod.
|
|
5694
|
-
holeHeight: zod.ZodEffects<zod.
|
|
5699
|
+
holeWidth: zod.ZodEffects<zod.ZodType<string | number, zod.ZodTypeDef, string | number>, number | undefined, string | number>;
|
|
5700
|
+
holeHeight: zod.ZodEffects<zod.ZodType<string | number, zod.ZodTypeDef, string | number>, number | undefined, string | number>;
|
|
5701
|
+
innerWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
5702
|
+
innerHeight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
5695
5703
|
portHints: zod.ZodOptional<zod.ZodArray<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, "many">>;
|
|
5696
5704
|
}>, "strip", zod.ZodTypeAny, {
|
|
5697
5705
|
shape: "pill";
|
|
5698
5706
|
outerWidth: number;
|
|
5699
5707
|
outerHeight: number;
|
|
5700
|
-
holeWidth: number;
|
|
5701
|
-
holeHeight: number;
|
|
5702
5708
|
pcbX?: number | undefined;
|
|
5703
5709
|
pcbY?: number | undefined;
|
|
5704
5710
|
name?: string | undefined;
|
|
5705
5711
|
portHints?: (string | number)[] | undefined;
|
|
5712
|
+
holeWidth?: number | undefined;
|
|
5713
|
+
holeHeight?: number | undefined;
|
|
5714
|
+
innerWidth?: number | undefined;
|
|
5715
|
+
innerHeight?: number | undefined;
|
|
5706
5716
|
}, {
|
|
5707
5717
|
shape: "pill";
|
|
5708
5718
|
outerWidth: string | number;
|
|
@@ -5713,6 +5723,8 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
5713
5723
|
pcbY?: string | number | undefined;
|
|
5714
5724
|
name?: string | undefined;
|
|
5715
5725
|
portHints?: (string | number)[] | undefined;
|
|
5726
|
+
innerWidth?: string | number | undefined;
|
|
5727
|
+
innerHeight?: string | number | undefined;
|
|
5716
5728
|
}>, zod.ZodEffects<zod.ZodObject<zod.objectUtil.extendShape<Omit<{
|
|
5717
5729
|
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
5718
5730
|
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
@@ -5779,7 +5791,93 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
5779
5791
|
portHints?: (string | number)[] | undefined;
|
|
5780
5792
|
holeShape?: "circle" | undefined;
|
|
5781
5793
|
padShape?: "rect" | undefined;
|
|
5782
|
-
}>]
|
|
5794
|
+
}>]>, {
|
|
5795
|
+
shape: "circle";
|
|
5796
|
+
holeDiameter: number;
|
|
5797
|
+
outerDiameter: number;
|
|
5798
|
+
pcbX?: number | undefined;
|
|
5799
|
+
pcbY?: number | undefined;
|
|
5800
|
+
name?: string | undefined;
|
|
5801
|
+
portHints?: (string | number)[] | undefined;
|
|
5802
|
+
} | {
|
|
5803
|
+
shape: "oval";
|
|
5804
|
+
outerWidth: number;
|
|
5805
|
+
outerHeight: number;
|
|
5806
|
+
pcbX?: number | undefined;
|
|
5807
|
+
pcbY?: number | undefined;
|
|
5808
|
+
name?: string | undefined;
|
|
5809
|
+
portHints?: (string | number)[] | undefined;
|
|
5810
|
+
holeWidth?: number | undefined;
|
|
5811
|
+
holeHeight?: number | undefined;
|
|
5812
|
+
innerWidth?: number | undefined;
|
|
5813
|
+
innerHeight?: number | undefined;
|
|
5814
|
+
} | {
|
|
5815
|
+
shape: "pill";
|
|
5816
|
+
outerWidth: number;
|
|
5817
|
+
outerHeight: number;
|
|
5818
|
+
pcbX?: number | undefined;
|
|
5819
|
+
pcbY?: number | undefined;
|
|
5820
|
+
name?: string | undefined;
|
|
5821
|
+
portHints?: (string | number)[] | undefined;
|
|
5822
|
+
holeWidth?: number | undefined;
|
|
5823
|
+
holeHeight?: number | undefined;
|
|
5824
|
+
innerWidth?: number | undefined;
|
|
5825
|
+
innerHeight?: number | undefined;
|
|
5826
|
+
} | {
|
|
5827
|
+
holeDiameter: number;
|
|
5828
|
+
rectPadWidth: number;
|
|
5829
|
+
rectPadHeight: number;
|
|
5830
|
+
pcbX?: number | undefined;
|
|
5831
|
+
pcbY?: number | undefined;
|
|
5832
|
+
name?: string | undefined;
|
|
5833
|
+
shape?: "circularHoleWithRectPad" | undefined;
|
|
5834
|
+
portHints?: (string | number)[] | undefined;
|
|
5835
|
+
holeShape?: "circle" | undefined;
|
|
5836
|
+
padShape?: "rect" | undefined;
|
|
5837
|
+
}, {
|
|
5838
|
+
shape: "circle";
|
|
5839
|
+
holeDiameter: string | number;
|
|
5840
|
+
outerDiameter: string | number;
|
|
5841
|
+
pcbX?: string | number | undefined;
|
|
5842
|
+
pcbY?: string | number | undefined;
|
|
5843
|
+
name?: string | undefined;
|
|
5844
|
+
portHints?: (string | number)[] | undefined;
|
|
5845
|
+
} | {
|
|
5846
|
+
shape: "oval";
|
|
5847
|
+
outerWidth: string | number;
|
|
5848
|
+
outerHeight: string | number;
|
|
5849
|
+
holeWidth: string | number;
|
|
5850
|
+
holeHeight: string | number;
|
|
5851
|
+
pcbX?: string | number | undefined;
|
|
5852
|
+
pcbY?: string | number | undefined;
|
|
5853
|
+
name?: string | undefined;
|
|
5854
|
+
portHints?: (string | number)[] | undefined;
|
|
5855
|
+
innerWidth?: string | number | undefined;
|
|
5856
|
+
innerHeight?: string | number | undefined;
|
|
5857
|
+
} | {
|
|
5858
|
+
shape: "pill";
|
|
5859
|
+
outerWidth: string | number;
|
|
5860
|
+
outerHeight: string | number;
|
|
5861
|
+
holeWidth: string | number;
|
|
5862
|
+
holeHeight: string | number;
|
|
5863
|
+
pcbX?: string | number | undefined;
|
|
5864
|
+
pcbY?: string | number | undefined;
|
|
5865
|
+
name?: string | undefined;
|
|
5866
|
+
portHints?: (string | number)[] | undefined;
|
|
5867
|
+
innerWidth?: string | number | undefined;
|
|
5868
|
+
innerHeight?: string | number | undefined;
|
|
5869
|
+
} | {
|
|
5870
|
+
holeDiameter: string | number;
|
|
5871
|
+
rectPadWidth: string | number;
|
|
5872
|
+
rectPadHeight: string | number;
|
|
5873
|
+
pcbX?: string | number | undefined;
|
|
5874
|
+
pcbY?: string | number | undefined;
|
|
5875
|
+
name?: string | undefined;
|
|
5876
|
+
shape?: "circularHoleWithRectPad" | undefined;
|
|
5877
|
+
portHints?: (string | number)[] | undefined;
|
|
5878
|
+
holeShape?: "circle" | undefined;
|
|
5879
|
+
padShape?: "rect" | undefined;
|
|
5880
|
+
}>;
|
|
5783
5881
|
};
|
|
5784
5882
|
getAvailablePcbLayers(): string[];
|
|
5785
5883
|
getPcbSize(): {
|
|
@@ -11322,8 +11420,8 @@ declare const useResistor: <PropsFromHook extends Omit<ResistorProps, "name"> |
|
|
|
11322
11420
|
declare const applyEditEventsToManualEditsFile: ({ circuitJson, editEvents, manualEditsFile, }: {
|
|
11323
11421
|
circuitJson: CircuitJson;
|
|
11324
11422
|
editEvents: ManualEditEvent[];
|
|
11325
|
-
manualEditsFile:
|
|
11326
|
-
}) =>
|
|
11423
|
+
manualEditsFile: ManualEditsFile;
|
|
11424
|
+
}) => ManualEditsFile;
|
|
11327
11425
|
|
|
11328
11426
|
/**
|
|
11329
11427
|
* This function can only be called in the PcbTraceRender phase or later
|
|
@@ -11382,18 +11480,24 @@ type PolarizedSel = Record<`C${Nums40}` | `L${Nums40}` | `LED${Nums40}` | `D${Nu
|
|
|
11382
11480
|
}>;
|
|
11383
11481
|
type CommonNetNames = "VCC" | "GND" | "VDD" | "PWR" | "V5" | "V3_3";
|
|
11384
11482
|
type TransistorSel = Record<`Q${Nums40}`, Record<TransistorPinNames, string>>;
|
|
11385
|
-
type JumperSel = Record<`J${Nums40}`, Record<PinNumbers100 | CommonPinNames, string>>;
|
|
11483
|
+
type JumperSel = Record<`J${Nums40}` | `CN${Nums40}`, Record<PinNumbers100 | CommonPinNames, string>>;
|
|
11386
11484
|
type ChipSel = Record<`U${Nums40}`, Record<CommonPinNames, string> & ChipFnSel>;
|
|
11387
11485
|
type NetSel = Record<"net", Record<CommonNetNames, string>>;
|
|
11388
|
-
type
|
|
11389
|
-
type
|
|
11390
|
-
|
|
11486
|
+
type ExplicitModuleSel = Record<"subcircuit" | "module" | "group", Record<`S${Nums40}` | `M${Nums40}` | `G${Nums40}`, SelWithoutSubcircuit>>;
|
|
11487
|
+
type GenericConnectionsAndSelectorsSel = Record<string, <CMP_FN extends (props: any) => any>(component: CMP_FN) => CMP_FN extends (props: infer P) => any ? P extends {
|
|
11488
|
+
connections: infer CN;
|
|
11489
|
+
} ? CN : P extends {
|
|
11490
|
+
selectors: infer SEL;
|
|
11491
|
+
} ? SEL extends Record<string, Record<string, string>> ? {
|
|
11492
|
+
[K in keyof SEL]: SEL[K] extends Record<string, string> ? SEL[K] : never;
|
|
11493
|
+
} : never : never : never>;
|
|
11494
|
+
type SelWithoutSubcircuit = NonPolarizedSel & PolarizedSel & TransistorSel & JumperSel & ChipSel & SwSel & NetSel & GenericConnectionsAndSelectorsSel;
|
|
11391
11495
|
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
11392
11496
|
type ChipFn<T extends ChipProps<any>> = (props: T) => any;
|
|
11393
11497
|
type ChipFnSel = <T extends ChipFn<any> | string>(chipFn?: T) => UnionToIntersection<T extends ChipFn<any> ? ChipConnections<T> : T extends string ? {
|
|
11394
11498
|
[K in T]: string;
|
|
11395
11499
|
} : never>;
|
|
11396
|
-
type Sel =
|
|
11500
|
+
type Sel = ExplicitModuleSel & SelWithoutSubcircuit;
|
|
11397
11501
|
declare const sel: Sel;
|
|
11398
11502
|
|
|
11399
11503
|
type AutorouterCompleteEvent = {
|
|
@@ -11501,4 +11605,4 @@ declare module "react/jsx-runtime" {
|
|
|
11501
11605
|
}
|
|
11502
11606
|
}
|
|
11503
11607
|
|
|
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 };
|
|
11608
|
+
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 GenericConnectionsAndSelectorsSel, 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
|
@@ -5404,10 +5404,49 @@ var TraceHint = class extends PrimitiveComponent {
|
|
|
5404
5404
|
}
|
|
5405
5405
|
};
|
|
5406
5406
|
|
|
5407
|
-
// lib/utils/edit-events/apply-edit-events-to-manual-edits-file.ts
|
|
5407
|
+
// lib/utils/edit-events/apply-pcb-edit-events-to-manual-edits-file.ts
|
|
5408
5408
|
import "zod";
|
|
5409
5409
|
import { su } from "@tscircuit/soup-util";
|
|
5410
|
-
var
|
|
5410
|
+
var applyPcbEditEventsToManualEditsFile = ({
|
|
5411
|
+
circuitJson,
|
|
5412
|
+
editEvents,
|
|
5413
|
+
manualEditsFile
|
|
5414
|
+
}) => {
|
|
5415
|
+
const updatedManualEditsFile = {
|
|
5416
|
+
...manualEditsFile,
|
|
5417
|
+
pcb_placements: [...manualEditsFile.pcb_placements ?? []]
|
|
5418
|
+
};
|
|
5419
|
+
for (const editEvent of editEvents) {
|
|
5420
|
+
if (editEvent.edit_event_type === "edit_pcb_component_location") {
|
|
5421
|
+
const { pcb_component_id, new_center } = editEvent;
|
|
5422
|
+
const pcb_component = su(circuitJson).pcb_component.get(pcb_component_id);
|
|
5423
|
+
if (!pcb_component) continue;
|
|
5424
|
+
const source_component = su(circuitJson).source_component.get(
|
|
5425
|
+
pcb_component.source_component_id
|
|
5426
|
+
);
|
|
5427
|
+
if (!source_component) continue;
|
|
5428
|
+
const existingPlacementIndex = updatedManualEditsFile.pcb_placements?.findIndex(
|
|
5429
|
+
(p) => p.selector === source_component.name
|
|
5430
|
+
);
|
|
5431
|
+
const newPlacement = {
|
|
5432
|
+
selector: source_component.name,
|
|
5433
|
+
center: new_center,
|
|
5434
|
+
relative_to: "group_center"
|
|
5435
|
+
};
|
|
5436
|
+
if (existingPlacementIndex >= 0) {
|
|
5437
|
+
updatedManualEditsFile.pcb_placements[existingPlacementIndex] = newPlacement;
|
|
5438
|
+
} else {
|
|
5439
|
+
updatedManualEditsFile.pcb_placements.push(newPlacement);
|
|
5440
|
+
}
|
|
5441
|
+
}
|
|
5442
|
+
}
|
|
5443
|
+
return updatedManualEditsFile;
|
|
5444
|
+
};
|
|
5445
|
+
|
|
5446
|
+
// lib/utils/edit-events/apply-schematic-edit-events-to-manual-edits-file.ts
|
|
5447
|
+
import { su as su2 } from "@tscircuit/soup-util";
|
|
5448
|
+
import "zod";
|
|
5449
|
+
var applySchematicEditEventsToManualEditsFile = ({
|
|
5411
5450
|
circuitJson,
|
|
5412
5451
|
editEvents,
|
|
5413
5452
|
manualEditsFile
|
|
@@ -5419,11 +5458,11 @@ var applyEditEventsToManualEditsFile = ({
|
|
|
5419
5458
|
for (const editEvent of editEvents) {
|
|
5420
5459
|
if (editEvent.edit_event_type === "edit_schematic_component_location") {
|
|
5421
5460
|
const { schematic_component_id, new_center } = editEvent;
|
|
5422
|
-
const schematic_component2 =
|
|
5461
|
+
const schematic_component2 = su2(circuitJson).schematic_component.get(
|
|
5423
5462
|
schematic_component_id
|
|
5424
5463
|
);
|
|
5425
5464
|
if (!schematic_component2) continue;
|
|
5426
|
-
const source_component =
|
|
5465
|
+
const source_component = su2(circuitJson).source_component.get(
|
|
5427
5466
|
schematic_component2.source_component_id
|
|
5428
5467
|
);
|
|
5429
5468
|
if (!source_component) continue;
|
|
@@ -5445,9 +5484,39 @@ var applyEditEventsToManualEditsFile = ({
|
|
|
5445
5484
|
return updatedManualEditsFile;
|
|
5446
5485
|
};
|
|
5447
5486
|
|
|
5487
|
+
// lib/utils/edit-events/apply-edit-events-to-manual-edits-file.ts
|
|
5488
|
+
var applyEditEventsToManualEditsFile = ({
|
|
5489
|
+
circuitJson,
|
|
5490
|
+
editEvents,
|
|
5491
|
+
manualEditsFile
|
|
5492
|
+
}) => {
|
|
5493
|
+
const schematicEditEvents = editEvents.filter(
|
|
5494
|
+
(event) => event.edit_event_type === "edit_schematic_component_location"
|
|
5495
|
+
);
|
|
5496
|
+
const pcbEditEvents = editEvents.filter(
|
|
5497
|
+
(event) => event.edit_event_type === "edit_pcb_component_location"
|
|
5498
|
+
);
|
|
5499
|
+
let updatedManualEditsFile = manualEditsFile;
|
|
5500
|
+
if (schematicEditEvents.length > 0) {
|
|
5501
|
+
updatedManualEditsFile = applySchematicEditEventsToManualEditsFile({
|
|
5502
|
+
circuitJson,
|
|
5503
|
+
editEvents: schematicEditEvents,
|
|
5504
|
+
manualEditsFile: updatedManualEditsFile
|
|
5505
|
+
});
|
|
5506
|
+
}
|
|
5507
|
+
if (pcbEditEvents.length > 0) {
|
|
5508
|
+
updatedManualEditsFile = applyPcbEditEventsToManualEditsFile({
|
|
5509
|
+
circuitJson,
|
|
5510
|
+
editEvents: pcbEditEvents,
|
|
5511
|
+
manualEditsFile: updatedManualEditsFile
|
|
5512
|
+
});
|
|
5513
|
+
}
|
|
5514
|
+
return updatedManualEditsFile;
|
|
5515
|
+
};
|
|
5516
|
+
|
|
5448
5517
|
// lib/utils/autorouting/getSimpleRouteJsonFromCircuitJson.ts
|
|
5449
5518
|
import { getObstaclesFromSoup as getObstaclesFromSoup2 } from "@tscircuit/infgrid-ijump-astar";
|
|
5450
|
-
import { su as
|
|
5519
|
+
import { su as su3 } from "@tscircuit/soup-util";
|
|
5451
5520
|
import {
|
|
5452
5521
|
getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson2
|
|
5453
5522
|
} from "circuit-json-to-connectivity-map";
|
|
@@ -5479,7 +5548,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
5479
5548
|
minTraceWidth = 0.1
|
|
5480
5549
|
}) => {
|
|
5481
5550
|
if (!db && circuitJson) {
|
|
5482
|
-
db =
|
|
5551
|
+
db = su3(circuitJson);
|
|
5483
5552
|
}
|
|
5484
5553
|
if (!db) {
|
|
5485
5554
|
throw new Error("db or circuitJson is required");
|
|
@@ -5498,7 +5567,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
5498
5567
|
(e) => !subcircuit_id || "subcircuit_id" in e && relevantSubcircuitIds.has(e.subcircuit_id)
|
|
5499
5568
|
);
|
|
5500
5569
|
const board = db.pcb_board.list()[0];
|
|
5501
|
-
db =
|
|
5570
|
+
db = su3(subcircuitElements);
|
|
5502
5571
|
const connMap = getFullConnectivityMapFromCircuitJson2(subcircuitElements);
|
|
5503
5572
|
const obstacles = getObstaclesFromSoup2(
|
|
5504
5573
|
[
|
|
@@ -7354,7 +7423,7 @@ var Switch = class extends NormalComponent {
|
|
|
7354
7423
|
};
|
|
7355
7424
|
|
|
7356
7425
|
// lib/RootCircuit.ts
|
|
7357
|
-
import { su as
|
|
7426
|
+
import { su as su4 } from "@tscircuit/soup-util";
|
|
7358
7427
|
import { isValidElement as isValidElement2 } from "react";
|
|
7359
7428
|
import { identity as identity4 } from "transformation-matrix";
|
|
7360
7429
|
|
|
@@ -7362,7 +7431,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
7362
7431
|
var package_default = {
|
|
7363
7432
|
name: "@tscircuit/core",
|
|
7364
7433
|
type: "module",
|
|
7365
|
-
version: "0.0.
|
|
7434
|
+
version: "0.0.365",
|
|
7366
7435
|
types: "dist/index.d.ts",
|
|
7367
7436
|
main: "dist/index.js",
|
|
7368
7437
|
module: "dist/index.js",
|
|
@@ -7419,7 +7488,7 @@ var package_default = {
|
|
|
7419
7488
|
"@tscircuit/circuit-json-util": "^0.0.45",
|
|
7420
7489
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
7421
7490
|
"@tscircuit/math-utils": "^0.0.12",
|
|
7422
|
-
"@tscircuit/props": "^0.0.
|
|
7491
|
+
"@tscircuit/props": "^0.0.170",
|
|
7423
7492
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
7424
7493
|
"@tscircuit/soup-util": "^0.0.41",
|
|
7425
7494
|
"circuit-json": "^0.0.153",
|
|
@@ -7454,7 +7523,7 @@ var RootCircuit = class {
|
|
|
7454
7523
|
_hasRenderedAtleastOnce = false;
|
|
7455
7524
|
constructor() {
|
|
7456
7525
|
this.children = [];
|
|
7457
|
-
this.db =
|
|
7526
|
+
this.db = su4([]);
|
|
7458
7527
|
this.root = this;
|
|
7459
7528
|
}
|
|
7460
7529
|
add(componentOrElm) {
|
|
@@ -7752,13 +7821,27 @@ var sel = new Proxy(
|
|
|
7752
7821
|
}
|
|
7753
7822
|
return `.${prop1} > .${prop2}`;
|
|
7754
7823
|
},
|
|
7755
|
-
// This handles function calls like
|
|
7824
|
+
// This handles function calls like...
|
|
7825
|
+
// - sel.U1(MyChip)
|
|
7826
|
+
// - sel.U1(({ selectors: { U1: { GND: "GND", VCC: "VCC" } } }) => ...)
|
|
7827
|
+
// - sel.U1(({ connections: { GND: "GND", VCC: "VCC" } }) => ...)
|
|
7756
7828
|
apply: (target, _2, args) => {
|
|
7757
7829
|
return new Proxy(
|
|
7758
7830
|
{},
|
|
7759
7831
|
{
|
|
7760
|
-
get: (_3,
|
|
7761
|
-
|
|
7832
|
+
get: (_3, pinOrSubComponentName) => {
|
|
7833
|
+
const pinResult = `.${prop1} > .${pinOrSubComponentName}`;
|
|
7834
|
+
if (prop1.startsWith("U")) {
|
|
7835
|
+
return pinResult;
|
|
7836
|
+
}
|
|
7837
|
+
return new Proxy(new String(pinResult), {
|
|
7838
|
+
get: (_4, nestedProp) => {
|
|
7839
|
+
if (typeof nestedProp === "symbol" || nestedProp === "toString") {
|
|
7840
|
+
return () => pinResult;
|
|
7841
|
+
}
|
|
7842
|
+
return `.${prop1} > .${pinOrSubComponentName} > .${nestedProp}`;
|
|
7843
|
+
}
|
|
7844
|
+
});
|
|
7762
7845
|
}
|
|
7763
7846
|
}
|
|
7764
7847
|
);
|
|
@@ -7768,86 +7851,6 @@ var sel = new Proxy(
|
|
|
7768
7851
|
}
|
|
7769
7852
|
);
|
|
7770
7853
|
|
|
7771
|
-
// lib/utils/edit-events/apply-pcb-edit-events-to-manual-edits-file.ts
|
|
7772
|
-
import "zod";
|
|
7773
|
-
import { su as su4 } from "@tscircuit/soup-util";
|
|
7774
|
-
var applyPcbEditEventsToManualEditsFile = ({
|
|
7775
|
-
circuitJson,
|
|
7776
|
-
editEvents,
|
|
7777
|
-
manualEditsFile
|
|
7778
|
-
}) => {
|
|
7779
|
-
const updatedManualEditsFile = {
|
|
7780
|
-
...manualEditsFile,
|
|
7781
|
-
pcb_placements: [...manualEditsFile.pcb_placements ?? []]
|
|
7782
|
-
};
|
|
7783
|
-
for (const editEvent of editEvents) {
|
|
7784
|
-
if (editEvent.edit_event_type === "edit_pcb_component_location") {
|
|
7785
|
-
const { pcb_component_id, new_center } = editEvent;
|
|
7786
|
-
const pcb_component = su4(circuitJson).pcb_component.get(pcb_component_id);
|
|
7787
|
-
if (!pcb_component) continue;
|
|
7788
|
-
const source_component = su4(circuitJson).source_component.get(
|
|
7789
|
-
pcb_component.source_component_id
|
|
7790
|
-
);
|
|
7791
|
-
if (!source_component) continue;
|
|
7792
|
-
const existingPlacementIndex = updatedManualEditsFile.pcb_placements?.findIndex(
|
|
7793
|
-
(p) => p.selector === source_component.name
|
|
7794
|
-
);
|
|
7795
|
-
const newPlacement = {
|
|
7796
|
-
selector: source_component.name,
|
|
7797
|
-
center: new_center,
|
|
7798
|
-
relative_to: "group_center"
|
|
7799
|
-
};
|
|
7800
|
-
if (existingPlacementIndex >= 0) {
|
|
7801
|
-
updatedManualEditsFile.pcb_placements[existingPlacementIndex] = newPlacement;
|
|
7802
|
-
} else {
|
|
7803
|
-
updatedManualEditsFile.pcb_placements.push(newPlacement);
|
|
7804
|
-
}
|
|
7805
|
-
}
|
|
7806
|
-
}
|
|
7807
|
-
return updatedManualEditsFile;
|
|
7808
|
-
};
|
|
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
|
-
|
|
7851
7854
|
// lib/index.ts
|
|
7852
7855
|
import { createElement } from "react";
|
|
7853
7856
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.366",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@tscircuit/circuit-json-util": "^0.0.45",
|
|
59
59
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
60
60
|
"@tscircuit/math-utils": "^0.0.12",
|
|
61
|
-
"@tscircuit/props": "^0.0.
|
|
61
|
+
"@tscircuit/props": "^0.0.170",
|
|
62
62
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
63
63
|
"@tscircuit/soup-util": "^0.0.41",
|
|
64
64
|
"circuit-json": "^0.0.153",
|