@tscircuit/core 0.0.1954 → 0.0.1955
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 +2514 -584
- package/dist/index.js +489 -321
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ __export(components_exports, {
|
|
|
18
18
|
Antenna: () => Antenna,
|
|
19
19
|
AssemblyDevice: () => AssemblyDevice,
|
|
20
20
|
AssemblyScreen: () => AssemblyScreen,
|
|
21
|
+
AssemblySubassembly: () => AssemblySubassembly,
|
|
21
22
|
AutoroutingPhase: () => AutoroutingPhase,
|
|
22
23
|
Battery: () => Battery,
|
|
23
24
|
Board: () => Board,
|
|
@@ -63,7 +64,7 @@ __export(components_exports, {
|
|
|
63
64
|
MountedBoard: () => MountedBoard,
|
|
64
65
|
Net: () => Net,
|
|
65
66
|
NetLabel: () => NetLabel,
|
|
66
|
-
NormalComponent: () =>
|
|
67
|
+
NormalComponent: () => NormalComponent,
|
|
67
68
|
OpAmp: () => OpAmp,
|
|
68
69
|
Panel: () => Panel,
|
|
69
70
|
PcbNoteDimension: () => PcbNoteDimension,
|
|
@@ -122,13 +123,13 @@ __export(components_exports, {
|
|
|
122
123
|
|
|
123
124
|
// lib/components/base-components/NormalComponent/NormalComponent.ts
|
|
124
125
|
import { fp } from "@tscircuit/footprinter";
|
|
125
|
-
import { normalizeDegrees as
|
|
126
|
+
import { normalizeDegrees as normalizeDegrees5 } from "@tscircuit/math-utils";
|
|
126
127
|
import {
|
|
127
128
|
distance as distance8,
|
|
128
129
|
pcb_component_invalid_layer_error,
|
|
129
130
|
pcb_manual_edit_conflict_warning,
|
|
130
|
-
point3 as
|
|
131
|
-
rotation as
|
|
131
|
+
point3 as point34,
|
|
132
|
+
rotation as rotation4,
|
|
132
133
|
source_part_not_found_warning as source_part_not_found_warning2
|
|
133
134
|
} from "circuit-json";
|
|
134
135
|
import Debug5 from "debug";
|
|
@@ -1761,11 +1762,11 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1761
1762
|
* components
|
|
1762
1763
|
*/
|
|
1763
1764
|
computePcbPropsTransform() {
|
|
1764
|
-
const
|
|
1765
|
+
const rotation5 = this._getPcbRotationBeforeLayout() ?? 0;
|
|
1765
1766
|
const { pcbX, pcbY } = this.getResolvedPcbPositionProp();
|
|
1766
1767
|
const matrix = compose2(
|
|
1767
1768
|
translate(pcbX, pcbY),
|
|
1768
|
-
rotate2(
|
|
1769
|
+
rotate2(rotation5 * Math.PI / 180)
|
|
1769
1770
|
);
|
|
1770
1771
|
return matrix;
|
|
1771
1772
|
}
|
|
@@ -1779,12 +1780,12 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1779
1780
|
_computePcbGlobalTransformBeforeLayout() {
|
|
1780
1781
|
const manualPlacement = this.getSubcircuit()._getPcbManualPlacementForComponent(this);
|
|
1781
1782
|
if (manualPlacement && this.props.pcbX === void 0 && this.props.pcbY === void 0) {
|
|
1782
|
-
const
|
|
1783
|
+
const rotation5 = this._getPcbRotationBeforeLayout() ?? 0;
|
|
1783
1784
|
return compose2(
|
|
1784
1785
|
this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity2(),
|
|
1785
1786
|
compose2(
|
|
1786
1787
|
translate(manualPlacement.x, manualPlacement.y),
|
|
1787
|
-
rotate2(
|
|
1788
|
+
rotate2(rotation5 * Math.PI / 180)
|
|
1788
1789
|
)
|
|
1789
1790
|
);
|
|
1790
1791
|
}
|
|
@@ -10843,16 +10844,16 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
10843
10844
|
const container = this.getPrimitiveContainer();
|
|
10844
10845
|
const { maybeFlipLayer, isFlipped } = this._getPcbPrimitiveFlippedHelpers();
|
|
10845
10846
|
const subcircuit = this.getSubcircuit();
|
|
10846
|
-
let
|
|
10847
|
+
let rotation5 = 0;
|
|
10847
10848
|
if (props.pcbRotation !== void 0 && props.pcbRotation !== 0) {
|
|
10848
|
-
|
|
10849
|
+
rotation5 = props.pcbRotation;
|
|
10849
10850
|
} else {
|
|
10850
10851
|
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
10851
10852
|
const decomposedTransform = decomposeTSR6(globalTransform);
|
|
10852
|
-
|
|
10853
|
+
rotation5 = decomposedTransform.rotation.angle * 180 / Math.PI;
|
|
10853
10854
|
}
|
|
10854
10855
|
if (isFlipped) {
|
|
10855
|
-
|
|
10856
|
+
rotation5 = (rotation5 + 180) % 360;
|
|
10856
10857
|
}
|
|
10857
10858
|
const uniqueLayers = new Set(props.layers);
|
|
10858
10859
|
if (props.layer) uniqueLayers.add(props.layer);
|
|
@@ -10920,7 +10921,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
10920
10921
|
font_size: fontSize,
|
|
10921
10922
|
layer: maybeFlipLayer(layer),
|
|
10922
10923
|
text: normalizeTextForCircuitJson(text),
|
|
10923
|
-
ccw_rotation:
|
|
10924
|
+
ccw_rotation: rotation5,
|
|
10924
10925
|
pcb_component_id: container.pcb_component_id,
|
|
10925
10926
|
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
10926
10927
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
|
|
@@ -13124,8 +13125,120 @@ import { z as z10 } from "zod";
|
|
|
13124
13125
|
|
|
13125
13126
|
// lib/components/primitive-components/CadAssembly.ts
|
|
13126
13127
|
import { cadassemblyProps } from "@tscircuit/props";
|
|
13128
|
+
|
|
13129
|
+
// lib/components/primitive-components/resolve-assembly-placement.ts
|
|
13130
|
+
import { normalizeDegrees as normalizeDegrees2 } from "@tscircuit/math-utils";
|
|
13131
|
+
|
|
13132
|
+
// lib/components/primitive-components/get-assembly-target.ts
|
|
13133
|
+
import { selectAll as selectAll2 } from "css-select";
|
|
13134
|
+
var getAssemblyTarget = (component, connectsTo) => {
|
|
13135
|
+
const tag = component.componentName === "AssemblyScreen" ? "assembly.screen" : "assembly.subassembly";
|
|
13136
|
+
const rootComponent = component.root?.firstChild;
|
|
13137
|
+
if (!rootComponent) {
|
|
13138
|
+
throw new Error(
|
|
13139
|
+
`Could not resolve ${tag} "${component.name}" because the circuit has no root component`
|
|
13140
|
+
);
|
|
13141
|
+
}
|
|
13142
|
+
let selectionScope = rootComponent;
|
|
13143
|
+
let ancestor = component.parent;
|
|
13144
|
+
while (ancestor) {
|
|
13145
|
+
if (ancestor.componentName === "AssemblyDevice") {
|
|
13146
|
+
selectionScope = ancestor;
|
|
13147
|
+
break;
|
|
13148
|
+
}
|
|
13149
|
+
ancestor = ancestor.parent;
|
|
13150
|
+
}
|
|
13151
|
+
const matches = selectAll2(
|
|
13152
|
+
preprocessSelector(connectsTo, component),
|
|
13153
|
+
selectionScope,
|
|
13154
|
+
{ adapter: cssSelectPrimitiveComponentAdapter }
|
|
13155
|
+
);
|
|
13156
|
+
if (matches.length !== 1) {
|
|
13157
|
+
throw new Error(
|
|
13158
|
+
`${tag} "${component.name}" connectsTo selector "${connectsTo}" matched ${matches.length} components; expected exactly one`
|
|
13159
|
+
);
|
|
13160
|
+
}
|
|
13161
|
+
const target = matches[0];
|
|
13162
|
+
if (!target.pcb_component_id && target.componentName !== "AssemblyScreen" && target.componentName !== "AssemblySubassembly") {
|
|
13163
|
+
throw new Error(
|
|
13164
|
+
`${tag} "${component.name}" connectsTo selector "${connectsTo}" matched ${target.getString()}, but it has no PCB component`
|
|
13165
|
+
);
|
|
13166
|
+
}
|
|
13167
|
+
return target;
|
|
13168
|
+
};
|
|
13169
|
+
|
|
13170
|
+
// lib/components/primitive-components/resolve-assembly-placement.ts
|
|
13171
|
+
var isPositionedAssembly = (component) => component.componentName === "AssemblyScreen" || component.componentName === "AssemblySubassembly";
|
|
13172
|
+
var findParentAssembly = (component) => {
|
|
13173
|
+
let parent = component.parent;
|
|
13174
|
+
while (parent) {
|
|
13175
|
+
if (isPositionedAssembly(parent)) return parent;
|
|
13176
|
+
if (parent.componentName === "AssemblyDevice" || parent.pcb_component_id)
|
|
13177
|
+
return void 0;
|
|
13178
|
+
parent = parent.parent;
|
|
13179
|
+
}
|
|
13180
|
+
return void 0;
|
|
13181
|
+
};
|
|
13182
|
+
var resolveAssemblyPlacement = (component, path = []) => {
|
|
13183
|
+
if (path.includes(component)) {
|
|
13184
|
+
throw new Error(
|
|
13185
|
+
`Assembly attachment cycle: ${[...path, component].map((item) => item.name).join(" -> ")}`
|
|
13186
|
+
);
|
|
13187
|
+
}
|
|
13188
|
+
const nextPath = [...path, component];
|
|
13189
|
+
const target = component.componentName === "AssemblyScreen" ? getAssemblyTarget(
|
|
13190
|
+
component,
|
|
13191
|
+
component._parsedProps.connectsTo
|
|
13192
|
+
) : findParentAssembly(component);
|
|
13193
|
+
if (!target)
|
|
13194
|
+
return { position: { x: 0, y: 0, z: 0 }, pcbRotation: 0, layer: "top" };
|
|
13195
|
+
if (isPositionedAssembly(target))
|
|
13196
|
+
return resolveAssemblyPlacement(target, nextPath);
|
|
13197
|
+
const db = component.root.db;
|
|
13198
|
+
const targetPcbComponent = db.pcb_component.get(target.pcb_component_id);
|
|
13199
|
+
if (!targetPcbComponent)
|
|
13200
|
+
throw new Error(`Assembly target "${target.name}" has no PCB component`);
|
|
13201
|
+
const board = target._getBoard();
|
|
13202
|
+
if (!board) {
|
|
13203
|
+
throw new Error(`Assembly target "${target.name}" is not on a board`);
|
|
13204
|
+
}
|
|
13205
|
+
const pcbBoard = board.pcb_board_id ? db.pcb_board.get(board.pcb_board_id) : null;
|
|
13206
|
+
const boardThickness = pcbBoard?.thickness ?? board.boardThickness;
|
|
13207
|
+
const layer = targetPcbComponent.layer === "bottom" ? "bottom" : "top";
|
|
13208
|
+
const isBottomLayer = layer === "bottom";
|
|
13209
|
+
const targetRotation = targetPcbComponent.rotation ?? 0;
|
|
13210
|
+
const insertionAxis = target instanceof NormalComponent ? target._getPcbComponentInsertionAxisDirection(layer, targetRotation) : void 0;
|
|
13211
|
+
const insertionAxisLength = insertionAxis ? Math.hypot(insertionAxis.x, insertionAxis.y) : 0;
|
|
13212
|
+
const cableInsertionCenter = targetPcbComponent.cable_insertion_center ?? targetPcbComponent.center;
|
|
13213
|
+
const inferredCableAxis = {
|
|
13214
|
+
x: cableInsertionCenter.x - targetPcbComponent.center.x,
|
|
13215
|
+
y: cableInsertionCenter.y - targetPcbComponent.center.y
|
|
13216
|
+
};
|
|
13217
|
+
const inferredCableAxisLength = Math.hypot(
|
|
13218
|
+
inferredCableAxis.x,
|
|
13219
|
+
inferredCableAxis.y
|
|
13220
|
+
);
|
|
13221
|
+
const pcbRotation = normalizeDegrees2(
|
|
13222
|
+
insertionAxis && insertionAxisLength > 1e-9 ? Math.atan2(-insertionAxis.x, insertionAxis.y) * 180 / Math.PI : inferredCableAxisLength > 1e-9 ? Math.atan2(-inferredCableAxis.x, inferredCableAxis.y) * 180 / Math.PI : targetRotation
|
|
13223
|
+
);
|
|
13224
|
+
return {
|
|
13225
|
+
position: {
|
|
13226
|
+
...cableInsertionCenter,
|
|
13227
|
+
z: isBottomLayer ? -boardThickness / 2 : boardThickness / 2
|
|
13228
|
+
},
|
|
13229
|
+
pcbRotation,
|
|
13230
|
+
layer,
|
|
13231
|
+
subcircuit_id: targetPcbComponent.subcircuit_id
|
|
13232
|
+
};
|
|
13233
|
+
};
|
|
13234
|
+
|
|
13235
|
+
// lib/components/primitive-components/CadAssembly.ts
|
|
13127
13236
|
var CadAssembly = class extends PrimitiveComponent2 {
|
|
13128
13237
|
isPrimitiveContainer = true;
|
|
13238
|
+
doInitialAssignNameToUnnamedComponents() {
|
|
13239
|
+
if (findParentAssembly(this)) return;
|
|
13240
|
+
super.doInitialAssignNameToUnnamedComponents();
|
|
13241
|
+
}
|
|
13129
13242
|
get config() {
|
|
13130
13243
|
return {
|
|
13131
13244
|
componentName: "CadAssembly",
|
|
@@ -13135,23 +13248,9 @@ var CadAssembly = class extends PrimitiveComponent2 {
|
|
|
13135
13248
|
};
|
|
13136
13249
|
|
|
13137
13250
|
// lib/components/primitive-components/CadModel.ts
|
|
13138
|
-
import {
|
|
13139
|
-
import {
|
|
13251
|
+
import { normalizeDegrees as normalizeDegrees4 } from "@tscircuit/math-utils";
|
|
13252
|
+
import { cadmodelProps, point3 as point33 } from "@tscircuit/props";
|
|
13140
13253
|
import { distance as distance7 } from "circuit-json";
|
|
13141
|
-
import { decomposeTSR as decomposeTSR8 } from "transformation-matrix";
|
|
13142
|
-
|
|
13143
|
-
// lib/components/base-components/NormalComponent/utils/getFileExtension.ts
|
|
13144
|
-
var getFileExtension = (filename) => {
|
|
13145
|
-
if (!filename) return null;
|
|
13146
|
-
const fragmentMatch = filename.match(/#ext=(\w+)$/);
|
|
13147
|
-
if (fragmentMatch) return fragmentMatch[1].toLowerCase();
|
|
13148
|
-
const withoutQuery = filename.split("?")[0];
|
|
13149
|
-
const sanitized = withoutQuery.split("#")[0];
|
|
13150
|
-
const lastSegment = sanitized.split("/").pop() ?? sanitized;
|
|
13151
|
-
if (!lastSegment.includes(".")) return null;
|
|
13152
|
-
const extension = lastSegment.split(".").pop();
|
|
13153
|
-
return extension?.toLowerCase() ?? null;
|
|
13154
|
-
};
|
|
13155
13254
|
|
|
13156
13255
|
// lib/utils/constructAssetUrl.ts
|
|
13157
13256
|
var joinUrlPath = (base, path) => {
|
|
@@ -13178,10 +13277,149 @@ var constructAssetUrl = (targetUrl, baseUrl) => {
|
|
|
13178
13277
|
};
|
|
13179
13278
|
|
|
13180
13279
|
// lib/components/primitive-components/CadModel.ts
|
|
13181
|
-
import {
|
|
13182
|
-
|
|
13183
|
-
|
|
13280
|
+
import { decomposeTSR as decomposeTSR8 } from "transformation-matrix";
|
|
13281
|
+
import { z as z9 } from "zod";
|
|
13282
|
+
|
|
13283
|
+
// lib/components/base-components/NormalComponent/utils/getFileExtension.ts
|
|
13284
|
+
var getFileExtension = (filename) => {
|
|
13285
|
+
if (!filename) return null;
|
|
13286
|
+
const fragmentMatch = filename.match(/#ext=(\w+)$/);
|
|
13287
|
+
if (fragmentMatch) return fragmentMatch[1].toLowerCase();
|
|
13288
|
+
const withoutQuery = filename.split("?")[0];
|
|
13289
|
+
const sanitized = withoutQuery.split("#")[0];
|
|
13290
|
+
const lastSegment = sanitized.split("/").pop() ?? sanitized;
|
|
13291
|
+
if (!lastSegment.includes(".")) return null;
|
|
13292
|
+
const extension = lastSegment.split(".").pop();
|
|
13293
|
+
return extension?.toLowerCase() ?? null;
|
|
13294
|
+
};
|
|
13295
|
+
|
|
13296
|
+
// lib/components/primitive-components/CadModel_renderInAssembly.ts
|
|
13297
|
+
import {
|
|
13298
|
+
cadModelBase as cadModelBase2,
|
|
13299
|
+
point3 as point32
|
|
13300
|
+
} from "@tscircuit/props";
|
|
13301
|
+
|
|
13302
|
+
// lib/components/primitive-components/render-assembly-cad-model.ts
|
|
13303
|
+
import { normalizeDegrees as normalizeDegrees3 } from "@tscircuit/math-utils";
|
|
13304
|
+
import { cadModelBase, point3 } from "@tscircuit/props";
|
|
13305
|
+
import { rotation } from "circuit-json";
|
|
13306
|
+
import {
|
|
13307
|
+
applyToPoint as applyToPoint25,
|
|
13308
|
+
compose as compose6,
|
|
13309
|
+
flipY as flipY4,
|
|
13310
|
+
identity as identity6,
|
|
13311
|
+
rotate as rotate3,
|
|
13312
|
+
translate as translate4
|
|
13313
|
+
} from "transformation-matrix";
|
|
13314
|
+
var renderAssemblyCadModel = (owner, model, placement) => {
|
|
13315
|
+
const base = cadModelBase.parse(typeof model === "string" ? {} : model);
|
|
13316
|
+
const bottom = placement.layer === "bottom";
|
|
13317
|
+
const offset = point3.parse(base.positionOffset ?? { x: 0, y: 0, z: 0 });
|
|
13318
|
+
const transform = compose6(
|
|
13319
|
+
translate4(placement.position.x, placement.position.y),
|
|
13320
|
+
rotate3(placement.pcbRotation * Math.PI / 180),
|
|
13321
|
+
bottom ? flipY4() : identity6()
|
|
13322
|
+
);
|
|
13323
|
+
const xy = applyToPoint25(transform, offset);
|
|
13324
|
+
const authoredRotation = base.pcbRotationOffset ?? base.rotationOffset ?? 0;
|
|
13325
|
+
const rotationOffset = typeof authoredRotation === "number" ? { x: 0, y: 0, z: authoredRotation } : {
|
|
13326
|
+
x: rotation.parse(authoredRotation.x),
|
|
13327
|
+
y: rotation.parse(authoredRotation.y),
|
|
13328
|
+
z: rotation.parse(authoredRotation.z)
|
|
13329
|
+
};
|
|
13330
|
+
const assetUrl = (url) => constructAssetUrl(url, owner.root?.platform?.projectBaseUrl);
|
|
13331
|
+
const urls = typeof model === "string" ? { footprinter_string: model } : {
|
|
13332
|
+
model_stl_url: "stlUrl" in model ? assetUrl(model.stlUrl) : void 0,
|
|
13333
|
+
model_obj_url: "objUrl" in model ? assetUrl(model.objUrl) : void 0,
|
|
13334
|
+
model_mtl_url: "mtlUrl" in model && model.mtlUrl ? assetUrl(model.mtlUrl) : void 0,
|
|
13335
|
+
model_gltf_url: "gltfUrl" in model ? assetUrl(model.gltfUrl) : void 0,
|
|
13336
|
+
model_glb_url: "glbUrl" in model ? assetUrl(model.glbUrl) : void 0,
|
|
13337
|
+
model_step_url: model.stepUrl ? assetUrl(model.stepUrl) : void 0,
|
|
13338
|
+
model_wrl_url: "wrlUrl" in model ? assetUrl(model.wrlUrl) : void 0,
|
|
13339
|
+
model_jscad: "jscad" in model ? model.jscad : void 0
|
|
13340
|
+
};
|
|
13341
|
+
const cad = owner.root.db.cad_component.insert({
|
|
13342
|
+
...urls,
|
|
13343
|
+
position: {
|
|
13344
|
+
...xy,
|
|
13345
|
+
z: placement.position.z + (bottom ? -1 : 1) * (offset.z + (base.zOffsetFromSurface ?? 0))
|
|
13346
|
+
},
|
|
13347
|
+
// Same CAD Euler convention as NormalComponent.doInitialCadModelRender:
|
|
13348
|
+
// bottom flips Y and negates the board-plane Z angle.
|
|
13349
|
+
rotation: {
|
|
13350
|
+
x: rotationOffset.x,
|
|
13351
|
+
y: (bottom ? 180 : 0) + rotationOffset.y,
|
|
13352
|
+
z: normalizeDegrees3(
|
|
13353
|
+
(bottom ? -1 : 1) * (placement.pcbRotation + rotationOffset.z)
|
|
13354
|
+
)
|
|
13355
|
+
},
|
|
13356
|
+
layer: placement.layer,
|
|
13357
|
+
source_component_id: owner.source_component_id,
|
|
13358
|
+
subcircuit_id: placement.subcircuit_id,
|
|
13359
|
+
model_origin_position: base.modelOriginPosition ?? { x: 0, y: 0, z: 0 },
|
|
13360
|
+
model_unit_to_mm_scale_factor: base.modelUnitToMmScale ?? 1,
|
|
13361
|
+
model_object_fit: "contain_within_bounds",
|
|
13362
|
+
model_board_normal_direction: base.modelBoardNormalDirection,
|
|
13363
|
+
size: base.size,
|
|
13364
|
+
anchor_alignment: "center",
|
|
13365
|
+
show_as_translucent_model: base.showAsTranslucentModel ?? false
|
|
13366
|
+
});
|
|
13367
|
+
return cad.cad_component_id;
|
|
13368
|
+
};
|
|
13369
|
+
|
|
13370
|
+
// lib/components/primitive-components/CadModel_renderInAssembly.ts
|
|
13371
|
+
var CadModel_renderInAssembly = (component) => {
|
|
13372
|
+
const owner = findParentAssembly(component);
|
|
13373
|
+
if (!owner) return false;
|
|
13374
|
+
if (component.root?.pcbDisabled || !owner.source_component_id) return true;
|
|
13375
|
+
const placement = resolveAssemblyPlacement(owner);
|
|
13376
|
+
const props = typeof component._parsedProps === "string" ? { modelUrl: component._parsedProps } : component._parsedProps;
|
|
13377
|
+
if (!props) return true;
|
|
13378
|
+
const { pcbX, pcbY } = component.getResolvedPcbPositionProp();
|
|
13379
|
+
const base = cadModelBase2.parse({
|
|
13380
|
+
...props,
|
|
13381
|
+
positionOffset: props.positionOffset ?? point32.parse({
|
|
13382
|
+
x: pcbX,
|
|
13383
|
+
y: pcbY,
|
|
13384
|
+
z: props.pcbZ ?? 0
|
|
13385
|
+
})
|
|
13386
|
+
});
|
|
13387
|
+
const modelUrl = props.modelUrl.replace(/#ext=\w+$/, "");
|
|
13388
|
+
let model;
|
|
13389
|
+
switch (getFileExtension(props.modelUrl)) {
|
|
13390
|
+
case "obj":
|
|
13391
|
+
model = { ...base, objUrl: modelUrl };
|
|
13392
|
+
break;
|
|
13393
|
+
case "gltf":
|
|
13394
|
+
model = { ...base, gltfUrl: modelUrl };
|
|
13395
|
+
break;
|
|
13396
|
+
case "glb":
|
|
13397
|
+
model = { ...base, glbUrl: modelUrl };
|
|
13398
|
+
break;
|
|
13399
|
+
case "step":
|
|
13400
|
+
case "stp":
|
|
13401
|
+
model = { ...base, stepUrl: modelUrl };
|
|
13402
|
+
break;
|
|
13403
|
+
case "wrl":
|
|
13404
|
+
case "vrml":
|
|
13405
|
+
model = { ...base, wrlUrl: modelUrl };
|
|
13406
|
+
break;
|
|
13407
|
+
default:
|
|
13408
|
+
model = { ...base, stlUrl: modelUrl };
|
|
13409
|
+
break;
|
|
13410
|
+
}
|
|
13411
|
+
component.cad_component_id = renderAssemblyCadModel(owner, model, placement);
|
|
13412
|
+
return true;
|
|
13413
|
+
};
|
|
13414
|
+
|
|
13415
|
+
// lib/components/primitive-components/CadModel.ts
|
|
13416
|
+
var rotation2 = z9.union([z9.number(), z9.string()]);
|
|
13417
|
+
var rotation3 = z9.object({ x: rotation2, y: rotation2, z: rotation2 });
|
|
13184
13418
|
var CadModel = class extends PrimitiveComponent2 {
|
|
13419
|
+
doInitialAssignNameToUnnamedComponents() {
|
|
13420
|
+
if (findParentAssembly(this)) return;
|
|
13421
|
+
super.doInitialAssignNameToUnnamedComponents();
|
|
13422
|
+
}
|
|
13185
13423
|
get config() {
|
|
13186
13424
|
return {
|
|
13187
13425
|
componentName: "CadModel",
|
|
@@ -13189,6 +13427,7 @@ var CadModel = class extends PrimitiveComponent2 {
|
|
|
13189
13427
|
};
|
|
13190
13428
|
}
|
|
13191
13429
|
doInitialCadModelRender() {
|
|
13430
|
+
if (CadModel_renderInAssembly(this)) return;
|
|
13192
13431
|
const parent = this._findParentWithPcbComponent();
|
|
13193
13432
|
if (!parent) return;
|
|
13194
13433
|
if (!parent.pcb_component_id) return;
|
|
@@ -13213,7 +13452,7 @@ var CadModel = class extends PrimitiveComponent2 {
|
|
|
13213
13452
|
rotationOffset.z = Number(parsed.z);
|
|
13214
13453
|
}
|
|
13215
13454
|
const { pcbX, pcbY } = this.getResolvedPcbPositionProp();
|
|
13216
|
-
const positionOffset =
|
|
13455
|
+
const positionOffset = point33.parse({
|
|
13217
13456
|
x: pcbX,
|
|
13218
13457
|
y: pcbY,
|
|
13219
13458
|
z: props.pcbZ ?? 0,
|
|
@@ -13265,7 +13504,7 @@ var CadModel = class extends PrimitiveComponent2 {
|
|
|
13265
13504
|
rotation: {
|
|
13266
13505
|
x: Number(rotationOffset.x),
|
|
13267
13506
|
y: (layer === "top" ? 0 : 180) + Number(rotationOffset.y),
|
|
13268
|
-
z:
|
|
13507
|
+
z: normalizeDegrees4(
|
|
13269
13508
|
layer === "bottom" ? -(accumulatedRotation + Number(rotationOffset.z)) : accumulatedRotation + Number(rotationOffset.z)
|
|
13270
13509
|
)
|
|
13271
13510
|
},
|
|
@@ -13274,7 +13513,7 @@ var CadModel = class extends PrimitiveComponent2 {
|
|
|
13274
13513
|
model_origin_alignment: "center_of_component_on_board_surface",
|
|
13275
13514
|
anchor_alignment: "center_of_component_on_board_surface",
|
|
13276
13515
|
model_origin_position: props.modelOriginPosition,
|
|
13277
|
-
size: props.size ?
|
|
13516
|
+
size: props.size ? point33.parse(props.size) : void 0,
|
|
13278
13517
|
source_component_id: parent.source_component_id,
|
|
13279
13518
|
model_unit_to_mm_scale_factor: typeof props.modelUnitToMmScale === "number" ? props.modelUnitToMmScale : void 0,
|
|
13280
13519
|
show_as_translucent_model: props.showAsTranslucentModel ?? parent._parsedProps.showAsTranslucentModel,
|
|
@@ -14997,11 +15236,11 @@ function getPrimaryPortsFromPortHintGroups(portHintGroups, opts) {
|
|
|
14997
15236
|
// lib/components/base-components/NormalComponent/NormalComponent.ts
|
|
14998
15237
|
var debug3 = Debug5("tscircuit:core");
|
|
14999
15238
|
var rotation32 = z10.object({
|
|
15000
|
-
x:
|
|
15001
|
-
y:
|
|
15002
|
-
z:
|
|
15239
|
+
x: rotation4,
|
|
15240
|
+
y: rotation4,
|
|
15241
|
+
z: rotation4
|
|
15003
15242
|
});
|
|
15004
|
-
var
|
|
15243
|
+
var NormalComponent = class extends PrimitiveComponent2 {
|
|
15005
15244
|
schematicBoxDimensions = null;
|
|
15006
15245
|
reactSubtrees = [];
|
|
15007
15246
|
_impliedFootprint;
|
|
@@ -15665,7 +15904,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
15665
15904
|
width: 0,
|
|
15666
15905
|
height: 0,
|
|
15667
15906
|
layer: componentLayer === "top" || componentLayer === "bottom" ? componentLayer : "top",
|
|
15668
|
-
rotation:
|
|
15907
|
+
rotation: normalizeDegrees5(globalTransformRotation),
|
|
15669
15908
|
insertion_direction: this._getPcbComponentInsertionDirection(
|
|
15670
15909
|
componentLayer,
|
|
15671
15910
|
globalTransformRotation
|
|
@@ -16338,7 +16577,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
16338
16577
|
z: typeof sourceRotationOffset === "number" ? sourceRotationOffset : 0,
|
|
16339
16578
|
...typeof sourceRotationOffset === "object" ? sourceRotationOffset : {}
|
|
16340
16579
|
});
|
|
16341
|
-
const positionOffset =
|
|
16580
|
+
const positionOffset = point34.parse({
|
|
16342
16581
|
x: 0,
|
|
16343
16582
|
y: 0,
|
|
16344
16583
|
z: 0,
|
|
@@ -16364,7 +16603,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
16364
16603
|
rotation: {
|
|
16365
16604
|
x: 0,
|
|
16366
16605
|
y: isBottomLayer ? 180 : 0,
|
|
16367
|
-
z:
|
|
16606
|
+
z: normalizeDegrees5(isBottomLayer ? -totalRotation : totalRotation)
|
|
16368
16607
|
},
|
|
16369
16608
|
pcb_component_id: this.pcb_component_id,
|
|
16370
16609
|
source_component_id: this.source_component_id,
|
|
@@ -16377,7 +16616,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
16377
16616
|
return;
|
|
16378
16617
|
}
|
|
16379
16618
|
const rotationWithOffset = totalRotation + (rotationOffset.z ?? 0);
|
|
16380
|
-
const cadRotationZ =
|
|
16619
|
+
const cadRotationZ = normalizeDegrees5(rotationWithOffset);
|
|
16381
16620
|
let footprinterStringForCadComponent;
|
|
16382
16621
|
if (!cadModel && footprintIsFootprinterString) {
|
|
16383
16622
|
footprinterStringForCadComponent = footprintString;
|
|
@@ -16392,7 +16631,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
16392
16631
|
rotation: {
|
|
16393
16632
|
x: rotationOffset.x,
|
|
16394
16633
|
y: rotationOffset.y + (isBottomLayer ? 180 : 0),
|
|
16395
|
-
z:
|
|
16634
|
+
z: normalizeDegrees5(isBottomLayer ? -cadRotationZ : cadRotationZ)
|
|
16396
16635
|
},
|
|
16397
16636
|
pcb_component_id: this.pcb_component_id,
|
|
16398
16637
|
source_component_id: this.source_component_id,
|
|
@@ -16708,7 +16947,7 @@ import {
|
|
|
16708
16947
|
} from "@tscircuit/checks";
|
|
16709
16948
|
import { getBoundsFromPoints as getBoundsFromPoints10 } from "@tscircuit/math-utils";
|
|
16710
16949
|
import { boardProps } from "@tscircuit/props";
|
|
16711
|
-
import { compose as
|
|
16950
|
+
import { compose as compose16, translate as translate16 } from "transformation-matrix";
|
|
16712
16951
|
|
|
16713
16952
|
// lib/utils/autorouting/getAncestorSubcircuitIds.ts
|
|
16714
16953
|
var getDescendantSubcircuitIds = (db, root_subcircuit_id) => {
|
|
@@ -16821,7 +17060,7 @@ import { formatSiUnit } from "format-si-unit";
|
|
|
16821
17060
|
import { symbols as symbols3 } from "schematic-symbols";
|
|
16822
17061
|
|
|
16823
17062
|
// lib/components/normal-components/Capacitor_addPolarityFabricationSymbols.ts
|
|
16824
|
-
import { applyToPoint as
|
|
17063
|
+
import { applyToPoint as applyToPoint26, compose as compose7, rotate as rotate4, translate as translate5 } from "transformation-matrix";
|
|
16825
17064
|
var generatedPaths = /* @__PURE__ */ new WeakMap();
|
|
16826
17065
|
var getPolarity = (port) => {
|
|
16827
17066
|
const hints = [port.name, ...port.port_hints ?? []].map(
|
|
@@ -16863,11 +17102,11 @@ var Capacitor_addPolarityFabricationSymbols = (capacitor) => {
|
|
|
16863
17102
|
if (!positive || !negative) return;
|
|
16864
17103
|
const distance23 = Math.hypot(negative.x - positive.x, negative.y - positive.y);
|
|
16865
17104
|
if (distance23 < 1e-6) return;
|
|
16866
|
-
const frame =
|
|
16867
|
-
|
|
16868
|
-
|
|
17105
|
+
const frame = compose7(
|
|
17106
|
+
translate5((positive.x + negative.x) / 2, (positive.y + negative.y) / 2),
|
|
17107
|
+
rotate4(Math.atan2(negative.y - positive.y, negative.x - positive.x))
|
|
16869
17108
|
);
|
|
16870
|
-
const point6 = (x, y) =>
|
|
17109
|
+
const point6 = (x, y) => applyToPoint26(frame, { x, y });
|
|
16871
17110
|
const offset = distance23 / 4;
|
|
16872
17111
|
const halfSize = Math.min(distance23 * 0.12, 0.3);
|
|
16873
17112
|
const routes = [
|
|
@@ -16922,7 +17161,7 @@ var CAPACITOR_CHIP_FOOTPRINTS = /* @__PURE__ */ new Set([
|
|
|
16922
17161
|
"2010",
|
|
16923
17162
|
"2512"
|
|
16924
17163
|
]);
|
|
16925
|
-
var Capacitor = class extends
|
|
17164
|
+
var Capacitor = class extends NormalComponent {
|
|
16926
17165
|
_adjustSilkscreenTextAutomatically = true;
|
|
16927
17166
|
get config() {
|
|
16928
17167
|
const baseSymbolName = this.props.symbolName ?? "capacitor";
|
|
@@ -17017,7 +17256,7 @@ var Capacitor = class extends NormalComponent3 {
|
|
|
17017
17256
|
|
|
17018
17257
|
// lib/utils/extractPcbPrimitivesFromCircuitJson.ts
|
|
17019
17258
|
import { transformPCBElements } from "@tscircuit/circuit-json-util";
|
|
17020
|
-
import { compose as
|
|
17259
|
+
import { compose as compose8, inverse, rotate as rotate5, translate as translate6 } from "transformation-matrix";
|
|
17021
17260
|
var extractPcbPrimitivesFromCircuitJson = ({
|
|
17022
17261
|
pcbComponent,
|
|
17023
17262
|
db,
|
|
@@ -17026,9 +17265,9 @@ var extractPcbPrimitivesFromCircuitJson = ({
|
|
|
17026
17265
|
const componentCenter = pcbComponent.center || { x: 0, y: 0 };
|
|
17027
17266
|
const componentRotation = pcbComponent.rotation || 0;
|
|
17028
17267
|
const absoluteToComponentRelativeTransform = inverse(
|
|
17029
|
-
|
|
17030
|
-
|
|
17031
|
-
|
|
17268
|
+
compose8(
|
|
17269
|
+
translate6(componentCenter.x, componentCenter.y),
|
|
17270
|
+
rotate5(componentRotation * Math.PI / 180)
|
|
17032
17271
|
)
|
|
17033
17272
|
);
|
|
17034
17273
|
const relativeElements = db.toArray().filter(
|
|
@@ -17132,7 +17371,7 @@ function inflateSourceCapacitor(sourceElm, inflatorContext) {
|
|
|
17132
17371
|
}
|
|
17133
17372
|
|
|
17134
17373
|
// lib/components/normal-components/Chip.ts
|
|
17135
|
-
import { normalizeDegrees as
|
|
17374
|
+
import { normalizeDegrees as normalizeDegrees6 } from "@tscircuit/math-utils";
|
|
17136
17375
|
import { chipProps } from "@tscircuit/props";
|
|
17137
17376
|
import { pcb_component_invalid_layer_error as pcb_component_invalid_layer_error2 } from "circuit-json";
|
|
17138
17377
|
|
|
@@ -17199,7 +17438,7 @@ var Chip_doInitialPcbPlacementDesignRuleChecks = (chip) => {
|
|
|
17199
17438
|
};
|
|
17200
17439
|
|
|
17201
17440
|
// lib/components/normal-components/Chip.ts
|
|
17202
|
-
var Chip = class extends
|
|
17441
|
+
var Chip = class extends NormalComponent {
|
|
17203
17442
|
get config() {
|
|
17204
17443
|
return {
|
|
17205
17444
|
componentName: "Chip",
|
|
@@ -17291,7 +17530,7 @@ var Chip = class extends NormalComponent3 {
|
|
|
17291
17530
|
height: 3,
|
|
17292
17531
|
// Default height, adjust as needed
|
|
17293
17532
|
layer: componentLayer === "top" || componentLayer === "bottom" ? componentLayer : "top",
|
|
17294
|
-
rotation:
|
|
17533
|
+
rotation: normalizeDegrees6(globalTransformRotation),
|
|
17295
17534
|
insertion_direction: this._getPcbComponentInsertionDirection(
|
|
17296
17535
|
componentLayer,
|
|
17297
17536
|
globalTransformRotation
|
|
@@ -18169,7 +18408,7 @@ import { diodeProps } from "@tscircuit/props";
|
|
|
18169
18408
|
var isFootprinterString = (footprint) => typeof footprint === "string" && !parseLibraryFootprintRef(footprint) && !isHttpUrl(footprint) && !isBlobUrl(footprint) && !isStaticAssetPath(footprint);
|
|
18170
18409
|
|
|
18171
18410
|
// lib/components/normal-components/Diode.ts
|
|
18172
|
-
var Diode = class extends
|
|
18411
|
+
var Diode = class extends NormalComponent {
|
|
18173
18412
|
get config() {
|
|
18174
18413
|
const symbolMap = {
|
|
18175
18414
|
schottky: "schottky_diode",
|
|
@@ -18300,7 +18539,7 @@ function inflateSourceDiode(sourceElm, inflatorContext) {
|
|
|
18300
18539
|
|
|
18301
18540
|
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceFiducial.ts
|
|
18302
18541
|
import { fiducialProps } from "@tscircuit/props";
|
|
18303
|
-
var InflatedFiducial = class extends
|
|
18542
|
+
var InflatedFiducial = class extends NormalComponent {
|
|
18304
18543
|
get config() {
|
|
18305
18544
|
return {
|
|
18306
18545
|
componentName: "Fiducial",
|
|
@@ -18729,22 +18968,22 @@ function createElectricalNetIdentity(srj) {
|
|
|
18729
18968
|
function getElectricalNetIdentity(srj) {
|
|
18730
18969
|
const cached = identityCache.get(srj);
|
|
18731
18970
|
if (cached) return cached;
|
|
18732
|
-
const
|
|
18733
|
-
identityCache.set(srj,
|
|
18734
|
-
return
|
|
18971
|
+
const identity11 = createElectricalNetIdentity(srj);
|
|
18972
|
+
identityCache.set(srj, identity11);
|
|
18973
|
+
return identity11;
|
|
18735
18974
|
}
|
|
18736
18975
|
function connectionsShareElectricalNet(srj, firstConnectionName, secondConnectionName) {
|
|
18737
|
-
const
|
|
18738
|
-
const firstNet =
|
|
18739
|
-
const secondNet =
|
|
18976
|
+
const identity11 = getElectricalNetIdentity(srj);
|
|
18977
|
+
const firstNet = identity11.connectionNetKeys.get(firstConnectionName);
|
|
18978
|
+
const secondNet = identity11.connectionNetKeys.get(secondConnectionName);
|
|
18740
18979
|
return firstNet !== void 0 && firstNet === secondNet;
|
|
18741
18980
|
}
|
|
18742
18981
|
function obstacleSharesElectricalNet(srj, obstacle, connectionName) {
|
|
18743
|
-
const
|
|
18744
|
-
const connectionNet =
|
|
18982
|
+
const identity11 = getElectricalNetIdentity(srj);
|
|
18983
|
+
const connectionNet = identity11.connectionNetKeys.get(connectionName);
|
|
18745
18984
|
if (!connectionNet) return false;
|
|
18746
18985
|
for (const token of obstacle.connectedTo)
|
|
18747
|
-
if (
|
|
18986
|
+
if (identity11.tokenNetKeys.get(token) === connectionNet) return true;
|
|
18748
18987
|
return false;
|
|
18749
18988
|
}
|
|
18750
18989
|
|
|
@@ -32363,8 +32602,8 @@ function layerSequences(bus) {
|
|
|
32363
32602
|
(connections) => connections.toSorted((a, b) => {
|
|
32364
32603
|
const delta = (a.exitTargetPoint ?? a.targetPoint)[axis] - (b.exitTargetPoint ?? b.targetPoint)[axis];
|
|
32365
32604
|
if (delta !== 0) return delta;
|
|
32366
|
-
const
|
|
32367
|
-
return
|
|
32605
|
+
const identity11 = (c) => "source_trace_id" in c.connection && typeof c.connection.source_trace_id === "string" ? c.connection.source_trace_id : c.connection.name;
|
|
32606
|
+
return identity11(a).localeCompare(identity11(b)) || a.connection.name.localeCompare(b.connection.name) || a.connectionIndex - b.connectionIndex;
|
|
32368
32607
|
})
|
|
32369
32608
|
);
|
|
32370
32609
|
}
|
|
@@ -38895,11 +39134,11 @@ function getMatchingBuses(buses, padBounds) {
|
|
|
38895
39134
|
const directions = ["right", "up", "left", "down"];
|
|
38896
39135
|
const fieldDirection = Math.abs(dx) >= Math.abs(dy) ? dx >= 0 ? "right" : "left" : dy >= 0 ? "up" : "down";
|
|
38897
39136
|
const edgeDirection = edge === "top" ? "up" : edge === "bottom" ? "down" : edge;
|
|
38898
|
-
const
|
|
39137
|
+
const rotation5 = directions.indexOf(fieldDirection) - directions.indexOf(edgeDirection);
|
|
38899
39138
|
return buses.map(
|
|
38900
39139
|
(bus) => bus.termination.type === "plane" ? bus : {
|
|
38901
39140
|
...bus,
|
|
38902
|
-
direction: directions[(directions.indexOf(bus.direction) +
|
|
39141
|
+
direction: directions[(directions.indexOf(bus.direction) + rotation5 + 4) % 4]
|
|
38903
39142
|
}
|
|
38904
39143
|
);
|
|
38905
39144
|
}
|
|
@@ -50546,7 +50785,7 @@ import {
|
|
|
50546
50785
|
midpoint,
|
|
50547
50786
|
pointToSegmentClosestPoint as pointToSegmentClosestPoint2
|
|
50548
50787
|
} from "@tscircuit/math-utils";
|
|
50549
|
-
import { applyToPoint as
|
|
50788
|
+
import { applyToPoint as applyToPoint28, compose as compose10, scale as scale2, translate as translate8 } from "transformation-matrix";
|
|
50550
50789
|
|
|
50551
50790
|
// node_modules/@tscircuit/implicit-copper-pour-solver/lib/geometry.ts
|
|
50552
50791
|
import {
|
|
@@ -50562,10 +50801,10 @@ import {
|
|
|
50562
50801
|
segmentToSegmentMinDistance
|
|
50563
50802
|
} from "@tscircuit/math-utils";
|
|
50564
50803
|
import {
|
|
50565
|
-
applyToPoint as
|
|
50566
|
-
compose as
|
|
50804
|
+
applyToPoint as applyToPoint27,
|
|
50805
|
+
compose as compose9,
|
|
50567
50806
|
rotateDEG,
|
|
50568
|
-
translate as
|
|
50807
|
+
translate as translate7
|
|
50569
50808
|
} from "transformation-matrix";
|
|
50570
50809
|
var rectTransforms = /* @__PURE__ */ new WeakMap();
|
|
50571
50810
|
var getRectTransforms = (primitive) => {
|
|
@@ -50574,13 +50813,13 @@ var getRectTransforms = (primitive) => {
|
|
|
50574
50813
|
const transforms = {
|
|
50575
50814
|
// compose applies the rightmost operation first: move the world point to
|
|
50576
50815
|
// the rectangle origin, then undo its counter-clockwise rotation.
|
|
50577
|
-
toLocal:
|
|
50816
|
+
toLocal: compose9(
|
|
50578
50817
|
rotateDEG(-primitive.rotation),
|
|
50579
|
-
|
|
50818
|
+
translate7(-primitive.x, -primitive.y)
|
|
50580
50819
|
),
|
|
50581
50820
|
// Rotate a rectangle-local point before translating it into board space.
|
|
50582
|
-
toWorld:
|
|
50583
|
-
|
|
50821
|
+
toWorld: compose9(
|
|
50822
|
+
translate7(primitive.x, primitive.y),
|
|
50584
50823
|
rotateDEG(primitive.rotation)
|
|
50585
50824
|
)
|
|
50586
50825
|
};
|
|
@@ -50616,7 +50855,7 @@ var distanceToPrimitive = (primitive, px, py) => {
|
|
|
50616
50855
|
return distanceToPolygon(point6, primitive.points);
|
|
50617
50856
|
}
|
|
50618
50857
|
const { toLocal } = getRectTransforms(primitive);
|
|
50619
|
-
return pointToBoxDistance(
|
|
50858
|
+
return pointToBoxDistance(applyToPoint27(toLocal, point6), {
|
|
50620
50859
|
center: { x: 0, y: 0 },
|
|
50621
50860
|
width: primitive.halfWidth * 2,
|
|
50622
50861
|
height: primitive.halfHeight * 2
|
|
@@ -50660,8 +50899,8 @@ var getClosestPointOnPrimitive = (primitive, point6) => {
|
|
|
50660
50899
|
return closestPoint;
|
|
50661
50900
|
}
|
|
50662
50901
|
const { toLocal, toWorld } = getRectTransforms(primitive);
|
|
50663
|
-
const localPoint =
|
|
50664
|
-
return
|
|
50902
|
+
const localPoint = applyToPoint27(toLocal, point6);
|
|
50903
|
+
return applyToPoint27(toWorld, {
|
|
50665
50904
|
x: clamp(localPoint.x, -primitive.halfWidth, primitive.halfWidth),
|
|
50666
50905
|
y: clamp(localPoint.y, -primitive.halfHeight, primitive.halfHeight)
|
|
50667
50906
|
});
|
|
@@ -51252,8 +51491,8 @@ var buildPowerPourPolygons = (problem) => {
|
|
|
51252
51491
|
1,
|
|
51253
51492
|
Math.round(problem.minRegionArea / problem.gridPitch ** 2)
|
|
51254
51493
|
);
|
|
51255
|
-
const gridVertexToWorld =
|
|
51256
|
-
|
|
51494
|
+
const gridVertexToWorld = compose10(
|
|
51495
|
+
translate8(problem.bounds.minX, problem.bounds.minY),
|
|
51257
51496
|
scale2(problem.gridPitch)
|
|
51258
51497
|
);
|
|
51259
51498
|
for (const labeledLayer of problem.labeledLayers) {
|
|
@@ -51272,7 +51511,7 @@ var buildPowerPourPolygons = (problem) => {
|
|
|
51272
51511
|
}
|
|
51273
51512
|
const loop = loops[0];
|
|
51274
51513
|
const points = loop.map(([i, j]) => {
|
|
51275
|
-
const point6 =
|
|
51514
|
+
const point6 = applyToPoint28(gridVertexToWorld, { x: i, y: j });
|
|
51276
51515
|
return {
|
|
51277
51516
|
x: clamp2(point6.x, problem.bounds.minX, problem.bounds.maxX),
|
|
51278
51517
|
y: clamp2(point6.y, problem.bounds.minY, problem.bounds.maxY)
|
|
@@ -51308,9 +51547,9 @@ import {
|
|
|
51308
51547
|
} from "circuit-json-to-connectivity-map";
|
|
51309
51548
|
import {
|
|
51310
51549
|
applyToPoints,
|
|
51311
|
-
compose as
|
|
51550
|
+
compose as compose11,
|
|
51312
51551
|
rotateDEG as rotateDEG2,
|
|
51313
|
-
translate as
|
|
51552
|
+
translate as translate9
|
|
51314
51553
|
} from "transformation-matrix";
|
|
51315
51554
|
var DEFAULT_GRID_PITCH = 0.25;
|
|
51316
51555
|
var DEFAULT_TRACE_CLEARANCE = 0.2;
|
|
@@ -51334,13 +51573,13 @@ var getBoardOutline = (board) => {
|
|
|
51334
51573
|
];
|
|
51335
51574
|
};
|
|
51336
51575
|
var addPillPrimitive = (primitives, params) => {
|
|
51337
|
-
const { layers, netIndex, x, y, width, height, rotation:
|
|
51576
|
+
const { layers, netIndex, x, y, width, height, rotation: rotation5 } = params;
|
|
51338
51577
|
const radius = Math.min(width, height) / 2;
|
|
51339
51578
|
const axisLength = Math.max(width, height) - radius * 2;
|
|
51340
51579
|
const halfAxis = axisLength / 2;
|
|
51341
|
-
const axisToWorld =
|
|
51342
|
-
|
|
51343
|
-
rotateDEG2(
|
|
51580
|
+
const axisToWorld = compose11(
|
|
51581
|
+
translate9(x, y),
|
|
51582
|
+
rotateDEG2(rotation5 + (height > width ? 90 : 0))
|
|
51344
51583
|
);
|
|
51345
51584
|
const [start, end] = applyToPoints(axisToWorld, [
|
|
51346
51585
|
{ x: -halfAxis, y: 0 },
|
|
@@ -51427,7 +51666,7 @@ var addPlatedHole = (primitives, hole, netIndex) => {
|
|
|
51427
51666
|
points: hole.pad_outline
|
|
51428
51667
|
});
|
|
51429
51668
|
} else if ("rect_pad_width" in hole && "rect_pad_height" in hole) {
|
|
51430
|
-
const
|
|
51669
|
+
const rotation5 = hole.shape === "circular_hole_with_rect_pad" ? hole.rect_ccw_rotation ?? 0 : hole.shape === "rotated_pill_hole_with_rect_pad" ? hole.rect_ccw_rotation : 0;
|
|
51431
51670
|
primitives.push({
|
|
51432
51671
|
kind: "rect",
|
|
51433
51672
|
layers,
|
|
@@ -51436,7 +51675,7 @@ var addPlatedHole = (primitives, hole, netIndex) => {
|
|
|
51436
51675
|
y: hole.y,
|
|
51437
51676
|
halfWidth: hole.rect_pad_width / 2,
|
|
51438
51677
|
halfHeight: hole.rect_pad_height / 2,
|
|
51439
|
-
rotation:
|
|
51678
|
+
rotation: rotation5
|
|
51440
51679
|
});
|
|
51441
51680
|
}
|
|
51442
51681
|
};
|
|
@@ -53478,7 +53717,7 @@ var applyEditEventsToManualEditsFile = ({
|
|
|
53478
53717
|
|
|
53479
53718
|
// lib/utils/edit-events/apply-edit-events-to-circuit-json.ts
|
|
53480
53719
|
import { transformPCBElement } from "@tscircuit/circuit-json-util";
|
|
53481
|
-
import { translate as
|
|
53720
|
+
import { translate as translate10 } from "transformation-matrix";
|
|
53482
53721
|
|
|
53483
53722
|
// lib/utils/edit-events/apply-trace-hint-edit-event.ts
|
|
53484
53723
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
@@ -53523,7 +53762,7 @@ var applyEditEvents = ({
|
|
|
53523
53762
|
);
|
|
53524
53763
|
const needsMovement = !component || component.center.x !== editEvent.new_center.x || component.center.y !== editEvent.new_center.y;
|
|
53525
53764
|
if (needsMovement && editEvent.original_center) {
|
|
53526
|
-
const mat =
|
|
53765
|
+
const mat = translate10(
|
|
53527
53766
|
editEvent.new_center.x - editEvent.original_center.x,
|
|
53528
53767
|
editEvent.new_center.y - editEvent.original_center.y
|
|
53529
53768
|
);
|
|
@@ -55011,7 +55250,7 @@ import "zod";
|
|
|
55011
55250
|
|
|
55012
55251
|
// lib/components/primitive-components/TraceHint.ts
|
|
55013
55252
|
import { traceHintProps } from "@tscircuit/props";
|
|
55014
|
-
import { applyToPoint as
|
|
55253
|
+
import { applyToPoint as applyToPoint29 } from "transformation-matrix";
|
|
55015
55254
|
var TraceHint = class extends PrimitiveComponent2 {
|
|
55016
55255
|
matchedPort = null;
|
|
55017
55256
|
get config() {
|
|
@@ -55051,7 +55290,7 @@ var TraceHint = class extends PrimitiveComponent2 {
|
|
|
55051
55290
|
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
55052
55291
|
return offsets.map(
|
|
55053
55292
|
(offset) => ({
|
|
55054
|
-
...
|
|
55293
|
+
...applyToPoint29(globalTransform, offset),
|
|
55055
55294
|
via: offset.via,
|
|
55056
55295
|
to_layer: offset.to_layer,
|
|
55057
55296
|
trace_width: offset.trace_width
|
|
@@ -55476,7 +55715,7 @@ var Group_doInitialAssignSchematicSheetToConnectedComponents = (group) => {
|
|
|
55476
55715
|
const schematicSheetId = schematicBox._resolveSchematicSheetId();
|
|
55477
55716
|
if (!chipRef || !schematicSheetId) continue;
|
|
55478
55717
|
const referencedComponent = schematicBox.getSubcircuit().selectOne(chipRef);
|
|
55479
|
-
if (!(referencedComponent instanceof
|
|
55718
|
+
if (!(referencedComponent instanceof NormalComponent)) continue;
|
|
55480
55719
|
if (!referencedComponent.source_component_id) continue;
|
|
55481
55720
|
schematicBoxReferencedSourceComponentIds.add(
|
|
55482
55721
|
referencedComponent.source_component_id
|
|
@@ -55503,7 +55742,7 @@ var Group_doInitialAssignSchematicSheetToConnectedComponents = (group) => {
|
|
|
55503
55742
|
}
|
|
55504
55743
|
}
|
|
55505
55744
|
const normalComponents = group.getDescendants().filter(
|
|
55506
|
-
(component) => component instanceof
|
|
55745
|
+
(component) => component instanceof NormalComponent && component.getSubcircuit() === group
|
|
55507
55746
|
);
|
|
55508
55747
|
for (const normalComponent of normalComponents) {
|
|
55509
55748
|
if (!normalComponent.source_component_id) continue;
|
|
@@ -56562,8 +56801,8 @@ import {
|
|
|
56562
56801
|
findBoundsAndCenter,
|
|
56563
56802
|
transformPCBElements as transformPCBElements2
|
|
56564
56803
|
} from "@tscircuit/circuit-json-util";
|
|
56565
|
-
import { normalizeDegrees as
|
|
56566
|
-
import { compose as
|
|
56804
|
+
import { normalizeDegrees as normalizeDegrees7 } from "@tscircuit/math-utils";
|
|
56805
|
+
import { compose as compose12, rotate as rotate6, translate as translate11 } from "transformation-matrix";
|
|
56567
56806
|
var updateCadRotation = ({
|
|
56568
56807
|
db,
|
|
56569
56808
|
pcbComponentId,
|
|
@@ -56580,7 +56819,7 @@ var updateCadRotation = ({
|
|
|
56580
56819
|
const currentRotationZ = cadComponent.rotation?.z ?? 0;
|
|
56581
56820
|
const nextRotation = {
|
|
56582
56821
|
...cadComponent.rotation ?? { x: 0, y: 0, z: 0 },
|
|
56583
|
-
z:
|
|
56822
|
+
z: normalizeDegrees7(currentRotationZ + delta)
|
|
56584
56823
|
};
|
|
56585
56824
|
db.cad_component.update(cadComponent.cad_component_id, {
|
|
56586
56825
|
rotation: nextRotation
|
|
@@ -56615,11 +56854,11 @@ var applyPackOutput = (group, packOutput, clusterMap, initialPackOutput) => {
|
|
|
56615
56854
|
const member = db.pcb_component.get(memberId);
|
|
56616
56855
|
if (!member) continue;
|
|
56617
56856
|
const originalCenter2 = member.center;
|
|
56618
|
-
const transformMatrix2 =
|
|
56857
|
+
const transformMatrix2 = compose12(
|
|
56619
56858
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
56620
|
-
|
|
56621
|
-
|
|
56622
|
-
|
|
56859
|
+
translate11(center.x + rotatedRel.x, center.y + rotatedRel.y),
|
|
56860
|
+
rotate6(angleRad),
|
|
56861
|
+
translate11(-originalCenter2.x, -originalCenter2.y)
|
|
56623
56862
|
);
|
|
56624
56863
|
const related = db.toArray().filter(
|
|
56625
56864
|
(elm) => "pcb_component_id" in elm && elm.pcb_component_id === memberId
|
|
@@ -56649,11 +56888,11 @@ var applyPackOutput = (group, packOutput, clusterMap, initialPackOutput) => {
|
|
|
56649
56888
|
}
|
|
56650
56889
|
const originalCenter2 = pcbComponent.center;
|
|
56651
56890
|
const rotationDegrees2 = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
|
|
56652
|
-
const transformMatrix2 =
|
|
56891
|
+
const transformMatrix2 = compose12(
|
|
56653
56892
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
56654
|
-
|
|
56655
|
-
|
|
56656
|
-
|
|
56893
|
+
translate11(center.x, center.y),
|
|
56894
|
+
rotate6(rotationDegrees2 * Math.PI / 180),
|
|
56895
|
+
translate11(-originalCenter2.x, -originalCenter2.y)
|
|
56657
56896
|
);
|
|
56658
56897
|
const related = db.toArray().filter(
|
|
56659
56898
|
(elm) => "pcb_component_id" in elm && elm.pcb_component_id === componentId
|
|
@@ -56674,11 +56913,11 @@ var applyPackOutput = (group, packOutput, clusterMap, initialPackOutput) => {
|
|
|
56674
56913
|
);
|
|
56675
56914
|
const originalCenter = initialPackedComponent?.center ?? pcbGroup.center;
|
|
56676
56915
|
const rotationDegrees = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
|
|
56677
|
-
const transformMatrix =
|
|
56916
|
+
const transformMatrix = compose12(
|
|
56678
56917
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
56679
|
-
|
|
56680
|
-
|
|
56681
|
-
|
|
56918
|
+
translate11(center.x, center.y),
|
|
56919
|
+
rotate6(rotationDegrees * Math.PI / 180),
|
|
56920
|
+
translate11(-originalCenter.x, -originalCenter.y)
|
|
56682
56921
|
);
|
|
56683
56922
|
const relatedElements = db.toArray().filter((elm) => {
|
|
56684
56923
|
if ("source_group_id" in elm && elm.source_group_id) {
|
|
@@ -57964,8 +58203,8 @@ function getPowerGroundForcedRotation(db, ports) {
|
|
|
57964
58203
|
const isPositiveVoltageSource = net.is_power === true || net.is_positive_voltage_source === true;
|
|
57965
58204
|
if (isPositiveVoltageSource === isGround) continue;
|
|
57966
58205
|
const rotationToPlacePinOnTop = ROTATION_TO_PLACE_SIDE_ON_TOP[facingDirectionToSide(port.facing_direction)];
|
|
57967
|
-
const
|
|
57968
|
-
powerGroundRotations.add(
|
|
58206
|
+
const rotation5 = isPositiveVoltageSource ? rotationToPlacePinOnTop : (rotationToPlacePinOnTop + 180) % 360;
|
|
58207
|
+
powerGroundRotations.add(rotation5);
|
|
57969
58208
|
}
|
|
57970
58209
|
return powerGroundRotations.size === 1 ? powerGroundRotations.values().next().value : null;
|
|
57971
58210
|
}
|
|
@@ -59056,9 +59295,9 @@ import Debug13 from "debug";
|
|
|
59056
59295
|
// lib/components/primitive-components/NetLabel.ts
|
|
59057
59296
|
import { netLabelProps } from "@tscircuit/props";
|
|
59058
59297
|
import {
|
|
59059
|
-
applyToPoint as
|
|
59060
|
-
identity as
|
|
59061
|
-
translate as
|
|
59298
|
+
applyToPoint as applyToPoint30,
|
|
59299
|
+
identity as identity7,
|
|
59300
|
+
translate as translate12
|
|
59062
59301
|
} from "transformation-matrix";
|
|
59063
59302
|
import { calculateElbow as calculateElbow2 } from "calculate-elbow";
|
|
59064
59303
|
var NetLabel = class extends PrimitiveComponent2 {
|
|
@@ -59121,11 +59360,11 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
59121
59360
|
const connectedPorts = this._getConnectedPorts();
|
|
59122
59361
|
if (connectedPorts.length > 0) {
|
|
59123
59362
|
const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
|
|
59124
|
-
const parentCenter =
|
|
59125
|
-
this.parent?.computeSchematicGlobalTransform?.() ??
|
|
59363
|
+
const parentCenter = applyToPoint30(
|
|
59364
|
+
this.parent?.computeSchematicGlobalTransform?.() ?? identity7(),
|
|
59126
59365
|
{ x: 0, y: 0 }
|
|
59127
59366
|
);
|
|
59128
|
-
return
|
|
59367
|
+
return translate12(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
|
|
59129
59368
|
}
|
|
59130
59369
|
}
|
|
59131
59370
|
return super.computeSchematicPropsTransform();
|
|
@@ -60719,9 +60958,9 @@ function getSchematicTextBounds2(text) {
|
|
|
60719
60958
|
minY = -height / 2;
|
|
60720
60959
|
maxY = height / 2;
|
|
60721
60960
|
}
|
|
60722
|
-
const
|
|
60723
|
-
const cos = Math.cos(
|
|
60724
|
-
const sin = Math.sin(
|
|
60961
|
+
const rotation5 = (text.rotation ?? 0) * Math.PI / 180;
|
|
60962
|
+
const cos = Math.cos(rotation5);
|
|
60963
|
+
const sin = Math.sin(rotation5);
|
|
60725
60964
|
const corners = [
|
|
60726
60965
|
{ x: minX, y: minY },
|
|
60727
60966
|
{ x: minX, y: maxY },
|
|
@@ -62663,7 +62902,7 @@ var Group_getFanoutPourNetMap = (group, routingPhasePlans) => {
|
|
|
62663
62902
|
import { getBoundsFromPoints as getBoundsFromPoints8 } from "@tscircuit/math-utils";
|
|
62664
62903
|
|
|
62665
62904
|
// lib/components/primitive-components/Group/get-saved-autorouting-phase-traces.ts
|
|
62666
|
-
import { applyToPoint as
|
|
62905
|
+
import { applyToPoint as applyToPoint31, compose as compose13, translate as translate13 } from "transformation-matrix";
|
|
62667
62906
|
var touchesEndpoint = (point6, endpoint) => Math.hypot(point6.x - endpoint.x, point6.y - endpoint.y) < 1e-4 && point6.layer === endpoint.layer;
|
|
62668
62907
|
function getSavedAutoroutingPhaseTraces(phase, input, isFanout) {
|
|
62669
62908
|
const group = phase.getGroup();
|
|
@@ -62708,8 +62947,8 @@ function getSavedAutoroutingPhaseTraces(phase, input, isFanout) {
|
|
|
62708
62947
|
);
|
|
62709
62948
|
const portBeforeLayout = port._getGlobalPcbPositionBeforeLayout();
|
|
62710
62949
|
const portAfterLayout = port._getGlobalPcbPositionAfterLayout();
|
|
62711
|
-
const transform =
|
|
62712
|
-
|
|
62950
|
+
const transform = compose13(
|
|
62951
|
+
translate13(
|
|
62713
62952
|
portAfterLayout.x - portBeforeLayout.x,
|
|
62714
62953
|
portAfterLayout.y - portBeforeLayout.y
|
|
62715
62954
|
),
|
|
@@ -62717,7 +62956,7 @@ function getSavedAutoroutingPhaseTraces(phase, input, isFanout) {
|
|
|
62717
62956
|
);
|
|
62718
62957
|
const route = path.route.map((point6) => ({
|
|
62719
62958
|
...point6,
|
|
62720
|
-
...
|
|
62959
|
+
...applyToPoint31(transform, point6)
|
|
62721
62960
|
}));
|
|
62722
62961
|
for (const point6 of route) {
|
|
62723
62962
|
const layers = point6.route_type === "wire" ? [point6.layer] : [point6.from_layer, point6.to_layer];
|
|
@@ -62845,7 +63084,7 @@ function getSavedAutoroutingPhaseTraces(phase, input, isFanout) {
|
|
|
62845
63084
|
}
|
|
62846
63085
|
|
|
62847
63086
|
// lib/components/primitive-components/Breakout/get-saved-fanout-traces.ts
|
|
62848
|
-
import { applyToPoint as
|
|
63087
|
+
import { applyToPoint as applyToPoint32, compose as compose14, translate as translate14 } from "transformation-matrix";
|
|
62849
63088
|
|
|
62850
63089
|
// lib/components/primitive-components/BreakoutPoint.ts
|
|
62851
63090
|
import { breakoutPointProps } from "@tscircuit/props";
|
|
@@ -63009,13 +63248,13 @@ function getSavedFanoutTraces(breakout, input) {
|
|
|
63009
63248
|
);
|
|
63010
63249
|
const pcbExit = db.pcb_breakout_point.get(exit.pcb_breakout_point_id);
|
|
63011
63250
|
const localExit = path.route.at(-1);
|
|
63012
|
-
const transform =
|
|
63251
|
+
const transform = compose14(
|
|
63013
63252
|
exit._computePcbGlobalTransformBeforeLayout(),
|
|
63014
|
-
|
|
63253
|
+
translate14(-localExit.x, -localExit.y)
|
|
63015
63254
|
);
|
|
63016
|
-
const originalExit =
|
|
63255
|
+
const originalExit = applyToPoint32(transform, localExit);
|
|
63017
63256
|
const route = path.route.map((point6) => {
|
|
63018
|
-
const position =
|
|
63257
|
+
const position = applyToPoint32(transform, point6);
|
|
63019
63258
|
return {
|
|
63020
63259
|
...point6,
|
|
63021
63260
|
x: position.x + pcbExit.x - originalExit.x,
|
|
@@ -63487,7 +63726,7 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
63487
63726
|
var package_default = {
|
|
63488
63727
|
name: "@tscircuit/core",
|
|
63489
63728
|
type: "module",
|
|
63490
|
-
version: "0.0.
|
|
63729
|
+
version: "0.0.1954",
|
|
63491
63730
|
types: "dist/index.d.ts",
|
|
63492
63731
|
main: "dist/index.js",
|
|
63493
63732
|
module: "dist/index.js",
|
|
@@ -63541,7 +63780,7 @@ var package_default = {
|
|
|
63541
63780
|
"@tscircuit/math-utils": "^0.0.36",
|
|
63542
63781
|
"@tscircuit/miniflex": "^0.0.4",
|
|
63543
63782
|
"@tscircuit/ngspice-spice-engine": "^0.0.20",
|
|
63544
|
-
"@tscircuit/props": "^0.0.
|
|
63783
|
+
"@tscircuit/props": "^0.0.664",
|
|
63545
63784
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
63546
63785
|
"@tscircuit/schematic-trace-solver": "^0.0.201",
|
|
63547
63786
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
@@ -63557,7 +63796,7 @@ var package_default = {
|
|
|
63557
63796
|
"bun-match-svg": "0.0.12",
|
|
63558
63797
|
"calculate-elbow": "^0.0.12",
|
|
63559
63798
|
"chokidar-cli": "^3.0.0",
|
|
63560
|
-
"circuit-json": "^0.0.
|
|
63799
|
+
"circuit-json": "^0.0.497",
|
|
63561
63800
|
"circuit-json-to-bpc": "^0.0.13",
|
|
63562
63801
|
"circuit-json-to-connectivity-map": "^0.0.30",
|
|
63563
63802
|
"circuit-json-to-gltf": "^0.0.128",
|
|
@@ -63620,8 +63859,8 @@ var package_default = {
|
|
|
63620
63859
|
},
|
|
63621
63860
|
overrides: {
|
|
63622
63861
|
"@tscircuit/circuit-json-util": "^0.0.114",
|
|
63623
|
-
"@tscircuit/props": "^0.0.
|
|
63624
|
-
"circuit-json": "^0.0.
|
|
63862
|
+
"@tscircuit/props": "^0.0.664",
|
|
63863
|
+
"circuit-json": "^0.0.497"
|
|
63625
63864
|
}
|
|
63626
63865
|
};
|
|
63627
63866
|
|
|
@@ -64425,12 +64664,12 @@ function insertAutoplacedJumpers(params) {
|
|
|
64425
64664
|
name: `__autoplaced_jumper_${jumperIndex}`,
|
|
64426
64665
|
supplier_part_numbers: {}
|
|
64427
64666
|
});
|
|
64428
|
-
const
|
|
64667
|
+
const rotation5 = jumper.orientation === "horizontal" ? 0 : 90;
|
|
64429
64668
|
const firstPadLayer = jumper.pads[0]?.layer || jumper.pads[0]?.layers?.[0] || "top";
|
|
64430
64669
|
const pcbComponent = db.pcb_component.insert({
|
|
64431
64670
|
source_component_id: sourceComponent.source_component_id,
|
|
64432
64671
|
center: jumper.center,
|
|
64433
|
-
rotation:
|
|
64672
|
+
rotation: rotation5,
|
|
64434
64673
|
layer: firstPadLayer,
|
|
64435
64674
|
width: jumper.width || 0,
|
|
64436
64675
|
height: jumper.height || 0,
|
|
@@ -64739,7 +64978,7 @@ var ensureRouteStartsAtSourceTraceStart = ({
|
|
|
64739
64978
|
const lastPoint = route[route.length - 1];
|
|
64740
64979
|
return getDistanceToPoint(lastPoint, firstPcbPort) < getDistanceToPoint(firstPoint, firstPcbPort) ? reversePcbTraceRoute(route, routeThicknessMode) : route;
|
|
64741
64980
|
};
|
|
64742
|
-
var Group5 = class extends
|
|
64981
|
+
var Group5 = class extends NormalComponent {
|
|
64743
64982
|
pcb_group_id = null;
|
|
64744
64983
|
schematic_group_id = null;
|
|
64745
64984
|
subcircuit_id = null;
|
|
@@ -66701,7 +66940,7 @@ function inflateSourceGroup(sourceGroup, inflatorContext) {
|
|
|
66701
66940
|
// lib/components/normal-components/Inductor.ts
|
|
66702
66941
|
import { inductorProps } from "@tscircuit/props";
|
|
66703
66942
|
import { formatSiUnit as formatSiUnit2, parseAndConvertSiUnit } from "format-si-unit";
|
|
66704
|
-
var Inductor = class extends
|
|
66943
|
+
var Inductor = class extends NormalComponent {
|
|
66705
66944
|
_adjustSilkscreenTextAutomatically = true;
|
|
66706
66945
|
get config() {
|
|
66707
66946
|
return {
|
|
@@ -66785,7 +67024,7 @@ function inflateSourceInductor(sourceElm, inflatorContext) {
|
|
|
66785
67024
|
import { ledProps } from "@tscircuit/props";
|
|
66786
67025
|
|
|
66787
67026
|
// lib/components/normal-components/Led_addPolarityFabricationSymbol.ts
|
|
66788
|
-
import { applyToPoint as
|
|
67027
|
+
import { applyToPoint as applyToPoint33, compose as compose15, rotate as rotate7, translate as translate15 } from "transformation-matrix";
|
|
66789
67028
|
var generatedNotes = /* @__PURE__ */ new WeakMap();
|
|
66790
67029
|
var getPolarity2 = (port) => {
|
|
66791
67030
|
const hints = [port.name, ...port.port_hints ?? []].map(
|
|
@@ -66826,11 +67065,11 @@ var Led_addPolarityFabricationSymbol = (led) => {
|
|
|
66826
67065
|
const distance23 = Math.hypot(k.x - a.x, k.y - a.y);
|
|
66827
67066
|
if (distance23 < 1e-6) return;
|
|
66828
67067
|
const angle = Math.atan2(k.y - a.y, k.x - a.x);
|
|
66829
|
-
const frame =
|
|
66830
|
-
|
|
66831
|
-
|
|
67068
|
+
const frame = compose15(
|
|
67069
|
+
translate15((a.x + k.x) / 2, (a.y + k.y) / 2),
|
|
67070
|
+
rotate7(angle)
|
|
66832
67071
|
);
|
|
66833
|
-
const point6 = (x, y) =>
|
|
67072
|
+
const point6 = (x, y) => applyToPoint33(frame, { x, y });
|
|
66834
67073
|
const common = {
|
|
66835
67074
|
pcb_component_id: pcb.pcb_component_id,
|
|
66836
67075
|
subcircuit_id: led.getSubcircuit()?.subcircuit_id ?? void 0,
|
|
@@ -66863,7 +67102,7 @@ var Led_addPolarityFabricationSymbol = (led) => {
|
|
|
66863
67102
|
};
|
|
66864
67103
|
|
|
66865
67104
|
// lib/components/normal-components/Led.ts
|
|
66866
|
-
var Led = class extends
|
|
67105
|
+
var Led = class extends NormalComponent {
|
|
66867
67106
|
get config() {
|
|
66868
67107
|
const symbolMap = {
|
|
66869
67108
|
laser: "laser_diode"
|
|
@@ -66992,11 +67231,11 @@ var possibleOrientations = [
|
|
|
66992
67231
|
{ gate: "bottom", drain: "left", source: "right" },
|
|
66993
67232
|
{ gate: "bottom", drain: "right", source: "left" }
|
|
66994
67233
|
];
|
|
66995
|
-
var getBaselineOrientation = (
|
|
66996
|
-
const normalizedRotation = (
|
|
67234
|
+
var getBaselineOrientation = (rotation5) => {
|
|
67235
|
+
const normalizedRotation = (rotation5 % 360 + 360) % 360;
|
|
66997
67236
|
if (normalizedRotation % 90 !== 0) {
|
|
66998
67237
|
throw new Error(
|
|
66999
|
-
`Schematic rotation ${
|
|
67238
|
+
`Schematic rotation ${rotation5} is not supported for Mosfet`
|
|
67000
67239
|
);
|
|
67001
67240
|
}
|
|
67002
67241
|
return [
|
|
@@ -67041,7 +67280,7 @@ var getMosfetSchematicSymbolName = (props) => {
|
|
|
67041
67280
|
};
|
|
67042
67281
|
|
|
67043
67282
|
// lib/components/normal-components/Mosfet.ts
|
|
67044
|
-
var Mosfet = class extends
|
|
67283
|
+
var Mosfet = class extends NormalComponent {
|
|
67045
67284
|
get config() {
|
|
67046
67285
|
return {
|
|
67047
67286
|
componentName: "Mosfet",
|
|
@@ -67142,7 +67381,7 @@ function inflateSourcePort(sourcePort, inflatorContext) {
|
|
|
67142
67381
|
// lib/components/normal-components/PushButton.ts
|
|
67143
67382
|
import { pushButtonProps } from "@tscircuit/props";
|
|
67144
67383
|
import { symbols as symbols6 } from "schematic-symbols";
|
|
67145
|
-
var PushButton = class extends
|
|
67384
|
+
var PushButton = class extends NormalComponent {
|
|
67146
67385
|
get config() {
|
|
67147
67386
|
return {
|
|
67148
67387
|
componentName: "PushButton",
|
|
@@ -67232,7 +67471,7 @@ function inflateSourcePushButton(sourceElm, inflatorContext) {
|
|
|
67232
67471
|
import { resistorProps } from "@tscircuit/props";
|
|
67233
67472
|
import { formatSiUnit as formatSiUnit3 } from "format-si-unit";
|
|
67234
67473
|
import { symbols as symbols7 } from "schematic-symbols";
|
|
67235
|
-
var Resistor = class extends
|
|
67474
|
+
var Resistor = class extends NormalComponent {
|
|
67236
67475
|
_adjustSilkscreenTextAutomatically = true;
|
|
67237
67476
|
get config() {
|
|
67238
67477
|
const baseSymbolName = this.props.symbolName ?? "boxresistor";
|
|
@@ -67361,7 +67600,7 @@ import { frequency, ms } from "circuit-json";
|
|
|
67361
67600
|
function hasSimProps(props) {
|
|
67362
67601
|
return props.simSwitchFrequency !== void 0 || props.simCloseAt !== void 0 || props.simOpenAt !== void 0 || props.simStartClosed !== void 0 || props.simStartOpen !== void 0;
|
|
67363
67602
|
}
|
|
67364
|
-
var Switch = class extends
|
|
67603
|
+
var Switch = class extends NormalComponent {
|
|
67365
67604
|
_getSwitchType() {
|
|
67366
67605
|
const props = this._parsedProps;
|
|
67367
67606
|
if (!props) return "spst";
|
|
@@ -67624,7 +67863,7 @@ var SHORT_ALIASES = {
|
|
|
67624
67863
|
base: ["b"],
|
|
67625
67864
|
emitter: ["e"]
|
|
67626
67865
|
};
|
|
67627
|
-
var Transistor = class extends
|
|
67866
|
+
var Transistor = class extends NormalComponent {
|
|
67628
67867
|
get config() {
|
|
67629
67868
|
const baseSymbolName = this.props.type === "npn" ? "npn_bipolar_transistor" : "pnp_bipolar_transistor";
|
|
67630
67869
|
return {
|
|
@@ -68111,7 +68350,7 @@ var DrcCheck = class extends PrimitiveComponent2 {
|
|
|
68111
68350
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
68112
68351
|
import Debug16 from "debug";
|
|
68113
68352
|
import { isValidElement as isValidElement3 } from "react";
|
|
68114
|
-
import { identity as
|
|
68353
|
+
import { identity as identity8 } from "transformation-matrix";
|
|
68115
68354
|
var IsolatedCircuit = class {
|
|
68116
68355
|
firstChild = null;
|
|
68117
68356
|
children;
|
|
@@ -68323,10 +68562,10 @@ var IsolatedCircuit = class {
|
|
|
68323
68562
|
throw new Error("project.preview is not yet implemented");
|
|
68324
68563
|
}
|
|
68325
68564
|
computeSchematicGlobalTransform() {
|
|
68326
|
-
return
|
|
68565
|
+
return identity8();
|
|
68327
68566
|
}
|
|
68328
68567
|
_computePcbGlobalTransformBeforeLayout() {
|
|
68329
|
-
return
|
|
68568
|
+
return identity8();
|
|
68330
68569
|
}
|
|
68331
68570
|
selectAll(selector) {
|
|
68332
68571
|
this._guessRootComponent();
|
|
@@ -69450,9 +69689,9 @@ var Board = class extends Group5 {
|
|
|
69450
69689
|
_computePcbGlobalTransformBeforeLayout() {
|
|
69451
69690
|
if (this._panelPositionOffset) {
|
|
69452
69691
|
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 };
|
|
69453
|
-
return
|
|
69692
|
+
return compose16(
|
|
69454
69693
|
parentTransform,
|
|
69455
|
-
|
|
69694
|
+
translate16(this._panelPositionOffset.x, this._panelPositionOffset.y)
|
|
69456
69695
|
);
|
|
69457
69696
|
}
|
|
69458
69697
|
return super._computePcbGlobalTransformBeforeLayout();
|
|
@@ -70101,7 +70340,7 @@ import { distance as distance21 } from "circuit-json";
|
|
|
70101
70340
|
// lib/components/normal-components/Subpanel.ts
|
|
70102
70341
|
import { subpanelProps } from "@tscircuit/props";
|
|
70103
70342
|
import { distance as distance20 } from "circuit-json";
|
|
70104
|
-
import { compose as
|
|
70343
|
+
import { compose as compose17, identity as identity9, translate as translate17 } from "transformation-matrix";
|
|
70105
70344
|
|
|
70106
70345
|
// lib/utils/panels/generate-panel-tabs-and-mouse-bites.ts
|
|
70107
70346
|
import * as Flatten from "@flatten-js/core";
|
|
@@ -70612,10 +70851,10 @@ var Subpanel = class _Subpanel extends Group5 {
|
|
|
70612
70851
|
_panelPositionOffset = null;
|
|
70613
70852
|
_computePcbGlobalTransformBeforeLayout() {
|
|
70614
70853
|
if (this._panelPositionOffset) {
|
|
70615
|
-
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ??
|
|
70616
|
-
return
|
|
70854
|
+
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? identity9();
|
|
70855
|
+
return compose17(
|
|
70617
70856
|
parentTransform,
|
|
70618
|
-
|
|
70857
|
+
translate17(this._panelPositionOffset.x, this._panelPositionOffset.y)
|
|
70619
70858
|
);
|
|
70620
70859
|
}
|
|
70621
70860
|
return super._computePcbGlobalTransformBeforeLayout();
|
|
@@ -71101,7 +71340,7 @@ var getGeneratedAntennaGeometry = (antennaShape) => {
|
|
|
71101
71340
|
};
|
|
71102
71341
|
|
|
71103
71342
|
// lib/components/normal-components/Antenna.ts
|
|
71104
|
-
var Antenna = class extends
|
|
71343
|
+
var Antenna = class extends NormalComponent {
|
|
71105
71344
|
get config() {
|
|
71106
71345
|
return {
|
|
71107
71346
|
componentName: "Antenna",
|
|
@@ -71251,7 +71490,7 @@ var Pinout = class extends Chip {
|
|
|
71251
71490
|
// lib/components/normal-components/Fuse.ts
|
|
71252
71491
|
import { fuseProps } from "@tscircuit/props";
|
|
71253
71492
|
import { formatSiUnit as formatSiUnit4, parseAndConvertSiUnit as parseAndConvertSiUnit2 } from "format-si-unit";
|
|
71254
|
-
var Fuse = class extends
|
|
71493
|
+
var Fuse = class extends NormalComponent {
|
|
71255
71494
|
get config() {
|
|
71256
71495
|
return {
|
|
71257
71496
|
componentName: "fuse",
|
|
@@ -71298,8 +71537,8 @@ var Fuse = class extends NormalComponent3 {
|
|
|
71298
71537
|
|
|
71299
71538
|
// lib/components/normal-components/Jumper.ts
|
|
71300
71539
|
import { jumperProps } from "@tscircuit/props";
|
|
71301
|
-
import { normalizeDegrees as
|
|
71302
|
-
var Jumper = class extends
|
|
71540
|
+
import { normalizeDegrees as normalizeDegrees8 } from "@tscircuit/math-utils";
|
|
71541
|
+
var Jumper = class extends NormalComponent {
|
|
71303
71542
|
schematicDimensions = null;
|
|
71304
71543
|
get config() {
|
|
71305
71544
|
return {
|
|
@@ -71347,7 +71586,7 @@ var Jumper = class extends NormalComponent3 {
|
|
|
71347
71586
|
height: 3,
|
|
71348
71587
|
// Default height, adjust as needed
|
|
71349
71588
|
layer: props.layer ?? "top",
|
|
71350
|
-
rotation:
|
|
71589
|
+
rotation: normalizeDegrees8(globalTransformRotation),
|
|
71351
71590
|
insertion_direction: this._getPcbComponentInsertionDirection(
|
|
71352
71591
|
props.layer ?? "top",
|
|
71353
71592
|
globalTransformRotation
|
|
@@ -71416,7 +71655,7 @@ var INTERCONNECT_STANDARD_FOOTPRINTS = {
|
|
|
71416
71655
|
"0805": "0805",
|
|
71417
71656
|
"1206": "1206"
|
|
71418
71657
|
};
|
|
71419
|
-
var Interconnect = class extends
|
|
71658
|
+
var Interconnect = class extends NormalComponent {
|
|
71420
71659
|
get config() {
|
|
71421
71660
|
return {
|
|
71422
71661
|
componentName: "Interconnect",
|
|
@@ -71477,8 +71716,8 @@ var Interconnect = class extends NormalComponent3 {
|
|
|
71477
71716
|
|
|
71478
71717
|
// lib/components/normal-components/SolderJumper.ts
|
|
71479
71718
|
import { solderjumperProps } from "@tscircuit/props";
|
|
71480
|
-
import { normalizeDegrees as
|
|
71481
|
-
var SolderJumper = class extends
|
|
71719
|
+
import { normalizeDegrees as normalizeDegrees9 } from "@tscircuit/math-utils";
|
|
71720
|
+
var SolderJumper = class extends NormalComponent {
|
|
71482
71721
|
schematicDimensions = null;
|
|
71483
71722
|
_getPinCountFromFootprintString(footprint) {
|
|
71484
71723
|
const match = footprint.match(/^solderjumper([23])(?:_|$)/);
|
|
@@ -71634,7 +71873,7 @@ var SolderJumper = class extends NormalComponent3 {
|
|
|
71634
71873
|
height: 3,
|
|
71635
71874
|
// Default height, adjust as needed
|
|
71636
71875
|
layer: props.layer ?? "top",
|
|
71637
|
-
rotation:
|
|
71876
|
+
rotation: normalizeDegrees9(globalTransformRotation),
|
|
71638
71877
|
insertion_direction: this._getPcbComponentInsertionDirection(
|
|
71639
71878
|
props.layer ?? "top",
|
|
71640
71879
|
globalTransformRotation
|
|
@@ -71697,7 +71936,7 @@ var SolderJumper = class extends NormalComponent3 {
|
|
|
71697
71936
|
|
|
71698
71937
|
// lib/components/normal-components/PowerSource.ts
|
|
71699
71938
|
import { powerSourceProps } from "@tscircuit/props";
|
|
71700
|
-
var PowerSource = class extends
|
|
71939
|
+
var PowerSource = class extends NormalComponent {
|
|
71701
71940
|
// @ts-ignore
|
|
71702
71941
|
get config() {
|
|
71703
71942
|
return {
|
|
@@ -71739,7 +71978,7 @@ var PowerSource = class extends NormalComponent3 {
|
|
|
71739
71978
|
// lib/components/normal-components/VoltageSource.ts
|
|
71740
71979
|
import { voltageSourceProps } from "@tscircuit/props";
|
|
71741
71980
|
import { formatSiUnit as formatSiUnit5 } from "format-si-unit";
|
|
71742
|
-
var VoltageSource = class extends
|
|
71981
|
+
var VoltageSource = class extends NormalComponent {
|
|
71743
71982
|
simulation_voltage_source_id = null;
|
|
71744
71983
|
get config() {
|
|
71745
71984
|
const isSquare = this.props.waveShape === "square";
|
|
@@ -71844,7 +72083,7 @@ var VoltageSource = class extends NormalComponent3 {
|
|
|
71844
72083
|
// lib/components/normal-components/CurrentSource.ts
|
|
71845
72084
|
import { currentSourceProps } from "@tscircuit/props";
|
|
71846
72085
|
import { formatSiUnit as formatSiUnit6 } from "format-si-unit";
|
|
71847
|
-
var CurrentSource = class extends
|
|
72086
|
+
var CurrentSource = class extends NormalComponent {
|
|
71848
72087
|
simulation_current_source_id = null;
|
|
71849
72088
|
get config() {
|
|
71850
72089
|
const symbolName = "current_source";
|
|
@@ -72107,7 +72346,7 @@ var Ammeter_doInitialSchematicLayout = (ammeter) => {
|
|
|
72107
72346
|
};
|
|
72108
72347
|
|
|
72109
72348
|
// lib/components/normal-components/Ammeter.ts
|
|
72110
|
-
var Ammeter = class extends
|
|
72349
|
+
var Ammeter = class extends NormalComponent {
|
|
72111
72350
|
simulation_current_probe_id = null;
|
|
72112
72351
|
get config() {
|
|
72113
72352
|
return {
|
|
@@ -72282,7 +72521,7 @@ var AutoroutingPhase = class extends PrimitiveComponent2 {
|
|
|
72282
72521
|
|
|
72283
72522
|
// lib/components/primitive-components/FabricationNoteDimension.ts
|
|
72284
72523
|
import { fabricationNoteDimensionProps } from "@tscircuit/props";
|
|
72285
|
-
import { applyToPoint as
|
|
72524
|
+
import { applyToPoint as applyToPoint34 } from "transformation-matrix";
|
|
72286
72525
|
var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
72287
72526
|
fabrication_note_dimension_id = null;
|
|
72288
72527
|
isPcbPrimitive = true;
|
|
@@ -72301,13 +72540,13 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
|
72301
72540
|
this.renderError(
|
|
72302
72541
|
`FabricationNoteDimension could not find selector "${input}"`
|
|
72303
72542
|
);
|
|
72304
|
-
return
|
|
72543
|
+
return applyToPoint34(transform, { x: 0, y: 0 });
|
|
72305
72544
|
}
|
|
72306
72545
|
return target._getGlobalPcbPositionBeforeLayout();
|
|
72307
72546
|
}
|
|
72308
72547
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
72309
72548
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
72310
|
-
return
|
|
72549
|
+
return applyToPoint34(transform, { x: numericX, y: numericY });
|
|
72311
72550
|
}
|
|
72312
72551
|
doInitialPcbPrimitiveRender() {
|
|
72313
72552
|
if (this.root?.pcbDisabled) return;
|
|
@@ -72402,7 +72641,7 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
|
72402
72641
|
|
|
72403
72642
|
// lib/components/primitive-components/PcbNoteDimension.ts
|
|
72404
72643
|
import { pcbNoteDimensionProps } from "@tscircuit/props";
|
|
72405
|
-
import { applyToPoint as
|
|
72644
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
72406
72645
|
var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
72407
72646
|
pcb_note_dimension_id = null;
|
|
72408
72647
|
isPcbPrimitive = true;
|
|
@@ -72419,7 +72658,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
72419
72658
|
);
|
|
72420
72659
|
if (!target) {
|
|
72421
72660
|
this.renderError(`PcbNoteDimension could not find selector "${input}"`);
|
|
72422
|
-
return
|
|
72661
|
+
return applyToPoint35(transform, { x: 0, y: 0 });
|
|
72423
72662
|
}
|
|
72424
72663
|
const targetPcbComponentId = target.pcb_component_id;
|
|
72425
72664
|
const root = this.root;
|
|
@@ -72436,7 +72675,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
72436
72675
|
}
|
|
72437
72676
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
72438
72677
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
72439
|
-
return
|
|
72678
|
+
return applyToPoint35(transform, { x: numericX, y: numericY });
|
|
72440
72679
|
}
|
|
72441
72680
|
doInitialPcbPrimitiveRender() {
|
|
72442
72681
|
if (this.root?.pcbDisabled) return;
|
|
@@ -75187,7 +75426,7 @@ import {
|
|
|
75187
75426
|
getTransformedSvgPathRoutes,
|
|
75188
75427
|
loadImageSource
|
|
75189
75428
|
} from "@tscircuit/image-utils";
|
|
75190
|
-
import { applyToPoint as
|
|
75429
|
+
import { applyToPoint as applyToPoint36 } from "transformation-matrix";
|
|
75191
75430
|
var SilkscreenGraphic = class extends PrimitiveComponent2 {
|
|
75192
75431
|
pcb_silkscreen_graphic_id = null;
|
|
75193
75432
|
pcb_silkscreen_graphic_ids = [];
|
|
@@ -75289,7 +75528,7 @@ var SilkscreenGraphic = class extends PrimitiveComponent2 {
|
|
|
75289
75528
|
{ x: halfWidth, y: -halfHeight },
|
|
75290
75529
|
{ x: -halfWidth, y: -halfHeight }
|
|
75291
75530
|
]).map(
|
|
75292
|
-
(point6) =>
|
|
75531
|
+
(point6) => applyToPoint36(transform, point6)
|
|
75293
75532
|
)
|
|
75294
75533
|
},
|
|
75295
75534
|
inner_rings: []
|
|
@@ -75406,7 +75645,7 @@ var Fiducial = class extends PrimitiveComponent2 {
|
|
|
75406
75645
|
|
|
75407
75646
|
// lib/components/primitive-components/AssemblyDevice.ts
|
|
75408
75647
|
import { assemblyDeviceProps } from "@tscircuit/props";
|
|
75409
|
-
import { identity as
|
|
75648
|
+
import { identity as identity10 } from "transformation-matrix";
|
|
75410
75649
|
var AssemblyDevice = class extends PrimitiveComponent2 {
|
|
75411
75650
|
isAssemblyDeviceContainer = true;
|
|
75412
75651
|
get config() {
|
|
@@ -75418,10 +75657,10 @@ var AssemblyDevice = class extends PrimitiveComponent2 {
|
|
|
75418
75657
|
doInitialAssignNameToUnnamedComponents() {
|
|
75419
75658
|
}
|
|
75420
75659
|
computeSchematicGlobalTransform() {
|
|
75421
|
-
return
|
|
75660
|
+
return identity10();
|
|
75422
75661
|
}
|
|
75423
75662
|
_computePcbGlobalTransformBeforeLayout() {
|
|
75424
|
-
return
|
|
75663
|
+
return identity10();
|
|
75425
75664
|
}
|
|
75426
75665
|
// Compatibility stage: this is a transparent product-level container and emits no
|
|
75427
75666
|
// Circuit JSON. The later schema migration adds source_assembly_device without
|
|
@@ -75431,46 +75670,6 @@ var AssemblyDevice = class extends PrimitiveComponent2 {
|
|
|
75431
75670
|
// lib/components/primitive-components/AssemblyScreen.ts
|
|
75432
75671
|
import { assemblyScreenProps } from "@tscircuit/props";
|
|
75433
75672
|
|
|
75434
|
-
// lib/components/primitive-components/AssemblyScreen_doInitialCadModelRender.ts
|
|
75435
|
-
import { normalizeDegrees as normalizeDegrees8 } from "@tscircuit/math-utils";
|
|
75436
|
-
|
|
75437
|
-
// lib/components/primitive-components/get-assembly-screen-target.ts
|
|
75438
|
-
import { selectAll as selectAll2 } from "css-select";
|
|
75439
|
-
var getAssemblyScreenTarget = (component, connectsTo) => {
|
|
75440
|
-
const rootComponent = component.root?.firstChild;
|
|
75441
|
-
if (!rootComponent) {
|
|
75442
|
-
throw new Error(
|
|
75443
|
-
`Could not resolve assembly.screen "${component.name}" because the circuit has no root component`
|
|
75444
|
-
);
|
|
75445
|
-
}
|
|
75446
|
-
let selectionScope = rootComponent;
|
|
75447
|
-
let ancestor = component.parent;
|
|
75448
|
-
while (ancestor) {
|
|
75449
|
-
if (ancestor.componentName === "AssemblyDevice") {
|
|
75450
|
-
selectionScope = ancestor;
|
|
75451
|
-
break;
|
|
75452
|
-
}
|
|
75453
|
-
ancestor = ancestor.parent;
|
|
75454
|
-
}
|
|
75455
|
-
const matches = selectAll2(
|
|
75456
|
-
preprocessSelector(connectsTo, component),
|
|
75457
|
-
selectionScope,
|
|
75458
|
-
{ adapter: cssSelectPrimitiveComponentAdapter }
|
|
75459
|
-
);
|
|
75460
|
-
if (matches.length !== 1) {
|
|
75461
|
-
throw new Error(
|
|
75462
|
-
`assembly.screen "${component.name}" connectsTo selector "${connectsTo}" matched ${matches.length} components; expected exactly one`
|
|
75463
|
-
);
|
|
75464
|
-
}
|
|
75465
|
-
const target = matches[0];
|
|
75466
|
-
if (!target.pcb_component_id) {
|
|
75467
|
-
throw new Error(
|
|
75468
|
-
`assembly.screen "${component.name}" connectsTo selector "${connectsTo}" matched ${target.getString()}, but it has no PCB component`
|
|
75469
|
-
);
|
|
75470
|
-
}
|
|
75471
|
-
return target;
|
|
75472
|
-
};
|
|
75473
|
-
|
|
75474
75673
|
// lib/components/primitive-components/AssemblyScreen_doInitialCadModelRender.ts
|
|
75475
75674
|
var formatMillimetersForModelprinter = (millimeters) => Number(millimeters.toFixed(6)).toString();
|
|
75476
75675
|
var getDefaultFlexScreenModel = (component) => {
|
|
@@ -75483,74 +75682,14 @@ var getDefaultFlexScreenModel = (component) => {
|
|
|
75483
75682
|
return `flexscreen_w${formatMillimetersForModelprinter(width)}mm_h${formatMillimetersForModelprinter(height)}mm`;
|
|
75484
75683
|
};
|
|
75485
75684
|
var AssemblyScreen_doInitialCadModelRender = (component) => {
|
|
75486
|
-
|
|
75487
|
-
if (!root || root.pcbDisabled || !component.source_component_id || !component.pcb_component_id) {
|
|
75685
|
+
if (!component.root || component.root.pcbDisabled || !component.source_component_id)
|
|
75488
75686
|
return;
|
|
75489
|
-
|
|
75490
|
-
|
|
75491
|
-
|
|
75492
|
-
|
|
75493
|
-
|
|
75494
|
-
if (!targetPcbComponent) {
|
|
75495
|
-
throw new Error(
|
|
75496
|
-
`assembly.screen "${component.name}" could not read the PCB component selected by "${props.connectsTo}"`
|
|
75497
|
-
);
|
|
75498
|
-
}
|
|
75499
|
-
const board = target._getBoard();
|
|
75500
|
-
if (!board) {
|
|
75501
|
-
throw new Error(
|
|
75502
|
-
`assembly.screen "${component.name}" target "${props.connectsTo}" is not on a board`
|
|
75503
|
-
);
|
|
75504
|
-
}
|
|
75505
|
-
const pcbBoard = board.pcb_board_id ? db.pcb_board.get(board.pcb_board_id) : null;
|
|
75506
|
-
const boardThickness = pcbBoard?.thickness ?? board.boardThickness;
|
|
75507
|
-
const layer = targetPcbComponent.layer === "bottom" ? "bottom" : "top";
|
|
75508
|
-
const isBottomLayer = layer === "bottom";
|
|
75509
|
-
const targetRotation = targetPcbComponent.rotation ?? 0;
|
|
75510
|
-
const insertionAxis = target instanceof NormalComponent3 ? target._getPcbComponentInsertionAxisDirection(layer, targetRotation) : void 0;
|
|
75511
|
-
const insertionAxisLength = insertionAxis ? Math.hypot(insertionAxis.x, insertionAxis.y) : 0;
|
|
75512
|
-
const cableInsertionCenter = targetPcbComponent.cable_insertion_center ?? targetPcbComponent.center;
|
|
75513
|
-
const inferredCableAxis = {
|
|
75514
|
-
x: cableInsertionCenter.x - targetPcbComponent.center.x,
|
|
75515
|
-
y: cableInsertionCenter.y - targetPcbComponent.center.y
|
|
75516
|
-
};
|
|
75517
|
-
const inferredCableAxisLength = Math.hypot(
|
|
75518
|
-
inferredCableAxis.x,
|
|
75519
|
-
inferredCableAxis.y
|
|
75520
|
-
);
|
|
75521
|
-
const screenBoardRotation = normalizeDegrees8(
|
|
75522
|
-
insertionAxis && insertionAxisLength > 1e-9 ? Math.atan2(-insertionAxis.x, insertionAxis.y) * 180 / Math.PI : inferredCableAxisLength > 1e-9 ? Math.atan2(-inferredCableAxis.x, inferredCableAxis.y) * 180 / Math.PI : targetRotation
|
|
75687
|
+
const placement = resolveAssemblyPlacement(component);
|
|
75688
|
+
component.cad_component_id = renderAssemblyCadModel(
|
|
75689
|
+
component,
|
|
75690
|
+
component._parsedProps.cadModel ?? getDefaultFlexScreenModel(component),
|
|
75691
|
+
placement
|
|
75523
75692
|
);
|
|
75524
|
-
db.pcb_component.update(component.pcb_component_id, {
|
|
75525
|
-
center: cableInsertionCenter,
|
|
75526
|
-
layer,
|
|
75527
|
-
rotation: screenBoardRotation,
|
|
75528
|
-
subcircuit_id: targetPcbComponent.subcircuit_id
|
|
75529
|
-
});
|
|
75530
|
-
const cadComponent = db.cad_component.insert({
|
|
75531
|
-
position: {
|
|
75532
|
-
x: cableInsertionCenter.x,
|
|
75533
|
-
y: cableInsertionCenter.y,
|
|
75534
|
-
z: isBottomLayer ? -boardThickness / 2 : boardThickness / 2
|
|
75535
|
-
},
|
|
75536
|
-
rotation: {
|
|
75537
|
-
x: 0,
|
|
75538
|
-
y: isBottomLayer ? 180 : 0,
|
|
75539
|
-
z: normalizeDegrees8(
|
|
75540
|
-
isBottomLayer ? -screenBoardRotation : screenBoardRotation
|
|
75541
|
-
)
|
|
75542
|
-
},
|
|
75543
|
-
pcb_component_id: component.pcb_component_id,
|
|
75544
|
-
source_component_id: component.source_component_id,
|
|
75545
|
-
subcircuit_id: targetPcbComponent.subcircuit_id,
|
|
75546
|
-
footprinter_string: props.cadModel ?? getDefaultFlexScreenModel(component),
|
|
75547
|
-
model_unit_to_mm_scale_factor: 1,
|
|
75548
|
-
model_object_fit: "contain_within_bounds",
|
|
75549
|
-
model_origin_position: { x: 0, y: 0, z: 0 },
|
|
75550
|
-
anchor_alignment: "center",
|
|
75551
|
-
show_as_translucent_model: false
|
|
75552
|
-
});
|
|
75553
|
-
component.cad_component_id = cadComponent.cad_component_id;
|
|
75554
75693
|
};
|
|
75555
75694
|
|
|
75556
75695
|
// lib/components/primitive-components/AssemblyScreen.ts
|
|
@@ -75573,24 +75712,44 @@ var AssemblyScreen = class extends PrimitiveComponent2 {
|
|
|
75573
75712
|
});
|
|
75574
75713
|
this.source_component_id = sourceComponent.source_component_id;
|
|
75575
75714
|
}
|
|
75576
|
-
|
|
75577
|
-
|
|
75578
|
-
|
|
75579
|
-
|
|
75580
|
-
|
|
75581
|
-
|
|
75582
|
-
|
|
75583
|
-
|
|
75584
|
-
|
|
75585
|
-
|
|
75586
|
-
|
|
75587
|
-
|
|
75588
|
-
|
|
75715
|
+
doInitialCadModelRender() {
|
|
75716
|
+
AssemblyScreen_doInitialCadModelRender(this);
|
|
75717
|
+
}
|
|
75718
|
+
};
|
|
75719
|
+
|
|
75720
|
+
// lib/components/primitive-components/AssemblySubassembly.ts
|
|
75721
|
+
import { assemblySubassemblyProps } from "@tscircuit/props";
|
|
75722
|
+
import { isValidElement as isValidElement4 } from "react";
|
|
75723
|
+
var AssemblySubassembly = class extends PrimitiveComponent2 {
|
|
75724
|
+
isAssemblyDeviceContainer = true;
|
|
75725
|
+
get config() {
|
|
75726
|
+
return {
|
|
75727
|
+
componentName: "AssemblySubassembly",
|
|
75728
|
+
zodProps: assemblySubassemblyProps
|
|
75729
|
+
};
|
|
75730
|
+
}
|
|
75731
|
+
doInitialAssignNameToUnnamedComponents() {
|
|
75732
|
+
if (this._parsedProps.name) return;
|
|
75733
|
+
throw new Error("assembly.subassembly requires a non-empty name");
|
|
75734
|
+
}
|
|
75735
|
+
doInitialReactSubtreesRender() {
|
|
75736
|
+
if (isValidElement4(this.props.cadModel))
|
|
75737
|
+
this.add(createInstanceFromReactElement(this.props.cadModel));
|
|
75738
|
+
}
|
|
75739
|
+
doInitialSourceRender() {
|
|
75740
|
+
const sourceComponent = this.root.db.source_component.insert({
|
|
75741
|
+
ftype: "simple_chip",
|
|
75742
|
+
name: this.name
|
|
75589
75743
|
});
|
|
75590
|
-
this.
|
|
75744
|
+
this.source_component_id = sourceComponent.source_component_id;
|
|
75591
75745
|
}
|
|
75592
75746
|
doInitialCadModelRender() {
|
|
75593
|
-
|
|
75747
|
+
if (!this.root || this.root.pcbDisabled || !this.source_component_id) return;
|
|
75748
|
+
const placement = resolveAssemblyPlacement(this);
|
|
75749
|
+
const model = this._parsedProps.cadModel;
|
|
75750
|
+
if (model && !(typeof model === "object" && "type" in model)) {
|
|
75751
|
+
this.cad_component_id = renderAssemblyCadModel(this, model, placement);
|
|
75752
|
+
}
|
|
75594
75753
|
}
|
|
75595
75754
|
};
|
|
75596
75755
|
|
|
@@ -75943,7 +76102,7 @@ var EnclosureFdmBox = class _EnclosureFdmBox extends PrimitiveComponent2 {
|
|
|
75943
76102
|
|
|
75944
76103
|
// lib/components/normal-components/Battery.ts
|
|
75945
76104
|
import { batteryProps } from "@tscircuit/props";
|
|
75946
|
-
var Battery = class extends
|
|
76105
|
+
var Battery = class extends NormalComponent {
|
|
75947
76106
|
get config() {
|
|
75948
76107
|
return {
|
|
75949
76108
|
componentName: "Battery",
|
|
@@ -75978,7 +76137,7 @@ var Battery = class extends NormalComponent3 {
|
|
|
75978
76137
|
|
|
75979
76138
|
// lib/components/normal-components/PinHeader.ts
|
|
75980
76139
|
import { pinHeaderProps } from "@tscircuit/props";
|
|
75981
|
-
var PinHeader = class extends
|
|
76140
|
+
var PinHeader = class extends NormalComponent {
|
|
75982
76141
|
_getPcbRotationBeforeLayout() {
|
|
75983
76142
|
const orientationRotation = this.props.pcbOrientation === "vertical" ? -90 : 0;
|
|
75984
76143
|
const baseRotation = super._getPcbRotationBeforeLayout() ?? 0;
|
|
@@ -76119,7 +76278,7 @@ function getResonatorSymbolName(variant) {
|
|
|
76119
76278
|
return "crystal";
|
|
76120
76279
|
}
|
|
76121
76280
|
}
|
|
76122
|
-
var Resonator = class extends
|
|
76281
|
+
var Resonator = class extends NormalComponent {
|
|
76123
76282
|
get config() {
|
|
76124
76283
|
return {
|
|
76125
76284
|
componentName: "Resonator",
|
|
@@ -76167,7 +76326,7 @@ function getPotentiometerSymbolName(variant) {
|
|
|
76167
76326
|
return "potentiometer2";
|
|
76168
76327
|
}
|
|
76169
76328
|
}
|
|
76170
|
-
var Potentiometer = class extends
|
|
76329
|
+
var Potentiometer = class extends NormalComponent {
|
|
76171
76330
|
get config() {
|
|
76172
76331
|
return {
|
|
76173
76332
|
componentName: "Potentiometer",
|
|
@@ -76203,7 +76362,7 @@ import { crystalProps } from "@tscircuit/props";
|
|
|
76203
76362
|
import { formatSiUnit as formatSiUnit9 } from "format-si-unit";
|
|
76204
76363
|
var DEFAULT_CRYSTAL_MAX_TRACE_LENGTH_MM = 10;
|
|
76205
76364
|
var DEFAULT_CRYSTAL_MAX_VIA_COUNT = 0;
|
|
76206
|
-
var Crystal = class extends
|
|
76365
|
+
var Crystal = class extends NormalComponent {
|
|
76207
76366
|
get config() {
|
|
76208
76367
|
const symbolName = this.props.symbolName ?? (this.props.pinVariant === "four_pin" ? "crystal_4pin" : "crystal");
|
|
76209
76368
|
return {
|
|
@@ -76291,7 +76450,7 @@ var Crystal = class extends NormalComponent3 {
|
|
|
76291
76450
|
|
|
76292
76451
|
// lib/components/normal-components/OpAmp.ts
|
|
76293
76452
|
import { opampProps } from "@tscircuit/props";
|
|
76294
|
-
var OpAmp = class extends
|
|
76453
|
+
var OpAmp = class extends NormalComponent {
|
|
76295
76454
|
getSchematicSymbolName() {
|
|
76296
76455
|
if (this.props.symbolName) {
|
|
76297
76456
|
return this.props.symbolName;
|
|
@@ -76380,7 +76539,7 @@ var TESTPOINT_DEFAULTS = {
|
|
|
76380
76539
|
SMT_CIRCLE_DIAMETER: 1.2,
|
|
76381
76540
|
SMT_RECT_SIZE: 2
|
|
76382
76541
|
};
|
|
76383
|
-
var TestPoint = class extends
|
|
76542
|
+
var TestPoint = class extends NormalComponent {
|
|
76384
76543
|
get config() {
|
|
76385
76544
|
return {
|
|
76386
76545
|
componentName: "TestPoint",
|
|
@@ -78013,6 +78172,12 @@ var analog = {
|
|
|
78013
78172
|
|
|
78014
78173
|
// lib/namespaced-elements/assembly.ts
|
|
78015
78174
|
var assembly = {
|
|
78175
|
+
subassembly: createNamespacedElement(
|
|
78176
|
+
"assembly.subassembly"
|
|
78177
|
+
),
|
|
78178
|
+
cadassembly: createNamespacedElement(
|
|
78179
|
+
"assembly.cadassembly"
|
|
78180
|
+
),
|
|
78016
78181
|
device: createNamespacedElement("assembly.device"),
|
|
78017
78182
|
screen: createNamespacedElement("assembly.screen")
|
|
78018
78183
|
};
|
|
@@ -78255,6 +78420,8 @@ extendCatalogue(components_exports);
|
|
|
78255
78420
|
extendCatalogue({
|
|
78256
78421
|
"assembly.device": AssemblyDevice,
|
|
78257
78422
|
"assembly.screen": AssemblyScreen,
|
|
78423
|
+
"assembly.subassembly": AssemblySubassembly,
|
|
78424
|
+
"assembly.cadassembly": AssemblySubassembly,
|
|
78258
78425
|
Bug: Chip,
|
|
78259
78426
|
"enclosure.cutoutaperture": EnclosureCutoutAperture,
|
|
78260
78427
|
"enclosure.fdm.box": EnclosureFdmBox,
|
|
@@ -78276,6 +78443,7 @@ export {
|
|
|
78276
78443
|
Antenna,
|
|
78277
78444
|
AssemblyDevice,
|
|
78278
78445
|
AssemblyScreen,
|
|
78446
|
+
AssemblySubassembly,
|
|
78279
78447
|
AutoroutingPhase,
|
|
78280
78448
|
Battery,
|
|
78281
78449
|
Board,
|
|
@@ -78323,7 +78491,7 @@ export {
|
|
|
78323
78491
|
MountedBoard,
|
|
78324
78492
|
Net,
|
|
78325
78493
|
NetLabel,
|
|
78326
|
-
|
|
78494
|
+
NormalComponent,
|
|
78327
78495
|
OpAmp,
|
|
78328
78496
|
Panel,
|
|
78329
78497
|
PcbNoteDimension,
|