@tscircuit/core 0.0.230 → 0.0.232
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 +9 -3
- package/dist/index.js +43 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _tscircuit_props from '@tscircuit/props';
|
|
2
|
-
import { subcircuitGroupProps, 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, inductorProps, potentiometerProps, pushButtonProps, crystalProps, CapacitorProps, ChipProps, ResistorProps } from '@tscircuit/props';
|
|
2
|
+
import { subcircuitGroupProps, 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, inductorProps, potentiometerProps, pushButtonProps, crystalProps, CapacitorProps, ChipProps, ResistorProps, ManualEditEvent, manual_edit_file } from '@tscircuit/props';
|
|
3
3
|
import React, { ReactElement } from 'react';
|
|
4
4
|
import * as zod from 'zod';
|
|
5
5
|
import { z, ZodType } from 'zod';
|
|
6
6
|
import { symbols, SchSymbol, BaseSymbolName } from 'schematic-symbols';
|
|
7
|
-
import { PcbTraceError, PcbPlacementError, PcbManualEditConflictError, LayerRef, AnyCircuitElement, AnySourceComponent, PcbTrace, RouteHintPoint } from 'circuit-json';
|
|
7
|
+
import { PcbTraceError, PcbPlacementError, PcbManualEditConflictError, LayerRef, AnyCircuitElement, AnySourceComponent, PcbTrace, RouteHintPoint, CircuitJson } from 'circuit-json';
|
|
8
8
|
import { Matrix } from 'transformation-matrix';
|
|
9
9
|
import { SoupUtilObjects } from '@tscircuit/soup-util';
|
|
10
10
|
import * as _tscircuit_layout from '@tscircuit/layout';
|
|
@@ -8377,6 +8377,12 @@ declare const useLed: <PropsFromHook extends Omit<{
|
|
|
8377
8377
|
|
|
8378
8378
|
declare const useResistor: <PropsFromHook extends Omit<ResistorProps, "name"> | undefined = undefined>(name: string, props?: PropsFromHook | undefined) => ComponentWithPins<ResistorProps, "left" | "right" | "pin1" | "pin2", PropsFromHook>;
|
|
8379
8379
|
|
|
8380
|
+
declare const applyEditEventsToManualEditsFile: ({ circuitJson, editEvents, manualEditsFile, }: {
|
|
8381
|
+
circuitJson: CircuitJson;
|
|
8382
|
+
editEvents: ManualEditEvent[];
|
|
8383
|
+
manualEditsFile: z.infer<typeof manual_edit_file>;
|
|
8384
|
+
}) => z.infer<typeof manual_edit_file>;
|
|
8385
|
+
|
|
8380
8386
|
interface TscircuitElements {
|
|
8381
8387
|
resistor: _tscircuit_props.ResistorProps;
|
|
8382
8388
|
capacitor: _tscircuit_props.CapacitorProps;
|
|
@@ -8436,4 +8442,4 @@ declare module "react/jsx-runtime" {
|
|
|
8436
8442
|
}
|
|
8437
8443
|
}
|
|
8438
8444
|
|
|
8439
|
-
export { Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Net, NetAlias, NormalComponent, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, Renderable, Resistor, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, SmtPad, Subcircuit, Trace, TraceHint, Via, createUseComponent, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
|
8445
|
+
export { Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Net, NetAlias, NormalComponent, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, Renderable, Resistor, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, SmtPad, Subcircuit, Trace, TraceHint, Via, applyEditEventsToManualEditsFile, createUseComponent, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
package/dist/index.js
CHANGED
|
@@ -2925,7 +2925,7 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
2925
2925
|
});
|
|
2926
2926
|
const component_name_text = db.schematic_text.insert({
|
|
2927
2927
|
text: props.name ?? "",
|
|
2928
|
-
schematic_component_id: schematic_component2.
|
|
2928
|
+
schematic_component_id: schematic_component2.schematic_component_id,
|
|
2929
2929
|
anchor: "left",
|
|
2930
2930
|
rotation: 0,
|
|
2931
2931
|
position: {
|
|
@@ -6122,6 +6122,47 @@ var useResistor = createUseComponent(
|
|
|
6122
6122
|
resistorPins2
|
|
6123
6123
|
);
|
|
6124
6124
|
|
|
6125
|
+
// lib/utils/edit-events/apply-edit-events-to-manual-edits-file.ts
|
|
6126
|
+
import "zod";
|
|
6127
|
+
import { su as su2 } from "@tscircuit/soup-util";
|
|
6128
|
+
var applyEditEventsToManualEditsFile = ({
|
|
6129
|
+
circuitJson,
|
|
6130
|
+
editEvents,
|
|
6131
|
+
manualEditsFile
|
|
6132
|
+
}) => {
|
|
6133
|
+
const updatedManualEditsFile = {
|
|
6134
|
+
...manualEditsFile,
|
|
6135
|
+
schematic_placements: [...manualEditsFile.schematic_placements ?? []]
|
|
6136
|
+
};
|
|
6137
|
+
for (const editEvent of editEvents) {
|
|
6138
|
+
if (editEvent.edit_event_type === "edit_schematic_component_location") {
|
|
6139
|
+
const { schematic_component_id, new_center } = editEvent;
|
|
6140
|
+
const schematic_component2 = su2(circuitJson).schematic_component.get(
|
|
6141
|
+
schematic_component_id
|
|
6142
|
+
);
|
|
6143
|
+
if (!schematic_component2) continue;
|
|
6144
|
+
const source_component = su2(circuitJson).source_component.get(
|
|
6145
|
+
schematic_component2.source_component_id
|
|
6146
|
+
);
|
|
6147
|
+
if (!source_component) continue;
|
|
6148
|
+
const existingPlacementIndex = updatedManualEditsFile.schematic_placements?.findIndex(
|
|
6149
|
+
(p) => p.selector === source_component.name
|
|
6150
|
+
);
|
|
6151
|
+
const newPlacement = {
|
|
6152
|
+
selector: source_component.name,
|
|
6153
|
+
center: new_center,
|
|
6154
|
+
relative_to: "group_center"
|
|
6155
|
+
};
|
|
6156
|
+
if (existingPlacementIndex >= 0) {
|
|
6157
|
+
updatedManualEditsFile.schematic_placements[existingPlacementIndex] = newPlacement;
|
|
6158
|
+
} else {
|
|
6159
|
+
updatedManualEditsFile.schematic_placements.push(newPlacement);
|
|
6160
|
+
}
|
|
6161
|
+
}
|
|
6162
|
+
}
|
|
6163
|
+
return updatedManualEditsFile;
|
|
6164
|
+
};
|
|
6165
|
+
|
|
6125
6166
|
// lib/register-catalogue.ts
|
|
6126
6167
|
extendCatalogue(components_exports);
|
|
6127
6168
|
extendCatalogue({
|
|
@@ -6168,6 +6209,7 @@ export {
|
|
|
6168
6209
|
Trace,
|
|
6169
6210
|
TraceHint,
|
|
6170
6211
|
Via,
|
|
6212
|
+
applyEditEventsToManualEditsFile,
|
|
6171
6213
|
createUseComponent,
|
|
6172
6214
|
useCapacitor,
|
|
6173
6215
|
useChip,
|
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.232",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"@tscircuit/footprinter": "^0.0.92",
|
|
44
44
|
"@tscircuit/infgrid-ijump-astar": "^0.0.26",
|
|
45
45
|
"@tscircuit/math-utils": "^0.0.5",
|
|
46
|
-
"@tscircuit/props": "^0.0.
|
|
46
|
+
"@tscircuit/props": "^0.0.115",
|
|
47
47
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
48
48
|
"@tscircuit/soup-util": "^0.0.41",
|
|
49
|
-
"circuit-json": "^0.0.
|
|
49
|
+
"circuit-json": "^0.0.117",
|
|
50
50
|
"circuit-json-to-connectivity-map": "^0.0.17",
|
|
51
51
|
"format-si-unit": "^0.0.2",
|
|
52
52
|
"nanoid": "^5.0.7",
|