@tscircuit/core 0.0.1484 → 0.0.1485
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 +7 -0
- package/dist/index.js +602 -525
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -153037,6 +153037,7 @@ declare class SchematicBox extends PrimitiveComponent<typeof schematicBoxProps>
|
|
|
153037
153037
|
}>>;
|
|
153038
153038
|
schX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
153039
153039
|
schY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
153040
|
+
schSheetName: zod.ZodOptional<zod.ZodString>;
|
|
153040
153041
|
width: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
153041
153042
|
height: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
153042
153043
|
overlay: zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
|
|
@@ -153060,6 +153061,7 @@ declare class SchematicBox extends PrimitiveComponent<typeof schematicBoxProps>
|
|
|
153060
153061
|
name?: string | undefined;
|
|
153061
153062
|
schX?: number | undefined;
|
|
153062
153063
|
schY?: number | undefined;
|
|
153064
|
+
schSheetName?: string | undefined;
|
|
153063
153065
|
padding?: number | undefined;
|
|
153064
153066
|
paddingLeft?: number | undefined;
|
|
153065
153067
|
paddingRight?: number | undefined;
|
|
@@ -153103,6 +153105,7 @@ declare class SchematicBox extends PrimitiveComponent<typeof schematicBoxProps>
|
|
|
153103
153105
|
name?: string | undefined;
|
|
153104
153106
|
schX?: string | number | undefined;
|
|
153105
153107
|
schY?: string | number | undefined;
|
|
153108
|
+
schSheetName?: string | undefined;
|
|
153106
153109
|
padding?: string | number | undefined;
|
|
153107
153110
|
paddingLeft?: string | number | undefined;
|
|
153108
153111
|
paddingRight?: string | number | undefined;
|
|
@@ -153152,6 +153155,7 @@ declare class SchematicBox extends PrimitiveComponent<typeof schematicBoxProps>
|
|
|
153152
153155
|
name?: string | undefined;
|
|
153153
153156
|
schX?: number | undefined;
|
|
153154
153157
|
schY?: number | undefined;
|
|
153158
|
+
schSheetName?: string | undefined;
|
|
153155
153159
|
padding?: number | undefined;
|
|
153156
153160
|
paddingLeft?: number | undefined;
|
|
153157
153161
|
paddingRight?: number | undefined;
|
|
@@ -153195,6 +153199,7 @@ declare class SchematicBox extends PrimitiveComponent<typeof schematicBoxProps>
|
|
|
153195
153199
|
name?: string | undefined;
|
|
153196
153200
|
schX?: string | number | undefined;
|
|
153197
153201
|
schY?: string | number | undefined;
|
|
153202
|
+
schSheetName?: string | undefined;
|
|
153198
153203
|
padding?: string | number | undefined;
|
|
153199
153204
|
paddingLeft?: string | number | undefined;
|
|
153200
153205
|
paddingRight?: string | number | undefined;
|
|
@@ -153244,6 +153249,7 @@ declare class SchematicBox extends PrimitiveComponent<typeof schematicBoxProps>
|
|
|
153244
153249
|
name?: string | undefined;
|
|
153245
153250
|
schX?: number | undefined;
|
|
153246
153251
|
schY?: number | undefined;
|
|
153252
|
+
schSheetName?: string | undefined;
|
|
153247
153253
|
padding?: number | undefined;
|
|
153248
153254
|
paddingLeft?: number | undefined;
|
|
153249
153255
|
paddingRight?: number | undefined;
|
|
@@ -153287,6 +153293,7 @@ declare class SchematicBox extends PrimitiveComponent<typeof schematicBoxProps>
|
|
|
153287
153293
|
name?: string | undefined;
|
|
153288
153294
|
schX?: string | number | undefined;
|
|
153289
153295
|
schY?: string | number | undefined;
|
|
153296
|
+
schSheetName?: string | undefined;
|
|
153290
153297
|
padding?: string | number | undefined;
|
|
153291
153298
|
paddingLeft?: string | number | undefined;
|
|
153292
153299
|
paddingRight?: string | number | undefined;
|
package/dist/index.js
CHANGED
|
@@ -17213,8 +17213,8 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
17213
17213
|
];
|
|
17214
17214
|
const defaultTraceWidth = minTraceWidth ?? board?.min_trace_width ?? 0.1;
|
|
17215
17215
|
for (const conn of allConns) {
|
|
17216
|
-
conn.nominalTraceWidth ??= defaultTraceWidth;
|
|
17217
|
-
conn.width ??= defaultTraceWidth;
|
|
17216
|
+
conn.nominalTraceWidth ??= nominalTraceWidth ?? defaultTraceWidth;
|
|
17217
|
+
conn.width ??= nominalTraceWidth ?? defaultTraceWidth;
|
|
17218
17218
|
}
|
|
17219
17219
|
const differentialPairs = subcircuitComponent?.selectAll("differentialpair") ?? [];
|
|
17220
17220
|
const srjDifferentialPairs = getDifferentialPairsForSimpleRouteJson({
|
|
@@ -17463,6 +17463,409 @@ var TraceHint = class extends PrimitiveComponent2 {
|
|
|
17463
17463
|
}
|
|
17464
17464
|
};
|
|
17465
17465
|
|
|
17466
|
+
// lib/components/primitive-components/SchematicBox/SchematicBox.ts
|
|
17467
|
+
import { schematicBoxProps } from "@tscircuit/props";
|
|
17468
|
+
|
|
17469
|
+
// lib/components/primitive-components/getTitleAnchorAndPosition.ts
|
|
17470
|
+
function getTitleAnchorAndPosition({
|
|
17471
|
+
anchor,
|
|
17472
|
+
x,
|
|
17473
|
+
y,
|
|
17474
|
+
width,
|
|
17475
|
+
height,
|
|
17476
|
+
isInside
|
|
17477
|
+
}) {
|
|
17478
|
+
switch (anchor) {
|
|
17479
|
+
case "top_left":
|
|
17480
|
+
return {
|
|
17481
|
+
x,
|
|
17482
|
+
y: y + height,
|
|
17483
|
+
textAnchor: isInside ? "top_left" : "bottom_left"
|
|
17484
|
+
};
|
|
17485
|
+
case "top_center":
|
|
17486
|
+
return {
|
|
17487
|
+
x: x + width / 2,
|
|
17488
|
+
y: y + height,
|
|
17489
|
+
textAnchor: isInside ? "top_center" : "bottom_center"
|
|
17490
|
+
};
|
|
17491
|
+
case "top_right":
|
|
17492
|
+
return {
|
|
17493
|
+
x: x + width,
|
|
17494
|
+
y: y + height,
|
|
17495
|
+
textAnchor: isInside ? "top_right" : "bottom_right"
|
|
17496
|
+
};
|
|
17497
|
+
case "center_left":
|
|
17498
|
+
return {
|
|
17499
|
+
x,
|
|
17500
|
+
y: y + height / 2,
|
|
17501
|
+
textAnchor: isInside ? "center_left" : "center_right"
|
|
17502
|
+
};
|
|
17503
|
+
case "center":
|
|
17504
|
+
return {
|
|
17505
|
+
x: x + width / 2,
|
|
17506
|
+
y: y + height / 2,
|
|
17507
|
+
textAnchor: "center"
|
|
17508
|
+
};
|
|
17509
|
+
case "center_right":
|
|
17510
|
+
return {
|
|
17511
|
+
x: x + width,
|
|
17512
|
+
y: y + height / 2,
|
|
17513
|
+
textAnchor: isInside ? "center_right" : "center_left"
|
|
17514
|
+
};
|
|
17515
|
+
case "bottom_left":
|
|
17516
|
+
return {
|
|
17517
|
+
x,
|
|
17518
|
+
y,
|
|
17519
|
+
textAnchor: isInside ? "bottom_left" : "top_left"
|
|
17520
|
+
};
|
|
17521
|
+
case "bottom_center":
|
|
17522
|
+
return {
|
|
17523
|
+
x: x + width / 2,
|
|
17524
|
+
y,
|
|
17525
|
+
textAnchor: isInside ? "bottom_center" : "top_center"
|
|
17526
|
+
};
|
|
17527
|
+
case "bottom_right":
|
|
17528
|
+
return {
|
|
17529
|
+
x: x + width,
|
|
17530
|
+
y,
|
|
17531
|
+
textAnchor: isInside ? "bottom_right" : "top_right"
|
|
17532
|
+
};
|
|
17533
|
+
default:
|
|
17534
|
+
return {
|
|
17535
|
+
x: x + width / 2,
|
|
17536
|
+
y: y + height,
|
|
17537
|
+
textAnchor: "center"
|
|
17538
|
+
};
|
|
17539
|
+
}
|
|
17540
|
+
}
|
|
17541
|
+
|
|
17542
|
+
// lib/components/primitive-components/SchematicBox/SchematicBox_doInitialSchematicComponentRender.ts
|
|
17543
|
+
var getSchematicBoxPinLabels = (pinLabels) => {
|
|
17544
|
+
if (!pinLabels) return [];
|
|
17545
|
+
return Object.entries(pinLabels).map(([pinKey, pinLabel]) => {
|
|
17546
|
+
const pinNumber = getPinNumberFromPinLabelsKey(pinKey);
|
|
17547
|
+
if (pinNumber === null) {
|
|
17548
|
+
throw new Error(
|
|
17549
|
+
`Invalid schematicbox pinLabels key "${pinKey}". Expected pin<number>.`
|
|
17550
|
+
);
|
|
17551
|
+
}
|
|
17552
|
+
const pinAliases = typeof pinLabel === "string" ? [pinLabel] : [...pinLabel];
|
|
17553
|
+
return {
|
|
17554
|
+
pinNumber,
|
|
17555
|
+
displayPinLabel: pinAliases[0] ?? pinKey,
|
|
17556
|
+
pinAliases
|
|
17557
|
+
};
|
|
17558
|
+
});
|
|
17559
|
+
};
|
|
17560
|
+
var SchematicBox_doInitialSchematicComponentRender = (schematicBox) => {
|
|
17561
|
+
if (schematicBox.root?.schematicDisabled) return;
|
|
17562
|
+
const { db } = schematicBox.root;
|
|
17563
|
+
const props = schematicBox._parsedProps;
|
|
17564
|
+
if (!props.chipRef) return;
|
|
17565
|
+
const referencedChip = schematicBox.getSubcircuit().selectOne(props.chipRef);
|
|
17566
|
+
if (!referencedChip?.source_component_id) {
|
|
17567
|
+
throw new Error(
|
|
17568
|
+
`Could not resolve chipRef "${props.chipRef}" for ${schematicBox.getString()}`
|
|
17569
|
+
);
|
|
17570
|
+
}
|
|
17571
|
+
const schematicBoxPinLabels = getSchematicBoxPinLabels(props.pinLabels);
|
|
17572
|
+
const pinLabelsByPinKey = Object.fromEntries(
|
|
17573
|
+
schematicBoxPinLabels.map(({ pinNumber, displayPinLabel }) => [
|
|
17574
|
+
`pin${pinNumber}`,
|
|
17575
|
+
displayPinLabel
|
|
17576
|
+
])
|
|
17577
|
+
);
|
|
17578
|
+
const sourcePorts = db.source_port.list({
|
|
17579
|
+
source_component_id: referencedChip.source_component_id
|
|
17580
|
+
});
|
|
17581
|
+
const dimensions = getAllDimensionsForSchematicBox({
|
|
17582
|
+
schWidth: props.width,
|
|
17583
|
+
schHeight: props.height,
|
|
17584
|
+
schPinSpacing: 0.2,
|
|
17585
|
+
pinCount: schematicBoxPinLabels.length,
|
|
17586
|
+
schPortArrangement: props.schPinArrangement,
|
|
17587
|
+
pinLabels: pinLabelsByPinKey
|
|
17588
|
+
});
|
|
17589
|
+
const center = schematicBox._getGlobalSchematicPositionBeforeLayout();
|
|
17590
|
+
const size = dimensions.getSize();
|
|
17591
|
+
const schematicSheetId = schematicBox._resolveSchematicSheetId();
|
|
17592
|
+
const portLabels = Object.fromEntries(
|
|
17593
|
+
schematicBoxPinLabels.map(({ pinNumber, displayPinLabel }) => [
|
|
17594
|
+
String(pinNumber),
|
|
17595
|
+
displayPinLabel
|
|
17596
|
+
])
|
|
17597
|
+
);
|
|
17598
|
+
const schematicComponent = db.schematic_component.insert({
|
|
17599
|
+
center,
|
|
17600
|
+
size,
|
|
17601
|
+
source_component_id: referencedChip.source_component_id,
|
|
17602
|
+
is_box_with_pins: true,
|
|
17603
|
+
port_arrangement: underscorifyPortArrangement(props.schPinArrangement),
|
|
17604
|
+
port_labels: portLabels,
|
|
17605
|
+
pin_spacing: 0.2,
|
|
17606
|
+
schematic_sheet_id: schematicSheetId
|
|
17607
|
+
});
|
|
17608
|
+
schematicBox.schematic_component_id = schematicComponent.schematic_component_id;
|
|
17609
|
+
for (const {
|
|
17610
|
+
pinNumber,
|
|
17611
|
+
displayPinLabel,
|
|
17612
|
+
pinAliases
|
|
17613
|
+
} of schematicBoxPinLabels) {
|
|
17614
|
+
const referencedSourcePort = sourcePorts.find(
|
|
17615
|
+
(sourcePort) => pinAliases.some(
|
|
17616
|
+
(pinAlias) => sourcePort.name === pinAlias || sourcePort.port_hints?.includes(pinAlias)
|
|
17617
|
+
)
|
|
17618
|
+
);
|
|
17619
|
+
if (!referencedSourcePort) {
|
|
17620
|
+
throw new Error(
|
|
17621
|
+
`Could not find pin "${displayPinLabel}" on chipRef "${props.chipRef}"`
|
|
17622
|
+
);
|
|
17623
|
+
}
|
|
17624
|
+
const portPosition = dimensions.getPortPositionByPinNumber(pinNumber);
|
|
17625
|
+
if (!portPosition) {
|
|
17626
|
+
throw new Error(
|
|
17627
|
+
`Could not determine schematic position for ${schematicBox.getString()} pin${pinNumber}`
|
|
17628
|
+
);
|
|
17629
|
+
}
|
|
17630
|
+
const facingDirection = {
|
|
17631
|
+
left: "left",
|
|
17632
|
+
right: "right",
|
|
17633
|
+
top: "up",
|
|
17634
|
+
bottom: "down"
|
|
17635
|
+
}[portPosition.side];
|
|
17636
|
+
db.schematic_port.insert({
|
|
17637
|
+
schematic_component_id: schematicComponent.schematic_component_id,
|
|
17638
|
+
center: {
|
|
17639
|
+
x: center.x + portPosition.x,
|
|
17640
|
+
y: center.y + portPosition.y
|
|
17641
|
+
},
|
|
17642
|
+
source_port_id: referencedSourcePort.source_port_id,
|
|
17643
|
+
facing_direction: facingDirection,
|
|
17644
|
+
distance_from_component_edge: 0.4,
|
|
17645
|
+
side_of_component: portPosition.side,
|
|
17646
|
+
pin_number: pinNumber,
|
|
17647
|
+
true_ccw_index: portPosition.trueIndex,
|
|
17648
|
+
display_pin_label: displayPinLabel,
|
|
17649
|
+
is_connected: false,
|
|
17650
|
+
schematic_sheet_id: schematicSheetId
|
|
17651
|
+
});
|
|
17652
|
+
}
|
|
17653
|
+
const sectionName = props.name ?? props.chipRef;
|
|
17654
|
+
db.schematic_text.insert({
|
|
17655
|
+
text: sectionName,
|
|
17656
|
+
schematic_component_id: schematicComponent.schematic_component_id,
|
|
17657
|
+
anchor: "left",
|
|
17658
|
+
rotation: 0,
|
|
17659
|
+
position: {
|
|
17660
|
+
x: center.x - size.width / 2,
|
|
17661
|
+
y: center.y + size.height / 2 + 0.13
|
|
17662
|
+
},
|
|
17663
|
+
color: "#006464",
|
|
17664
|
+
font_size: 0.18,
|
|
17665
|
+
schematic_sheet_id: schematicSheetId
|
|
17666
|
+
});
|
|
17667
|
+
};
|
|
17668
|
+
|
|
17669
|
+
// lib/components/primitive-components/SchematicBox/SchematicBox.ts
|
|
17670
|
+
var SchematicBox = class extends PrimitiveComponent2 {
|
|
17671
|
+
isSchematicPrimitive = true;
|
|
17672
|
+
get config() {
|
|
17673
|
+
return {
|
|
17674
|
+
componentName: "SchematicBox",
|
|
17675
|
+
zodProps: schematicBoxProps,
|
|
17676
|
+
shouldRenderAsSchematicBox: true
|
|
17677
|
+
};
|
|
17678
|
+
}
|
|
17679
|
+
doInitialSchematicComponentRender() {
|
|
17680
|
+
SchematicBox_doInitialSchematicComponentRender(this);
|
|
17681
|
+
}
|
|
17682
|
+
doInitialSchematicPrimitiveRender() {
|
|
17683
|
+
if (this.root?.schematicDisabled) return;
|
|
17684
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
17685
|
+
const { db } = this.root;
|
|
17686
|
+
const { _parsedProps: props } = this;
|
|
17687
|
+
if (props.chipRef) return;
|
|
17688
|
+
const basePadding = 0.6;
|
|
17689
|
+
const generalPadding = typeof props.padding === "number" ? props.padding : 0;
|
|
17690
|
+
const paddingTop = typeof props.paddingTop === "number" ? props.paddingTop : generalPadding;
|
|
17691
|
+
const paddingBottom = typeof props.paddingBottom === "number" ? props.paddingBottom : generalPadding;
|
|
17692
|
+
const paddingLeft = typeof props.paddingLeft === "number" ? props.paddingLeft : generalPadding;
|
|
17693
|
+
const paddingRight = typeof props.paddingRight === "number" ? props.paddingRight : generalPadding;
|
|
17694
|
+
const hasOverlay = props.overlay && props.overlay.length > 0;
|
|
17695
|
+
const hasFixedSize = typeof props.width === "number" && typeof props.height === "number";
|
|
17696
|
+
let width;
|
|
17697
|
+
let height;
|
|
17698
|
+
let x;
|
|
17699
|
+
let y;
|
|
17700
|
+
let centerX;
|
|
17701
|
+
let centerY;
|
|
17702
|
+
if (hasOverlay) {
|
|
17703
|
+
const portsWithSelectors = props.overlay.map((selector) => ({
|
|
17704
|
+
selector,
|
|
17705
|
+
port: this.getSubcircuit().selectOne(selector, {
|
|
17706
|
+
type: "port"
|
|
17707
|
+
})
|
|
17708
|
+
})).filter(({ port }) => port != null);
|
|
17709
|
+
const portsWithPosition = portsWithSelectors.map(({ port }) => ({
|
|
17710
|
+
position: port._getGlobalSchematicPositionAfterLayout()
|
|
17711
|
+
}));
|
|
17712
|
+
if (portsWithPosition.length === 0) return;
|
|
17713
|
+
const xs = portsWithPosition.map((p) => p.position.x);
|
|
17714
|
+
const ys = portsWithPosition.map((p) => p.position.y);
|
|
17715
|
+
const minX = Math.min(...xs);
|
|
17716
|
+
const maxX = Math.max(...xs);
|
|
17717
|
+
const minY = Math.min(...ys);
|
|
17718
|
+
const maxY = Math.max(...ys);
|
|
17719
|
+
const rawWidth = maxX - minX;
|
|
17720
|
+
const rawHeight = maxY - minY;
|
|
17721
|
+
const defaultHorizontalPadding = rawWidth === 0 ? basePadding : 0;
|
|
17722
|
+
const defaultVerticalPadding = rawHeight === 0 ? basePadding : 0;
|
|
17723
|
+
const finalPaddingLeft = paddingLeft + defaultHorizontalPadding / 2;
|
|
17724
|
+
const finalPaddingRight = paddingRight + defaultHorizontalPadding / 2;
|
|
17725
|
+
const finalPaddingTop = paddingTop + defaultVerticalPadding / 2;
|
|
17726
|
+
const finalPaddingBottom = paddingBottom + defaultVerticalPadding / 2;
|
|
17727
|
+
const left = minX - finalPaddingLeft;
|
|
17728
|
+
const right = maxX + finalPaddingRight;
|
|
17729
|
+
const top = minY - finalPaddingBottom;
|
|
17730
|
+
const bottom = maxY + finalPaddingTop;
|
|
17731
|
+
width = right - left;
|
|
17732
|
+
height = bottom - top;
|
|
17733
|
+
x = left + (props.schX ?? 0);
|
|
17734
|
+
y = top + (props.schY ?? 0);
|
|
17735
|
+
centerX = x + width / 2;
|
|
17736
|
+
centerY = y + height / 2;
|
|
17737
|
+
} else if (hasFixedSize) {
|
|
17738
|
+
width = props.width;
|
|
17739
|
+
height = props.height;
|
|
17740
|
+
const center = this._getGlobalSchematicPositionBeforeLayout();
|
|
17741
|
+
centerX = center.x;
|
|
17742
|
+
centerY = center.y;
|
|
17743
|
+
x = centerX - width / 2;
|
|
17744
|
+
y = centerY - height / 2;
|
|
17745
|
+
} else {
|
|
17746
|
+
return;
|
|
17747
|
+
}
|
|
17748
|
+
db.schematic_box.insert({
|
|
17749
|
+
height,
|
|
17750
|
+
width,
|
|
17751
|
+
x,
|
|
17752
|
+
y,
|
|
17753
|
+
is_dashed: props.strokeStyle === "dashed",
|
|
17754
|
+
schematic_sheet_id: this._resolveSchematicSheetId()
|
|
17755
|
+
});
|
|
17756
|
+
if (props.title) {
|
|
17757
|
+
const isInside = props.titleInside;
|
|
17758
|
+
const TITLE_PADDING = 0.1;
|
|
17759
|
+
const anchor = props.titleAlignment;
|
|
17760
|
+
const anchorPos = getTitleAnchorAndPosition({
|
|
17761
|
+
anchor,
|
|
17762
|
+
x,
|
|
17763
|
+
y,
|
|
17764
|
+
width,
|
|
17765
|
+
height,
|
|
17766
|
+
isInside
|
|
17767
|
+
});
|
|
17768
|
+
let titleOffsetY;
|
|
17769
|
+
let titleOffsetX;
|
|
17770
|
+
const textAnchor = anchorPos.textAnchor;
|
|
17771
|
+
if (isInside) {
|
|
17772
|
+
titleOffsetY = anchor.includes("top") ? -TITLE_PADDING : anchor.includes("bottom") ? TITLE_PADDING : 0;
|
|
17773
|
+
titleOffsetX = anchor.includes("left") ? TITLE_PADDING : anchor.includes("right") ? -TITLE_PADDING : 0;
|
|
17774
|
+
} else {
|
|
17775
|
+
titleOffsetY = anchor.includes("top") ? TITLE_PADDING : anchor.includes("bottom") ? -TITLE_PADDING : 0;
|
|
17776
|
+
titleOffsetX = anchor.includes("center_left") ? -TITLE_PADDING : anchor.includes("center_right") ? TITLE_PADDING : 0;
|
|
17777
|
+
}
|
|
17778
|
+
const titleX = anchorPos.x + titleOffsetX;
|
|
17779
|
+
const titleY = anchorPos.y + titleOffsetY;
|
|
17780
|
+
db.schematic_text.insert({
|
|
17781
|
+
anchor: textAnchor,
|
|
17782
|
+
text: props.title,
|
|
17783
|
+
font_size: props.titleFontSize ?? 0.18,
|
|
17784
|
+
color: props.titleColor ?? "#000000",
|
|
17785
|
+
position: {
|
|
17786
|
+
x: titleX,
|
|
17787
|
+
y: titleY
|
|
17788
|
+
},
|
|
17789
|
+
rotation: 0,
|
|
17790
|
+
schematic_sheet_id: this._resolveSchematicSheetId()
|
|
17791
|
+
});
|
|
17792
|
+
}
|
|
17793
|
+
}
|
|
17794
|
+
};
|
|
17795
|
+
|
|
17796
|
+
// lib/components/primitive-components/Group/Group_doInitialAssignSchematicSheetToConnectedComponents.ts
|
|
17797
|
+
var Group_doInitialAssignSchematicSheetToConnectedComponents = (group) => {
|
|
17798
|
+
if (!group.isSubcircuit || group.root?.schematicDisabled) return;
|
|
17799
|
+
const { db } = group.root;
|
|
17800
|
+
const schematicSheetIdsBySubcircuitConnectivityMapKey = /* @__PURE__ */ new Map();
|
|
17801
|
+
const schematicBoxReferencedSourceComponentIds = /* @__PURE__ */ new Set();
|
|
17802
|
+
const schematicBoxes = group.getDescendants().filter(
|
|
17803
|
+
(component) => component instanceof SchematicBox && component.getSubcircuit() === group
|
|
17804
|
+
);
|
|
17805
|
+
for (const schematicBox of schematicBoxes) {
|
|
17806
|
+
const { chipRef, pinLabels } = schematicBox._parsedProps;
|
|
17807
|
+
const schematicSheetId = schematicBox._resolveSchematicSheetId();
|
|
17808
|
+
if (!chipRef || !schematicSheetId) continue;
|
|
17809
|
+
const referencedComponent = schematicBox.getSubcircuit().selectOne(chipRef);
|
|
17810
|
+
if (!(referencedComponent instanceof NormalComponent3)) continue;
|
|
17811
|
+
if (!referencedComponent.source_component_id) continue;
|
|
17812
|
+
schematicBoxReferencedSourceComponentIds.add(
|
|
17813
|
+
referencedComponent.source_component_id
|
|
17814
|
+
);
|
|
17815
|
+
const referencedSourcePorts = db.source_port.list({
|
|
17816
|
+
source_component_id: referencedComponent.source_component_id
|
|
17817
|
+
});
|
|
17818
|
+
for (const { pinAliases } of getSchematicBoxPinLabels(pinLabels)) {
|
|
17819
|
+
const referencedSourcePort = referencedSourcePorts.find(
|
|
17820
|
+
(sourcePort) => pinAliases.some(
|
|
17821
|
+
(pinAlias) => sourcePort.name === pinAlias || sourcePort.port_hints?.includes(pinAlias)
|
|
17822
|
+
)
|
|
17823
|
+
);
|
|
17824
|
+
const subcircuitConnectivityMapKey = referencedSourcePort?.subcircuit_connectivity_map_key;
|
|
17825
|
+
if (!subcircuitConnectivityMapKey) continue;
|
|
17826
|
+
const schematicSheetIds = schematicSheetIdsBySubcircuitConnectivityMapKey.get(
|
|
17827
|
+
subcircuitConnectivityMapKey
|
|
17828
|
+
) ?? /* @__PURE__ */ new Set();
|
|
17829
|
+
schematicSheetIds.add(schematicSheetId);
|
|
17830
|
+
schematicSheetIdsBySubcircuitConnectivityMapKey.set(
|
|
17831
|
+
subcircuitConnectivityMapKey,
|
|
17832
|
+
schematicSheetIds
|
|
17833
|
+
);
|
|
17834
|
+
}
|
|
17835
|
+
}
|
|
17836
|
+
const normalComponents = group.getDescendants().filter(
|
|
17837
|
+
(component) => component instanceof NormalComponent3 && component.getSubcircuit() === group
|
|
17838
|
+
);
|
|
17839
|
+
for (const normalComponent of normalComponents) {
|
|
17840
|
+
if (!normalComponent.source_component_id) continue;
|
|
17841
|
+
if (schematicBoxReferencedSourceComponentIds.has(
|
|
17842
|
+
normalComponent.source_component_id
|
|
17843
|
+
)) {
|
|
17844
|
+
continue;
|
|
17845
|
+
}
|
|
17846
|
+
if (normalComponent._resolveSchematicSheetId()) continue;
|
|
17847
|
+
const connectedSchematicSheetIds = /* @__PURE__ */ new Set();
|
|
17848
|
+
const sourcePorts = db.source_port.list({
|
|
17849
|
+
source_component_id: normalComponent.source_component_id
|
|
17850
|
+
});
|
|
17851
|
+
for (const sourcePort of sourcePorts) {
|
|
17852
|
+
const subcircuitConnectivityMapKey = sourcePort.subcircuit_connectivity_map_key;
|
|
17853
|
+
if (!subcircuitConnectivityMapKey) continue;
|
|
17854
|
+
const schematicSheetIds = schematicSheetIdsBySubcircuitConnectivityMapKey.get(
|
|
17855
|
+
subcircuitConnectivityMapKey
|
|
17856
|
+
);
|
|
17857
|
+
if (!schematicSheetIds) continue;
|
|
17858
|
+
for (const schematicSheetId of schematicSheetIds) {
|
|
17859
|
+
connectedSchematicSheetIds.add(schematicSheetId);
|
|
17860
|
+
}
|
|
17861
|
+
}
|
|
17862
|
+
if (connectedSchematicSheetIds.size !== 1) continue;
|
|
17863
|
+
const [inferredSchematicSheetId] = connectedSchematicSheetIds;
|
|
17864
|
+
if (!inferredSchematicSheetId) continue;
|
|
17865
|
+
normalComponent.schematic_sheet_id = inferredSchematicSheetId;
|
|
17866
|
+
}
|
|
17867
|
+
};
|
|
17868
|
+
|
|
17466
17869
|
// lib/components/primitive-components/Group/Group_doInitialPcbCalcPlacementResolution.ts
|
|
17467
17870
|
import { getBoundsOfPcbElements as getBoundsOfPcbElements2 } from "@tscircuit/circuit-json-util";
|
|
17468
17871
|
var SUPPORTED_COMPONENT_FIELDS = /* @__PURE__ */ new Set([
|
|
@@ -23129,7 +23532,7 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
23129
23532
|
var package_default = {
|
|
23130
23533
|
name: "@tscircuit/core",
|
|
23131
23534
|
type: "module",
|
|
23132
|
-
version: "0.0.
|
|
23535
|
+
version: "0.0.1484",
|
|
23133
23536
|
types: "dist/index.d.ts",
|
|
23134
23537
|
main: "dist/index.js",
|
|
23135
23538
|
module: "dist/index.js",
|
|
@@ -23179,7 +23582,7 @@ var package_default = {
|
|
|
23179
23582
|
"@tscircuit/math-utils": "^0.0.36",
|
|
23180
23583
|
"@tscircuit/miniflex": "^0.0.4",
|
|
23181
23584
|
"@tscircuit/ngspice-spice-engine": "^0.0.19",
|
|
23182
|
-
"@tscircuit/props": "^0.0.
|
|
23585
|
+
"@tscircuit/props": "^0.0.589",
|
|
23183
23586
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
23184
23587
|
"@tscircuit/schematic-trace-solver": "^0.0.104",
|
|
23185
23588
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
@@ -24516,6 +24919,7 @@ var Group = class extends NormalComponent3 {
|
|
|
24516
24919
|
}
|
|
24517
24920
|
doInitialSourceAddConnectivityMapKey() {
|
|
24518
24921
|
Group_doInitialSourceAddConnectivityMapKey(this);
|
|
24922
|
+
Group_doInitialAssignSchematicSheetToConnectedComponents(this);
|
|
24519
24923
|
}
|
|
24520
24924
|
_areChildSubcircuitsRouted() {
|
|
24521
24925
|
const subcircuitChildren = this._findDirectChildSubcircuits();
|
|
@@ -24601,6 +25005,7 @@ var Group = class extends NormalComponent3 {
|
|
|
24601
25005
|
);
|
|
24602
25006
|
if (serverMode === "solve-endpoint") {
|
|
24603
25007
|
if (this.props.autorouter?.inputFormat === "simplified") {
|
|
25008
|
+
const preferredTraceWidth = props.defaultTraceWidth ?? props.nominalTraceWidth;
|
|
24604
25009
|
const { autorouting_result: autorouting_result2 } = await fetchWithDebug(
|
|
24605
25010
|
`${serverUrl}/autorouting/solve`,
|
|
24606
25011
|
{
|
|
@@ -24609,7 +25014,7 @@ var Group = class extends NormalComponent3 {
|
|
|
24609
25014
|
input_simple_route_json: getSimpleRouteJsonFromCircuitJson({
|
|
24610
25015
|
db,
|
|
24611
25016
|
minTraceWidth: Number(props.minTraceWidth ?? 0.15),
|
|
24612
|
-
nominalTraceWidth:
|
|
25017
|
+
nominalTraceWidth: preferredTraceWidth != null ? Number(preferredTraceWidth) : void 0,
|
|
24613
25018
|
subcircuit_id: this.subcircuit_id,
|
|
24614
25019
|
subcircuitComponent: this
|
|
24615
25020
|
}).simpleRouteJson,
|
|
@@ -24713,7 +25118,9 @@ var Group = class extends NormalComponent3 {
|
|
|
24713
25118
|
const isAutoJumperPreset = this._isAutoJumperAutorouter(autorouterConfig);
|
|
24714
25119
|
const isSingleLayerBoard = this._getSubcircuitLayerCount() === 1;
|
|
24715
25120
|
const minTraceWidth = Number(props.minTraceWidth ?? 0.15);
|
|
24716
|
-
const nominalTraceWidth = Number(
|
|
25121
|
+
const nominalTraceWidth = Number(
|
|
25122
|
+
props.defaultTraceWidth ?? props.nominalTraceWidth ?? minTraceWidth
|
|
25123
|
+
);
|
|
24717
25124
|
const { simpleRouteJson: baseSimpleRouteJson } = getSimpleRouteJsonFromCircuitJson({
|
|
24718
25125
|
db,
|
|
24719
25126
|
minTraceWidth,
|
|
@@ -32982,558 +33389,228 @@ var getMosfetSchematicSymbolName = (props) => {
|
|
|
32982
33389
|
const { gate, drain } = getRequestedOrientation(props);
|
|
32983
33390
|
return `${baseSymbolName}_gate_${gate}_drain_${drain}`;
|
|
32984
33391
|
};
|
|
32985
|
-
|
|
32986
|
-
// lib/components/normal-components/Mosfet.ts
|
|
32987
|
-
var Mosfet = class extends NormalComponent3 {
|
|
32988
|
-
get config() {
|
|
32989
|
-
return {
|
|
32990
|
-
componentName: "Mosfet",
|
|
32991
|
-
schematicSymbolName: this.props.symbolName ?? getMosfetSchematicSymbolName(this.props),
|
|
32992
|
-
zodProps: mosfetProps,
|
|
32993
|
-
shouldRenderAsSchematicBox: false
|
|
32994
|
-
};
|
|
32995
|
-
}
|
|
32996
|
-
doInitialSourceRender() {
|
|
32997
|
-
const { db } = this.root;
|
|
32998
|
-
const { _parsedProps: props } = this;
|
|
32999
|
-
const source_component = db.source_component.insert({
|
|
33000
|
-
ftype: "simple_mosfet",
|
|
33001
|
-
name: this.name,
|
|
33002
|
-
mosfet_mode: props.mosfetMode,
|
|
33003
|
-
channel_type: props.channelType,
|
|
33004
|
-
display_name: props.displayName
|
|
33005
|
-
});
|
|
33006
|
-
this.source_component_id = source_component.source_component_id;
|
|
33007
|
-
}
|
|
33008
|
-
};
|
|
33009
|
-
|
|
33010
|
-
// lib/components/normal-components/InternalCircuitMosfet.ts
|
|
33011
|
-
import { isValidElement as isValidElement3 } from "react";
|
|
33012
|
-
var InternalCircuitMosfet = class extends Mosfet {
|
|
33013
|
-
resolveFootprint() {
|
|
33014
|
-
return void 0;
|
|
33015
|
-
}
|
|
33016
|
-
doInitialPcbComponentRender() {
|
|
33017
|
-
}
|
|
33018
|
-
doInitialReactSubtreesRender() {
|
|
33019
|
-
const symbol = this.props.symbol;
|
|
33020
|
-
if (isValidElement3(symbol) && !this.children.some((child) => child.componentName === "Symbol")) {
|
|
33021
|
-
this.add(symbol);
|
|
33022
|
-
}
|
|
33023
|
-
}
|
|
33024
|
-
};
|
|
33025
|
-
|
|
33026
|
-
// lib/components/normal-components/OpAmp.ts
|
|
33027
|
-
import { opampProps } from "@tscircuit/props";
|
|
33028
|
-
var OpAmp = class extends NormalComponent3 {
|
|
33029
|
-
getSchematicSymbolName() {
|
|
33030
|
-
if (this.props.symbolName) {
|
|
33031
|
-
return this.props.symbolName;
|
|
33032
|
-
}
|
|
33033
|
-
const hasPowerConnections = this.props.connections?.positive_supply || this.props.connections?.negative_supply;
|
|
33034
|
-
if (hasPowerConnections) {
|
|
33035
|
-
return "opamp_with_power";
|
|
33036
|
-
}
|
|
33037
|
-
return "opamp_no_power";
|
|
33038
|
-
}
|
|
33039
|
-
get config() {
|
|
33040
|
-
return {
|
|
33041
|
-
componentName: "OpAmp",
|
|
33042
|
-
schematicSymbolName: this.getSchematicSymbolName(),
|
|
33043
|
-
zodProps: opampProps,
|
|
33044
|
-
sourceFtype: "simple_op_amp"
|
|
33045
|
-
};
|
|
33046
|
-
}
|
|
33047
|
-
initPorts() {
|
|
33048
|
-
const additionalAliases = {
|
|
33049
|
-
pin1: ["non_inverting_input"],
|
|
33050
|
-
pin2: ["inverting_input"]
|
|
33051
|
-
};
|
|
33052
|
-
const hasPowerSymbol = this.getSchematicSymbolName() === "opamp_with_power";
|
|
33053
|
-
if (hasPowerSymbol) {
|
|
33054
|
-
Object.assign(additionalAliases, {
|
|
33055
|
-
pin4: ["output"],
|
|
33056
|
-
pin5: ["positive_supply", "vcc", "vdd"],
|
|
33057
|
-
pin3: ["negative_supply", "vee", "vss", "gnd"]
|
|
33058
|
-
});
|
|
33059
|
-
} else {
|
|
33060
|
-
Object.assign(additionalAliases, {
|
|
33061
|
-
pin3: ["output"],
|
|
33062
|
-
pin4: ["positive_supply", "vcc", "vdd"],
|
|
33063
|
-
pin5: ["negative_supply", "vee", "vss", "gnd"]
|
|
33064
|
-
});
|
|
33065
|
-
}
|
|
33066
|
-
super.initPorts({
|
|
33067
|
-
pinCount: 5,
|
|
33068
|
-
additionalAliases
|
|
33069
|
-
});
|
|
33070
|
-
}
|
|
33071
|
-
doInitialSourceRender() {
|
|
33072
|
-
const { db } = this.root;
|
|
33073
|
-
const { _parsedProps: props } = this;
|
|
33074
|
-
const source_component = db.source_component.insert({
|
|
33075
|
-
ftype: "simple_op_amp",
|
|
33076
|
-
name: this.name,
|
|
33077
|
-
supplier_part_numbers: props.supplierPartNumbers,
|
|
33078
|
-
display_name: props.displayName
|
|
33079
|
-
});
|
|
33080
|
-
this.source_component_id = source_component.source_component_id;
|
|
33081
|
-
}
|
|
33082
|
-
doInitialSimulationRender() {
|
|
33083
|
-
const { db } = this.root;
|
|
33084
|
-
const invertingInputPort = this.portMap.inverting_input;
|
|
33085
|
-
const nonInvertingInputPort = this.portMap.non_inverting_input;
|
|
33086
|
-
const outputPort = this.portMap.output;
|
|
33087
|
-
const positiveSupplyPort = this.portMap.positive_supply;
|
|
33088
|
-
const negativeSupplyPort = this.portMap.negative_supply;
|
|
33089
|
-
if (!invertingInputPort?.source_port_id || !nonInvertingInputPort?.source_port_id || !outputPort?.source_port_id || !positiveSupplyPort?.source_port_id || !negativeSupplyPort?.source_port_id) {
|
|
33090
|
-
return;
|
|
33091
|
-
}
|
|
33092
|
-
db.simulation_op_amp.insert({
|
|
33093
|
-
type: "simulation_op_amp",
|
|
33094
|
-
source_component_id: this.source_component_id,
|
|
33095
|
-
inverting_input_source_port_id: invertingInputPort.source_port_id,
|
|
33096
|
-
non_inverting_input_source_port_id: nonInvertingInputPort.source_port_id,
|
|
33097
|
-
output_source_port_id: outputPort.source_port_id,
|
|
33098
|
-
positive_supply_source_port_id: positiveSupplyPort.source_port_id,
|
|
33099
|
-
negative_supply_source_port_id: negativeSupplyPort.source_port_id
|
|
33100
|
-
});
|
|
33101
|
-
}
|
|
33102
|
-
inverting_input = this.portMap.inverting_input;
|
|
33103
|
-
non_inverting_input = this.portMap.non_inverting_input;
|
|
33104
|
-
output = this.portMap.output;
|
|
33105
|
-
positive_supply = this.portMap.positive_supply;
|
|
33106
|
-
negative_supply = this.portMap.negative_supply;
|
|
33107
|
-
};
|
|
33108
|
-
|
|
33109
|
-
// lib/components/normal-components/TestPoint.ts
|
|
33110
|
-
import { testpointProps } from "@tscircuit/props";
|
|
33111
|
-
var TESTPOINT_DEFAULTS = {
|
|
33112
|
-
HOLE_DIAMETER: 0.5,
|
|
33113
|
-
SMT_CIRCLE_DIAMETER: 1.2,
|
|
33114
|
-
SMT_RECT_SIZE: 2
|
|
33115
|
-
};
|
|
33116
|
-
var TestPoint = class extends NormalComponent3 {
|
|
33117
|
-
get config() {
|
|
33118
|
-
return {
|
|
33119
|
-
componentName: "TestPoint",
|
|
33120
|
-
schematicSymbolName: this.props.symbolName ?? "testpoint",
|
|
33121
|
-
zodProps: testpointProps,
|
|
33122
|
-
sourceFtype: FTYPE.simple_test_point
|
|
33123
|
-
};
|
|
33124
|
-
}
|
|
33125
|
-
_getPropsWithDefaults() {
|
|
33126
|
-
let {
|
|
33127
|
-
padShape,
|
|
33128
|
-
holeDiameter,
|
|
33129
|
-
footprintVariant,
|
|
33130
|
-
padDiameter,
|
|
33131
|
-
width,
|
|
33132
|
-
height
|
|
33133
|
-
} = this._parsedProps;
|
|
33134
|
-
if (!footprintVariant && holeDiameter) {
|
|
33135
|
-
footprintVariant = "through_hole";
|
|
33136
|
-
}
|
|
33137
|
-
footprintVariant ??= "through_hole";
|
|
33138
|
-
padShape ??= "circle";
|
|
33139
|
-
if (footprintVariant === "pad") {
|
|
33140
|
-
if (padShape === "circle") {
|
|
33141
|
-
padDiameter ??= TESTPOINT_DEFAULTS.SMT_CIRCLE_DIAMETER;
|
|
33142
|
-
} else if (padShape === "rect") {
|
|
33143
|
-
width ??= TESTPOINT_DEFAULTS.SMT_RECT_SIZE;
|
|
33144
|
-
height ??= width;
|
|
33145
|
-
}
|
|
33146
|
-
} else if (footprintVariant === "through_hole") {
|
|
33147
|
-
holeDiameter ??= TESTPOINT_DEFAULTS.HOLE_DIAMETER;
|
|
33148
|
-
}
|
|
33149
|
-
return {
|
|
33150
|
-
padShape,
|
|
33151
|
-
holeDiameter,
|
|
33152
|
-
footprintVariant,
|
|
33153
|
-
padDiameter,
|
|
33154
|
-
width,
|
|
33155
|
-
height
|
|
33156
|
-
};
|
|
33157
|
-
}
|
|
33158
|
-
_getImpliedFootprintString() {
|
|
33159
|
-
const {
|
|
33160
|
-
padShape,
|
|
33161
|
-
holeDiameter,
|
|
33162
|
-
footprintVariant,
|
|
33163
|
-
padDiameter,
|
|
33164
|
-
width,
|
|
33165
|
-
height
|
|
33166
|
-
} = this._getPropsWithDefaults();
|
|
33167
|
-
if (footprintVariant === "through_hole") {
|
|
33168
|
-
return `platedhole_d${holeDiameter}`;
|
|
33169
|
-
}
|
|
33170
|
-
if (footprintVariant === "pad") {
|
|
33171
|
-
if (padShape === "circle") {
|
|
33172
|
-
return `smtpad_circle_d${padDiameter}`;
|
|
33173
|
-
}
|
|
33174
|
-
if (padShape === "rect") {
|
|
33175
|
-
return `smtpad_rect_w${width}_h${height}`;
|
|
33176
|
-
}
|
|
33177
|
-
}
|
|
33178
|
-
throw new Error(
|
|
33179
|
-
`Footprint variant "${footprintVariant}" with pad shape "${padShape}" not implemented`
|
|
33180
|
-
);
|
|
33392
|
+
|
|
33393
|
+
// lib/components/normal-components/Mosfet.ts
|
|
33394
|
+
var Mosfet = class extends NormalComponent3 {
|
|
33395
|
+
get config() {
|
|
33396
|
+
return {
|
|
33397
|
+
componentName: "Mosfet",
|
|
33398
|
+
schematicSymbolName: this.props.symbolName ?? getMosfetSchematicSymbolName(this.props),
|
|
33399
|
+
zodProps: mosfetProps,
|
|
33400
|
+
shouldRenderAsSchematicBox: false
|
|
33401
|
+
};
|
|
33181
33402
|
}
|
|
33182
33403
|
doInitialSourceRender() {
|
|
33183
33404
|
const { db } = this.root;
|
|
33184
33405
|
const { _parsedProps: props } = this;
|
|
33185
|
-
const {
|
|
33186
|
-
padShape,
|
|
33187
|
-
holeDiameter,
|
|
33188
|
-
footprintVariant,
|
|
33189
|
-
padDiameter,
|
|
33190
|
-
width,
|
|
33191
|
-
height
|
|
33192
|
-
} = this._getPropsWithDefaults();
|
|
33193
33406
|
const source_component = db.source_component.insert({
|
|
33194
|
-
ftype:
|
|
33407
|
+
ftype: "simple_mosfet",
|
|
33195
33408
|
name: this.name,
|
|
33196
|
-
|
|
33197
|
-
|
|
33198
|
-
pad_shape: padShape,
|
|
33199
|
-
pad_diameter: padDiameter,
|
|
33200
|
-
hole_diameter: holeDiameter,
|
|
33201
|
-
width,
|
|
33202
|
-
height,
|
|
33203
|
-
are_pins_interchangeable: true,
|
|
33409
|
+
mosfet_mode: props.mosfetMode,
|
|
33410
|
+
channel_type: props.channelType,
|
|
33204
33411
|
display_name: props.displayName
|
|
33205
33412
|
});
|
|
33206
33413
|
this.source_component_id = source_component.source_component_id;
|
|
33207
33414
|
}
|
|
33208
33415
|
};
|
|
33209
33416
|
|
|
33210
|
-
// lib/components/
|
|
33211
|
-
import {
|
|
33212
|
-
|
|
33213
|
-
|
|
33214
|
-
|
|
33215
|
-
anchor,
|
|
33216
|
-
x,
|
|
33217
|
-
y,
|
|
33218
|
-
width,
|
|
33219
|
-
height,
|
|
33220
|
-
isInside
|
|
33221
|
-
}) {
|
|
33222
|
-
switch (anchor) {
|
|
33223
|
-
case "top_left":
|
|
33224
|
-
return {
|
|
33225
|
-
x,
|
|
33226
|
-
y: y + height,
|
|
33227
|
-
textAnchor: isInside ? "top_left" : "bottom_left"
|
|
33228
|
-
};
|
|
33229
|
-
case "top_center":
|
|
33230
|
-
return {
|
|
33231
|
-
x: x + width / 2,
|
|
33232
|
-
y: y + height,
|
|
33233
|
-
textAnchor: isInside ? "top_center" : "bottom_center"
|
|
33234
|
-
};
|
|
33235
|
-
case "top_right":
|
|
33236
|
-
return {
|
|
33237
|
-
x: x + width,
|
|
33238
|
-
y: y + height,
|
|
33239
|
-
textAnchor: isInside ? "top_right" : "bottom_right"
|
|
33240
|
-
};
|
|
33241
|
-
case "center_left":
|
|
33242
|
-
return {
|
|
33243
|
-
x,
|
|
33244
|
-
y: y + height / 2,
|
|
33245
|
-
textAnchor: isInside ? "center_left" : "center_right"
|
|
33246
|
-
};
|
|
33247
|
-
case "center":
|
|
33248
|
-
return {
|
|
33249
|
-
x: x + width / 2,
|
|
33250
|
-
y: y + height / 2,
|
|
33251
|
-
textAnchor: "center"
|
|
33252
|
-
};
|
|
33253
|
-
case "center_right":
|
|
33254
|
-
return {
|
|
33255
|
-
x: x + width,
|
|
33256
|
-
y: y + height / 2,
|
|
33257
|
-
textAnchor: isInside ? "center_right" : "center_left"
|
|
33258
|
-
};
|
|
33259
|
-
case "bottom_left":
|
|
33260
|
-
return {
|
|
33261
|
-
x,
|
|
33262
|
-
y,
|
|
33263
|
-
textAnchor: isInside ? "bottom_left" : "top_left"
|
|
33264
|
-
};
|
|
33265
|
-
case "bottom_center":
|
|
33266
|
-
return {
|
|
33267
|
-
x: x + width / 2,
|
|
33268
|
-
y,
|
|
33269
|
-
textAnchor: isInside ? "bottom_center" : "top_center"
|
|
33270
|
-
};
|
|
33271
|
-
case "bottom_right":
|
|
33272
|
-
return {
|
|
33273
|
-
x: x + width,
|
|
33274
|
-
y,
|
|
33275
|
-
textAnchor: isInside ? "bottom_right" : "top_right"
|
|
33276
|
-
};
|
|
33277
|
-
default:
|
|
33278
|
-
return {
|
|
33279
|
-
x: x + width / 2,
|
|
33280
|
-
y: y + height,
|
|
33281
|
-
textAnchor: "center"
|
|
33282
|
-
};
|
|
33417
|
+
// lib/components/normal-components/InternalCircuitMosfet.ts
|
|
33418
|
+
import { isValidElement as isValidElement3 } from "react";
|
|
33419
|
+
var InternalCircuitMosfet = class extends Mosfet {
|
|
33420
|
+
resolveFootprint() {
|
|
33421
|
+
return void 0;
|
|
33283
33422
|
}
|
|
33284
|
-
|
|
33423
|
+
doInitialPcbComponentRender() {
|
|
33424
|
+
}
|
|
33425
|
+
doInitialReactSubtreesRender() {
|
|
33426
|
+
const symbol = this.props.symbol;
|
|
33427
|
+
if (isValidElement3(symbol) && !this.children.some((child) => child.componentName === "Symbol")) {
|
|
33428
|
+
this.add(symbol);
|
|
33429
|
+
}
|
|
33430
|
+
}
|
|
33431
|
+
};
|
|
33285
33432
|
|
|
33286
|
-
// lib/components/
|
|
33287
|
-
|
|
33288
|
-
|
|
33289
|
-
|
|
33290
|
-
|
|
33291
|
-
|
|
33292
|
-
throw new Error(
|
|
33293
|
-
`Invalid schematicbox pinLabels key "${pinKey}". Expected pin<number>.`
|
|
33294
|
-
);
|
|
33433
|
+
// lib/components/normal-components/OpAmp.ts
|
|
33434
|
+
import { opampProps } from "@tscircuit/props";
|
|
33435
|
+
var OpAmp = class extends NormalComponent3 {
|
|
33436
|
+
getSchematicSymbolName() {
|
|
33437
|
+
if (this.props.symbolName) {
|
|
33438
|
+
return this.props.symbolName;
|
|
33295
33439
|
}
|
|
33296
|
-
const
|
|
33440
|
+
const hasPowerConnections = this.props.connections?.positive_supply || this.props.connections?.negative_supply;
|
|
33441
|
+
if (hasPowerConnections) {
|
|
33442
|
+
return "opamp_with_power";
|
|
33443
|
+
}
|
|
33444
|
+
return "opamp_no_power";
|
|
33445
|
+
}
|
|
33446
|
+
get config() {
|
|
33297
33447
|
return {
|
|
33298
|
-
|
|
33299
|
-
|
|
33300
|
-
|
|
33448
|
+
componentName: "OpAmp",
|
|
33449
|
+
schematicSymbolName: this.getSchematicSymbolName(),
|
|
33450
|
+
zodProps: opampProps,
|
|
33451
|
+
sourceFtype: "simple_op_amp"
|
|
33301
33452
|
};
|
|
33302
|
-
});
|
|
33303
|
-
};
|
|
33304
|
-
var SchematicBox_doInitialSchematicComponentRender = (schematicBox) => {
|
|
33305
|
-
if (schematicBox.root?.schematicDisabled) return;
|
|
33306
|
-
const { db } = schematicBox.root;
|
|
33307
|
-
const props = schematicBox._parsedProps;
|
|
33308
|
-
if (!props.chipRef) return;
|
|
33309
|
-
const referencedChip = schematicBox.getSubcircuit().selectOne(props.chipRef);
|
|
33310
|
-
if (!referencedChip?.source_component_id) {
|
|
33311
|
-
throw new Error(
|
|
33312
|
-
`Could not resolve chipRef "${props.chipRef}" for ${schematicBox.getString()}`
|
|
33313
|
-
);
|
|
33314
33453
|
}
|
|
33315
|
-
|
|
33316
|
-
|
|
33317
|
-
|
|
33318
|
-
|
|
33319
|
-
|
|
33320
|
-
|
|
33321
|
-
|
|
33322
|
-
|
|
33323
|
-
|
|
33324
|
-
|
|
33325
|
-
|
|
33326
|
-
|
|
33327
|
-
|
|
33328
|
-
|
|
33329
|
-
|
|
33330
|
-
|
|
33331
|
-
|
|
33332
|
-
|
|
33333
|
-
const center = schematicBox._getGlobalSchematicPositionBeforeLayout();
|
|
33334
|
-
const size = dimensions.getSize();
|
|
33335
|
-
const schematicSheetId = schematicBox._resolveSchematicSheetId();
|
|
33336
|
-
const portLabels = Object.fromEntries(
|
|
33337
|
-
schematicBoxPinLabels.map(({ pinNumber, displayPinLabel }) => [
|
|
33338
|
-
String(pinNumber),
|
|
33339
|
-
displayPinLabel
|
|
33340
|
-
])
|
|
33341
|
-
);
|
|
33342
|
-
const schematicComponent = db.schematic_component.insert({
|
|
33343
|
-
center,
|
|
33344
|
-
size,
|
|
33345
|
-
source_component_id: referencedChip.source_component_id,
|
|
33346
|
-
is_box_with_pins: true,
|
|
33347
|
-
port_arrangement: underscorifyPortArrangement(props.schPinArrangement),
|
|
33348
|
-
port_labels: portLabels,
|
|
33349
|
-
pin_spacing: 0.2,
|
|
33350
|
-
schematic_sheet_id: schematicSheetId
|
|
33351
|
-
});
|
|
33352
|
-
schematicBox.schematic_component_id = schematicComponent.schematic_component_id;
|
|
33353
|
-
for (const {
|
|
33354
|
-
pinNumber,
|
|
33355
|
-
displayPinLabel,
|
|
33356
|
-
pinAliases
|
|
33357
|
-
} of schematicBoxPinLabels) {
|
|
33358
|
-
const referencedSourcePort = sourcePorts.find(
|
|
33359
|
-
(sourcePort) => pinAliases.some(
|
|
33360
|
-
(pinAlias) => sourcePort.name === pinAlias || sourcePort.port_hints?.includes(pinAlias)
|
|
33361
|
-
)
|
|
33362
|
-
);
|
|
33363
|
-
if (!referencedSourcePort) {
|
|
33364
|
-
throw new Error(
|
|
33365
|
-
`Could not find pin "${displayPinLabel}" on chipRef "${props.chipRef}"`
|
|
33366
|
-
);
|
|
33454
|
+
initPorts() {
|
|
33455
|
+
const additionalAliases = {
|
|
33456
|
+
pin1: ["non_inverting_input"],
|
|
33457
|
+
pin2: ["inverting_input"]
|
|
33458
|
+
};
|
|
33459
|
+
const hasPowerSymbol = this.getSchematicSymbolName() === "opamp_with_power";
|
|
33460
|
+
if (hasPowerSymbol) {
|
|
33461
|
+
Object.assign(additionalAliases, {
|
|
33462
|
+
pin4: ["output"],
|
|
33463
|
+
pin5: ["positive_supply", "vcc", "vdd"],
|
|
33464
|
+
pin3: ["negative_supply", "vee", "vss", "gnd"]
|
|
33465
|
+
});
|
|
33466
|
+
} else {
|
|
33467
|
+
Object.assign(additionalAliases, {
|
|
33468
|
+
pin3: ["output"],
|
|
33469
|
+
pin4: ["positive_supply", "vcc", "vdd"],
|
|
33470
|
+
pin5: ["negative_supply", "vee", "vss", "gnd"]
|
|
33471
|
+
});
|
|
33367
33472
|
}
|
|
33368
|
-
|
|
33369
|
-
|
|
33370
|
-
|
|
33371
|
-
|
|
33372
|
-
|
|
33473
|
+
super.initPorts({
|
|
33474
|
+
pinCount: 5,
|
|
33475
|
+
additionalAliases
|
|
33476
|
+
});
|
|
33477
|
+
}
|
|
33478
|
+
doInitialSourceRender() {
|
|
33479
|
+
const { db } = this.root;
|
|
33480
|
+
const { _parsedProps: props } = this;
|
|
33481
|
+
const source_component = db.source_component.insert({
|
|
33482
|
+
ftype: "simple_op_amp",
|
|
33483
|
+
name: this.name,
|
|
33484
|
+
supplier_part_numbers: props.supplierPartNumbers,
|
|
33485
|
+
display_name: props.displayName
|
|
33486
|
+
});
|
|
33487
|
+
this.source_component_id = source_component.source_component_id;
|
|
33488
|
+
}
|
|
33489
|
+
doInitialSimulationRender() {
|
|
33490
|
+
const { db } = this.root;
|
|
33491
|
+
const invertingInputPort = this.portMap.inverting_input;
|
|
33492
|
+
const nonInvertingInputPort = this.portMap.non_inverting_input;
|
|
33493
|
+
const outputPort = this.portMap.output;
|
|
33494
|
+
const positiveSupplyPort = this.portMap.positive_supply;
|
|
33495
|
+
const negativeSupplyPort = this.portMap.negative_supply;
|
|
33496
|
+
if (!invertingInputPort?.source_port_id || !nonInvertingInputPort?.source_port_id || !outputPort?.source_port_id || !positiveSupplyPort?.source_port_id || !negativeSupplyPort?.source_port_id) {
|
|
33497
|
+
return;
|
|
33373
33498
|
}
|
|
33374
|
-
|
|
33375
|
-
|
|
33376
|
-
|
|
33377
|
-
|
|
33378
|
-
|
|
33379
|
-
|
|
33380
|
-
|
|
33381
|
-
|
|
33382
|
-
center: {
|
|
33383
|
-
x: center.x + portPosition.x,
|
|
33384
|
-
y: center.y + portPosition.y
|
|
33385
|
-
},
|
|
33386
|
-
source_port_id: referencedSourcePort.source_port_id,
|
|
33387
|
-
facing_direction: facingDirection,
|
|
33388
|
-
distance_from_component_edge: 0.4,
|
|
33389
|
-
side_of_component: portPosition.side,
|
|
33390
|
-
pin_number: pinNumber,
|
|
33391
|
-
true_ccw_index: portPosition.trueIndex,
|
|
33392
|
-
display_pin_label: displayPinLabel,
|
|
33393
|
-
is_connected: false,
|
|
33394
|
-
schematic_sheet_id: schematicSheetId
|
|
33499
|
+
db.simulation_op_amp.insert({
|
|
33500
|
+
type: "simulation_op_amp",
|
|
33501
|
+
source_component_id: this.source_component_id,
|
|
33502
|
+
inverting_input_source_port_id: invertingInputPort.source_port_id,
|
|
33503
|
+
non_inverting_input_source_port_id: nonInvertingInputPort.source_port_id,
|
|
33504
|
+
output_source_port_id: outputPort.source_port_id,
|
|
33505
|
+
positive_supply_source_port_id: positiveSupplyPort.source_port_id,
|
|
33506
|
+
negative_supply_source_port_id: negativeSupplyPort.source_port_id
|
|
33395
33507
|
});
|
|
33396
33508
|
}
|
|
33397
|
-
|
|
33398
|
-
|
|
33399
|
-
|
|
33400
|
-
|
|
33401
|
-
|
|
33402
|
-
rotation: 0,
|
|
33403
|
-
position: {
|
|
33404
|
-
x: center.x - size.width / 2,
|
|
33405
|
-
y: center.y + size.height / 2 + 0.13
|
|
33406
|
-
},
|
|
33407
|
-
color: "#006464",
|
|
33408
|
-
font_size: 0.18,
|
|
33409
|
-
schematic_sheet_id: schematicSheetId
|
|
33410
|
-
});
|
|
33509
|
+
inverting_input = this.portMap.inverting_input;
|
|
33510
|
+
non_inverting_input = this.portMap.non_inverting_input;
|
|
33511
|
+
output = this.portMap.output;
|
|
33512
|
+
positive_supply = this.portMap.positive_supply;
|
|
33513
|
+
negative_supply = this.portMap.negative_supply;
|
|
33411
33514
|
};
|
|
33412
33515
|
|
|
33413
|
-
// lib/components/
|
|
33414
|
-
|
|
33415
|
-
|
|
33516
|
+
// lib/components/normal-components/TestPoint.ts
|
|
33517
|
+
import { testpointProps } from "@tscircuit/props";
|
|
33518
|
+
var TESTPOINT_DEFAULTS = {
|
|
33519
|
+
HOLE_DIAMETER: 0.5,
|
|
33520
|
+
SMT_CIRCLE_DIAMETER: 1.2,
|
|
33521
|
+
SMT_RECT_SIZE: 2
|
|
33522
|
+
};
|
|
33523
|
+
var TestPoint = class extends NormalComponent3 {
|
|
33416
33524
|
get config() {
|
|
33417
33525
|
return {
|
|
33418
|
-
componentName: "
|
|
33419
|
-
|
|
33420
|
-
|
|
33526
|
+
componentName: "TestPoint",
|
|
33527
|
+
schematicSymbolName: this.props.symbolName ?? "testpoint",
|
|
33528
|
+
zodProps: testpointProps,
|
|
33529
|
+
sourceFtype: FTYPE.simple_test_point
|
|
33421
33530
|
};
|
|
33422
33531
|
}
|
|
33423
|
-
|
|
33424
|
-
|
|
33532
|
+
_getPropsWithDefaults() {
|
|
33533
|
+
let {
|
|
33534
|
+
padShape,
|
|
33535
|
+
holeDiameter,
|
|
33536
|
+
footprintVariant,
|
|
33537
|
+
padDiameter,
|
|
33538
|
+
width,
|
|
33539
|
+
height
|
|
33540
|
+
} = this._parsedProps;
|
|
33541
|
+
if (!footprintVariant && holeDiameter) {
|
|
33542
|
+
footprintVariant = "through_hole";
|
|
33543
|
+
}
|
|
33544
|
+
footprintVariant ??= "through_hole";
|
|
33545
|
+
padShape ??= "circle";
|
|
33546
|
+
if (footprintVariant === "pad") {
|
|
33547
|
+
if (padShape === "circle") {
|
|
33548
|
+
padDiameter ??= TESTPOINT_DEFAULTS.SMT_CIRCLE_DIAMETER;
|
|
33549
|
+
} else if (padShape === "rect") {
|
|
33550
|
+
width ??= TESTPOINT_DEFAULTS.SMT_RECT_SIZE;
|
|
33551
|
+
height ??= width;
|
|
33552
|
+
}
|
|
33553
|
+
} else if (footprintVariant === "through_hole") {
|
|
33554
|
+
holeDiameter ??= TESTPOINT_DEFAULTS.HOLE_DIAMETER;
|
|
33555
|
+
}
|
|
33556
|
+
return {
|
|
33557
|
+
padShape,
|
|
33558
|
+
holeDiameter,
|
|
33559
|
+
footprintVariant,
|
|
33560
|
+
padDiameter,
|
|
33561
|
+
width,
|
|
33562
|
+
height
|
|
33563
|
+
};
|
|
33425
33564
|
}
|
|
33426
|
-
|
|
33427
|
-
|
|
33428
|
-
|
|
33565
|
+
_getImpliedFootprintString() {
|
|
33566
|
+
const {
|
|
33567
|
+
padShape,
|
|
33568
|
+
holeDiameter,
|
|
33569
|
+
footprintVariant,
|
|
33570
|
+
padDiameter,
|
|
33571
|
+
width,
|
|
33572
|
+
height
|
|
33573
|
+
} = this._getPropsWithDefaults();
|
|
33574
|
+
if (footprintVariant === "through_hole") {
|
|
33575
|
+
return `platedhole_d${holeDiameter}`;
|
|
33576
|
+
}
|
|
33577
|
+
if (footprintVariant === "pad") {
|
|
33578
|
+
if (padShape === "circle") {
|
|
33579
|
+
return `smtpad_circle_d${padDiameter}`;
|
|
33580
|
+
}
|
|
33581
|
+
if (padShape === "rect") {
|
|
33582
|
+
return `smtpad_rect_w${width}_h${height}`;
|
|
33583
|
+
}
|
|
33584
|
+
}
|
|
33585
|
+
throw new Error(
|
|
33586
|
+
`Footprint variant "${footprintVariant}" with pad shape "${padShape}" not implemented`
|
|
33587
|
+
);
|
|
33588
|
+
}
|
|
33589
|
+
doInitialSourceRender() {
|
|
33429
33590
|
const { db } = this.root;
|
|
33430
33591
|
const { _parsedProps: props } = this;
|
|
33431
|
-
|
|
33432
|
-
|
|
33433
|
-
|
|
33434
|
-
|
|
33435
|
-
|
|
33436
|
-
const paddingLeft = typeof props.paddingLeft === "number" ? props.paddingLeft : generalPadding;
|
|
33437
|
-
const paddingRight = typeof props.paddingRight === "number" ? props.paddingRight : generalPadding;
|
|
33438
|
-
const hasOverlay = props.overlay && props.overlay.length > 0;
|
|
33439
|
-
const hasFixedSize = typeof props.width === "number" && typeof props.height === "number";
|
|
33440
|
-
let width;
|
|
33441
|
-
let height;
|
|
33442
|
-
let x;
|
|
33443
|
-
let y;
|
|
33444
|
-
let centerX;
|
|
33445
|
-
let centerY;
|
|
33446
|
-
if (hasOverlay) {
|
|
33447
|
-
const portsWithSelectors = props.overlay.map((selector) => ({
|
|
33448
|
-
selector,
|
|
33449
|
-
port: this.getSubcircuit().selectOne(selector, {
|
|
33450
|
-
type: "port"
|
|
33451
|
-
})
|
|
33452
|
-
})).filter(({ port }) => port != null);
|
|
33453
|
-
const portsWithPosition = portsWithSelectors.map(({ port }) => ({
|
|
33454
|
-
position: port._getGlobalSchematicPositionAfterLayout()
|
|
33455
|
-
}));
|
|
33456
|
-
if (portsWithPosition.length === 0) return;
|
|
33457
|
-
const xs = portsWithPosition.map((p) => p.position.x);
|
|
33458
|
-
const ys = portsWithPosition.map((p) => p.position.y);
|
|
33459
|
-
const minX = Math.min(...xs);
|
|
33460
|
-
const maxX = Math.max(...xs);
|
|
33461
|
-
const minY = Math.min(...ys);
|
|
33462
|
-
const maxY = Math.max(...ys);
|
|
33463
|
-
const rawWidth = maxX - minX;
|
|
33464
|
-
const rawHeight = maxY - minY;
|
|
33465
|
-
const defaultHorizontalPadding = rawWidth === 0 ? basePadding : 0;
|
|
33466
|
-
const defaultVerticalPadding = rawHeight === 0 ? basePadding : 0;
|
|
33467
|
-
const finalPaddingLeft = paddingLeft + defaultHorizontalPadding / 2;
|
|
33468
|
-
const finalPaddingRight = paddingRight + defaultHorizontalPadding / 2;
|
|
33469
|
-
const finalPaddingTop = paddingTop + defaultVerticalPadding / 2;
|
|
33470
|
-
const finalPaddingBottom = paddingBottom + defaultVerticalPadding / 2;
|
|
33471
|
-
const left = minX - finalPaddingLeft;
|
|
33472
|
-
const right = maxX + finalPaddingRight;
|
|
33473
|
-
const top = minY - finalPaddingBottom;
|
|
33474
|
-
const bottom = maxY + finalPaddingTop;
|
|
33475
|
-
width = right - left;
|
|
33476
|
-
height = bottom - top;
|
|
33477
|
-
x = left + (props.schX ?? 0);
|
|
33478
|
-
y = top + (props.schY ?? 0);
|
|
33479
|
-
centerX = x + width / 2;
|
|
33480
|
-
centerY = y + height / 2;
|
|
33481
|
-
} else if (hasFixedSize) {
|
|
33482
|
-
width = props.width;
|
|
33483
|
-
height = props.height;
|
|
33484
|
-
const center = this._getGlobalSchematicPositionBeforeLayout();
|
|
33485
|
-
centerX = center.x;
|
|
33486
|
-
centerY = center.y;
|
|
33487
|
-
x = centerX - width / 2;
|
|
33488
|
-
y = centerY - height / 2;
|
|
33489
|
-
} else {
|
|
33490
|
-
return;
|
|
33491
|
-
}
|
|
33492
|
-
db.schematic_box.insert({
|
|
33493
|
-
height,
|
|
33592
|
+
const {
|
|
33593
|
+
padShape,
|
|
33594
|
+
holeDiameter,
|
|
33595
|
+
footprintVariant,
|
|
33596
|
+
padDiameter,
|
|
33494
33597
|
width,
|
|
33495
|
-
|
|
33496
|
-
|
|
33497
|
-
|
|
33498
|
-
|
|
33598
|
+
height
|
|
33599
|
+
} = this._getPropsWithDefaults();
|
|
33600
|
+
const source_component = db.source_component.insert({
|
|
33601
|
+
ftype: FTYPE.simple_test_point,
|
|
33602
|
+
name: this.name,
|
|
33603
|
+
supplier_part_numbers: props.supplierPartNumbers,
|
|
33604
|
+
footprint_variant: footprintVariant,
|
|
33605
|
+
pad_shape: padShape,
|
|
33606
|
+
pad_diameter: padDiameter,
|
|
33607
|
+
hole_diameter: holeDiameter,
|
|
33608
|
+
width,
|
|
33609
|
+
height,
|
|
33610
|
+
are_pins_interchangeable: true,
|
|
33611
|
+
display_name: props.displayName
|
|
33499
33612
|
});
|
|
33500
|
-
|
|
33501
|
-
const isInside = props.titleInside;
|
|
33502
|
-
const TITLE_PADDING = 0.1;
|
|
33503
|
-
const anchor = props.titleAlignment;
|
|
33504
|
-
const anchorPos = getTitleAnchorAndPosition({
|
|
33505
|
-
anchor,
|
|
33506
|
-
x,
|
|
33507
|
-
y,
|
|
33508
|
-
width,
|
|
33509
|
-
height,
|
|
33510
|
-
isInside
|
|
33511
|
-
});
|
|
33512
|
-
let titleOffsetY;
|
|
33513
|
-
let titleOffsetX;
|
|
33514
|
-
const textAnchor = anchorPos.textAnchor;
|
|
33515
|
-
if (isInside) {
|
|
33516
|
-
titleOffsetY = anchor.includes("top") ? -TITLE_PADDING : anchor.includes("bottom") ? TITLE_PADDING : 0;
|
|
33517
|
-
titleOffsetX = anchor.includes("left") ? TITLE_PADDING : anchor.includes("right") ? -TITLE_PADDING : 0;
|
|
33518
|
-
} else {
|
|
33519
|
-
titleOffsetY = anchor.includes("top") ? TITLE_PADDING : anchor.includes("bottom") ? -TITLE_PADDING : 0;
|
|
33520
|
-
titleOffsetX = anchor.includes("center_left") ? -TITLE_PADDING : anchor.includes("center_right") ? TITLE_PADDING : 0;
|
|
33521
|
-
}
|
|
33522
|
-
const titleX = anchorPos.x + titleOffsetX;
|
|
33523
|
-
const titleY = anchorPos.y + titleOffsetY;
|
|
33524
|
-
db.schematic_text.insert({
|
|
33525
|
-
anchor: textAnchor,
|
|
33526
|
-
text: props.title,
|
|
33527
|
-
font_size: props.titleFontSize ?? 0.18,
|
|
33528
|
-
color: props.titleColor ?? "#000000",
|
|
33529
|
-
position: {
|
|
33530
|
-
x: titleX,
|
|
33531
|
-
y: titleY
|
|
33532
|
-
},
|
|
33533
|
-
rotation: 0,
|
|
33534
|
-
schematic_sheet_id: this._resolveSchematicSheetId()
|
|
33535
|
-
});
|
|
33536
|
-
}
|
|
33613
|
+
this.source_component_id = source_component.source_component_id;
|
|
33537
33614
|
}
|
|
33538
33615
|
};
|
|
33539
33616
|
|
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.1485",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@tscircuit/math-utils": "^0.0.36",
|
|
52
52
|
"@tscircuit/miniflex": "^0.0.4",
|
|
53
53
|
"@tscircuit/ngspice-spice-engine": "^0.0.19",
|
|
54
|
-
"@tscircuit/props": "^0.0.
|
|
54
|
+
"@tscircuit/props": "^0.0.589",
|
|
55
55
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
56
56
|
"@tscircuit/schematic-trace-solver": "^0.0.104",
|
|
57
57
|
"@tscircuit/solver-utils": "^0.0.16",
|