@tscircuit/core 0.0.1395 → 0.0.1397
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.js +61 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19810,8 +19810,18 @@ import { SchematicTracePipelineSolver as SchematicTracePipelineSolver4 } from "@
|
|
|
19810
19810
|
import Debug12 from "debug";
|
|
19811
19811
|
|
|
19812
19812
|
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/createSchematicTraceSolverInputProblem.ts
|
|
19813
|
+
import {
|
|
19814
|
+
getBoundFromCenteredRect as getBoundFromCenteredRect4,
|
|
19815
|
+
getBoundsCenter as getBoundsCenter2
|
|
19816
|
+
} from "@tscircuit/math-utils";
|
|
19813
19817
|
import "@tscircuit/schematic-trace-solver";
|
|
19814
19818
|
|
|
19819
|
+
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/schematicTextToTextBounds.ts
|
|
19820
|
+
import {
|
|
19821
|
+
getBoundFromCenteredRect as getBoundFromCenteredRect3,
|
|
19822
|
+
getBoundsCenter
|
|
19823
|
+
} from "@tscircuit/math-utils";
|
|
19824
|
+
|
|
19815
19825
|
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/getSchematicTextBounds.ts
|
|
19816
19826
|
import { getBoundsFromPoints as getBoundsFromPoints4 } from "@tscircuit/math-utils";
|
|
19817
19827
|
var DEFAULT_SCHEMATIC_TEXT_FONT_SIZE = 0.18;
|
|
@@ -19863,10 +19873,29 @@ function getSchematicTextBounds(text) {
|
|
|
19863
19873
|
}
|
|
19864
19874
|
|
|
19865
19875
|
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/schematicTextToTextBounds.ts
|
|
19866
|
-
|
|
19867
|
-
|
|
19876
|
+
var REFDES_TEXT_BOX_CHIP_OVERLAP = 0.01;
|
|
19877
|
+
var REFDES_TEXT_BOX_CLEARANCE = 0.06;
|
|
19878
|
+
function isReferenceDesignatorText(text, sourceComponent) {
|
|
19879
|
+
if (!sourceComponent) return false;
|
|
19880
|
+
return text.text === sourceComponent.display_name || text.text === sourceComponent.name;
|
|
19881
|
+
}
|
|
19882
|
+
function schematicTextToTextBox(text, options = {}) {
|
|
19868
19883
|
if (!text.text) return null;
|
|
19869
19884
|
const bounds = getSchematicTextBounds(text);
|
|
19885
|
+
if (isReferenceDesignatorText(text, options.sourceComponent) && options.schematicComponent?.center && options.schematicComponent?.size) {
|
|
19886
|
+
const componentBounds = getBoundFromCenteredRect3({
|
|
19887
|
+
center: options.schematicComponent.center,
|
|
19888
|
+
width: options.schematicComponent.size.width,
|
|
19889
|
+
height: options.schematicComponent.size.height
|
|
19890
|
+
});
|
|
19891
|
+
const textHeight = bounds.maxY - bounds.minY;
|
|
19892
|
+
if (bounds.minY > componentBounds.maxY) {
|
|
19893
|
+
bounds.minX -= REFDES_TEXT_BOX_CLEARANCE;
|
|
19894
|
+
bounds.maxX += REFDES_TEXT_BOX_CLEARANCE;
|
|
19895
|
+
bounds.minY = componentBounds.maxY - REFDES_TEXT_BOX_CHIP_OVERLAP;
|
|
19896
|
+
bounds.maxY = componentBounds.maxY + textHeight + REFDES_TEXT_BOX_CLEARANCE;
|
|
19897
|
+
}
|
|
19898
|
+
}
|
|
19870
19899
|
return {
|
|
19871
19900
|
chipId: text.schematic_component_id,
|
|
19872
19901
|
center: getBoundsCenter(bounds),
|
|
@@ -19877,10 +19906,6 @@ function schematicTextToTextBox(text) {
|
|
|
19877
19906
|
}
|
|
19878
19907
|
|
|
19879
19908
|
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/createSchematicTraceSolverInputProblem.ts
|
|
19880
|
-
import {
|
|
19881
|
-
getBoundFromCenteredRect as getBoundFromCenteredRect3,
|
|
19882
|
-
getBoundsCenter as getBoundsCenter2
|
|
19883
|
-
} from "@tscircuit/math-utils";
|
|
19884
19909
|
var DEFAULT_MAX_MSP_PAIR_DISTANCE = 2.4;
|
|
19885
19910
|
var SCHEMATIC_RAIL_NET_LABEL_HEIGHT = 0.42;
|
|
19886
19911
|
function createSchematicTraceSolverInputProblem(group) {
|
|
@@ -19896,9 +19921,27 @@ function createSchematicTraceSolverInputProblem(group) {
|
|
|
19896
19921
|
const schematicComponentIds = new Set(
|
|
19897
19922
|
schematicComponents.map((component) => component.schematic_component_id)
|
|
19898
19923
|
);
|
|
19924
|
+
const schematicComponentsById = new Map(
|
|
19925
|
+
schematicComponents.map((component) => [
|
|
19926
|
+
component.schematic_component_id,
|
|
19927
|
+
component
|
|
19928
|
+
])
|
|
19929
|
+
);
|
|
19899
19930
|
const textBoxes = db.schematic_text.list().filter(
|
|
19900
19931
|
(text) => text.schematic_component_id && schematicComponentIds.has(text.schematic_component_id)
|
|
19901
|
-
).map(
|
|
19932
|
+
).map((text) => {
|
|
19933
|
+
const schematicComponent = schematicComponentsById.get(
|
|
19934
|
+
text.schematic_component_id
|
|
19935
|
+
);
|
|
19936
|
+
if (!schematicComponent) return;
|
|
19937
|
+
const sourceComponent = db.source_component.get(
|
|
19938
|
+
schematicComponent.source_component_id
|
|
19939
|
+
);
|
|
19940
|
+
return schematicTextToTextBox(text, {
|
|
19941
|
+
schematicComponent,
|
|
19942
|
+
sourceComponent
|
|
19943
|
+
});
|
|
19944
|
+
}).filter((textBox) => Boolean(textBox));
|
|
19902
19945
|
const componentNameToSectionId = /* @__PURE__ */ new Map();
|
|
19903
19946
|
for (const component of group.getDescendants()) {
|
|
19904
19947
|
if (component.name && component._parsedProps?.schSectionName) {
|
|
@@ -19937,7 +19980,7 @@ function createSchematicTraceSolverInputProblem(group) {
|
|
|
19937
19980
|
if (sourceComponent?.name) {
|
|
19938
19981
|
sectionId = componentNameToSectionId.get(sourceComponent.name);
|
|
19939
19982
|
}
|
|
19940
|
-
const layoutBounds = getSchematicComponentWithTextBounds(db, schematicComponent) ??
|
|
19983
|
+
const layoutBounds = getSchematicComponentWithTextBounds(db, schematicComponent) ?? getBoundFromCenteredRect4({
|
|
19941
19984
|
center: schematicComponent.center,
|
|
19942
19985
|
width: schematicComponent.size.width,
|
|
19943
19986
|
height: schematicComponent.size.height
|
|
@@ -20064,10 +20107,15 @@ function createSchematicTraceSolverInputProblem(group) {
|
|
|
20064
20107
|
sourceNet.name || sourceNet.source_net_id || connKey
|
|
20065
20108
|
);
|
|
20066
20109
|
userNetIdToConnKey.set(userNetId, connKey);
|
|
20067
|
-
const
|
|
20110
|
+
const netLabelTextWidth = Number(
|
|
20068
20111
|
getSchematicNetLabelTextWidth({ text: String(userNetId) }).toFixed(2)
|
|
20069
20112
|
);
|
|
20070
|
-
|
|
20113
|
+
let netLabelWidth = netLabelTextWidth;
|
|
20114
|
+
let netLabelHeight;
|
|
20115
|
+
if (sourceNet.is_ground || sourceNet.is_power) {
|
|
20116
|
+
netLabelWidth = SCHEMATIC_RAIL_NET_LABEL_HEIGHT;
|
|
20117
|
+
netLabelHeight = netLabelTextWidth;
|
|
20118
|
+
}
|
|
20071
20119
|
netConnections.push({
|
|
20072
20120
|
netId: userNetId,
|
|
20073
20121
|
pinIds: schematicPortIds.map(
|
|
@@ -25238,7 +25286,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
25238
25286
|
var package_default = {
|
|
25239
25287
|
name: "@tscircuit/core",
|
|
25240
25288
|
type: "module",
|
|
25241
|
-
version: "0.0.
|
|
25289
|
+
version: "0.0.1396",
|
|
25242
25290
|
types: "dist/index.d.ts",
|
|
25243
25291
|
main: "dist/index.js",
|
|
25244
25292
|
module: "dist/index.js",
|
|
@@ -28592,7 +28640,7 @@ import { distance as distance16 } from "@tscircuit/math-utils";
|
|
|
28592
28640
|
// node_modules/@tscircuit/breakout-point-solver/lib/pad/breakout-pad-collisions.ts
|
|
28593
28641
|
import {
|
|
28594
28642
|
doesSegmentIntersectRect,
|
|
28595
|
-
getBoundFromCenteredRect as
|
|
28643
|
+
getBoundFromCenteredRect as getBoundFromCenteredRect5
|
|
28596
28644
|
} from "@tscircuit/math-utils";
|
|
28597
28645
|
var degreesToRadians = (degrees) => degrees * Math.PI / 180;
|
|
28598
28646
|
var rotatePoint = (point6, radians) => {
|
|
@@ -28615,7 +28663,7 @@ var getLocalPadPoint = (point6, pad) => {
|
|
|
28615
28663
|
};
|
|
28616
28664
|
var getInflatedPadRect = (pad) => {
|
|
28617
28665
|
const clearance = pad.clearance ?? 0;
|
|
28618
|
-
return
|
|
28666
|
+
return getBoundFromCenteredRect5({
|
|
28619
28667
|
center: { x: 0, y: 0 },
|
|
28620
28668
|
width: pad.width + clearance * 2,
|
|
28621
28669
|
height: pad.height + clearance * 2
|