@tscircuit/core 0.0.367 → 0.0.369
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 +11 -1
- package/dist/index.js +83 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1041,6 +1041,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
1041
1041
|
|
|
1042
1042
|
declare class Board extends Group<typeof boardProps> {
|
|
1043
1043
|
pcb_board_id: string | null;
|
|
1044
|
+
_drcChecksComplete: boolean;
|
|
1044
1045
|
get isSubcircuit(): boolean;
|
|
1045
1046
|
get config(): {
|
|
1046
1047
|
componentName: string;
|
|
@@ -1667,6 +1668,7 @@ declare class Board extends Group<typeof boardProps> {
|
|
|
1667
1668
|
removePcbComponentRender(): void;
|
|
1668
1669
|
_computePcbGlobalTransformBeforeLayout(): Matrix;
|
|
1669
1670
|
doInitialPcbDesignRuleChecks(): void;
|
|
1671
|
+
updatePcbDesignRuleChecks(): void;
|
|
1670
1672
|
}
|
|
1671
1673
|
|
|
1672
1674
|
declare class Capacitor extends NormalComponent<typeof capacitorProps, PassivePorts> {
|
|
@@ -11546,6 +11548,14 @@ declare const applySchematicEditEventsToManualEditsFile: ({ circuitJson, editEve
|
|
|
11546
11548
|
manualEditsFile: z.infer<typeof manual_edits_file>;
|
|
11547
11549
|
}) => z.infer<typeof manual_edits_file>;
|
|
11548
11550
|
|
|
11551
|
+
/**
|
|
11552
|
+
* Applies edit events directly to a CircuitJson object
|
|
11553
|
+
*/
|
|
11554
|
+
declare const applyEditEvents: ({ circuitJson, editEvents, }: {
|
|
11555
|
+
circuitJson: CircuitJson;
|
|
11556
|
+
editEvents: ManualEditEvent[];
|
|
11557
|
+
}) => CircuitJson;
|
|
11558
|
+
|
|
11549
11559
|
interface TscircuitElements {
|
|
11550
11560
|
resistor: _tscircuit_props.ResistorProps;
|
|
11551
11561
|
capacitor: _tscircuit_props.CapacitorProps;
|
|
@@ -11611,4 +11621,4 @@ declare module "react/jsx-runtime" {
|
|
|
11611
11621
|
}
|
|
11612
11622
|
}
|
|
11613
11623
|
|
|
11614
|
-
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 };
|
|
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 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, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
package/dist/index.js
CHANGED
|
@@ -6234,6 +6234,7 @@ var Group = class extends NormalComponent {
|
|
|
6234
6234
|
import { checkEachPcbTraceNonOverlapping as checkEachPcbTraceNonOverlapping2 } from "@tscircuit/checks";
|
|
6235
6235
|
var Board = class extends Group {
|
|
6236
6236
|
pcb_board_id = null;
|
|
6237
|
+
_drcChecksComplete = false;
|
|
6237
6238
|
get isSubcircuit() {
|
|
6238
6239
|
return true;
|
|
6239
6240
|
}
|
|
@@ -6331,8 +6332,15 @@ var Board = class extends Group {
|
|
|
6331
6332
|
doInitialPcbDesignRuleChecks() {
|
|
6332
6333
|
if (this.root?.pcbDisabled) return;
|
|
6333
6334
|
if (this.getInheritedProperty("routingDisabled")) return;
|
|
6334
|
-
const { db } = this.root;
|
|
6335
6335
|
super.doInitialPcbDesignRuleChecks();
|
|
6336
|
+
}
|
|
6337
|
+
updatePcbDesignRuleChecks() {
|
|
6338
|
+
if (this.root?.pcbDisabled) return;
|
|
6339
|
+
if (this.getInheritedProperty("routingDisabled")) return;
|
|
6340
|
+
const { db } = this.root;
|
|
6341
|
+
if (!this._areChildSubcircuitsRouted()) return;
|
|
6342
|
+
if (this._drcChecksComplete) return;
|
|
6343
|
+
this._drcChecksComplete = true;
|
|
6336
6344
|
const errors = checkEachPcbTraceNonOverlapping2(db.toArray());
|
|
6337
6345
|
for (const error of errors) {
|
|
6338
6346
|
db.pcb_trace_error.insert(error);
|
|
@@ -7433,7 +7441,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
7433
7441
|
var package_default = {
|
|
7434
7442
|
name: "@tscircuit/core",
|
|
7435
7443
|
type: "module",
|
|
7436
|
-
version: "0.0.
|
|
7444
|
+
version: "0.0.368",
|
|
7437
7445
|
types: "dist/index.d.ts",
|
|
7438
7446
|
main: "dist/index.js",
|
|
7439
7447
|
module: "dist/index.js",
|
|
@@ -7853,6 +7861,78 @@ var sel = new Proxy(
|
|
|
7853
7861
|
}
|
|
7854
7862
|
);
|
|
7855
7863
|
|
|
7864
|
+
// lib/utils/edit-events/apply-edit-events-to-circuit-json.ts
|
|
7865
|
+
import { transformPCBElement } from "@tscircuit/soup-util";
|
|
7866
|
+
import { translate as translate3 } from "transformation-matrix";
|
|
7867
|
+
|
|
7868
|
+
// lib/utils/edit-events/apply-trace-hint-edit-event.ts
|
|
7869
|
+
import { su as su5 } from "@tscircuit/soup-util";
|
|
7870
|
+
var applyTraceHintEditEvent = (circuitJson, edit_event) => {
|
|
7871
|
+
const existingTraceHint = su5(circuitJson).pcb_trace_hint.get(
|
|
7872
|
+
edit_event.pcb_trace_hint_id
|
|
7873
|
+
);
|
|
7874
|
+
if (existingTraceHint) {
|
|
7875
|
+
circuitJson = circuitJson.map(
|
|
7876
|
+
(e) => e.pcb_trace_hint_id === edit_event.pcb_trace_hint_id ? {
|
|
7877
|
+
...e,
|
|
7878
|
+
route: edit_event.route
|
|
7879
|
+
} : e
|
|
7880
|
+
);
|
|
7881
|
+
} else {
|
|
7882
|
+
const pcbPort = su5(circuitJson).pcb_port.get(edit_event.pcb_port_id);
|
|
7883
|
+
circuitJson = circuitJson.filter(
|
|
7884
|
+
(e) => !(e.type === "pcb_trace_hint" && e.pcb_port_id === edit_event.pcb_port_id)
|
|
7885
|
+
).concat([
|
|
7886
|
+
{
|
|
7887
|
+
type: "pcb_trace_hint",
|
|
7888
|
+
pcb_trace_hint_id: edit_event.pcb_trace_hint_id,
|
|
7889
|
+
route: edit_event.route,
|
|
7890
|
+
pcb_port_id: edit_event.pcb_port_id,
|
|
7891
|
+
pcb_component_id: pcbPort?.pcb_component_id
|
|
7892
|
+
}
|
|
7893
|
+
]);
|
|
7894
|
+
}
|
|
7895
|
+
return circuitJson;
|
|
7896
|
+
};
|
|
7897
|
+
|
|
7898
|
+
// lib/utils/edit-events/apply-edit-events-to-circuit-json.ts
|
|
7899
|
+
var applyEditEvents = ({
|
|
7900
|
+
circuitJson,
|
|
7901
|
+
editEvents
|
|
7902
|
+
}) => {
|
|
7903
|
+
circuitJson = JSON.parse(JSON.stringify(circuitJson));
|
|
7904
|
+
for (const editEvent of editEvents) {
|
|
7905
|
+
if (editEvent.edit_event_type === "edit_pcb_component_location") {
|
|
7906
|
+
const component = circuitJson.find(
|
|
7907
|
+
(e) => e.type === "pcb_component" && e.pcb_component_id === editEvent.pcb_component_id
|
|
7908
|
+
);
|
|
7909
|
+
const needsMovement = !component || component.center.x !== editEvent.new_center.x || component.center.y !== editEvent.new_center.y;
|
|
7910
|
+
if (needsMovement && editEvent.original_center) {
|
|
7911
|
+
const mat = translate3(
|
|
7912
|
+
editEvent.new_center.x - editEvent.original_center.x,
|
|
7913
|
+
editEvent.new_center.y - editEvent.original_center.y
|
|
7914
|
+
);
|
|
7915
|
+
circuitJson = circuitJson.map(
|
|
7916
|
+
(e) => e.pcb_component_id !== editEvent.pcb_component_id ? e : transformPCBElement(e, mat)
|
|
7917
|
+
);
|
|
7918
|
+
}
|
|
7919
|
+
} else if (editEvent.edit_event_type === "edit_schematic_component_location") {
|
|
7920
|
+
circuitJson = circuitJson.map((e) => {
|
|
7921
|
+
if (e.type === "schematic_component" && e.schematic_component_id === editEvent.schematic_component_id) {
|
|
7922
|
+
return {
|
|
7923
|
+
...e,
|
|
7924
|
+
center: editEvent.new_center
|
|
7925
|
+
};
|
|
7926
|
+
}
|
|
7927
|
+
return e;
|
|
7928
|
+
});
|
|
7929
|
+
} else if (editEvent.edit_event_type === "edit_pcb_trace_hint") {
|
|
7930
|
+
circuitJson = applyTraceHintEditEvent(circuitJson, editEvent);
|
|
7931
|
+
}
|
|
7932
|
+
}
|
|
7933
|
+
return circuitJson;
|
|
7934
|
+
};
|
|
7935
|
+
|
|
7856
7936
|
// lib/index.ts
|
|
7857
7937
|
import { createElement } from "react";
|
|
7858
7938
|
|
|
@@ -7907,6 +7987,7 @@ export {
|
|
|
7907
7987
|
TraceHint,
|
|
7908
7988
|
Transistor,
|
|
7909
7989
|
Via,
|
|
7990
|
+
applyEditEvents,
|
|
7910
7991
|
applyEditEventsToManualEditsFile,
|
|
7911
7992
|
applyPcbEditEventsToManualEditsFile,
|
|
7912
7993
|
applySchematicEditEventsToManualEditsFile,
|