@tscircuit/core 0.0.2308 → 0.0.2310
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 +332 -247
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -78,7 +78,7 @@ __export(components_exports, {
|
|
|
78
78
|
Fiducial: () => Fiducial,
|
|
79
79
|
Footprint: () => Footprint,
|
|
80
80
|
Fuse: () => Fuse,
|
|
81
|
-
Group: () =>
|
|
81
|
+
Group: () => Group,
|
|
82
82
|
Hole: () => Hole,
|
|
83
83
|
IbisModel: () => IbisModel,
|
|
84
84
|
Inductor: () => Inductor,
|
|
@@ -23395,9 +23395,9 @@ var SystemBlockPage = class extends SystemBlockPrimitive {
|
|
|
23395
23395
|
};
|
|
23396
23396
|
|
|
23397
23397
|
// lib/components/normal-components/Board/Board.ts
|
|
23398
|
-
import { getBoundsFromPoints as
|
|
23398
|
+
import { getBoundsFromPoints as getBoundsFromPoints14 } from "@tscircuit/math-utils";
|
|
23399
23399
|
import { boardProps } from "@tscircuit/props";
|
|
23400
|
-
import { compose as compose19, translate as
|
|
23400
|
+
import { compose as compose19, translate as translate20 } from "transformation-matrix";
|
|
23401
23401
|
|
|
23402
23402
|
// lib/utils/autorouting/getAncestorSubcircuitIds.ts
|
|
23403
23403
|
var getDescendantSubcircuitIds = (db2, root_subcircuit_id) => {
|
|
@@ -26324,7 +26324,7 @@ import {
|
|
|
26324
26324
|
getRerouteSimpleRouteJson,
|
|
26325
26325
|
reconnectReroutedSimpleRouteJsonRegion
|
|
26326
26326
|
} from "@tscircuit/capacity-autorouter";
|
|
26327
|
-
import { getBoundsFromPoints as
|
|
26327
|
+
import { getBoundsFromPoints as getBoundsFromPoints13 } from "@tscircuit/math-utils";
|
|
26328
26328
|
import {
|
|
26329
26329
|
groupProps
|
|
26330
26330
|
} from "@tscircuit/props";
|
|
@@ -153015,6 +153015,185 @@ var Group_doInitialSchematicBoxComponentRender = (group) => {
|
|
|
153015
153015
|
};
|
|
153016
153016
|
|
|
153017
153017
|
// lib/components/primitive-components/Group/Group_doInitialSchematicLayoutFlex.ts
|
|
153018
|
+
import { getBoundsFromPoints as getBoundsFromPoints11 } from "@tscircuit/math-utils";
|
|
153019
|
+
|
|
153020
|
+
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/getSchematicTextBounds.ts
|
|
153021
|
+
import { getBoundsFromPoints as getBoundsFromPoints10 } from "@tscircuit/math-utils";
|
|
153022
|
+
|
|
153023
|
+
// lib/utils/schematic/getSchematicTextWidth.ts
|
|
153024
|
+
function getSchematicTextWidth({
|
|
153025
|
+
text,
|
|
153026
|
+
fontSize
|
|
153027
|
+
}) {
|
|
153028
|
+
const fontScale = fontSize / 0.18;
|
|
153029
|
+
const charWidth = 0.12 * fontScale;
|
|
153030
|
+
return text.length * charWidth;
|
|
153031
|
+
}
|
|
153032
|
+
|
|
153033
|
+
// lib/utils/schematic/getSchematicTextObstacleWidth.ts
|
|
153034
|
+
var ASCII_ADVANCES = [
|
|
153035
|
+
28,
|
|
153036
|
+
28,
|
|
153037
|
+
35,
|
|
153038
|
+
56,
|
|
153039
|
+
56,
|
|
153040
|
+
89,
|
|
153041
|
+
67,
|
|
153042
|
+
19,
|
|
153043
|
+
33,
|
|
153044
|
+
33,
|
|
153045
|
+
39,
|
|
153046
|
+
58,
|
|
153047
|
+
28,
|
|
153048
|
+
33,
|
|
153049
|
+
28,
|
|
153050
|
+
28,
|
|
153051
|
+
56,
|
|
153052
|
+
56,
|
|
153053
|
+
56,
|
|
153054
|
+
56,
|
|
153055
|
+
56,
|
|
153056
|
+
56,
|
|
153057
|
+
56,
|
|
153058
|
+
56,
|
|
153059
|
+
56,
|
|
153060
|
+
56,
|
|
153061
|
+
28,
|
|
153062
|
+
28,
|
|
153063
|
+
58,
|
|
153064
|
+
58,
|
|
153065
|
+
58,
|
|
153066
|
+
56,
|
|
153067
|
+
102,
|
|
153068
|
+
67,
|
|
153069
|
+
67,
|
|
153070
|
+
72,
|
|
153071
|
+
72,
|
|
153072
|
+
67,
|
|
153073
|
+
61,
|
|
153074
|
+
78,
|
|
153075
|
+
72,
|
|
153076
|
+
28,
|
|
153077
|
+
50,
|
|
153078
|
+
67,
|
|
153079
|
+
56,
|
|
153080
|
+
83,
|
|
153081
|
+
72,
|
|
153082
|
+
78,
|
|
153083
|
+
67,
|
|
153084
|
+
78,
|
|
153085
|
+
72,
|
|
153086
|
+
67,
|
|
153087
|
+
61,
|
|
153088
|
+
72,
|
|
153089
|
+
67,
|
|
153090
|
+
94,
|
|
153091
|
+
67,
|
|
153092
|
+
67,
|
|
153093
|
+
61,
|
|
153094
|
+
28,
|
|
153095
|
+
28,
|
|
153096
|
+
28,
|
|
153097
|
+
47,
|
|
153098
|
+
56,
|
|
153099
|
+
33,
|
|
153100
|
+
56,
|
|
153101
|
+
56,
|
|
153102
|
+
50,
|
|
153103
|
+
56,
|
|
153104
|
+
56,
|
|
153105
|
+
28,
|
|
153106
|
+
56,
|
|
153107
|
+
56,
|
|
153108
|
+
22,
|
|
153109
|
+
22,
|
|
153110
|
+
50,
|
|
153111
|
+
22,
|
|
153112
|
+
83,
|
|
153113
|
+
56,
|
|
153114
|
+
56,
|
|
153115
|
+
56,
|
|
153116
|
+
56,
|
|
153117
|
+
33,
|
|
153118
|
+
50,
|
|
153119
|
+
28,
|
|
153120
|
+
56,
|
|
153121
|
+
50,
|
|
153122
|
+
72,
|
|
153123
|
+
50,
|
|
153124
|
+
50,
|
|
153125
|
+
50,
|
|
153126
|
+
33,
|
|
153127
|
+
26,
|
|
153128
|
+
33,
|
|
153129
|
+
58
|
|
153130
|
+
];
|
|
153131
|
+
function getSchematicTextObstacleWidth({
|
|
153132
|
+
text,
|
|
153133
|
+
fontSize
|
|
153134
|
+
}) {
|
|
153135
|
+
let totalAdvance = 0;
|
|
153136
|
+
for (const character of text) {
|
|
153137
|
+
const advance = ASCII_ADVANCES[character.charCodeAt(0) - 32];
|
|
153138
|
+
if (advance === void 0) {
|
|
153139
|
+
return getSchematicTextWidth({ text, fontSize });
|
|
153140
|
+
}
|
|
153141
|
+
totalAdvance += advance;
|
|
153142
|
+
}
|
|
153143
|
+
return totalAdvance * (fontSize / 100);
|
|
153144
|
+
}
|
|
153145
|
+
|
|
153146
|
+
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/getSchematicTextBounds.ts
|
|
153147
|
+
var DEFAULT_SCHEMATIC_TEXT_FONT_SIZE = 0.18;
|
|
153148
|
+
function getSchematicTextBounds(text) {
|
|
153149
|
+
const fontSize = text.font_size ?? DEFAULT_SCHEMATIC_TEXT_FONT_SIZE;
|
|
153150
|
+
const width = getSchematicTextObstacleWidth({
|
|
153151
|
+
text: text.text ?? "",
|
|
153152
|
+
fontSize
|
|
153153
|
+
});
|
|
153154
|
+
const height = fontSize;
|
|
153155
|
+
const anchor = text.anchor ?? "center";
|
|
153156
|
+
let minX;
|
|
153157
|
+
let maxX;
|
|
153158
|
+
if (anchor.includes("left")) {
|
|
153159
|
+
minX = 0;
|
|
153160
|
+
maxX = width;
|
|
153161
|
+
} else if (anchor.includes("right")) {
|
|
153162
|
+
minX = -width;
|
|
153163
|
+
maxX = 0;
|
|
153164
|
+
} else {
|
|
153165
|
+
minX = -width / 2;
|
|
153166
|
+
maxX = width / 2;
|
|
153167
|
+
}
|
|
153168
|
+
let minY;
|
|
153169
|
+
let maxY;
|
|
153170
|
+
if (anchor.includes("top")) {
|
|
153171
|
+
minY = -height;
|
|
153172
|
+
maxY = 0;
|
|
153173
|
+
} else if (anchor.includes("bottom")) {
|
|
153174
|
+
minY = 0;
|
|
153175
|
+
maxY = height;
|
|
153176
|
+
} else {
|
|
153177
|
+
minY = -height / 2;
|
|
153178
|
+
maxY = height / 2;
|
|
153179
|
+
}
|
|
153180
|
+
const rotation6 = (text.rotation ?? 0) * Math.PI / 180;
|
|
153181
|
+
const cos3 = Math.cos(rotation6);
|
|
153182
|
+
const sin3 = Math.sin(rotation6);
|
|
153183
|
+
const corners = [
|
|
153184
|
+
{ x: minX, y: minY },
|
|
153185
|
+
{ x: minX, y: maxY },
|
|
153186
|
+
{ x: maxX, y: minY },
|
|
153187
|
+
{ x: maxX, y: maxY }
|
|
153188
|
+
].map((corner) => ({
|
|
153189
|
+
x: text.position.x + corner.x * cos3 - corner.y * sin3,
|
|
153190
|
+
y: text.position.y + corner.x * sin3 + corner.y * cos3
|
|
153191
|
+
}));
|
|
153192
|
+
return getBoundsFromPoints10(corners);
|
|
153193
|
+
}
|
|
153194
|
+
|
|
153195
|
+
// lib/components/primitive-components/Group/Group_doInitialSchematicLayoutFlex.ts
|
|
153196
|
+
import { applyToPoint as applyToPoint41, translate as translate17 } from "transformation-matrix";
|
|
153018
153197
|
import {
|
|
153019
153198
|
getCircuitJsonTree,
|
|
153020
153199
|
getMinimumFlexContainer as getMinimumFlexContainer2,
|
|
@@ -153048,6 +153227,7 @@ var getSizeOfTreeNodeChild = (db2, child) => {
|
|
|
153048
153227
|
const groupComponents = db2.schematic_component.list({
|
|
153049
153228
|
schematic_group_id: schGroup?.schematic_group_id
|
|
153050
153229
|
});
|
|
153230
|
+
if (groupComponents.length === 0) return { width: 0, height: 0 };
|
|
153051
153231
|
let minX = Infinity;
|
|
153052
153232
|
let maxX = -Infinity;
|
|
153053
153233
|
let minY = Infinity;
|
|
@@ -153077,6 +153257,66 @@ var Group_doInitialSchematicLayoutFlex = (group) => {
|
|
|
153077
153257
|
const tree = getCircuitJsonTree(db2.toArray(), {
|
|
153078
153258
|
source_group_id: group.source_group_id
|
|
153079
153259
|
});
|
|
153260
|
+
const textOnlyGroupLayouts = group.getDescendants().filter((child) => child instanceof Group).filter(
|
|
153261
|
+
(child) => tree.childNodes.some(
|
|
153262
|
+
(node) => node.sourceGroup?.source_group_id === child.source_group_id
|
|
153263
|
+
)
|
|
153264
|
+
).flatMap((childGroup) => {
|
|
153265
|
+
const descendants2 = childGroup.getDescendants();
|
|
153266
|
+
if (descendants2.some(
|
|
153267
|
+
(child) => !(child instanceof Group) && !(child instanceof SchematicText)
|
|
153268
|
+
))
|
|
153269
|
+
return [];
|
|
153270
|
+
const schematicGroup = db2.schematic_group.get(
|
|
153271
|
+
childGroup.schematic_group_id
|
|
153272
|
+
);
|
|
153273
|
+
if (!schematicGroup) return [];
|
|
153274
|
+
const texts = descendants2.filter(
|
|
153275
|
+
(child) => child instanceof SchematicText
|
|
153276
|
+
).flatMap((child) => {
|
|
153277
|
+
const text = db2.schematic_text.get(child.schematic_text_id);
|
|
153278
|
+
return text ? [text] : [];
|
|
153279
|
+
});
|
|
153280
|
+
const bounds2 = getBoundsFromPoints11(
|
|
153281
|
+
texts.flatMap((text) => {
|
|
153282
|
+
const bounds3 = getSchematicTextBounds(text);
|
|
153283
|
+
return [
|
|
153284
|
+
{ x: bounds3.minX, y: bounds3.minY },
|
|
153285
|
+
{ x: bounds3.maxX, y: bounds3.maxY }
|
|
153286
|
+
];
|
|
153287
|
+
})
|
|
153288
|
+
);
|
|
153289
|
+
return [
|
|
153290
|
+
{
|
|
153291
|
+
schematicGroup,
|
|
153292
|
+
texts,
|
|
153293
|
+
schematicGroups: [
|
|
153294
|
+
childGroup,
|
|
153295
|
+
...descendants2.filter(
|
|
153296
|
+
(child) => child instanceof Group
|
|
153297
|
+
)
|
|
153298
|
+
].flatMap((child) => {
|
|
153299
|
+
const schematicGroup2 = db2.schematic_group.get(
|
|
153300
|
+
child.schematic_group_id
|
|
153301
|
+
);
|
|
153302
|
+
return schematicGroup2 ? [schematicGroup2] : [];
|
|
153303
|
+
}),
|
|
153304
|
+
center: bounds2 ? {
|
|
153305
|
+
x: (bounds2.minX + bounds2.maxX) / 2,
|
|
153306
|
+
y: (bounds2.minY + bounds2.maxY) / 2
|
|
153307
|
+
} : schematicGroup.center,
|
|
153308
|
+
width: childGroup._parsedProps.schWidth ?? (bounds2 ? bounds2.maxX - bounds2.minX : 0),
|
|
153309
|
+
height: childGroup._parsedProps.schHeight ?? (bounds2 ? bounds2.maxY - bounds2.minY : 0)
|
|
153310
|
+
}
|
|
153311
|
+
];
|
|
153312
|
+
});
|
|
153313
|
+
for (const layout of textOnlyGroupLayouts) {
|
|
153314
|
+
db2.schematic_group.update(layout.schematicGroup.schematic_group_id, {
|
|
153315
|
+
center: layout.center,
|
|
153316
|
+
width: layout.width,
|
|
153317
|
+
height: layout.height
|
|
153318
|
+
});
|
|
153319
|
+
}
|
|
153080
153320
|
const rawJustify = props.schJustifyContent ?? props.justifyContent;
|
|
153081
153321
|
const rawAlign = props.schAlignItems ?? props.alignItems;
|
|
153082
153322
|
const rawGap = props.schFlexGap ?? props.schGap ?? props.gap;
|
|
@@ -153195,6 +153435,29 @@ var Group_doInitialSchematicLayoutFlex = (group) => {
|
|
|
153195
153435
|
source_group_id: sourceGroup.source_group_id
|
|
153196
153436
|
});
|
|
153197
153437
|
if (!schGroup) continue;
|
|
153438
|
+
const textOnlyLayout = textOnlyGroupLayouts.find(
|
|
153439
|
+
(layout) => layout.schematicGroup.source_group_id === sourceGroup.source_group_id
|
|
153440
|
+
);
|
|
153441
|
+
if (textOnlyLayout) {
|
|
153442
|
+
const transform2 = translate17(
|
|
153443
|
+
child.position.x + child.size.width / 2 + offset.x - textOnlyLayout.center.x,
|
|
153444
|
+
child.position.y + child.size.height / 2 + offset.y - textOnlyLayout.center.y
|
|
153445
|
+
);
|
|
153446
|
+
for (const text of textOnlyLayout.texts) {
|
|
153447
|
+
db2.schematic_text.update(text.schematic_text_id, {
|
|
153448
|
+
position: applyToPoint41(transform2, text.position)
|
|
153449
|
+
});
|
|
153450
|
+
}
|
|
153451
|
+
for (const schematicGroup of textOnlyLayout.schematicGroups) {
|
|
153452
|
+
const currentGroup = db2.schematic_group.get(
|
|
153453
|
+
schematicGroup.schematic_group_id
|
|
153454
|
+
);
|
|
153455
|
+
db2.schematic_group.update(schematicGroup.schematic_group_id, {
|
|
153456
|
+
center: applyToPoint41(transform2, currentGroup.center)
|
|
153457
|
+
});
|
|
153458
|
+
}
|
|
153459
|
+
continue;
|
|
153460
|
+
}
|
|
153198
153461
|
repositionSchematicGroupTo(allCircuitJson, sourceGroup.source_group_id, {
|
|
153199
153462
|
x: child.position.x + child.size.width / 2 + offset.x,
|
|
153200
153463
|
y: child.position.y + child.size.height / 2 + offset.y
|
|
@@ -153533,18 +153796,6 @@ import Debug8 from "debug";
|
|
|
153533
153796
|
// lib/utils/schematic/getSchematicComponentWithTextBounds.ts
|
|
153534
153797
|
import { getBoundFromCenteredRect as getBoundFromCenteredRect3 } from "@tscircuit/math-utils";
|
|
153535
153798
|
import { symbols as symbols6 } from "schematic-symbols";
|
|
153536
|
-
|
|
153537
|
-
// lib/utils/schematic/getSchematicTextWidth.ts
|
|
153538
|
-
function getSchematicTextWidth({
|
|
153539
|
-
text,
|
|
153540
|
-
fontSize
|
|
153541
|
-
}) {
|
|
153542
|
-
const fontScale = fontSize / 0.18;
|
|
153543
|
-
const charWidth = 0.12 * fontScale;
|
|
153544
|
-
return text.length * charWidth;
|
|
153545
|
-
}
|
|
153546
|
-
|
|
153547
|
-
// lib/utils/schematic/getSchematicComponentWithTextBounds.ts
|
|
153548
153799
|
var SYMBOL_TEXT_FONT_SIZE = 0.18;
|
|
153549
153800
|
var TEXT_BOX_ENABLED_FTYPES = /* @__PURE__ */ new Set([
|
|
153550
153801
|
"simple_resistor",
|
|
@@ -153562,7 +153813,7 @@ var TEXT_BOX_ENABLED_FTYPES = /* @__PURE__ */ new Set([
|
|
|
153562
153813
|
"simple_voltage_source",
|
|
153563
153814
|
"simple_test_point"
|
|
153564
153815
|
]);
|
|
153565
|
-
function
|
|
153816
|
+
function getSchematicTextBounds2({
|
|
153566
153817
|
text,
|
|
153567
153818
|
position: position2,
|
|
153568
153819
|
anchor,
|
|
@@ -153621,7 +153872,7 @@ function getSymbolTextBounds({
|
|
|
153621
153872
|
}
|
|
153622
153873
|
if (!value) continue;
|
|
153623
153874
|
textBounds.push(
|
|
153624
|
-
|
|
153875
|
+
getSchematicTextBounds2({
|
|
153625
153876
|
text: value,
|
|
153626
153877
|
position: {
|
|
153627
153878
|
x: primitive.x - symbol.center.x + schematicComponent.center.x,
|
|
@@ -154847,9 +155098,9 @@ import Debug13 from "debug";
|
|
|
154847
155098
|
// lib/components/primitive-components/NetLabel.ts
|
|
154848
155099
|
import { netLabelProps } from "@tscircuit/props";
|
|
154849
155100
|
import {
|
|
154850
|
-
applyToPoint as
|
|
155101
|
+
applyToPoint as applyToPoint42,
|
|
154851
155102
|
identity as identity10,
|
|
154852
|
-
translate as
|
|
155103
|
+
translate as translate18
|
|
154853
155104
|
} from "transformation-matrix";
|
|
154854
155105
|
import { calculateElbow as calculateElbow3 } from "calculate-elbow";
|
|
154855
155106
|
var NetLabel = class extends PrimitiveComponent {
|
|
@@ -154912,11 +155163,11 @@ var NetLabel = class extends PrimitiveComponent {
|
|
|
154912
155163
|
const connectedPorts = this._getConnectedPorts();
|
|
154913
155164
|
if (connectedPorts.length > 0) {
|
|
154914
155165
|
const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
|
|
154915
|
-
const parentCenter =
|
|
155166
|
+
const parentCenter = applyToPoint42(
|
|
154916
155167
|
this.parent?.computeSchematicGlobalTransform?.() ?? identity10(),
|
|
154917
155168
|
{ x: 0, y: 0 }
|
|
154918
155169
|
);
|
|
154919
|
-
return
|
|
155170
|
+
return translate18(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
|
|
154920
155171
|
}
|
|
154921
155172
|
}
|
|
154922
155173
|
return super.computeSchematicPropsTransform();
|
|
@@ -156639,173 +156890,6 @@ import {
|
|
|
156639
156890
|
getBoundFromCenteredRect as getBoundFromCenteredRect6,
|
|
156640
156891
|
getBoundsCenter
|
|
156641
156892
|
} from "@tscircuit/math-utils";
|
|
156642
|
-
|
|
156643
|
-
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/getSchematicTextBounds.ts
|
|
156644
|
-
import { getBoundsFromPoints as getBoundsFromPoints10 } from "@tscircuit/math-utils";
|
|
156645
|
-
|
|
156646
|
-
// lib/utils/schematic/getSchematicTextObstacleWidth.ts
|
|
156647
|
-
var ASCII_ADVANCES = [
|
|
156648
|
-
28,
|
|
156649
|
-
28,
|
|
156650
|
-
35,
|
|
156651
|
-
56,
|
|
156652
|
-
56,
|
|
156653
|
-
89,
|
|
156654
|
-
67,
|
|
156655
|
-
19,
|
|
156656
|
-
33,
|
|
156657
|
-
33,
|
|
156658
|
-
39,
|
|
156659
|
-
58,
|
|
156660
|
-
28,
|
|
156661
|
-
33,
|
|
156662
|
-
28,
|
|
156663
|
-
28,
|
|
156664
|
-
56,
|
|
156665
|
-
56,
|
|
156666
|
-
56,
|
|
156667
|
-
56,
|
|
156668
|
-
56,
|
|
156669
|
-
56,
|
|
156670
|
-
56,
|
|
156671
|
-
56,
|
|
156672
|
-
56,
|
|
156673
|
-
56,
|
|
156674
|
-
28,
|
|
156675
|
-
28,
|
|
156676
|
-
58,
|
|
156677
|
-
58,
|
|
156678
|
-
58,
|
|
156679
|
-
56,
|
|
156680
|
-
102,
|
|
156681
|
-
67,
|
|
156682
|
-
67,
|
|
156683
|
-
72,
|
|
156684
|
-
72,
|
|
156685
|
-
67,
|
|
156686
|
-
61,
|
|
156687
|
-
78,
|
|
156688
|
-
72,
|
|
156689
|
-
28,
|
|
156690
|
-
50,
|
|
156691
|
-
67,
|
|
156692
|
-
56,
|
|
156693
|
-
83,
|
|
156694
|
-
72,
|
|
156695
|
-
78,
|
|
156696
|
-
67,
|
|
156697
|
-
78,
|
|
156698
|
-
72,
|
|
156699
|
-
67,
|
|
156700
|
-
61,
|
|
156701
|
-
72,
|
|
156702
|
-
67,
|
|
156703
|
-
94,
|
|
156704
|
-
67,
|
|
156705
|
-
67,
|
|
156706
|
-
61,
|
|
156707
|
-
28,
|
|
156708
|
-
28,
|
|
156709
|
-
28,
|
|
156710
|
-
47,
|
|
156711
|
-
56,
|
|
156712
|
-
33,
|
|
156713
|
-
56,
|
|
156714
|
-
56,
|
|
156715
|
-
50,
|
|
156716
|
-
56,
|
|
156717
|
-
56,
|
|
156718
|
-
28,
|
|
156719
|
-
56,
|
|
156720
|
-
56,
|
|
156721
|
-
22,
|
|
156722
|
-
22,
|
|
156723
|
-
50,
|
|
156724
|
-
22,
|
|
156725
|
-
83,
|
|
156726
|
-
56,
|
|
156727
|
-
56,
|
|
156728
|
-
56,
|
|
156729
|
-
56,
|
|
156730
|
-
33,
|
|
156731
|
-
50,
|
|
156732
|
-
28,
|
|
156733
|
-
56,
|
|
156734
|
-
50,
|
|
156735
|
-
72,
|
|
156736
|
-
50,
|
|
156737
|
-
50,
|
|
156738
|
-
50,
|
|
156739
|
-
33,
|
|
156740
|
-
26,
|
|
156741
|
-
33,
|
|
156742
|
-
58
|
|
156743
|
-
];
|
|
156744
|
-
function getSchematicTextObstacleWidth({
|
|
156745
|
-
text,
|
|
156746
|
-
fontSize
|
|
156747
|
-
}) {
|
|
156748
|
-
let totalAdvance = 0;
|
|
156749
|
-
for (const character of text) {
|
|
156750
|
-
const advance = ASCII_ADVANCES[character.charCodeAt(0) - 32];
|
|
156751
|
-
if (advance === void 0) {
|
|
156752
|
-
return getSchematicTextWidth({ text, fontSize });
|
|
156753
|
-
}
|
|
156754
|
-
totalAdvance += advance;
|
|
156755
|
-
}
|
|
156756
|
-
return totalAdvance * (fontSize / 100);
|
|
156757
|
-
}
|
|
156758
|
-
|
|
156759
|
-
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/getSchematicTextBounds.ts
|
|
156760
|
-
var DEFAULT_SCHEMATIC_TEXT_FONT_SIZE = 0.18;
|
|
156761
|
-
function getSchematicTextBounds2(text) {
|
|
156762
|
-
const fontSize = text.font_size ?? DEFAULT_SCHEMATIC_TEXT_FONT_SIZE;
|
|
156763
|
-
const width = getSchematicTextObstacleWidth({
|
|
156764
|
-
text: text.text ?? "",
|
|
156765
|
-
fontSize
|
|
156766
|
-
});
|
|
156767
|
-
const height = fontSize;
|
|
156768
|
-
const anchor = text.anchor ?? "center";
|
|
156769
|
-
let minX;
|
|
156770
|
-
let maxX;
|
|
156771
|
-
if (anchor.includes("left")) {
|
|
156772
|
-
minX = 0;
|
|
156773
|
-
maxX = width;
|
|
156774
|
-
} else if (anchor.includes("right")) {
|
|
156775
|
-
minX = -width;
|
|
156776
|
-
maxX = 0;
|
|
156777
|
-
} else {
|
|
156778
|
-
minX = -width / 2;
|
|
156779
|
-
maxX = width / 2;
|
|
156780
|
-
}
|
|
156781
|
-
let minY;
|
|
156782
|
-
let maxY;
|
|
156783
|
-
if (anchor.includes("top")) {
|
|
156784
|
-
minY = -height;
|
|
156785
|
-
maxY = 0;
|
|
156786
|
-
} else if (anchor.includes("bottom")) {
|
|
156787
|
-
minY = 0;
|
|
156788
|
-
maxY = height;
|
|
156789
|
-
} else {
|
|
156790
|
-
minY = -height / 2;
|
|
156791
|
-
maxY = height / 2;
|
|
156792
|
-
}
|
|
156793
|
-
const rotation6 = (text.rotation ?? 0) * Math.PI / 180;
|
|
156794
|
-
const cos3 = Math.cos(rotation6);
|
|
156795
|
-
const sin3 = Math.sin(rotation6);
|
|
156796
|
-
const corners = [
|
|
156797
|
-
{ x: minX, y: minY },
|
|
156798
|
-
{ x: minX, y: maxY },
|
|
156799
|
-
{ x: maxX, y: minY },
|
|
156800
|
-
{ x: maxX, y: maxY }
|
|
156801
|
-
].map((corner) => ({
|
|
156802
|
-
x: text.position.x + corner.x * cos3 - corner.y * sin3,
|
|
156803
|
-
y: text.position.y + corner.x * sin3 + corner.y * cos3
|
|
156804
|
-
}));
|
|
156805
|
-
return getBoundsFromPoints10(corners);
|
|
156806
|
-
}
|
|
156807
|
-
|
|
156808
|
-
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/schematicTextToTextBounds.ts
|
|
156809
156893
|
var REFDES_TEXT_BOX_CHIP_OVERLAP = 0.01;
|
|
156810
156894
|
var REFDES_TEXT_BOX_CLEARANCE = 0.06;
|
|
156811
156895
|
function isReferenceDesignatorText(text, sourceComponent) {
|
|
@@ -156814,7 +156898,7 @@ function isReferenceDesignatorText(text, sourceComponent) {
|
|
|
156814
156898
|
}
|
|
156815
156899
|
function schematicTextToTextBox(text, options = {}) {
|
|
156816
156900
|
if (!text.text) return null;
|
|
156817
|
-
const bounds =
|
|
156901
|
+
const bounds = getSchematicTextBounds(text);
|
|
156818
156902
|
if (isReferenceDesignatorText(text, options.sourceComponent) && options.schematicComponent?.center && options.schematicComponent?.size) {
|
|
156819
156903
|
const componentBounds = getBoundFromCenteredRect6({
|
|
156820
156904
|
center: options.schematicComponent.center,
|
|
@@ -156880,7 +156964,7 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
|
|
|
156880
156964
|
const componentsToVisit = [...group.children].reverse();
|
|
156881
156965
|
while (componentsToVisit.length > 0) {
|
|
156882
156966
|
const child = componentsToVisit.pop();
|
|
156883
|
-
if (child instanceof
|
|
156967
|
+
if (child instanceof Group) {
|
|
156884
156968
|
if (child.isSubcircuit) {
|
|
156885
156969
|
if (child._parsedProps.showAsSchematicBox) childGroups.push(child);
|
|
156886
156970
|
continue;
|
|
@@ -157832,7 +157916,7 @@ var Group_doInitialSchematicTraceRender = (group) => {
|
|
|
157832
157916
|
const board = group._getBoard();
|
|
157833
157917
|
let schematicScope = group;
|
|
157834
157918
|
while (schematicScope) {
|
|
157835
|
-
if (schematicScope instanceof
|
|
157919
|
+
if (schematicScope instanceof Group) {
|
|
157836
157920
|
for (const netLabel of schematicScope.selectAll("netlabel")) {
|
|
157837
157921
|
netLabels.add(netLabel);
|
|
157838
157922
|
}
|
|
@@ -157845,7 +157929,7 @@ var Group_doInitialSchematicTraceRender = (group) => {
|
|
|
157845
157929
|
[
|
|
157846
157930
|
group,
|
|
157847
157931
|
...group.getDescendants().filter(
|
|
157848
|
-
(component) => component instanceof
|
|
157932
|
+
(component) => component instanceof Group
|
|
157849
157933
|
)
|
|
157850
157934
|
].map((schematicGroup) => schematicGroup.schematic_group_id).filter(
|
|
157851
157935
|
(schematicGroupId) => Boolean(schematicGroupId)
|
|
@@ -158761,10 +158845,10 @@ var Group_getFanoutPourNetMap = (group, routingPhasePlans) => {
|
|
|
158761
158845
|
};
|
|
158762
158846
|
|
|
158763
158847
|
// lib/components/primitive-components/Group/Group_getRoutingPhasePlans.ts
|
|
158764
|
-
import { getBoundsFromPoints as
|
|
158848
|
+
import { getBoundsFromPoints as getBoundsFromPoints12 } from "@tscircuit/math-utils";
|
|
158765
158849
|
|
|
158766
158850
|
// lib/components/primitive-components/Breakout/get-saved-fanout-traces.ts
|
|
158767
|
-
import { applyToPoint as
|
|
158851
|
+
import { applyToPoint as applyToPoint43, compose as compose18, translate as translate19 } from "transformation-matrix";
|
|
158768
158852
|
|
|
158769
158853
|
// lib/components/primitive-components/BreakoutPoint.ts
|
|
158770
158854
|
import { breakoutPointProps } from "@tscircuit/props";
|
|
@@ -158930,11 +159014,11 @@ function getSavedFanoutTraces(breakout, input) {
|
|
|
158930
159014
|
const localExit = path.route.at(-1);
|
|
158931
159015
|
const transform2 = compose18(
|
|
158932
159016
|
exit._computePcbGlobalTransformBeforeLayout(),
|
|
158933
|
-
|
|
159017
|
+
translate19(-localExit.x, -localExit.y)
|
|
158934
159018
|
);
|
|
158935
|
-
const originalExit =
|
|
159019
|
+
const originalExit = applyToPoint43(transform2, localExit);
|
|
158936
159020
|
const route = resolveSavedTraceRouteWidths(path.route).map((point8) => {
|
|
158937
|
-
const position2 =
|
|
159021
|
+
const position2 = applyToPoint43(transform2, point8);
|
|
158938
159022
|
return {
|
|
158939
159023
|
...point8,
|
|
158940
159024
|
x: position2.x + pcbExit.x - originalExit.x,
|
|
@@ -159358,7 +159442,7 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
159358
159442
|
(trace) => !trace.pcb_trace_id
|
|
159359
159443
|
);
|
|
159360
159444
|
const pcbGroup = breakout.pcb_group_id ? breakout.root?.db.pcb_group.get(breakout.pcb_group_id) : null;
|
|
159361
|
-
const outlineBounds = pcbGroup?.outline ?
|
|
159445
|
+
const outlineBounds = pcbGroup?.outline ? getBoundsFromPoints12(pcbGroup.outline) : null;
|
|
159362
159446
|
const routingWidth = pcbGroup?.width ?? (outlineBounds ? outlineBounds.maxX - outlineBounds.minX : void 0);
|
|
159363
159447
|
const routingHeight = pcbGroup?.height ?? (outlineBounds ? outlineBounds.maxY - outlineBounds.minY : void 0);
|
|
159364
159448
|
const routingBounds2 = pcbGroup && routingWidth && routingHeight ? {
|
|
@@ -159472,7 +159556,7 @@ var RoutingPhasePreparationError = class extends Error {
|
|
|
159472
159556
|
var package_default = {
|
|
159473
159557
|
name: "@tscircuit/core",
|
|
159474
159558
|
type: "module",
|
|
159475
|
-
version: "0.0.
|
|
159559
|
+
version: "0.0.2309",
|
|
159476
159560
|
types: "dist/index.d.ts",
|
|
159477
159561
|
main: "dist/index.js",
|
|
159478
159562
|
module: "dist/index.js",
|
|
@@ -159512,12 +159596,12 @@ var package_default = {
|
|
|
159512
159596
|
"@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
|
|
159513
159597
|
"@tscircuit/bus-lanes-solver": "https://jscdn.tscircuit.com/@tscircuit/bus-lanes-solver/0.0.49.tgz",
|
|
159514
159598
|
"@tscircuit/cableprinter": "^0.0.6",
|
|
159515
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
159599
|
+
"@tscircuit/capacity-autorouter": "^0.0.1064",
|
|
159516
159600
|
"@tscircuit/checks": "^0.0.270",
|
|
159517
159601
|
"@tscircuit/circuit-json-util": "^0.0.128",
|
|
159518
159602
|
"@tscircuit/common": "^0.0.20",
|
|
159519
159603
|
"@tscircuit/copper-pour-solver": "^0.0.72",
|
|
159520
|
-
"@tscircuit/create-fdm-enclosure": "0.0.
|
|
159604
|
+
"@tscircuit/create-fdm-enclosure": "0.0.6",
|
|
159521
159605
|
"@tscircuit/dogbone-solver": "https://jscdn.tscircuit.com/@tscircuit/dogbone-solver/0.0.1.tgz",
|
|
159522
159606
|
"@tscircuit/fanout-solver": "0.0.81",
|
|
159523
159607
|
"@tscircuit/flex-utils": "https://jscdn.tscircuit.com/@tscircuit/flex-utils/0.0.8.tgz",
|
|
@@ -159547,7 +159631,7 @@ var package_default = {
|
|
|
159547
159631
|
"@types/react-dom": "^19.1.6",
|
|
159548
159632
|
"@types/react-reconciler": "^0.28.9",
|
|
159549
159633
|
"bpc-graph": "^0.0.57",
|
|
159550
|
-
"bun-match-svg": "0.0.
|
|
159634
|
+
"bun-match-svg": "0.0.16",
|
|
159551
159635
|
"calculate-elbow": "^0.0.12",
|
|
159552
159636
|
"chokidar-cli": "^3.0.0",
|
|
159553
159637
|
"circuit-json": "^0.0.548",
|
|
@@ -159560,7 +159644,7 @@ var package_default = {
|
|
|
159560
159644
|
"connectivity-map": "^1.0.1",
|
|
159561
159645
|
debug: "^4.3.6",
|
|
159562
159646
|
flatbush: "^4.5.0",
|
|
159563
|
-
"graphics-debug": "^0.0.
|
|
159647
|
+
"graphics-debug": "^0.0.99",
|
|
159564
159648
|
howfat: "^0.3.8",
|
|
159565
159649
|
"kicad-to-circuit-json": "^0.0.149",
|
|
159566
159650
|
kicadts: "^0.0.53",
|
|
@@ -159640,6 +159724,7 @@ var package_default = {
|
|
|
159640
159724
|
"@dagrejs/dagre": "^2.0.4"
|
|
159641
159725
|
},
|
|
159642
159726
|
overrides: {
|
|
159727
|
+
"graphics-debug": "$graphics-debug",
|
|
159643
159728
|
"@tscircuit/graphics-debug-3d": "https://jscdn.tscircuit.com/@tscircuit/graphics-debug-3d/0.0.1.tgz",
|
|
159644
159729
|
"@tscircuit/props": "^0.0.721",
|
|
159645
159730
|
"circuit-json": "^0.0.548",
|
|
@@ -160268,7 +160353,7 @@ function getAccumulatedPcbTracesWithStageOutputReplacements({
|
|
|
160268
160353
|
// lib/components/primitive-components/Group/get-source-trace-id-for-routed-trace.ts
|
|
160269
160354
|
import { distance as distance20, pointToSegmentDistance as pointToSegmentDistance6 } from "@tscircuit/math-utils";
|
|
160270
160355
|
import { ConnectivityMap as ConnectivityMap6 } from "circuit-json-to-connectivity-map";
|
|
160271
|
-
import { applyToPoint as
|
|
160356
|
+
import { applyToPoint as applyToPoint44, rotateDEG as rotateDEG6 } from "transformation-matrix";
|
|
160272
160357
|
var POINT_EPSILON3 = 1e-6;
|
|
160273
160358
|
function isPointOnWireSegment({
|
|
160274
160359
|
point: point8,
|
|
@@ -160286,7 +160371,7 @@ function isPointInSmtPad({
|
|
|
160286
160371
|
traceWidth = 0
|
|
160287
160372
|
}) {
|
|
160288
160373
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
160289
|
-
const unrotatedPoint = pad.shape === "rotated_rect" ?
|
|
160374
|
+
const unrotatedPoint = pad.shape === "rotated_rect" ? applyToPoint44(rotateDEG6(-pad.ccw_rotation, pad.x, pad.y), point8) : point8;
|
|
160290
160375
|
return Math.abs(unrotatedPoint.x - pad.x) <= pad.width / 2 + traceWidth / 2 && Math.abs(unrotatedPoint.y - pad.y) <= pad.height / 2 + traceWidth / 2;
|
|
160291
160376
|
}
|
|
160292
160377
|
if (pad.shape === "circle") {
|
|
@@ -160794,7 +160879,7 @@ var ensureRouteStartsAtSourceTraceStart = ({
|
|
|
160794
160879
|
const lastPoint = route[route.length - 1];
|
|
160795
160880
|
return getDistanceToPoint(lastPoint, firstPcbPort) < getDistanceToPoint(firstPoint, firstPcbPort) ? reversePcbTraceRoute(route, routeThicknessMode) : route;
|
|
160796
160881
|
};
|
|
160797
|
-
var
|
|
160882
|
+
var Group = class extends NormalComponent {
|
|
160798
160883
|
pcb_group_id = null;
|
|
160799
160884
|
schematic_group_id = null;
|
|
160800
160885
|
subcircuit_id = null;
|
|
@@ -161044,7 +161129,7 @@ var Group5 = class extends NormalComponent {
|
|
|
161044
161129
|
x: distance21.parse(point8.x),
|
|
161045
161130
|
y: distance21.parse(point8.y)
|
|
161046
161131
|
}));
|
|
161047
|
-
const outlineBounds =
|
|
161132
|
+
const outlineBounds = getBoundsFromPoints13(numericOutline);
|
|
161048
161133
|
if (!outlineBounds) return;
|
|
161049
161134
|
const centerX2 = (outlineBounds.minX + outlineBounds.maxX) / 2;
|
|
161050
161135
|
const centerY2 = (outlineBounds.minY + outlineBounds.maxY) / 2;
|
|
@@ -162921,7 +163006,7 @@ function inflateSourceGroup(sourceGroup, inflatorContext) {
|
|
|
162921
163006
|
if (pcbGroup?.anchor_alignment) {
|
|
162922
163007
|
groupProps2.pcbAnchorAlignment = pcbGroup.anchor_alignment;
|
|
162923
163008
|
}
|
|
162924
|
-
const group = new
|
|
163009
|
+
const group = new Group(groupProps2);
|
|
162925
163010
|
group._isInflatedFromCircuitJson = true;
|
|
162926
163011
|
group.source_group_id = sourceGroup.source_group_id;
|
|
162927
163012
|
if (groupsMap) {
|
|
@@ -164399,7 +164484,7 @@ var IsolatedCircuit = class {
|
|
|
164399
164484
|
this.firstChild = this.children[0];
|
|
164400
164485
|
return;
|
|
164401
164486
|
}
|
|
164402
|
-
const group = new
|
|
164487
|
+
const group = new Group({ subcircuit: true });
|
|
164403
164488
|
group.parent = this;
|
|
164404
164489
|
group.addAll(this.children);
|
|
164405
164490
|
this.children = [group];
|
|
@@ -165209,7 +165294,7 @@ var getRoundedRectOutline = (width, height, radius) => {
|
|
|
165209
165294
|
}
|
|
165210
165295
|
return outline;
|
|
165211
165296
|
};
|
|
165212
|
-
var Board = class extends
|
|
165297
|
+
var Board = class extends Group {
|
|
165213
165298
|
pcbFold;
|
|
165214
165299
|
pcb_board_id = null;
|
|
165215
165300
|
source_board_id = null;
|
|
@@ -165291,7 +165376,7 @@ var Board = class extends Group5 {
|
|
|
165291
165376
|
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 };
|
|
165292
165377
|
return compose19(
|
|
165293
165378
|
parentTransform,
|
|
165294
|
-
|
|
165379
|
+
translate20(this._panelPositionOffset.x, this._panelPositionOffset.y)
|
|
165295
165380
|
);
|
|
165296
165381
|
}
|
|
165297
165382
|
return super._computePcbGlobalTransformBeforeLayout();
|
|
@@ -165304,7 +165389,7 @@ var Board = class extends Group5 {
|
|
|
165304
165389
|
let width = dbBoard?.width ?? props.width;
|
|
165305
165390
|
let height = dbBoard?.height ?? props.height;
|
|
165306
165391
|
if ((width == null || height == null) && props.outline?.length) {
|
|
165307
|
-
const outlineBounds =
|
|
165392
|
+
const outlineBounds = getBoundsFromPoints14(props.outline);
|
|
165308
165393
|
if (outlineBounds) {
|
|
165309
165394
|
width ??= outlineBounds.maxX - outlineBounds.minX;
|
|
165310
165395
|
height ??= outlineBounds.maxY - outlineBounds.minY;
|
|
@@ -165361,7 +165446,7 @@ var Board = class extends Group5 {
|
|
|
165361
165446
|
let width = pcbGroup.width ?? 0;
|
|
165362
165447
|
let height = pcbGroup.height ?? 0;
|
|
165363
165448
|
if (pcbGroup.outline && pcbGroup.outline.length > 0) {
|
|
165364
|
-
const bounds =
|
|
165449
|
+
const bounds = getBoundsFromPoints14(pcbGroup.outline);
|
|
165365
165450
|
if (bounds) {
|
|
165366
165451
|
width = bounds.maxX - bounds.minX;
|
|
165367
165452
|
height = bounds.maxY - bounds.minY;
|
|
@@ -165543,7 +165628,7 @@ var Board = class extends Group5 {
|
|
|
165543
165628
|
}
|
|
165544
165629
|
let outlineTranslation = { x: 0, y: 0 };
|
|
165545
165630
|
if (props.outline && outline && outline.length > 0 && (this.parent?.lowercaseComponentName === "panel" || this.parent?.lowercaseComponentName === "subpanel")) {
|
|
165546
|
-
const outlineBounds =
|
|
165631
|
+
const outlineBounds = getBoundsFromPoints14(outline);
|
|
165547
165632
|
if (outlineBounds) {
|
|
165548
165633
|
const outlineCenterX = (outlineBounds.minX + outlineBounds.maxX) / 2;
|
|
165549
165634
|
const outlineCenterY = (outlineBounds.minY + outlineBounds.maxY) / 2;
|
|
@@ -165646,7 +165731,7 @@ var Board = class extends Group5 {
|
|
|
165646
165731
|
if (this.pcb_board_id) {
|
|
165647
165732
|
db2.pcb_board.update(this.pcb_board_id, { center: position2 });
|
|
165648
165733
|
if (pcbBoard?.outline) {
|
|
165649
|
-
const outlineBounds =
|
|
165734
|
+
const outlineBounds = getBoundsFromPoints14(pcbBoard.outline);
|
|
165650
165735
|
if (outlineBounds) {
|
|
165651
165736
|
const oldOutlineCenter = {
|
|
165652
165737
|
x: (outlineBounds.minX + outlineBounds.maxX) / 2,
|
|
@@ -165680,7 +165765,7 @@ import { mountedboardProps } from "@tscircuit/props";
|
|
|
165680
165765
|
|
|
165681
165766
|
// lib/components/primitive-components/Group/Subcircuit/Subcircuit.ts
|
|
165682
165767
|
import "@tscircuit/props";
|
|
165683
|
-
var Subcircuit = class extends
|
|
165768
|
+
var Subcircuit = class extends Group {
|
|
165684
165769
|
constructor(props) {
|
|
165685
165770
|
super({
|
|
165686
165771
|
...props,
|
|
@@ -165841,7 +165926,7 @@ import { distance as distance27 } from "circuit-json";
|
|
|
165841
165926
|
// lib/components/normal-components/Subpanel.ts
|
|
165842
165927
|
import { subpanelProps } from "@tscircuit/props";
|
|
165843
165928
|
import { distance as distance26 } from "circuit-json";
|
|
165844
|
-
import { compose as compose21, identity as identity12, translate as
|
|
165929
|
+
import { compose as compose21, identity as identity12, translate as translate23 } from "transformation-matrix";
|
|
165845
165930
|
|
|
165846
165931
|
// lib/utils/panels/generate-panel-tabs-and-mouse-bites.ts
|
|
165847
165932
|
import * as Flatten3 from "@flatten-js/core";
|
|
@@ -165849,10 +165934,10 @@ import { point as point7, Polygon as Polygon7 } from "@flatten-js/core";
|
|
|
165849
165934
|
|
|
165850
165935
|
// lib/utils/panels/generate-continuous-panel-routing-slots.ts
|
|
165851
165936
|
import {
|
|
165852
|
-
applyToPoint as
|
|
165937
|
+
applyToPoint as applyToPoint45,
|
|
165853
165938
|
compose as compose20,
|
|
165854
165939
|
rotateDEG as rotateDEG7,
|
|
165855
|
-
translate as
|
|
165940
|
+
translate as translate21
|
|
165856
165941
|
} from "transformation-matrix";
|
|
165857
165942
|
function getPointAlongOutline(edges, perimeterDistance) {
|
|
165858
165943
|
const perimeter = edges.at(-1).perimeterStart + edges.at(-1).length;
|
|
@@ -165861,9 +165946,9 @@ function getPointAlongOutline(edges, perimeterDistance) {
|
|
|
165861
165946
|
(outlineEdge) => wrappedDistance <= outlineEdge.perimeterStart + outlineEdge.length
|
|
165862
165947
|
) ?? edges.at(-1);
|
|
165863
165948
|
const ccwRotationDegrees = Math.atan2(edge.end.y - edge.start.y, edge.end.x - edge.start.x) * 180 / Math.PI;
|
|
165864
|
-
return
|
|
165949
|
+
return applyToPoint45(
|
|
165865
165950
|
compose20(
|
|
165866
|
-
|
|
165951
|
+
translate21(edge.start.x, edge.start.y),
|
|
165867
165952
|
rotateDEG7(ccwRotationDegrees)
|
|
165868
165953
|
),
|
|
165869
165954
|
{ x: wrappedDistance - edge.perimeterStart, y: 0 }
|
|
@@ -165884,15 +165969,15 @@ function getOutwardSlotBoundary(route, options) {
|
|
|
165884
165969
|
const denominator = 1 + before.x * after.x + before.y * after.y;
|
|
165885
165970
|
if (denominator < 1e-8) {
|
|
165886
165971
|
return [before, after].map(
|
|
165887
|
-
(normal) =>
|
|
165888
|
-
|
|
165972
|
+
(normal) => applyToPoint45(
|
|
165973
|
+
translate21(normal.x * options.width, normal.y * options.width),
|
|
165889
165974
|
position2
|
|
165890
165975
|
)
|
|
165891
165976
|
);
|
|
165892
165977
|
}
|
|
165893
165978
|
return [
|
|
165894
|
-
|
|
165895
|
-
|
|
165979
|
+
applyToPoint45(
|
|
165980
|
+
translate21(
|
|
165896
165981
|
(before.x + after.x) * options.width / denominator,
|
|
165897
165982
|
(before.y + after.y) * options.width / denominator
|
|
165898
165983
|
),
|
|
@@ -166243,14 +166328,14 @@ function generatePanelOutlineRoutingCutouts(boards, options) {
|
|
|
166243
166328
|
import { distance as distance25 } from "circuit-json";
|
|
166244
166329
|
|
|
166245
166330
|
// lib/utils/panels/get-board-dimensions-from-props.ts
|
|
166246
|
-
import { getBoundsFromPoints as
|
|
166331
|
+
import { getBoundsFromPoints as getBoundsFromPoints15 } from "@tscircuit/math-utils";
|
|
166247
166332
|
import { distance as distance24 } from "circuit-json";
|
|
166248
166333
|
var getBoardDimensionsFromProps = (board) => {
|
|
166249
166334
|
const props = board._parsedProps;
|
|
166250
166335
|
let width = props.width != null ? distance24.parse(props.width) : void 0;
|
|
166251
166336
|
let height = props.height != null ? distance24.parse(props.height) : void 0;
|
|
166252
166337
|
if ((width === void 0 || height === void 0) && props.outline?.length) {
|
|
166253
|
-
const outlineBounds =
|
|
166338
|
+
const outlineBounds = getBoundsFromPoints15(props.outline);
|
|
166254
166339
|
if (outlineBounds) {
|
|
166255
166340
|
width ??= outlineBounds.maxX - outlineBounds.minX;
|
|
166256
166341
|
height ??= outlineBounds.maxY - outlineBounds.minY;
|
|
@@ -166439,7 +166524,7 @@ function getItemDimensions(item, db2) {
|
|
|
166439
166524
|
}
|
|
166440
166525
|
|
|
166441
166526
|
// lib/components/normal-components/Subpanel.ts
|
|
166442
|
-
var Subpanel = class _Subpanel extends
|
|
166527
|
+
var Subpanel = class _Subpanel extends Group {
|
|
166443
166528
|
pcb_panel_id = null;
|
|
166444
166529
|
_panelizationFeaturesGenerated = false;
|
|
166445
166530
|
get config() {
|
|
@@ -166491,7 +166576,7 @@ var Subpanel = class _Subpanel extends Group5 {
|
|
|
166491
166576
|
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? identity12();
|
|
166492
166577
|
return compose21(
|
|
166493
166578
|
parentTransform,
|
|
166494
|
-
|
|
166579
|
+
translate23(this._panelPositionOffset.x, this._panelPositionOffset.y)
|
|
166495
166580
|
);
|
|
166496
166581
|
}
|
|
166497
166582
|
return super._computePcbGlobalTransformBeforeLayout();
|
|
@@ -170169,9 +170254,9 @@ var defaultImplicitBreakoutPointSolverFn = (input) => {
|
|
|
170169
170254
|
};
|
|
170170
170255
|
|
|
170171
170256
|
// lib/components/primitive-components/Breakout/Breakout_doInitialPcbPlacementDesignRuleChecks.ts
|
|
170172
|
-
import { getBoundsFromPoints as
|
|
170257
|
+
import { getBoundsFromPoints as getBoundsFromPoints16 } from "@tscircuit/math-utils";
|
|
170173
170258
|
var getFanoutBounds = (pcbGroup) => {
|
|
170174
|
-
const outlineBounds = pcbGroup.outline ?
|
|
170259
|
+
const outlineBounds = pcbGroup.outline ? getBoundsFromPoints16(pcbGroup.outline) : null;
|
|
170175
170260
|
const width = pcbGroup.width ?? (outlineBounds ? outlineBounds.maxX - outlineBounds.minX : void 0);
|
|
170176
170261
|
const height = pcbGroup.height ?? (outlineBounds ? outlineBounds.maxY - outlineBounds.minY : void 0);
|
|
170177
170262
|
if (width === void 0 || height === void 0) return null;
|
|
@@ -171237,7 +171322,7 @@ var solveImplicitBreakoutPoints = (breakout, solverFn) => {
|
|
|
171237
171322
|
};
|
|
171238
171323
|
|
|
171239
171324
|
// lib/components/primitive-components/Breakout/Breakout.ts
|
|
171240
|
-
var Breakout = class extends
|
|
171325
|
+
var Breakout = class extends Group {
|
|
171241
171326
|
get isDogboneFanout() {
|
|
171242
171327
|
const autorouter = this._parsedProps.autorouter;
|
|
171243
171328
|
return (typeof autorouter === "string" ? autorouter : autorouter?.preset) === "dogbone";
|
|
@@ -171398,7 +171483,7 @@ import {
|
|
|
171398
171483
|
getTransformedSvgPathRoutes,
|
|
171399
171484
|
loadImageSource
|
|
171400
171485
|
} from "@tscircuit/image-utils";
|
|
171401
|
-
import { applyToPoint as
|
|
171486
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
171402
171487
|
var SilkscreenGraphic = class extends PrimitiveComponent {
|
|
171403
171488
|
pcb_silkscreen_graphic_id = null;
|
|
171404
171489
|
pcb_silkscreen_graphic_ids = [];
|
|
@@ -171500,7 +171585,7 @@ var SilkscreenGraphic = class extends PrimitiveComponent {
|
|
|
171500
171585
|
{ x: halfWidth, y: -halfHeight },
|
|
171501
171586
|
{ x: -halfWidth, y: -halfHeight }
|
|
171502
171587
|
]).map(
|
|
171503
|
-
(point8) =>
|
|
171588
|
+
(point8) => applyToPoint46(transform2, point8)
|
|
171504
171589
|
)
|
|
171505
171590
|
},
|
|
171506
171591
|
inner_rings: []
|
|
@@ -174114,7 +174199,7 @@ var SchematicSection = class _SchematicSection extends PrimitiveComponent {
|
|
|
174114
174199
|
schematic_component_id: schematicComponentId
|
|
174115
174200
|
})) {
|
|
174116
174201
|
positions.push(
|
|
174117
|
-
|
|
174202
|
+
getSchematicTextBounds2({
|
|
174118
174203
|
text: text.text,
|
|
174119
174204
|
position: text.position,
|
|
174120
174205
|
anchor: text.anchor,
|
|
@@ -176176,17 +176261,17 @@ var SpiceModel = class extends PrimitiveComponent {
|
|
|
176176
176261
|
|
|
176177
176262
|
// lib/components/primitive-components/PcbBend.ts
|
|
176178
176263
|
import { pcbBendProps } from "@tscircuit/props";
|
|
176179
|
-
import { applyToPoint as
|
|
176264
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
176180
176265
|
|
|
176181
176266
|
// lib/components/primitive-components/getPcbFlexBoardTransform.ts
|
|
176182
|
-
import { compose as compose22, translate as
|
|
176267
|
+
import { compose as compose22, translate as translate24 } from "transformation-matrix";
|
|
176183
176268
|
function getPcbFlexBoardTransform(primitive) {
|
|
176184
176269
|
const boardId = primitive._getBoard()?.pcb_board_id;
|
|
176185
176270
|
const board = boardId ? primitive.root.db.pcb_board.get(boardId) : null;
|
|
176186
176271
|
if (!board)
|
|
176187
176272
|
throw new Error(`${primitive.componentName} must be inside a board`);
|
|
176188
176273
|
const transform2 = compose22(
|
|
176189
|
-
|
|
176274
|
+
translate24(-board.center.x, -board.center.y),
|
|
176190
176275
|
primitive._computePcbGlobalTransformBeforeLayout()
|
|
176191
176276
|
);
|
|
176192
176277
|
return { board, transform: transform2 };
|
|
@@ -176210,8 +176295,8 @@ var PcbBend = class extends PrimitiveComponent {
|
|
|
176210
176295
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
|
|
176211
176296
|
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
|
|
176212
176297
|
name: props.name,
|
|
176213
|
-
start:
|
|
176214
|
-
end:
|
|
176298
|
+
start: applyToPoint47(transform2, { x: props.x1, y: props.y1 }),
|
|
176299
|
+
end: applyToPoint47(transform2, { x: props.x2, y: props.y2 }),
|
|
176215
176300
|
bend_angle: props.bendAngle,
|
|
176216
176301
|
bend_radius: props.bendRadius,
|
|
176217
176302
|
bend_side: props.bendSide
|
|
@@ -176247,7 +176332,7 @@ var PcbBend = class extends PrimitiveComponent {
|
|
|
176247
176332
|
|
|
176248
176333
|
// lib/components/primitive-components/PcbStiffener.ts
|
|
176249
176334
|
import { pcbStiffenerProps } from "@tscircuit/props";
|
|
176250
|
-
import { applyToPoint as
|
|
176335
|
+
import { applyToPoint as applyToPoint48, decomposeTSR as decomposeTSR12 } from "transformation-matrix";
|
|
176251
176336
|
var PcbStiffener = class extends PrimitiveComponent {
|
|
176252
176337
|
pcb_stiffener_id = null;
|
|
176253
176338
|
get config() {
|
|
@@ -176270,14 +176355,14 @@ var PcbStiffener = class extends PrimitiveComponent {
|
|
|
176270
176355
|
};
|
|
176271
176356
|
const geometry = props.shape === "rect" ? {
|
|
176272
176357
|
shape: "rect",
|
|
176273
|
-
center:
|
|
176358
|
+
center: applyToPoint48(transform2, { x: 0, y: 0 }),
|
|
176274
176359
|
rotation: decomposeTSR12(transform2).rotation.angle * 180 / Math.PI,
|
|
176275
176360
|
width: props.width,
|
|
176276
176361
|
height: props.height
|
|
176277
176362
|
} : {
|
|
176278
176363
|
shape: "polygon",
|
|
176279
176364
|
outline: props.outline.map(
|
|
176280
|
-
(point8) =>
|
|
176365
|
+
(point8) => applyToPoint48(transform2, point8)
|
|
176281
176366
|
)
|
|
176282
176367
|
};
|
|
176283
176368
|
this.pcb_stiffener_id = db2.pcb_stiffener.insert({
|
|
@@ -176888,7 +176973,7 @@ function parseCableString(cableString) {
|
|
|
176888
176973
|
// lib/components/primitive-components/resolve-assembly-cable.ts
|
|
176889
176974
|
import { cad_cable as cad_cable2 } from "circuit-json";
|
|
176890
176975
|
import { vec3 as vec310 } from "gl-matrix";
|
|
176891
|
-
import { applyToPoint as
|
|
176976
|
+
import { applyToPoint as applyToPoint49 } from "transformation-matrix";
|
|
176892
176977
|
|
|
176893
176978
|
// lib/components/primitive-components/resolve-assembly-cable-endpoint.ts
|
|
176894
176979
|
import { getJstMotorConnector } from "@tscircuit/modelprinter";
|
|
@@ -177238,7 +177323,7 @@ function resolveAuthoredAssemblyCablePath({
|
|
|
177238
177323
|
fromExit,
|
|
177239
177324
|
{ x: fromTangent[0], y: fromTangent[1], z: fromTangent[2] },
|
|
177240
177325
|
...waypoints.map((waypoint) => {
|
|
177241
|
-
const offset =
|
|
177326
|
+
const offset = applyToPoint49(boardToWorld, waypoint);
|
|
177242
177327
|
return {
|
|
177243
177328
|
x: anchor.x + offset.x,
|
|
177244
177329
|
y: anchor.y + offset.y,
|
|
@@ -178234,7 +178319,7 @@ export {
|
|
|
178234
178319
|
Fiducial,
|
|
178235
178320
|
Footprint,
|
|
178236
178321
|
Fuse,
|
|
178237
|
-
|
|
178322
|
+
Group,
|
|
178238
178323
|
Hole,
|
|
178239
178324
|
IbisModel,
|
|
178240
178325
|
Inductor,
|
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.2310",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
|
|
42
42
|
"@tscircuit/bus-lanes-solver": "https://jscdn.tscircuit.com/@tscircuit/bus-lanes-solver/0.0.49.tgz",
|
|
43
43
|
"@tscircuit/cableprinter": "^0.0.6",
|
|
44
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
44
|
+
"@tscircuit/capacity-autorouter": "^0.0.1064",
|
|
45
45
|
"@tscircuit/checks": "^0.0.270",
|
|
46
46
|
"@tscircuit/circuit-json-util": "^0.0.128",
|
|
47
47
|
"@tscircuit/common": "^0.0.20",
|
|
48
48
|
"@tscircuit/copper-pour-solver": "^0.0.72",
|
|
49
|
-
"@tscircuit/create-fdm-enclosure": "0.0.
|
|
49
|
+
"@tscircuit/create-fdm-enclosure": "0.0.6",
|
|
50
50
|
"@tscircuit/dogbone-solver": "https://jscdn.tscircuit.com/@tscircuit/dogbone-solver/0.0.1.tgz",
|
|
51
51
|
"@tscircuit/fanout-solver": "0.0.81",
|
|
52
52
|
"@tscircuit/flex-utils": "https://jscdn.tscircuit.com/@tscircuit/flex-utils/0.0.8.tgz",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@types/react-dom": "^19.1.6",
|
|
77
77
|
"@types/react-reconciler": "^0.28.9",
|
|
78
78
|
"bpc-graph": "^0.0.57",
|
|
79
|
-
"bun-match-svg": "0.0.
|
|
79
|
+
"bun-match-svg": "0.0.16",
|
|
80
80
|
"calculate-elbow": "^0.0.12",
|
|
81
81
|
"chokidar-cli": "^3.0.0",
|
|
82
82
|
"circuit-json": "^0.0.548",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"connectivity-map": "^1.0.1",
|
|
90
90
|
"debug": "^4.3.6",
|
|
91
91
|
"flatbush": "^4.5.0",
|
|
92
|
-
"graphics-debug": "^0.0.
|
|
92
|
+
"graphics-debug": "^0.0.99",
|
|
93
93
|
"howfat": "^0.3.8",
|
|
94
94
|
"kicad-to-circuit-json": "^0.0.149",
|
|
95
95
|
"kicadts": "^0.0.53",
|
|
@@ -169,6 +169,7 @@
|
|
|
169
169
|
"@dagrejs/dagre": "^2.0.4"
|
|
170
170
|
},
|
|
171
171
|
"overrides": {
|
|
172
|
+
"graphics-debug": "$graphics-debug",
|
|
172
173
|
"@tscircuit/graphics-debug-3d": "https://jscdn.tscircuit.com/@tscircuit/graphics-debug-3d/0.0.1.tgz",
|
|
173
174
|
"@tscircuit/props": "^0.0.721",
|
|
174
175
|
"circuit-json": "^0.0.548",
|