@tscircuit/core 0.0.740 → 0.0.742
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 +105 -2
- package/dist/index.js +165 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as circuit_json from 'circuit-json';
|
|
2
2
|
import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, LayerRef, AnyCircuitElement, Size, AnySourceComponent, PcbTraceRoutePoint, PcbTrace as PcbTrace$1, PcbVia, SchematicPort, SchematicComponent, RouteHintPoint, CircuitJson } from 'circuit-json';
|
|
3
3
|
import * as _tscircuit_props from '@tscircuit/props';
|
|
4
|
-
import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, solderjumperProps, ledProps, powerSourceProps, CommonComponentProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, copperPourProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicBoxProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
4
|
+
import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, solderjumperProps, ledProps, powerSourceProps, CommonComponentProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, copperPourProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicBoxProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import react__default, { ReactElement, DetailedHTMLProps, SVGProps } from 'react';
|
|
7
7
|
export { createElement } from 'react';
|
|
@@ -32389,6 +32389,107 @@ declare class SchematicRect extends PrimitiveComponent<typeof schematicRectProps
|
|
|
32389
32389
|
doInitialSchematicPrimitiveRender(): void;
|
|
32390
32390
|
}
|
|
32391
32391
|
|
|
32392
|
+
declare class SchematicArc extends PrimitiveComponent<typeof schematicArcProps> {
|
|
32393
|
+
isSchematicPrimitive: boolean;
|
|
32394
|
+
get config(): {
|
|
32395
|
+
componentName: string;
|
|
32396
|
+
zodProps: zod.ZodObject<{
|
|
32397
|
+
center: zod.ZodObject<{
|
|
32398
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
32399
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
32400
|
+
}, "strip", zod.ZodTypeAny, {
|
|
32401
|
+
x: number;
|
|
32402
|
+
y: number;
|
|
32403
|
+
}, {
|
|
32404
|
+
x: string | number;
|
|
32405
|
+
y: string | number;
|
|
32406
|
+
}>;
|
|
32407
|
+
radius: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
32408
|
+
startAngleDegrees: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
32409
|
+
endAngleDegrees: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
32410
|
+
direction: zod.ZodDefault<zod.ZodEnum<["clockwise", "counterclockwise"]>>;
|
|
32411
|
+
strokeWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
32412
|
+
color: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
|
|
32413
|
+
isDashed: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
|
|
32414
|
+
}, "strip", zod.ZodTypeAny, {
|
|
32415
|
+
direction: "clockwise" | "counterclockwise";
|
|
32416
|
+
center: {
|
|
32417
|
+
x: number;
|
|
32418
|
+
y: number;
|
|
32419
|
+
};
|
|
32420
|
+
color: string;
|
|
32421
|
+
radius: number;
|
|
32422
|
+
startAngleDegrees: number;
|
|
32423
|
+
endAngleDegrees: number;
|
|
32424
|
+
isDashed: boolean;
|
|
32425
|
+
strokeWidth?: number | undefined;
|
|
32426
|
+
}, {
|
|
32427
|
+
center: {
|
|
32428
|
+
x: string | number;
|
|
32429
|
+
y: string | number;
|
|
32430
|
+
};
|
|
32431
|
+
radius: string | number;
|
|
32432
|
+
startAngleDegrees: string | number;
|
|
32433
|
+
endAngleDegrees: string | number;
|
|
32434
|
+
direction?: "clockwise" | "counterclockwise" | undefined;
|
|
32435
|
+
strokeWidth?: string | number | undefined;
|
|
32436
|
+
color?: string | undefined;
|
|
32437
|
+
isDashed?: boolean | undefined;
|
|
32438
|
+
}>;
|
|
32439
|
+
};
|
|
32440
|
+
schematic_arc_id?: string;
|
|
32441
|
+
doInitialSchematicPrimitiveRender(): void;
|
|
32442
|
+
}
|
|
32443
|
+
|
|
32444
|
+
declare class SchematicCircle extends PrimitiveComponent<typeof schematicCircleProps> {
|
|
32445
|
+
isSchematicPrimitive: boolean;
|
|
32446
|
+
get config(): {
|
|
32447
|
+
componentName: string;
|
|
32448
|
+
zodProps: zod.ZodObject<{
|
|
32449
|
+
center: zod.ZodObject<{
|
|
32450
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
32451
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
32452
|
+
}, "strip", zod.ZodTypeAny, {
|
|
32453
|
+
x: number;
|
|
32454
|
+
y: number;
|
|
32455
|
+
}, {
|
|
32456
|
+
x: string | number;
|
|
32457
|
+
y: string | number;
|
|
32458
|
+
}>;
|
|
32459
|
+
radius: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
32460
|
+
strokeWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
32461
|
+
color: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
|
|
32462
|
+
isFilled: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
|
|
32463
|
+
fillColor: zod.ZodOptional<zod.ZodString>;
|
|
32464
|
+
isDashed: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
|
|
32465
|
+
}, "strip", zod.ZodTypeAny, {
|
|
32466
|
+
center: {
|
|
32467
|
+
x: number;
|
|
32468
|
+
y: number;
|
|
32469
|
+
};
|
|
32470
|
+
color: string;
|
|
32471
|
+
radius: number;
|
|
32472
|
+
isDashed: boolean;
|
|
32473
|
+
isFilled: boolean;
|
|
32474
|
+
strokeWidth?: number | undefined;
|
|
32475
|
+
fillColor?: string | undefined;
|
|
32476
|
+
}, {
|
|
32477
|
+
center: {
|
|
32478
|
+
x: string | number;
|
|
32479
|
+
y: string | number;
|
|
32480
|
+
};
|
|
32481
|
+
radius: string | number;
|
|
32482
|
+
strokeWidth?: string | number | undefined;
|
|
32483
|
+
color?: string | undefined;
|
|
32484
|
+
isDashed?: boolean | undefined;
|
|
32485
|
+
isFilled?: boolean | undefined;
|
|
32486
|
+
fillColor?: string | undefined;
|
|
32487
|
+
}>;
|
|
32488
|
+
};
|
|
32489
|
+
schematic_circle_id?: string;
|
|
32490
|
+
doInitialSchematicPrimitiveRender(): void;
|
|
32491
|
+
}
|
|
32492
|
+
|
|
32392
32493
|
declare class SchematicBox extends PrimitiveComponent<typeof schematicBoxProps> {
|
|
32393
32494
|
isSchematicPrimitive: boolean;
|
|
32394
32495
|
get config(): {
|
|
@@ -33194,6 +33295,8 @@ interface TscircuitElements {
|
|
|
33194
33295
|
schematicbox: _tscircuit_props.SchematicBoxProps;
|
|
33195
33296
|
schematicline: _tscircuit_props.SchematicLineProps;
|
|
33196
33297
|
schematicrect: _tscircuit_props.SchematicRectProps;
|
|
33298
|
+
schematicarc: _tscircuit_props.SchematicArcProps;
|
|
33299
|
+
schematiccircle: _tscircuit_props.SchematicCircleProps;
|
|
33197
33300
|
schematicpath: _tscircuit_props.SchematicPathProps;
|
|
33198
33301
|
schematictext: _tscircuit_props.SchematicTextProps;
|
|
33199
33302
|
schematictable: _tscircuit_props.SchematicTableProps;
|
|
@@ -33254,4 +33357,4 @@ declare module "react/jsx-runtime" {
|
|
|
33254
33357
|
}
|
|
33255
33358
|
}
|
|
33256
33359
|
|
|
33257
|
-
export { type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, CopperPour, Crystal, Cutout, type DebugLogOutputEvent, Diode, FabricationNotePath, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, PcbTrace, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SchematicBox, SchematicCell, SchematicLine, SchematicRect, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
|
33360
|
+
export { type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, CopperPour, Crystal, Cutout, type DebugLogOutputEvent, Diode, FabricationNotePath, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, PcbTrace, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicRect, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
package/dist/index.js
CHANGED
|
@@ -46,8 +46,10 @@ __export(components_exports, {
|
|
|
46
46
|
Renderable: () => Renderable,
|
|
47
47
|
Resistor: () => Resistor,
|
|
48
48
|
Resonator: () => Resonator,
|
|
49
|
+
SchematicArc: () => SchematicArc,
|
|
49
50
|
SchematicBox: () => SchematicBox,
|
|
50
51
|
SchematicCell: () => SchematicCell,
|
|
52
|
+
SchematicCircle: () => SchematicCircle,
|
|
51
53
|
SchematicLine: () => SchematicLine,
|
|
52
54
|
SchematicRect: () => SchematicRect,
|
|
53
55
|
SchematicRow: () => SchematicRow,
|
|
@@ -79,6 +81,7 @@ import {
|
|
|
79
81
|
rotation as rotation2,
|
|
80
82
|
schematic_manual_edit_conflict_warning
|
|
81
83
|
} from "circuit-json";
|
|
84
|
+
import { decomposeTSR as decomposeTSR4 } from "transformation-matrix";
|
|
82
85
|
import Debug4 from "debug";
|
|
83
86
|
|
|
84
87
|
// lib/fiber/create-instance-from-react-element.ts
|
|
@@ -3085,6 +3088,58 @@ function getBoundsOfPcbComponents(components) {
|
|
|
3085
3088
|
}
|
|
3086
3089
|
|
|
3087
3090
|
// lib/utils/autorouting/getBoundsForSchematic.ts
|
|
3091
|
+
function normalizeAngle(angle) {
|
|
3092
|
+
const normalized = angle % 360;
|
|
3093
|
+
return normalized < 0 ? normalized + 360 : normalized;
|
|
3094
|
+
}
|
|
3095
|
+
function isAngleBetween(angle, start, end, direction) {
|
|
3096
|
+
if (direction === "counterclockwise") {
|
|
3097
|
+
if (end >= start) {
|
|
3098
|
+
return angle >= start && angle <= end;
|
|
3099
|
+
}
|
|
3100
|
+
return angle >= start || angle <= end;
|
|
3101
|
+
}
|
|
3102
|
+
if (end <= start) {
|
|
3103
|
+
return angle <= start && angle >= end;
|
|
3104
|
+
}
|
|
3105
|
+
return angle <= start || angle >= end;
|
|
3106
|
+
}
|
|
3107
|
+
function getArcBounds(elm) {
|
|
3108
|
+
const center = elm.center;
|
|
3109
|
+
const radius = elm.radius;
|
|
3110
|
+
const startAngle = elm.start_angle_degrees;
|
|
3111
|
+
const endAngle = elm.end_angle_degrees;
|
|
3112
|
+
const direction = elm.direction ?? "counterclockwise";
|
|
3113
|
+
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof radius !== "number" || typeof startAngle !== "number" || typeof endAngle !== "number") {
|
|
3114
|
+
return null;
|
|
3115
|
+
}
|
|
3116
|
+
const start = normalizeAngle(startAngle);
|
|
3117
|
+
const end = normalizeAngle(endAngle);
|
|
3118
|
+
const consideredAngles = /* @__PURE__ */ new Set([start, end]);
|
|
3119
|
+
const cardinalAngles = [0, 90, 180, 270];
|
|
3120
|
+
for (const cardinal of cardinalAngles) {
|
|
3121
|
+
if (isAngleBetween(cardinal, start, end, direction)) {
|
|
3122
|
+
consideredAngles.add(cardinal);
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
let minX = Infinity;
|
|
3126
|
+
let minY = Infinity;
|
|
3127
|
+
let maxX = -Infinity;
|
|
3128
|
+
let maxY = -Infinity;
|
|
3129
|
+
for (const angle of consideredAngles) {
|
|
3130
|
+
const radians = angle * Math.PI / 180;
|
|
3131
|
+
const x = center.x + radius * Math.cos(radians);
|
|
3132
|
+
const y = center.y + radius * Math.sin(radians);
|
|
3133
|
+
minX = Math.min(minX, x);
|
|
3134
|
+
maxX = Math.max(maxX, x);
|
|
3135
|
+
minY = Math.min(minY, y);
|
|
3136
|
+
maxY = Math.max(maxY, y);
|
|
3137
|
+
}
|
|
3138
|
+
if (!Number.isFinite(minX) || !Number.isFinite(minY)) {
|
|
3139
|
+
return null;
|
|
3140
|
+
}
|
|
3141
|
+
return { minX, maxX, minY, maxY };
|
|
3142
|
+
}
|
|
3088
3143
|
function getBoundsForSchematic(db) {
|
|
3089
3144
|
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
3090
3145
|
for (const elm of db) {
|
|
@@ -3123,6 +3178,23 @@ function getBoundsForSchematic(db) {
|
|
|
3123
3178
|
cy = elm.center?.y;
|
|
3124
3179
|
w = elm.width;
|
|
3125
3180
|
h = elm.height;
|
|
3181
|
+
} else if (elm.type === "schematic_circle") {
|
|
3182
|
+
cx = elm.center?.x;
|
|
3183
|
+
cy = elm.center?.y;
|
|
3184
|
+
const radius = elm.radius;
|
|
3185
|
+
if (typeof radius === "number") {
|
|
3186
|
+
w = radius * 2;
|
|
3187
|
+
h = radius * 2;
|
|
3188
|
+
}
|
|
3189
|
+
} else if (elm.type === "schematic_arc") {
|
|
3190
|
+
const bounds = getArcBounds(elm);
|
|
3191
|
+
if (bounds) {
|
|
3192
|
+
minX = Math.min(minX, bounds.minX);
|
|
3193
|
+
maxX = Math.max(maxX, bounds.maxX);
|
|
3194
|
+
minY = Math.min(minY, bounds.minY);
|
|
3195
|
+
maxY = Math.max(maxY, bounds.maxY);
|
|
3196
|
+
}
|
|
3197
|
+
continue;
|
|
3126
3198
|
}
|
|
3127
3199
|
if (typeof cx === "number" && typeof cy === "number" && typeof w === "number" && typeof h === "number") {
|
|
3128
3200
|
minX = Math.min(minX, cx - w / 2);
|
|
@@ -4160,6 +4232,7 @@ var Footprint = class extends PrimitiveComponent2 {
|
|
|
4160
4232
|
// lib/components/primitive-components/CadModel.ts
|
|
4161
4233
|
import { cadmodelProps, point3 } from "@tscircuit/props";
|
|
4162
4234
|
import { z as z7 } from "zod";
|
|
4235
|
+
import { decomposeTSR as decomposeTSR3 } from "transformation-matrix";
|
|
4163
4236
|
var rotation = z7.union([z7.number(), z7.string()]);
|
|
4164
4237
|
var rotation3 = z7.object({ x: rotation, y: rotation, z: rotation });
|
|
4165
4238
|
var CadModel = class extends PrimitiveComponent2 {
|
|
@@ -4179,6 +4252,9 @@ var CadModel = class extends PrimitiveComponent2 {
|
|
|
4179
4252
|
const pcb_component = db.pcb_component.get(parent.pcb_component_id);
|
|
4180
4253
|
const props = this._parsedProps;
|
|
4181
4254
|
if (!props || typeof props.modelUrl !== "string") return;
|
|
4255
|
+
const parentTransform = parent._computePcbGlobalTransformBeforeLayout();
|
|
4256
|
+
const decomposedTransform = decomposeTSR3(parentTransform);
|
|
4257
|
+
const accumulatedRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
|
|
4182
4258
|
const rotationOffset = rotation3.parse({ x: 0, y: 0, z: 0 });
|
|
4183
4259
|
if (typeof props.rotationOffset === "number") {
|
|
4184
4260
|
rotationOffset.z = Number(props.rotationOffset);
|
|
@@ -4219,7 +4295,7 @@ var CadModel = class extends PrimitiveComponent2 {
|
|
|
4219
4295
|
rotation: {
|
|
4220
4296
|
x: Number(rotationOffset.x),
|
|
4221
4297
|
y: (layer === "top" ? 0 : 180) + Number(rotationOffset.y),
|
|
4222
|
-
z: layer === "bottom" ? -(
|
|
4298
|
+
z: layer === "bottom" ? -(accumulatedRotation + Number(rotationOffset.z)) + 180 : accumulatedRotation + Number(rotationOffset.z)
|
|
4223
4299
|
},
|
|
4224
4300
|
pcb_component_id: parent.pcb_component_id,
|
|
4225
4301
|
source_component_id: parent.source_component_id,
|
|
@@ -7643,6 +7719,16 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
7643
7719
|
const rect = db.schematic_rect.get(child.schematic_rect_id);
|
|
7644
7720
|
if (rect) schematicElements.push(rect);
|
|
7645
7721
|
}
|
|
7722
|
+
if (child.isSchematicPrimitive && child.componentName === "SchematicCircle") {
|
|
7723
|
+
const circle = db.schematic_circle.get(
|
|
7724
|
+
child.schematic_circle_id
|
|
7725
|
+
);
|
|
7726
|
+
if (circle) schematicElements.push(circle);
|
|
7727
|
+
}
|
|
7728
|
+
if (child.isSchematicPrimitive && child.componentName === "SchematicArc") {
|
|
7729
|
+
const arc = db.schematic_arc.get(child.schematic_arc_id);
|
|
7730
|
+
if (arc) schematicElements.push(arc);
|
|
7731
|
+
}
|
|
7646
7732
|
if (child.isSchematicPrimitive && child.componentName === "SchematicText") {
|
|
7647
7733
|
const text = db.schematic_text.get(child.schematic_text_id);
|
|
7648
7734
|
if (text) schematicElements.push(text);
|
|
@@ -7945,6 +8031,9 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
7945
8031
|
...typeof cadModel?.positionOffset === "object" ? cadModel.positionOffset : {}
|
|
7946
8032
|
});
|
|
7947
8033
|
const computedLayer = this.props.layer === "bottom" ? "bottom" : "top";
|
|
8034
|
+
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
8035
|
+
const decomposedTransform = decomposeTSR4(globalTransform);
|
|
8036
|
+
const accumulatedRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
|
|
7948
8037
|
const cad_model = db.cad_component.insert({
|
|
7949
8038
|
// TODO z maybe depends on layer
|
|
7950
8039
|
position: {
|
|
@@ -7955,7 +8044,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
7955
8044
|
rotation: {
|
|
7956
8045
|
x: rotationOffset.x,
|
|
7957
8046
|
y: (computedLayer === "top" ? 0 : 180) + rotationOffset.y,
|
|
7958
|
-
z: computedLayer === "bottom" ? -(
|
|
8047
|
+
z: computedLayer === "bottom" ? -(accumulatedRotation + rotationOffset.z) + 180 : accumulatedRotation + rotationOffset.z
|
|
7959
8048
|
},
|
|
7960
8049
|
pcb_component_id: this.pcb_component_id,
|
|
7961
8050
|
source_component_id: this.source_component_id,
|
|
@@ -15168,6 +15257,77 @@ var SchematicRect = class extends PrimitiveComponent2 {
|
|
|
15168
15257
|
}
|
|
15169
15258
|
};
|
|
15170
15259
|
|
|
15260
|
+
// lib/components/primitive-components/SchematicArc.ts
|
|
15261
|
+
import { schematicArcProps } from "@tscircuit/props";
|
|
15262
|
+
var SchematicArc = class extends PrimitiveComponent2 {
|
|
15263
|
+
isSchematicPrimitive = true;
|
|
15264
|
+
get config() {
|
|
15265
|
+
return {
|
|
15266
|
+
componentName: "SchematicArc",
|
|
15267
|
+
zodProps: schematicArcProps
|
|
15268
|
+
};
|
|
15269
|
+
}
|
|
15270
|
+
schematic_arc_id;
|
|
15271
|
+
doInitialSchematicPrimitiveRender() {
|
|
15272
|
+
if (this.root?.schematicDisabled) return;
|
|
15273
|
+
const { db } = this.root;
|
|
15274
|
+
const { _parsedProps: props } = this;
|
|
15275
|
+
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
15276
|
+
const schematic_component_id = this.getPrimitiveContainer()?.parent?.schematic_component_id;
|
|
15277
|
+
const schematic_arc = db.schematic_arc.insert({
|
|
15278
|
+
schematic_component_id,
|
|
15279
|
+
center: {
|
|
15280
|
+
x: props.center.x + globalPos.x,
|
|
15281
|
+
y: props.center.y + globalPos.y
|
|
15282
|
+
},
|
|
15283
|
+
radius: props.radius,
|
|
15284
|
+
start_angle_degrees: props.startAngleDegrees,
|
|
15285
|
+
end_angle_degrees: props.endAngleDegrees,
|
|
15286
|
+
direction: props.direction,
|
|
15287
|
+
stroke_width: SCHEMATIC_COMPONENT_OUTLINE_STROKE_WIDTH,
|
|
15288
|
+
color: SCHEMATIC_COMPONENT_OUTLINE_COLOR,
|
|
15289
|
+
is_dashed: props.isDashed,
|
|
15290
|
+
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0
|
|
15291
|
+
});
|
|
15292
|
+
this.schematic_arc_id = schematic_arc.schematic_arc_id;
|
|
15293
|
+
}
|
|
15294
|
+
};
|
|
15295
|
+
|
|
15296
|
+
// lib/components/primitive-components/SchematicCircle.ts
|
|
15297
|
+
import { schematicCircleProps } from "@tscircuit/props";
|
|
15298
|
+
var SchematicCircle = class extends PrimitiveComponent2 {
|
|
15299
|
+
isSchematicPrimitive = true;
|
|
15300
|
+
get config() {
|
|
15301
|
+
return {
|
|
15302
|
+
componentName: "SchematicCircle",
|
|
15303
|
+
zodProps: schematicCircleProps
|
|
15304
|
+
};
|
|
15305
|
+
}
|
|
15306
|
+
schematic_circle_id;
|
|
15307
|
+
doInitialSchematicPrimitiveRender() {
|
|
15308
|
+
if (this.root?.schematicDisabled) return;
|
|
15309
|
+
const { db } = this.root;
|
|
15310
|
+
const { _parsedProps: props } = this;
|
|
15311
|
+
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
15312
|
+
const schematic_component_id = this.getPrimitiveContainer()?.parent?.schematic_component_id;
|
|
15313
|
+
const schematic_circle = db.schematic_circle.insert({
|
|
15314
|
+
schematic_component_id,
|
|
15315
|
+
center: {
|
|
15316
|
+
x: props.center.x + globalPos.x,
|
|
15317
|
+
y: props.center.y + globalPos.y
|
|
15318
|
+
},
|
|
15319
|
+
radius: props.radius,
|
|
15320
|
+
stroke_width: SCHEMATIC_COMPONENT_OUTLINE_STROKE_WIDTH,
|
|
15321
|
+
color: SCHEMATIC_COMPONENT_OUTLINE_COLOR,
|
|
15322
|
+
is_filled: props.isFilled,
|
|
15323
|
+
fill_color: props.fillColor,
|
|
15324
|
+
is_dashed: props.isDashed,
|
|
15325
|
+
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0
|
|
15326
|
+
});
|
|
15327
|
+
this.schematic_circle_id = schematic_circle.schematic_circle_id;
|
|
15328
|
+
}
|
|
15329
|
+
};
|
|
15330
|
+
|
|
15171
15331
|
// lib/components/primitive-components/SchematicBox.ts
|
|
15172
15332
|
import { schematicBoxProps } from "@tscircuit/props";
|
|
15173
15333
|
|
|
@@ -15539,7 +15699,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
15539
15699
|
var package_default = {
|
|
15540
15700
|
name: "@tscircuit/core",
|
|
15541
15701
|
type: "module",
|
|
15542
|
-
version: "0.0.
|
|
15702
|
+
version: "0.0.741",
|
|
15543
15703
|
types: "dist/index.d.ts",
|
|
15544
15704
|
main: "dist/index.js",
|
|
15545
15705
|
module: "dist/index.js",
|
|
@@ -16084,8 +16244,10 @@ export {
|
|
|
16084
16244
|
Resistor,
|
|
16085
16245
|
Resonator,
|
|
16086
16246
|
RootCircuit,
|
|
16247
|
+
SchematicArc,
|
|
16087
16248
|
SchematicBox,
|
|
16088
16249
|
SchematicCell,
|
|
16250
|
+
SchematicCircle,
|
|
16089
16251
|
SchematicLine,
|
|
16090
16252
|
SchematicRect,
|
|
16091
16253
|
SchematicRow,
|