@tscircuit/core 0.0.1880 → 0.0.1882
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 +3 -1
- package/dist/index.js +158 -72
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { z, ZodType } from 'zod';
|
|
|
11
11
|
import { symbols, SchSymbol, BaseSymbolName } from 'schematic-symbols';
|
|
12
12
|
import { CircuitJsonUtilObjects } from '@tscircuit/circuit-json-util';
|
|
13
13
|
import { Matrix } from 'transformation-matrix';
|
|
14
|
-
import { AutoroutingPipelineSolver, AssignableAutoroutingPipeline2, AssignableAutoroutingPipeline3, AutoroutingPipeline1_OriginalUnravel, AutoroutingPipelineSolver3_HgPortPointPathing, AutoroutingPipelineSolver4, AutoroutingPipelineSolver5, AutoroutingPipelineSolver8, AutoroutingPipelineSolver9_PreloadedTraceGraph, AutoroutingPipelineSolver11_Simplification, SimplifiedPcbTrace as SimplifiedPcbTrace$1, SimpleRouteJson as SimpleRouteJson$1 } from '@tscircuit/capacity-autorouter';
|
|
14
|
+
import { AutoroutingPipelineSolver, AssignableAutoroutingPipeline2, AssignableAutoroutingPipeline3, AutoroutingPipeline1_OriginalUnravel, AutoroutingPipelineSolver3_HgPortPointPathing, AutoroutingPipelineSolver4, AutoroutingPipelineSolver5, AutoroutingPipelineSolver8, AutoroutingPipelineSolver9_PreloadedTraceGraph, AutoroutingPipelineSolver9_Networked, AutoroutingPipelineSolver11_Simplification, SimplifiedPcbTrace as SimplifiedPcbTrace$1, SimpleRouteJson as SimpleRouteJson$1 } from '@tscircuit/capacity-autorouter';
|
|
15
15
|
import { CopperPourPipelineSolver } from '@tscircuit/copper-pour-solver';
|
|
16
16
|
import { CreateFdmEnclosureSolver, EnclosureApertureInput } from '@tscircuit/create-fdm-enclosure';
|
|
17
17
|
import { FanoutSolver } from '@tscircuit/fanout-solver';
|
|
@@ -37,6 +37,7 @@ declare const SOLVERS: {
|
|
|
37
37
|
AutoroutingPipelineSolver7_MultiGraph: typeof AutoroutingPipelineSolver;
|
|
38
38
|
AutoroutingPipelineSolver8: typeof AutoroutingPipelineSolver8;
|
|
39
39
|
AutoroutingPipelineSolver9_PreloadedTraceGraph: typeof AutoroutingPipelineSolver9_PreloadedTraceGraph;
|
|
40
|
+
AutoroutingPipelineSolver9_Networked: typeof AutoroutingPipelineSolver9_Networked;
|
|
40
41
|
AutoroutingPipelineSolver11_Simplification: typeof AutoroutingPipelineSolver11_Simplification;
|
|
41
42
|
CopperPourPipelineSolver: typeof CopperPourPipelineSolver;
|
|
42
43
|
CreateFdmEnclosureSolver: typeof CreateFdmEnclosureSolver;
|
|
@@ -15511,6 +15512,7 @@ declare class Capacitor extends NormalComponent<typeof capacitorProps, Polarized
|
|
|
15511
15512
|
getFootprinterString(): string | null;
|
|
15512
15513
|
doInitialCreateNetsFromProps(): void;
|
|
15513
15514
|
doInitialCreateTracesFromProps(): void;
|
|
15515
|
+
doInitialPcbComponentSizeCalculation(): void;
|
|
15514
15516
|
doInitialSourceRender(): void;
|
|
15515
15517
|
}
|
|
15516
15518
|
|
package/dist/index.js
CHANGED
|
@@ -16586,7 +16586,7 @@ import {
|
|
|
16586
16586
|
} from "@tscircuit/checks";
|
|
16587
16587
|
import { getBoundsFromPoints as getBoundsFromPoints10 } from "@tscircuit/math-utils";
|
|
16588
16588
|
import { boardProps } from "@tscircuit/props";
|
|
16589
|
-
import { compose as
|
|
16589
|
+
import { compose as compose13, translate as translate13 } from "transformation-matrix";
|
|
16590
16590
|
|
|
16591
16591
|
// lib/utils/autorouting/getAncestorSubcircuitIds.ts
|
|
16592
16592
|
var getDescendantSubcircuitIds = (db, root_subcircuit_id) => {
|
|
@@ -16698,6 +16698,76 @@ import { capacitorProps } from "@tscircuit/props";
|
|
|
16698
16698
|
import { formatSiUnit } from "format-si-unit";
|
|
16699
16699
|
import { symbols as symbols3 } from "schematic-symbols";
|
|
16700
16700
|
|
|
16701
|
+
// lib/components/normal-components/Capacitor_addPolarityFabricationSymbols.ts
|
|
16702
|
+
import { applyToPoint as applyToPoint25, compose as compose6, rotate as rotate3, translate as translate4 } from "transformation-matrix";
|
|
16703
|
+
var generatedPaths = /* @__PURE__ */ new WeakMap();
|
|
16704
|
+
var getPolarity = (port) => {
|
|
16705
|
+
const hints = [port.name, ...port.port_hints ?? []].map(
|
|
16706
|
+
(hint) => hint.toLowerCase().replace(/[^a-z0-9+-]/g, "")
|
|
16707
|
+
);
|
|
16708
|
+
const positive = hints.some(
|
|
16709
|
+
(hint) => ["a", "anode", "pos", "positive", "+"].includes(hint)
|
|
16710
|
+
);
|
|
16711
|
+
const negative = hints.some(
|
|
16712
|
+
(hint) => ["k", "cathode", "neg", "negative", "-"].includes(hint)
|
|
16713
|
+
);
|
|
16714
|
+
if (positive === negative) return null;
|
|
16715
|
+
return positive ? "positive" : "negative";
|
|
16716
|
+
};
|
|
16717
|
+
var Capacitor_addPolarityFabricationSymbols = (capacitor) => {
|
|
16718
|
+
const root = capacitor.root;
|
|
16719
|
+
if (!root) return;
|
|
16720
|
+
const { db } = root;
|
|
16721
|
+
for (const path of generatedPaths.get(capacitor) ?? []) {
|
|
16722
|
+
db.pcb_fabrication_note_path.delete(path.pcb_fabrication_note_path_id);
|
|
16723
|
+
}
|
|
16724
|
+
generatedPaths.delete(capacitor);
|
|
16725
|
+
if (root.pcbDisabled || !capacitor.props.polarized || !capacitor.pcb_component_id)
|
|
16726
|
+
return;
|
|
16727
|
+
const pcb = db.pcb_component.get(capacitor.pcb_component_id);
|
|
16728
|
+
if (!pcb || pcb.layer !== "top" && pcb.layer !== "bottom") return;
|
|
16729
|
+
const ports = db.source_port.list({
|
|
16730
|
+
source_component_id: capacitor.source_component_id
|
|
16731
|
+
});
|
|
16732
|
+
const positives = ports.filter((port) => getPolarity(port) === "positive");
|
|
16733
|
+
const negatives = ports.filter((port) => getPolarity(port) === "negative");
|
|
16734
|
+
if (positives.length !== 1 || negatives.length !== 1) return;
|
|
16735
|
+
const positive = db.pcb_port.getWhere({
|
|
16736
|
+
source_port_id: positives[0].source_port_id
|
|
16737
|
+
});
|
|
16738
|
+
const negative = db.pcb_port.getWhere({
|
|
16739
|
+
source_port_id: negatives[0].source_port_id
|
|
16740
|
+
});
|
|
16741
|
+
if (!positive || !negative) return;
|
|
16742
|
+
const distance22 = Math.hypot(negative.x - positive.x, negative.y - positive.y);
|
|
16743
|
+
if (distance22 < 1e-6) return;
|
|
16744
|
+
const frame = compose6(
|
|
16745
|
+
translate4((positive.x + negative.x) / 2, (positive.y + negative.y) / 2),
|
|
16746
|
+
rotate3(Math.atan2(negative.y - positive.y, negative.x - positive.x))
|
|
16747
|
+
);
|
|
16748
|
+
const point6 = (x, y) => applyToPoint25(frame, { x, y });
|
|
16749
|
+
const offset = distance22 / 4;
|
|
16750
|
+
const halfSize = Math.min(distance22 * 0.12, 0.3);
|
|
16751
|
+
const routes = [
|
|
16752
|
+
[point6(-offset - halfSize, 0), point6(-offset + halfSize, 0)],
|
|
16753
|
+
[point6(-offset, -halfSize), point6(-offset, halfSize)],
|
|
16754
|
+
[point6(offset - halfSize, 0), point6(offset + halfSize, 0)]
|
|
16755
|
+
];
|
|
16756
|
+
const paths = [];
|
|
16757
|
+
generatedPaths.set(capacitor, paths);
|
|
16758
|
+
for (const route of routes) {
|
|
16759
|
+
paths.push(
|
|
16760
|
+
db.pcb_fabrication_note_path.insert({
|
|
16761
|
+
pcb_component_id: pcb.pcb_component_id,
|
|
16762
|
+
subcircuit_id: capacitor.getSubcircuit()?.subcircuit_id ?? void 0,
|
|
16763
|
+
layer: pcb.layer,
|
|
16764
|
+
route,
|
|
16765
|
+
stroke_width: Math.min(0.08, halfSize * 0.4)
|
|
16766
|
+
})
|
|
16767
|
+
);
|
|
16768
|
+
}
|
|
16769
|
+
};
|
|
16770
|
+
|
|
16701
16771
|
// lib/components/normal-components/Capacitor_getAutomaticMaxDecouplingTraceLength.ts
|
|
16702
16772
|
var DEFAULT_MAX_DECOUPLING_TRACE_LENGTH_MM = 1;
|
|
16703
16773
|
function getCapacitorPorts(capacitor) {
|
|
@@ -16800,6 +16870,10 @@ var Capacitor = class extends NormalComponent3 {
|
|
|
16800
16870
|
}
|
|
16801
16871
|
this._createTracesFromConnectionsProp();
|
|
16802
16872
|
}
|
|
16873
|
+
doInitialPcbComponentSizeCalculation() {
|
|
16874
|
+
super.doInitialPcbComponentSizeCalculation();
|
|
16875
|
+
Capacitor_addPolarityFabricationSymbols(this);
|
|
16876
|
+
}
|
|
16803
16877
|
doInitialSourceRender() {
|
|
16804
16878
|
const { db } = this.root;
|
|
16805
16879
|
const { _parsedProps: props } = this;
|
|
@@ -16821,7 +16895,7 @@ var Capacitor = class extends NormalComponent3 {
|
|
|
16821
16895
|
|
|
16822
16896
|
// lib/utils/extractPcbPrimitivesFromCircuitJson.ts
|
|
16823
16897
|
import { transformPCBElements } from "@tscircuit/circuit-json-util";
|
|
16824
|
-
import { compose as
|
|
16898
|
+
import { compose as compose7, inverse, rotate as rotate4, translate as translate5 } from "transformation-matrix";
|
|
16825
16899
|
var extractPcbPrimitivesFromCircuitJson = ({
|
|
16826
16900
|
pcbComponent,
|
|
16827
16901
|
db,
|
|
@@ -16830,9 +16904,9 @@ var extractPcbPrimitivesFromCircuitJson = ({
|
|
|
16830
16904
|
const componentCenter = pcbComponent.center || { x: 0, y: 0 };
|
|
16831
16905
|
const componentRotation = pcbComponent.rotation || 0;
|
|
16832
16906
|
const absoluteToComponentRelativeTransform = inverse(
|
|
16833
|
-
|
|
16834
|
-
|
|
16835
|
-
|
|
16907
|
+
compose7(
|
|
16908
|
+
translate5(componentCenter.x, componentCenter.y),
|
|
16909
|
+
rotate4(componentRotation * Math.PI / 180)
|
|
16836
16910
|
)
|
|
16837
16911
|
);
|
|
16838
16912
|
const relativeElements = db.toArray().filter(
|
|
@@ -39068,7 +39142,9 @@ function getPresetAutoroutingConfig(autorouterConfig, platformConfig) {
|
|
|
39068
39142
|
}
|
|
39069
39143
|
|
|
39070
39144
|
// lib/utils/autorouting/CapacityMeshAutorouter.ts
|
|
39071
|
-
import
|
|
39145
|
+
import {
|
|
39146
|
+
AutoroutingPipelineSolver9_Networked as AutoroutingPipelineSolver9_Networked2
|
|
39147
|
+
} from "@tscircuit/capacity-autorouter";
|
|
39072
39148
|
|
|
39073
39149
|
// lib/solvers.ts
|
|
39074
39150
|
import {
|
|
@@ -39082,6 +39158,7 @@ import {
|
|
|
39082
39158
|
AutoroutingPipelineSolver7_MultiGraph,
|
|
39083
39159
|
AutoroutingPipelineSolver8,
|
|
39084
39160
|
AutoroutingPipelineSolver9_PreloadedTraceGraph,
|
|
39161
|
+
AutoroutingPipelineSolver9_Networked,
|
|
39085
39162
|
AutoroutingPipelineSolver11_Simplification
|
|
39086
39163
|
} from "@tscircuit/capacity-autorouter";
|
|
39087
39164
|
import { CopperPourPipelineSolver } from "@tscircuit/copper-pour-solver";
|
|
@@ -39103,7 +39180,7 @@ import {
|
|
|
39103
39180
|
midpoint,
|
|
39104
39181
|
pointToSegmentClosestPoint as pointToSegmentClosestPoint2
|
|
39105
39182
|
} from "@tscircuit/math-utils";
|
|
39106
|
-
import { applyToPoint as
|
|
39183
|
+
import { applyToPoint as applyToPoint27, compose as compose9, scale as scale2, translate as translate7 } from "transformation-matrix";
|
|
39107
39184
|
|
|
39108
39185
|
// node_modules/@tscircuit/implicit-copper-pour-solver/lib/geometry.ts
|
|
39109
39186
|
import {
|
|
@@ -39119,10 +39196,10 @@ import {
|
|
|
39119
39196
|
segmentToSegmentMinDistance
|
|
39120
39197
|
} from "@tscircuit/math-utils";
|
|
39121
39198
|
import {
|
|
39122
|
-
applyToPoint as
|
|
39123
|
-
compose as
|
|
39199
|
+
applyToPoint as applyToPoint26,
|
|
39200
|
+
compose as compose8,
|
|
39124
39201
|
rotateDEG,
|
|
39125
|
-
translate as
|
|
39202
|
+
translate as translate6
|
|
39126
39203
|
} from "transformation-matrix";
|
|
39127
39204
|
var rectTransforms = /* @__PURE__ */ new WeakMap();
|
|
39128
39205
|
var getRectTransforms = (primitive) => {
|
|
@@ -39131,13 +39208,13 @@ var getRectTransforms = (primitive) => {
|
|
|
39131
39208
|
const transforms = {
|
|
39132
39209
|
// compose applies the rightmost operation first: move the world point to
|
|
39133
39210
|
// the rectangle origin, then undo its counter-clockwise rotation.
|
|
39134
|
-
toLocal:
|
|
39211
|
+
toLocal: compose8(
|
|
39135
39212
|
rotateDEG(-primitive.rotation),
|
|
39136
|
-
|
|
39213
|
+
translate6(-primitive.x, -primitive.y)
|
|
39137
39214
|
),
|
|
39138
39215
|
// Rotate a rectangle-local point before translating it into board space.
|
|
39139
|
-
toWorld:
|
|
39140
|
-
|
|
39216
|
+
toWorld: compose8(
|
|
39217
|
+
translate6(primitive.x, primitive.y),
|
|
39141
39218
|
rotateDEG(primitive.rotation)
|
|
39142
39219
|
)
|
|
39143
39220
|
};
|
|
@@ -39173,7 +39250,7 @@ var distanceToPrimitive = (primitive, px, py) => {
|
|
|
39173
39250
|
return distanceToPolygon(point6, primitive.points);
|
|
39174
39251
|
}
|
|
39175
39252
|
const { toLocal } = getRectTransforms(primitive);
|
|
39176
|
-
return pointToBoxDistance(
|
|
39253
|
+
return pointToBoxDistance(applyToPoint26(toLocal, point6), {
|
|
39177
39254
|
center: { x: 0, y: 0 },
|
|
39178
39255
|
width: primitive.halfWidth * 2,
|
|
39179
39256
|
height: primitive.halfHeight * 2
|
|
@@ -39217,8 +39294,8 @@ var getClosestPointOnPrimitive = (primitive, point6) => {
|
|
|
39217
39294
|
return closestPoint;
|
|
39218
39295
|
}
|
|
39219
39296
|
const { toLocal, toWorld } = getRectTransforms(primitive);
|
|
39220
|
-
const localPoint =
|
|
39221
|
-
return
|
|
39297
|
+
const localPoint = applyToPoint26(toLocal, point6);
|
|
39298
|
+
return applyToPoint26(toWorld, {
|
|
39222
39299
|
x: clamp(localPoint.x, -primitive.halfWidth, primitive.halfWidth),
|
|
39223
39300
|
y: clamp(localPoint.y, -primitive.halfHeight, primitive.halfHeight)
|
|
39224
39301
|
});
|
|
@@ -39809,8 +39886,8 @@ var buildPowerPourPolygons = (problem) => {
|
|
|
39809
39886
|
1,
|
|
39810
39887
|
Math.round(problem.minRegionArea / problem.gridPitch ** 2)
|
|
39811
39888
|
);
|
|
39812
|
-
const gridVertexToWorld =
|
|
39813
|
-
|
|
39889
|
+
const gridVertexToWorld = compose9(
|
|
39890
|
+
translate7(problem.bounds.minX, problem.bounds.minY),
|
|
39814
39891
|
scale2(problem.gridPitch)
|
|
39815
39892
|
);
|
|
39816
39893
|
for (const labeledLayer of problem.labeledLayers) {
|
|
@@ -39829,7 +39906,7 @@ var buildPowerPourPolygons = (problem) => {
|
|
|
39829
39906
|
}
|
|
39830
39907
|
const loop = loops[0];
|
|
39831
39908
|
const points = loop.map(([i, j]) => {
|
|
39832
|
-
const point6 =
|
|
39909
|
+
const point6 = applyToPoint27(gridVertexToWorld, { x: i, y: j });
|
|
39833
39910
|
return {
|
|
39834
39911
|
x: clamp2(point6.x, problem.bounds.minX, problem.bounds.maxX),
|
|
39835
39912
|
y: clamp2(point6.y, problem.bounds.minY, problem.bounds.maxY)
|
|
@@ -39865,9 +39942,9 @@ import {
|
|
|
39865
39942
|
} from "circuit-json-to-connectivity-map";
|
|
39866
39943
|
import {
|
|
39867
39944
|
applyToPoints,
|
|
39868
|
-
compose as
|
|
39945
|
+
compose as compose10,
|
|
39869
39946
|
rotateDEG as rotateDEG2,
|
|
39870
|
-
translate as
|
|
39947
|
+
translate as translate8
|
|
39871
39948
|
} from "transformation-matrix";
|
|
39872
39949
|
var DEFAULT_GRID_PITCH = 0.25;
|
|
39873
39950
|
var DEFAULT_TRACE_CLEARANCE = 0.2;
|
|
@@ -39895,8 +39972,8 @@ var addPillPrimitive = (primitives, params) => {
|
|
|
39895
39972
|
const radius = Math.min(width, height) / 2;
|
|
39896
39973
|
const axisLength = Math.max(width, height) - radius * 2;
|
|
39897
39974
|
const halfAxis = axisLength / 2;
|
|
39898
|
-
const axisToWorld =
|
|
39899
|
-
|
|
39975
|
+
const axisToWorld = compose10(
|
|
39976
|
+
translate8(x, y),
|
|
39900
39977
|
rotateDEG2(rotation4 + (height > width ? 90 : 0))
|
|
39901
39978
|
);
|
|
39902
39979
|
const [start, end] = applyToPoints(axisToWorld, [
|
|
@@ -41429,6 +41506,7 @@ var SOLVERS = {
|
|
|
41429
41506
|
AutoroutingPipelineSolver7_MultiGraph,
|
|
41430
41507
|
AutoroutingPipelineSolver8,
|
|
41431
41508
|
AutoroutingPipelineSolver9_PreloadedTraceGraph,
|
|
41509
|
+
AutoroutingPipelineSolver9_Networked,
|
|
41432
41510
|
AutoroutingPipelineSolver11_Simplification,
|
|
41433
41511
|
CopperPourPipelineSolver,
|
|
41434
41512
|
CreateFdmEnclosureSolver,
|
|
@@ -41589,8 +41667,11 @@ var getAutorouterSolverName = ({
|
|
|
41589
41667
|
useAutoJumperSolver = false,
|
|
41590
41668
|
autorouterVersion: autorouterVersion2,
|
|
41591
41669
|
useLaserPrefabSolver = false,
|
|
41592
|
-
useTraceSimplificationSolver = false
|
|
41670
|
+
useTraceSimplificationSolver = false,
|
|
41671
|
+
platformConfig,
|
|
41672
|
+
effort
|
|
41593
41673
|
}) => {
|
|
41674
|
+
const pipeline9SolverName = platformConfig?.useCloudAutorouter && (effort === void 0 || effort === 1) ? "AutoroutingPipelineSolver9_Networked" : "AutoroutingPipelineSolver9_PreloadedTraceGraph";
|
|
41594
41675
|
if (useTraceSimplificationSolver) {
|
|
41595
41676
|
return "AutoroutingPipelineSolver11_Simplification";
|
|
41596
41677
|
}
|
|
@@ -41610,12 +41691,12 @@ var getAutorouterSolverName = ({
|
|
|
41610
41691
|
return "AutoroutingPipelineSolver7_MultiGraph";
|
|
41611
41692
|
}
|
|
41612
41693
|
if (autorouterVersion2 === "beta_pipeline9" || autorouterVersion2 === "latest") {
|
|
41613
|
-
return
|
|
41694
|
+
return pipeline9SolverName;
|
|
41614
41695
|
}
|
|
41615
41696
|
if (useLaserPrefabSolver) return "AutoroutingPipelineSolver8";
|
|
41616
41697
|
if (useAutoJumperSolver) return "AssignableAutoroutingPipeline3";
|
|
41617
41698
|
if (useAssignableSolver) return "AssignableAutoroutingPipeline2";
|
|
41618
|
-
return
|
|
41699
|
+
return pipeline9SolverName;
|
|
41619
41700
|
};
|
|
41620
41701
|
function getCapacityAutorouterCacheProvider(platformConfig) {
|
|
41621
41702
|
if (!platformConfig?.localCacheEngine) return null;
|
|
@@ -41653,16 +41734,21 @@ var TscircuitAutorouter = class {
|
|
|
41653
41734
|
useAutoJumperSolver,
|
|
41654
41735
|
autorouterVersion: autorouterVersion2,
|
|
41655
41736
|
useLaserPrefabSolver,
|
|
41656
|
-
useTraceSimplificationSolver
|
|
41737
|
+
useTraceSimplificationSolver,
|
|
41738
|
+
platformConfig,
|
|
41739
|
+
effort
|
|
41657
41740
|
});
|
|
41658
|
-
const SolverClass = SOLVERS[solverName];
|
|
41659
41741
|
const solverCacheProvider = getCapacityAutorouterCacheProvider(platformConfig);
|
|
41660
|
-
|
|
41742
|
+
const solverOptions = {
|
|
41661
41743
|
capacityDepth,
|
|
41662
41744
|
targetMinCapacity,
|
|
41663
41745
|
cacheProvider: solverCacheProvider,
|
|
41664
41746
|
effort
|
|
41665
|
-
}
|
|
41747
|
+
};
|
|
41748
|
+
this.solver = solverName === "AutoroutingPipelineSolver9_Networked" ? new AutoroutingPipelineSolver9_Networked2(input, {
|
|
41749
|
+
...solverOptions,
|
|
41750
|
+
effort: 1
|
|
41751
|
+
}) : new SOLVERS[solverName](input, solverOptions);
|
|
41666
41752
|
onSolverStarted?.({
|
|
41667
41753
|
solverName,
|
|
41668
41754
|
solverParams: {
|
|
@@ -42009,7 +42095,7 @@ var applyEditEventsToManualEditsFile = ({
|
|
|
42009
42095
|
|
|
42010
42096
|
// lib/utils/edit-events/apply-edit-events-to-circuit-json.ts
|
|
42011
42097
|
import { transformPCBElement } from "@tscircuit/circuit-json-util";
|
|
42012
|
-
import { translate as
|
|
42098
|
+
import { translate as translate9 } from "transformation-matrix";
|
|
42013
42099
|
|
|
42014
42100
|
// lib/utils/edit-events/apply-trace-hint-edit-event.ts
|
|
42015
42101
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
@@ -42054,7 +42140,7 @@ var applyEditEvents = ({
|
|
|
42054
42140
|
);
|
|
42055
42141
|
const needsMovement = !component || component.center.x !== editEvent.new_center.x || component.center.y !== editEvent.new_center.y;
|
|
42056
42142
|
if (needsMovement && editEvent.original_center) {
|
|
42057
|
-
const mat =
|
|
42143
|
+
const mat = translate9(
|
|
42058
42144
|
editEvent.new_center.x - editEvent.original_center.x,
|
|
42059
42145
|
editEvent.new_center.y - editEvent.original_center.y
|
|
42060
42146
|
);
|
|
@@ -43465,7 +43551,7 @@ import "zod";
|
|
|
43465
43551
|
|
|
43466
43552
|
// lib/components/primitive-components/TraceHint.ts
|
|
43467
43553
|
import { traceHintProps } from "@tscircuit/props";
|
|
43468
|
-
import { applyToPoint as
|
|
43554
|
+
import { applyToPoint as applyToPoint28 } from "transformation-matrix";
|
|
43469
43555
|
var TraceHint = class extends PrimitiveComponent2 {
|
|
43470
43556
|
matchedPort = null;
|
|
43471
43557
|
get config() {
|
|
@@ -43505,7 +43591,7 @@ var TraceHint = class extends PrimitiveComponent2 {
|
|
|
43505
43591
|
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
43506
43592
|
return offsets.map(
|
|
43507
43593
|
(offset) => ({
|
|
43508
|
-
...
|
|
43594
|
+
...applyToPoint28(globalTransform, offset),
|
|
43509
43595
|
via: offset.via,
|
|
43510
43596
|
to_layer: offset.to_layer,
|
|
43511
43597
|
trace_width: offset.trace_width
|
|
@@ -45017,7 +45103,7 @@ import {
|
|
|
45017
45103
|
transformPCBElements as transformPCBElements2
|
|
45018
45104
|
} from "@tscircuit/circuit-json-util";
|
|
45019
45105
|
import { normalizeDegrees as normalizeDegrees5 } from "@tscircuit/math-utils";
|
|
45020
|
-
import { compose as
|
|
45106
|
+
import { compose as compose11, rotate as rotate5, translate as translate10 } from "transformation-matrix";
|
|
45021
45107
|
var updateCadRotation = ({
|
|
45022
45108
|
db,
|
|
45023
45109
|
pcbComponentId,
|
|
@@ -45069,11 +45155,11 @@ var applyPackOutput = (group, packOutput, clusterMap, initialPackOutput) => {
|
|
|
45069
45155
|
const member = db.pcb_component.get(memberId);
|
|
45070
45156
|
if (!member) continue;
|
|
45071
45157
|
const originalCenter2 = member.center;
|
|
45072
|
-
const transformMatrix2 =
|
|
45158
|
+
const transformMatrix2 = compose11(
|
|
45073
45159
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
45074
|
-
|
|
45075
|
-
|
|
45076
|
-
|
|
45160
|
+
translate10(center.x + rotatedRel.x, center.y + rotatedRel.y),
|
|
45161
|
+
rotate5(angleRad),
|
|
45162
|
+
translate10(-originalCenter2.x, -originalCenter2.y)
|
|
45077
45163
|
);
|
|
45078
45164
|
const related = db.toArray().filter(
|
|
45079
45165
|
(elm) => "pcb_component_id" in elm && elm.pcb_component_id === memberId
|
|
@@ -45103,11 +45189,11 @@ var applyPackOutput = (group, packOutput, clusterMap, initialPackOutput) => {
|
|
|
45103
45189
|
}
|
|
45104
45190
|
const originalCenter2 = pcbComponent.center;
|
|
45105
45191
|
const rotationDegrees2 = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
|
|
45106
|
-
const transformMatrix2 =
|
|
45192
|
+
const transformMatrix2 = compose11(
|
|
45107
45193
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
45108
|
-
|
|
45109
|
-
|
|
45110
|
-
|
|
45194
|
+
translate10(center.x, center.y),
|
|
45195
|
+
rotate5(rotationDegrees2 * Math.PI / 180),
|
|
45196
|
+
translate10(-originalCenter2.x, -originalCenter2.y)
|
|
45111
45197
|
);
|
|
45112
45198
|
const related = db.toArray().filter(
|
|
45113
45199
|
(elm) => "pcb_component_id" in elm && elm.pcb_component_id === componentId
|
|
@@ -45128,11 +45214,11 @@ var applyPackOutput = (group, packOutput, clusterMap, initialPackOutput) => {
|
|
|
45128
45214
|
);
|
|
45129
45215
|
const originalCenter = initialPackedComponent?.center ?? pcbGroup.center;
|
|
45130
45216
|
const rotationDegrees = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
|
|
45131
|
-
const transformMatrix =
|
|
45217
|
+
const transformMatrix = compose11(
|
|
45132
45218
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
45133
|
-
|
|
45134
|
-
|
|
45135
|
-
|
|
45219
|
+
translate10(center.x, center.y),
|
|
45220
|
+
rotate5(rotationDegrees * Math.PI / 180),
|
|
45221
|
+
translate10(-originalCenter.x, -originalCenter.y)
|
|
45136
45222
|
);
|
|
45137
45223
|
const relatedElements = db.toArray().filter((elm) => {
|
|
45138
45224
|
if ("source_group_id" in elm && elm.source_group_id) {
|
|
@@ -47480,9 +47566,9 @@ import Debug13 from "debug";
|
|
|
47480
47566
|
// lib/components/primitive-components/NetLabel.ts
|
|
47481
47567
|
import { netLabelProps } from "@tscircuit/props";
|
|
47482
47568
|
import {
|
|
47483
|
-
applyToPoint as
|
|
47569
|
+
applyToPoint as applyToPoint29,
|
|
47484
47570
|
identity as identity6,
|
|
47485
|
-
translate as
|
|
47571
|
+
translate as translate11
|
|
47486
47572
|
} from "transformation-matrix";
|
|
47487
47573
|
import { calculateElbow as calculateElbow2 } from "calculate-elbow";
|
|
47488
47574
|
var NetLabel = class extends PrimitiveComponent2 {
|
|
@@ -47545,11 +47631,11 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
47545
47631
|
const connectedPorts = this._getConnectedPorts();
|
|
47546
47632
|
if (connectedPorts.length > 0) {
|
|
47547
47633
|
const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
|
|
47548
|
-
const parentCenter =
|
|
47634
|
+
const parentCenter = applyToPoint29(
|
|
47549
47635
|
this.parent?.computeSchematicGlobalTransform?.() ?? identity6(),
|
|
47550
47636
|
{ x: 0, y: 0 }
|
|
47551
47637
|
);
|
|
47552
|
-
return
|
|
47638
|
+
return translate11(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
|
|
47553
47639
|
}
|
|
47554
47640
|
}
|
|
47555
47641
|
return super.computeSchematicPropsTransform();
|
|
@@ -51542,7 +51628,7 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
51542
51628
|
var package_default = {
|
|
51543
51629
|
name: "@tscircuit/core",
|
|
51544
51630
|
type: "module",
|
|
51545
|
-
version: "0.0.
|
|
51631
|
+
version: "0.0.1881",
|
|
51546
51632
|
types: "dist/index.d.ts",
|
|
51547
51633
|
main: "dist/index.js",
|
|
51548
51634
|
module: "dist/index.js",
|
|
@@ -51595,7 +51681,7 @@ var package_default = {
|
|
|
51595
51681
|
"@tscircuit/math-utils": "^0.0.36",
|
|
51596
51682
|
"@tscircuit/miniflex": "^0.0.4",
|
|
51597
51683
|
"@tscircuit/ngspice-spice-engine": "^0.0.20",
|
|
51598
|
-
"@tscircuit/props": "^0.0.
|
|
51684
|
+
"@tscircuit/props": "^0.0.647",
|
|
51599
51685
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
51600
51686
|
"@tscircuit/schematic-trace-solver": "^0.0.189",
|
|
51601
51687
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
@@ -51674,7 +51760,7 @@ var package_default = {
|
|
|
51674
51760
|
},
|
|
51675
51761
|
overrides: {
|
|
51676
51762
|
"@tscircuit/circuit-json-util": "^0.0.113",
|
|
51677
|
-
"@tscircuit/props": "^0.0.
|
|
51763
|
+
"@tscircuit/props": "^0.0.647",
|
|
51678
51764
|
"circuit-json": "^0.0.484"
|
|
51679
51765
|
}
|
|
51680
51766
|
};
|
|
@@ -56854,11 +56940,11 @@ import {
|
|
|
56854
56940
|
Polygon as Polygon2,
|
|
56855
56941
|
Segment
|
|
56856
56942
|
} from "@flatten-js/core";
|
|
56857
|
-
import { compose as
|
|
56943
|
+
import { compose as compose12, rotate as rotate6, translate as translate12 } from "transformation-matrix";
|
|
56858
56944
|
var placePolygon = (polygon, center, degrees = 0) => {
|
|
56859
|
-
const { a, b, c, d, e, f } =
|
|
56860
|
-
|
|
56861
|
-
|
|
56945
|
+
const { a, b, c, d, e, f } = compose12(
|
|
56946
|
+
translate12(center.x, center.y),
|
|
56947
|
+
rotate6(degrees * Math.PI / 180)
|
|
56862
56948
|
);
|
|
56863
56949
|
return polygon.transform(new Matrix(a, b, c, d, e, f));
|
|
56864
56950
|
};
|
|
@@ -57539,9 +57625,9 @@ var Board = class extends Group5 {
|
|
|
57539
57625
|
_computePcbGlobalTransformBeforeLayout() {
|
|
57540
57626
|
if (this._panelPositionOffset) {
|
|
57541
57627
|
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 };
|
|
57542
|
-
return
|
|
57628
|
+
return compose13(
|
|
57543
57629
|
parentTransform,
|
|
57544
|
-
|
|
57630
|
+
translate13(this._panelPositionOffset.x, this._panelPositionOffset.y)
|
|
57545
57631
|
);
|
|
57546
57632
|
}
|
|
57547
57633
|
return super._computePcbGlobalTransformBeforeLayout();
|
|
@@ -58162,7 +58248,7 @@ import { distance as distance20 } from "circuit-json";
|
|
|
58162
58248
|
// lib/components/normal-components/Subpanel.ts
|
|
58163
58249
|
import { subpanelProps } from "@tscircuit/props";
|
|
58164
58250
|
import { distance as distance19 } from "circuit-json";
|
|
58165
|
-
import { compose as
|
|
58251
|
+
import { compose as compose14, identity as identity8, translate as translate14 } from "transformation-matrix";
|
|
58166
58252
|
|
|
58167
58253
|
// lib/utils/panels/generate-panel-tabs-and-mouse-bites.ts
|
|
58168
58254
|
import * as Flatten from "@flatten-js/core";
|
|
@@ -58674,9 +58760,9 @@ var Subpanel = class _Subpanel extends Group5 {
|
|
|
58674
58760
|
_computePcbGlobalTransformBeforeLayout() {
|
|
58675
58761
|
if (this._panelPositionOffset) {
|
|
58676
58762
|
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? identity8();
|
|
58677
|
-
return
|
|
58763
|
+
return compose14(
|
|
58678
58764
|
parentTransform,
|
|
58679
|
-
|
|
58765
|
+
translate14(this._panelPositionOffset.x, this._panelPositionOffset.y)
|
|
58680
58766
|
);
|
|
58681
58767
|
}
|
|
58682
58768
|
return super._computePcbGlobalTransformBeforeLayout();
|
|
@@ -60343,7 +60429,7 @@ var AutoroutingPhase = class extends PrimitiveComponent2 {
|
|
|
60343
60429
|
|
|
60344
60430
|
// lib/components/primitive-components/FabricationNoteDimension.ts
|
|
60345
60431
|
import { fabricationNoteDimensionProps } from "@tscircuit/props";
|
|
60346
|
-
import { applyToPoint as
|
|
60432
|
+
import { applyToPoint as applyToPoint30 } from "transformation-matrix";
|
|
60347
60433
|
var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
60348
60434
|
fabrication_note_dimension_id = null;
|
|
60349
60435
|
isPcbPrimitive = true;
|
|
@@ -60362,13 +60448,13 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
|
60362
60448
|
this.renderError(
|
|
60363
60449
|
`FabricationNoteDimension could not find selector "${input}"`
|
|
60364
60450
|
);
|
|
60365
|
-
return
|
|
60451
|
+
return applyToPoint30(transform, { x: 0, y: 0 });
|
|
60366
60452
|
}
|
|
60367
60453
|
return target._getGlobalPcbPositionBeforeLayout();
|
|
60368
60454
|
}
|
|
60369
60455
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
60370
60456
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
60371
|
-
return
|
|
60457
|
+
return applyToPoint30(transform, { x: numericX, y: numericY });
|
|
60372
60458
|
}
|
|
60373
60459
|
doInitialPcbPrimitiveRender() {
|
|
60374
60460
|
if (this.root?.pcbDisabled) return;
|
|
@@ -60463,7 +60549,7 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
|
60463
60549
|
|
|
60464
60550
|
// lib/components/primitive-components/PcbNoteDimension.ts
|
|
60465
60551
|
import { pcbNoteDimensionProps } from "@tscircuit/props";
|
|
60466
|
-
import { applyToPoint as
|
|
60552
|
+
import { applyToPoint as applyToPoint31 } from "transformation-matrix";
|
|
60467
60553
|
var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
60468
60554
|
pcb_note_dimension_id = null;
|
|
60469
60555
|
isPcbPrimitive = true;
|
|
@@ -60480,7 +60566,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
60480
60566
|
);
|
|
60481
60567
|
if (!target) {
|
|
60482
60568
|
this.renderError(`PcbNoteDimension could not find selector "${input}"`);
|
|
60483
|
-
return
|
|
60569
|
+
return applyToPoint31(transform, { x: 0, y: 0 });
|
|
60484
60570
|
}
|
|
60485
60571
|
const targetPcbComponentId = target.pcb_component_id;
|
|
60486
60572
|
const root = this.root;
|
|
@@ -60497,7 +60583,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
60497
60583
|
}
|
|
60498
60584
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
60499
60585
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
60500
|
-
return
|
|
60586
|
+
return applyToPoint31(transform, { x: numericX, y: numericY });
|
|
60501
60587
|
}
|
|
60502
60588
|
doInitialPcbPrimitiveRender() {
|
|
60503
60589
|
if (this.root?.pcbDisabled) return;
|
|
@@ -63225,7 +63311,7 @@ import {
|
|
|
63225
63311
|
getTransformedSvgPathRoutes,
|
|
63226
63312
|
loadImageSource
|
|
63227
63313
|
} from "@tscircuit/image-utils";
|
|
63228
|
-
import { applyToPoint as
|
|
63314
|
+
import { applyToPoint as applyToPoint32 } from "transformation-matrix";
|
|
63229
63315
|
var SilkscreenGraphic = class extends PrimitiveComponent2 {
|
|
63230
63316
|
pcb_silkscreen_graphic_id = null;
|
|
63231
63317
|
pcb_silkscreen_graphic_ids = [];
|
|
@@ -63327,7 +63413,7 @@ var SilkscreenGraphic = class extends PrimitiveComponent2 {
|
|
|
63327
63413
|
{ x: halfWidth, y: -halfHeight },
|
|
63328
63414
|
{ x: -halfWidth, y: -halfHeight }
|
|
63329
63415
|
]).map(
|
|
63330
|
-
(point6) =>
|
|
63416
|
+
(point6) => applyToPoint32(transform, point6)
|
|
63331
63417
|
)
|
|
63332
63418
|
},
|
|
63333
63419
|
inner_rings: []
|
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.1882",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@tscircuit/math-utils": "^0.0.36",
|
|
55
55
|
"@tscircuit/miniflex": "^0.0.4",
|
|
56
56
|
"@tscircuit/ngspice-spice-engine": "^0.0.20",
|
|
57
|
-
"@tscircuit/props": "^0.0.
|
|
57
|
+
"@tscircuit/props": "^0.0.647",
|
|
58
58
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
59
59
|
"@tscircuit/schematic-trace-solver": "^0.0.189",
|
|
60
60
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
},
|
|
134
134
|
"overrides": {
|
|
135
135
|
"@tscircuit/circuit-json-util": "^0.0.113",
|
|
136
|
-
"@tscircuit/props": "^0.0.
|
|
136
|
+
"@tscircuit/props": "^0.0.647",
|
|
137
137
|
"circuit-json": "^0.0.484"
|
|
138
138
|
}
|
|
139
139
|
}
|