@tscircuit/core 0.0.412 → 0.0.413
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 +140 -2
- package/dist/index.js +157 -4
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tscircuit_props from '@tscircuit/props';
|
|
2
|
-
import { PlatformConfig, 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, schematicTextProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
2
|
+
import { PlatformConfig, 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, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, schematicTextProps, 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';
|
|
@@ -7255,6 +7255,143 @@ declare class Via extends PrimitiveComponent<typeof viaProps> {
|
|
|
7255
7255
|
doInitialPcbPrimitiveRender(): void;
|
|
7256
7256
|
}
|
|
7257
7257
|
|
|
7258
|
+
declare class Cutout extends PrimitiveComponent<typeof cutoutProps> {
|
|
7259
|
+
pcb_cutout_id: string | null;
|
|
7260
|
+
isPcbPrimitive: boolean;
|
|
7261
|
+
get config(): {
|
|
7262
|
+
componentName: string;
|
|
7263
|
+
zodProps: zod.ZodDiscriminatedUnion<"shape", [zod.ZodObject<Omit<{
|
|
7264
|
+
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
7265
|
+
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
7266
|
+
pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
7267
|
+
layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
7268
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
7269
|
+
}, "strip", zod.ZodTypeAny, {
|
|
7270
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
7271
|
+
}, {
|
|
7272
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
7273
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
7274
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
7275
|
+
}>>;
|
|
7276
|
+
}, "pcbRotation" | "layer"> & {
|
|
7277
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
7278
|
+
shape: zod.ZodLiteral<"rect">;
|
|
7279
|
+
width: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
7280
|
+
height: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
7281
|
+
}, "strip", zod.ZodTypeAny, {
|
|
7282
|
+
shape: "rect";
|
|
7283
|
+
width: number;
|
|
7284
|
+
height: number;
|
|
7285
|
+
pcbX?: number | undefined;
|
|
7286
|
+
pcbY?: number | undefined;
|
|
7287
|
+
name?: string | undefined;
|
|
7288
|
+
}, {
|
|
7289
|
+
shape: "rect";
|
|
7290
|
+
width: string | number;
|
|
7291
|
+
height: string | number;
|
|
7292
|
+
pcbX?: string | number | undefined;
|
|
7293
|
+
pcbY?: string | number | undefined;
|
|
7294
|
+
name?: string | undefined;
|
|
7295
|
+
}>, zod.ZodObject<Omit<{
|
|
7296
|
+
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
7297
|
+
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
7298
|
+
pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
7299
|
+
layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
7300
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
7301
|
+
}, "strip", zod.ZodTypeAny, {
|
|
7302
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
7303
|
+
}, {
|
|
7304
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
7305
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
7306
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
7307
|
+
}>>;
|
|
7308
|
+
}, "pcbRotation" | "layer"> & {
|
|
7309
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
7310
|
+
shape: zod.ZodLiteral<"circle">;
|
|
7311
|
+
radius: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
7312
|
+
}, "strip", zod.ZodTypeAny, {
|
|
7313
|
+
shape: "circle";
|
|
7314
|
+
radius: number;
|
|
7315
|
+
pcbX?: number | undefined;
|
|
7316
|
+
pcbY?: number | undefined;
|
|
7317
|
+
name?: string | undefined;
|
|
7318
|
+
}, {
|
|
7319
|
+
shape: "circle";
|
|
7320
|
+
radius: string | number;
|
|
7321
|
+
pcbX?: string | number | undefined;
|
|
7322
|
+
pcbY?: string | number | undefined;
|
|
7323
|
+
name?: string | undefined;
|
|
7324
|
+
}>, zod.ZodObject<Omit<{
|
|
7325
|
+
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
7326
|
+
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
7327
|
+
pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
7328
|
+
layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
7329
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
7330
|
+
}, "strip", zod.ZodTypeAny, {
|
|
7331
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
7332
|
+
}, {
|
|
7333
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
7334
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
7335
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
7336
|
+
}>>;
|
|
7337
|
+
}, "pcbRotation" | "layer"> & {
|
|
7338
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
7339
|
+
shape: zod.ZodLiteral<"polygon">;
|
|
7340
|
+
points: zod.ZodArray<zod.ZodObject<{
|
|
7341
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
7342
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
7343
|
+
}, "strip", zod.ZodTypeAny, {
|
|
7344
|
+
x: number;
|
|
7345
|
+
y: number;
|
|
7346
|
+
}, {
|
|
7347
|
+
x: string | number;
|
|
7348
|
+
y: string | number;
|
|
7349
|
+
}>, "many">;
|
|
7350
|
+
}, "strip", zod.ZodTypeAny, {
|
|
7351
|
+
shape: "polygon";
|
|
7352
|
+
points: {
|
|
7353
|
+
x: number;
|
|
7354
|
+
y: number;
|
|
7355
|
+
}[];
|
|
7356
|
+
pcbX?: number | undefined;
|
|
7357
|
+
pcbY?: number | undefined;
|
|
7358
|
+
name?: string | undefined;
|
|
7359
|
+
}, {
|
|
7360
|
+
shape: "polygon";
|
|
7361
|
+
points: {
|
|
7362
|
+
x: string | number;
|
|
7363
|
+
y: string | number;
|
|
7364
|
+
}[];
|
|
7365
|
+
pcbX?: string | number | undefined;
|
|
7366
|
+
pcbY?: string | number | undefined;
|
|
7367
|
+
name?: string | undefined;
|
|
7368
|
+
}>]>;
|
|
7369
|
+
};
|
|
7370
|
+
doInitialPcbPrimitiveRender(): void;
|
|
7371
|
+
getPcbSize(): {
|
|
7372
|
+
width: number;
|
|
7373
|
+
height: number;
|
|
7374
|
+
};
|
|
7375
|
+
_getPcbCircuitJsonBounds(): {
|
|
7376
|
+
center: {
|
|
7377
|
+
x: number;
|
|
7378
|
+
y: number;
|
|
7379
|
+
};
|
|
7380
|
+
bounds: {
|
|
7381
|
+
left: number;
|
|
7382
|
+
top: number;
|
|
7383
|
+
right: number;
|
|
7384
|
+
bottom: number;
|
|
7385
|
+
};
|
|
7386
|
+
width: number;
|
|
7387
|
+
height: number;
|
|
7388
|
+
};
|
|
7389
|
+
_setPositionFromLayout(newCenter: {
|
|
7390
|
+
x: number;
|
|
7391
|
+
y: number;
|
|
7392
|
+
}): void;
|
|
7393
|
+
}
|
|
7394
|
+
|
|
7258
7395
|
declare class Battery extends NormalComponent<typeof batteryProps, PassivePorts> {
|
|
7259
7396
|
get config(): {
|
|
7260
7397
|
componentName: string;
|
|
@@ -12221,6 +12358,7 @@ interface TscircuitElements {
|
|
|
12221
12358
|
crystal: _tscircuit_props.CrystalProps;
|
|
12222
12359
|
footprint: any;
|
|
12223
12360
|
silkscreentext: _tscircuit_props.SilkscreenTextProps;
|
|
12361
|
+
cutout: _tscircuit_props.CutoutProps;
|
|
12224
12362
|
silkscreenpath: _tscircuit_props.SilkscreenPathProps;
|
|
12225
12363
|
silkscreenline: _tscircuit_props.SilkscreenLineProps;
|
|
12226
12364
|
silkscreenrect: _tscircuit_props.SilkscreenRectProps;
|
|
@@ -12254,4 +12392,4 @@ declare module "react/jsx-runtime" {
|
|
|
12254
12392
|
}
|
|
12255
12393
|
}
|
|
12256
12394
|
|
|
12257
|
-
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, PcbTrace, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SchematicText, 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 };
|
|
12395
|
+
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, Cutout, Diode, FabricationNotePath, FabricationNoteText, Footprint, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Mosfet, Net, NetAlias, NormalComponent, type Obstacle, PcbTrace, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SchematicText, 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
|
@@ -13,6 +13,7 @@ __export(components_exports, {
|
|
|
13
13
|
Chip: () => Chip,
|
|
14
14
|
Constraint: () => Constraint2,
|
|
15
15
|
Crystal: () => Crystal,
|
|
16
|
+
Cutout: () => Cutout,
|
|
16
17
|
Diode: () => Diode,
|
|
17
18
|
FabricationNotePath: () => FabricationNotePath,
|
|
18
19
|
FabricationNoteText: () => FabricationNoteText,
|
|
@@ -7821,6 +7822,157 @@ var Via = class extends PrimitiveComponent2 {
|
|
|
7821
7822
|
}
|
|
7822
7823
|
};
|
|
7823
7824
|
|
|
7825
|
+
// lib/components/primitive-components/Cutout.ts
|
|
7826
|
+
import { applyToPoint as applyToPoint7 } from "transformation-matrix";
|
|
7827
|
+
import { cutoutProps } from "@tscircuit/props";
|
|
7828
|
+
var Cutout = class extends PrimitiveComponent2 {
|
|
7829
|
+
pcb_cutout_id = null;
|
|
7830
|
+
isPcbPrimitive = true;
|
|
7831
|
+
get config() {
|
|
7832
|
+
return {
|
|
7833
|
+
componentName: "Cutout",
|
|
7834
|
+
zodProps: cutoutProps
|
|
7835
|
+
};
|
|
7836
|
+
}
|
|
7837
|
+
doInitialPcbPrimitiveRender() {
|
|
7838
|
+
if (this.root?.pcbDisabled) return;
|
|
7839
|
+
const { db } = this.root;
|
|
7840
|
+
const { _parsedProps: props } = this;
|
|
7841
|
+
const subcircuit = this.getSubcircuit();
|
|
7842
|
+
const pcb_group_id = this.getGroup()?.pcb_group_id ?? void 0;
|
|
7843
|
+
const globalPosition = this._getGlobalPcbPositionBeforeLayout();
|
|
7844
|
+
let inserted_pcb_cutout = void 0;
|
|
7845
|
+
if (props.shape === "rect") {
|
|
7846
|
+
const rectData = {
|
|
7847
|
+
shape: "rect",
|
|
7848
|
+
center: globalPosition,
|
|
7849
|
+
width: props.width,
|
|
7850
|
+
height: props.height,
|
|
7851
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
7852
|
+
pcb_group_id
|
|
7853
|
+
};
|
|
7854
|
+
inserted_pcb_cutout = db.pcb_cutout.insert(rectData);
|
|
7855
|
+
} else if (props.shape === "circle") {
|
|
7856
|
+
const circleData = {
|
|
7857
|
+
shape: "circle",
|
|
7858
|
+
center: globalPosition,
|
|
7859
|
+
radius: props.radius,
|
|
7860
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
7861
|
+
pcb_group_id
|
|
7862
|
+
};
|
|
7863
|
+
inserted_pcb_cutout = db.pcb_cutout.insert(circleData);
|
|
7864
|
+
} else if (props.shape === "polygon") {
|
|
7865
|
+
const transform = this._computePcbGlobalTransformBeforeLayout();
|
|
7866
|
+
const transformedPoints = props.points.map(
|
|
7867
|
+
(p) => applyToPoint7(transform, p)
|
|
7868
|
+
);
|
|
7869
|
+
const polygonData = {
|
|
7870
|
+
shape: "polygon",
|
|
7871
|
+
points: transformedPoints,
|
|
7872
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
7873
|
+
pcb_group_id
|
|
7874
|
+
};
|
|
7875
|
+
inserted_pcb_cutout = db.pcb_cutout.insert(polygonData);
|
|
7876
|
+
}
|
|
7877
|
+
if (inserted_pcb_cutout) {
|
|
7878
|
+
this.pcb_cutout_id = inserted_pcb_cutout.pcb_cutout_id;
|
|
7879
|
+
}
|
|
7880
|
+
}
|
|
7881
|
+
getPcbSize() {
|
|
7882
|
+
const { _parsedProps: props } = this;
|
|
7883
|
+
if (props.shape === "rect") {
|
|
7884
|
+
return { width: props.width, height: props.height };
|
|
7885
|
+
}
|
|
7886
|
+
if (props.shape === "circle") {
|
|
7887
|
+
return { width: props.radius * 2, height: props.radius * 2 };
|
|
7888
|
+
}
|
|
7889
|
+
if (props.shape === "polygon") {
|
|
7890
|
+
if (props.points.length === 0) return { width: 0, height: 0 };
|
|
7891
|
+
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
7892
|
+
for (const point of props.points) {
|
|
7893
|
+
minX = Math.min(minX, point.x);
|
|
7894
|
+
maxX = Math.max(maxX, point.x);
|
|
7895
|
+
minY = Math.min(minY, point.y);
|
|
7896
|
+
maxY = Math.max(maxY, point.y);
|
|
7897
|
+
}
|
|
7898
|
+
return { width: maxX - minX, height: maxY - minY };
|
|
7899
|
+
}
|
|
7900
|
+
return { width: 0, height: 0 };
|
|
7901
|
+
}
|
|
7902
|
+
_getPcbCircuitJsonBounds() {
|
|
7903
|
+
if (!this.pcb_cutout_id) return super._getPcbCircuitJsonBounds();
|
|
7904
|
+
const { db } = this.root;
|
|
7905
|
+
const cutout = db.pcb_cutout.get(this.pcb_cutout_id);
|
|
7906
|
+
if (!cutout) return super._getPcbCircuitJsonBounds();
|
|
7907
|
+
if (cutout.shape === "rect") {
|
|
7908
|
+
return {
|
|
7909
|
+
center: cutout.center,
|
|
7910
|
+
bounds: {
|
|
7911
|
+
left: cutout.center.x - cutout.width / 2,
|
|
7912
|
+
top: cutout.center.y + cutout.height / 2,
|
|
7913
|
+
// Assuming Y is up
|
|
7914
|
+
right: cutout.center.x + cutout.width / 2,
|
|
7915
|
+
bottom: cutout.center.y - cutout.height / 2
|
|
7916
|
+
},
|
|
7917
|
+
width: cutout.width,
|
|
7918
|
+
height: cutout.height
|
|
7919
|
+
};
|
|
7920
|
+
} else if (cutout.shape === "circle") {
|
|
7921
|
+
return {
|
|
7922
|
+
center: cutout.center,
|
|
7923
|
+
bounds: {
|
|
7924
|
+
left: cutout.center.x - cutout.radius,
|
|
7925
|
+
top: cutout.center.y + cutout.radius,
|
|
7926
|
+
right: cutout.center.x + cutout.radius,
|
|
7927
|
+
bottom: cutout.center.y - cutout.radius
|
|
7928
|
+
},
|
|
7929
|
+
width: cutout.radius * 2,
|
|
7930
|
+
height: cutout.radius * 2
|
|
7931
|
+
};
|
|
7932
|
+
} else if (cutout.shape === "polygon") {
|
|
7933
|
+
if (cutout.points.length === 0) return super._getPcbCircuitJsonBounds();
|
|
7934
|
+
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
7935
|
+
for (const point of cutout.points) {
|
|
7936
|
+
minX = Math.min(minX, point.x);
|
|
7937
|
+
maxX = Math.max(maxX, point.x);
|
|
7938
|
+
minY = Math.min(minY, point.y);
|
|
7939
|
+
maxY = Math.max(maxY, point.y);
|
|
7940
|
+
}
|
|
7941
|
+
return {
|
|
7942
|
+
center: { x: (minX + maxX) / 2, y: (minY + maxY) / 2 },
|
|
7943
|
+
bounds: { left: minX, top: maxY, right: maxX, bottom: minY },
|
|
7944
|
+
width: maxX - minX,
|
|
7945
|
+
height: maxY - minY
|
|
7946
|
+
};
|
|
7947
|
+
}
|
|
7948
|
+
return super._getPcbCircuitJsonBounds();
|
|
7949
|
+
}
|
|
7950
|
+
_setPositionFromLayout(newCenter) {
|
|
7951
|
+
if (!this.pcb_cutout_id) return;
|
|
7952
|
+
const { db } = this.root;
|
|
7953
|
+
const cutout = db.pcb_cutout.get(this.pcb_cutout_id);
|
|
7954
|
+
if (!cutout) return;
|
|
7955
|
+
if (cutout.shape === "rect" || cutout.shape === "circle") {
|
|
7956
|
+
db.pcb_cutout.update(this.pcb_cutout_id, {
|
|
7957
|
+
...cutout,
|
|
7958
|
+
center: newCenter
|
|
7959
|
+
});
|
|
7960
|
+
} else if (cutout.shape === "polygon") {
|
|
7961
|
+
const oldCenter = this._getPcbCircuitJsonBounds().center;
|
|
7962
|
+
const dx = newCenter.x - oldCenter.x;
|
|
7963
|
+
const dy = newCenter.y - oldCenter.y;
|
|
7964
|
+
const newPoints = cutout.points.map((p) => ({
|
|
7965
|
+
x: p.x + dx,
|
|
7966
|
+
y: p.y + dy
|
|
7967
|
+
}));
|
|
7968
|
+
db.pcb_cutout.update(this.pcb_cutout_id, {
|
|
7969
|
+
...cutout,
|
|
7970
|
+
points: newPoints
|
|
7971
|
+
});
|
|
7972
|
+
}
|
|
7973
|
+
}
|
|
7974
|
+
};
|
|
7975
|
+
|
|
7824
7976
|
// lib/components/normal-components/Battery.ts
|
|
7825
7977
|
import { batteryProps } from "@tscircuit/props";
|
|
7826
7978
|
var Battery = class extends NormalComponent {
|
|
@@ -8257,7 +8409,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
8257
8409
|
var package_default = {
|
|
8258
8410
|
name: "@tscircuit/core",
|
|
8259
8411
|
type: "module",
|
|
8260
|
-
version: "0.0.
|
|
8412
|
+
version: "0.0.412",
|
|
8261
8413
|
types: "dist/index.d.ts",
|
|
8262
8414
|
main: "dist/index.js",
|
|
8263
8415
|
module: "dist/index.js",
|
|
@@ -8291,7 +8443,7 @@ var package_default = {
|
|
|
8291
8443
|
"@types/react-reconciler": "^0.28.9",
|
|
8292
8444
|
"bun-match-svg": "0.0.8",
|
|
8293
8445
|
"chokidar-cli": "^3.0.0",
|
|
8294
|
-
"circuit-to-svg": "^0.0.
|
|
8446
|
+
"circuit-to-svg": "^0.0.127",
|
|
8295
8447
|
concurrently: "^9.1.2",
|
|
8296
8448
|
debug: "^4.3.6",
|
|
8297
8449
|
"graphics-debug": "^0.0.4",
|
|
@@ -8308,10 +8460,10 @@ var package_default = {
|
|
|
8308
8460
|
"@tscircuit/circuit-json-util": "^0.0.47",
|
|
8309
8461
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
8310
8462
|
"@tscircuit/math-utils": "^0.0.18",
|
|
8311
|
-
"@tscircuit/props": "^0.0.
|
|
8463
|
+
"@tscircuit/props": "^0.0.184",
|
|
8312
8464
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
8313
8465
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
8314
|
-
"circuit-json": "^0.0.
|
|
8466
|
+
"circuit-json": "^0.0.180",
|
|
8315
8467
|
"schematic-symbols": "^0.0.132"
|
|
8316
8468
|
},
|
|
8317
8469
|
peerDependencies: {
|
|
@@ -8706,6 +8858,7 @@ export {
|
|
|
8706
8858
|
Circuit,
|
|
8707
8859
|
Constraint2 as Constraint,
|
|
8708
8860
|
Crystal,
|
|
8861
|
+
Cutout,
|
|
8709
8862
|
Diode,
|
|
8710
8863
|
FabricationNotePath,
|
|
8711
8864
|
FabricationNoteText,
|
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.413",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@types/react-reconciler": "^0.28.9",
|
|
36
36
|
"bun-match-svg": "0.0.8",
|
|
37
37
|
"chokidar-cli": "^3.0.0",
|
|
38
|
-
"circuit-to-svg": "^0.0.
|
|
38
|
+
"circuit-to-svg": "^0.0.127",
|
|
39
39
|
"concurrently": "^9.1.2",
|
|
40
40
|
"debug": "^4.3.6",
|
|
41
41
|
"graphics-debug": "^0.0.4",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"@tscircuit/circuit-json-util": "^0.0.47",
|
|
53
53
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
54
54
|
"@tscircuit/math-utils": "^0.0.18",
|
|
55
|
-
"@tscircuit/props": "^0.0.
|
|
55
|
+
"@tscircuit/props": "^0.0.184",
|
|
56
56
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
57
57
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
58
|
-
"circuit-json": "^0.0.
|
|
58
|
+
"circuit-json": "^0.0.180",
|
|
59
59
|
"schematic-symbols": "^0.0.132"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|