@tscircuit/core 0.0.1060 → 0.0.1062
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +97 -55
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6659,7 +6659,6 @@ var SilkscreenRect = class extends PrimitiveComponent2 {
|
|
|
6659
6659
|
|
|
6660
6660
|
// lib/components/primitive-components/SilkscreenText.ts
|
|
6661
6661
|
import { silkscreenTextProps } from "@tscircuit/props";
|
|
6662
|
-
import { decomposeTSR as decomposeTSR4 } from "transformation-matrix";
|
|
6663
6662
|
|
|
6664
6663
|
// lib/utils/pcbSx/resolve-pcb-property.ts
|
|
6665
6664
|
function parseSegment(seg) {
|
|
@@ -6737,6 +6736,13 @@ function resolvePcbProperty({
|
|
|
6737
6736
|
}
|
|
6738
6737
|
|
|
6739
6738
|
// lib/components/primitive-components/SilkscreenText.ts
|
|
6739
|
+
import {
|
|
6740
|
+
applyToPoint as applyToPoint13,
|
|
6741
|
+
compose as compose3,
|
|
6742
|
+
decomposeTSR as decomposeTSR4,
|
|
6743
|
+
flipY as flipY2,
|
|
6744
|
+
identity as identity4
|
|
6745
|
+
} from "transformation-matrix";
|
|
6740
6746
|
var SilkscreenText = class extends PrimitiveComponent2 {
|
|
6741
6747
|
pcb_silkscreen_text_ids = [];
|
|
6742
6748
|
isPcbPrimitive = true;
|
|
@@ -6752,7 +6758,6 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
6752
6758
|
const { db } = this.root;
|
|
6753
6759
|
const { _parsedProps: props } = this;
|
|
6754
6760
|
const container = this.getPrimitiveContainer();
|
|
6755
|
-
const position = this._getGlobalPcbPositionBeforeLayout();
|
|
6756
6761
|
const { maybeFlipLayer, isFlipped } = this._getPcbPrimitiveFlippedHelpers();
|
|
6757
6762
|
const subcircuit = this.getSubcircuit();
|
|
6758
6763
|
let rotation4 = 0;
|
|
@@ -6775,7 +6780,36 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
6775
6780
|
pathFromAmpersand: "silkscreentext",
|
|
6776
6781
|
component: this
|
|
6777
6782
|
});
|
|
6783
|
+
const resolvedPcbSxPcbX = resolvePcbProperty({
|
|
6784
|
+
propertyName: "pcbX",
|
|
6785
|
+
resolvedPcbSx: this.getResolvedPcbSx(),
|
|
6786
|
+
pathFromAmpersand: "silkscreentext",
|
|
6787
|
+
component: this
|
|
6788
|
+
});
|
|
6789
|
+
const resolvedPcbSxPcbY = resolvePcbProperty({
|
|
6790
|
+
propertyName: "pcbY",
|
|
6791
|
+
resolvedPcbSx: this.getResolvedPcbSx(),
|
|
6792
|
+
pathFromAmpersand: "silkscreentext",
|
|
6793
|
+
component: this
|
|
6794
|
+
});
|
|
6778
6795
|
const fontSize = props.fontSize ?? resolvedPcbSxFontSize ?? this.getInheritedProperty("pcbStyle")?.silkscreenFontSize ?? this._footprinterFontSize ?? 1;
|
|
6796
|
+
const hasResolvedPcbSxPosition = resolvedPcbSxPcbX !== void 0 || resolvedPcbSxPcbY !== void 0;
|
|
6797
|
+
const position = hasResolvedPcbSxPosition && this._footprinterFontSize !== void 0 ? applyToPoint13(
|
|
6798
|
+
compose3(
|
|
6799
|
+
this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity4(),
|
|
6800
|
+
isFlipped ? flipY2() : identity4()
|
|
6801
|
+
),
|
|
6802
|
+
{
|
|
6803
|
+
x: this.resolvePcbCoordinate(
|
|
6804
|
+
resolvedPcbSxPcbX ?? props.pcbX ?? 0,
|
|
6805
|
+
"pcbX"
|
|
6806
|
+
),
|
|
6807
|
+
y: this.resolvePcbCoordinate(
|
|
6808
|
+
resolvedPcbSxPcbY ?? props.pcbY ?? 0,
|
|
6809
|
+
"pcbY"
|
|
6810
|
+
)
|
|
6811
|
+
}
|
|
6812
|
+
) : this._getGlobalPcbPositionBeforeLayout();
|
|
6779
6813
|
const uniformPadding = props.knockoutPadding ?? 0;
|
|
6780
6814
|
const hasKnockoutPadding = props.knockoutPadding !== void 0 || props.knockoutPaddingLeft !== void 0 || props.knockoutPaddingRight !== void 0 || props.knockoutPaddingTop !== void 0 || props.knockoutPaddingBottom !== void 0;
|
|
6781
6815
|
const knockoutPadding = hasKnockoutPadding ? {
|
|
@@ -6846,7 +6880,7 @@ import { smtPadProps } from "@tscircuit/props";
|
|
|
6846
6880
|
import {
|
|
6847
6881
|
distance as distance5
|
|
6848
6882
|
} from "circuit-json";
|
|
6849
|
-
import { applyToPoint as
|
|
6883
|
+
import { applyToPoint as applyToPoint14, decomposeTSR as decomposeTSR5 } from "transformation-matrix";
|
|
6850
6884
|
var SmtPad = class extends PrimitiveComponent2 {
|
|
6851
6885
|
pcb_smtpad_id = null;
|
|
6852
6886
|
matchedPort = null;
|
|
@@ -7066,7 +7100,7 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
7066
7100
|
});
|
|
7067
7101
|
} else if (props.shape === "polygon") {
|
|
7068
7102
|
const transformedPoints = props.points.map((point6) => {
|
|
7069
|
-
const transformed =
|
|
7103
|
+
const transformed = applyToPoint14(globalTransform, {
|
|
7070
7104
|
x: distance5.parse(point6.x),
|
|
7071
7105
|
y: distance5.parse(point6.y)
|
|
7072
7106
|
});
|
|
@@ -7775,7 +7809,7 @@ var SCHEMATIC_COMPONENT_OUTLINE_STROKE_WIDTH = 0.12;
|
|
|
7775
7809
|
|
|
7776
7810
|
// lib/components/primitive-components/Port/Port.ts
|
|
7777
7811
|
import "schematic-symbols";
|
|
7778
|
-
import { applyToPoint as
|
|
7812
|
+
import { applyToPoint as applyToPoint15, compose as compose4, translate as translate3 } from "transformation-matrix";
|
|
7779
7813
|
import { z as z7 } from "zod";
|
|
7780
7814
|
|
|
7781
7815
|
// lib/components/primitive-components/Port/areAllPcbPrimitivesOverlapping.ts
|
|
@@ -7995,11 +8029,11 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
7995
8029
|
);
|
|
7996
8030
|
}
|
|
7997
8031
|
}
|
|
7998
|
-
const transform =
|
|
8032
|
+
const transform = compose4(
|
|
7999
8033
|
parentNormalComponent.computeSchematicGlobalTransform(),
|
|
8000
8034
|
translate3(-symbol.center.x, -symbol.center.y)
|
|
8001
8035
|
);
|
|
8002
|
-
return
|
|
8036
|
+
return applyToPoint15(transform, schematicSymbolPortDef);
|
|
8003
8037
|
}
|
|
8004
8038
|
const parentBoxDim = parentNormalComponent?._getSchematicBoxDimensions();
|
|
8005
8039
|
if (parentBoxDim && this.props.pinNumber !== void 0) {
|
|
@@ -8011,7 +8045,7 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
8011
8045
|
`Couldn't find position for schematic_port for port ${this.getString()} inside of the schematic box`
|
|
8012
8046
|
);
|
|
8013
8047
|
}
|
|
8014
|
-
return
|
|
8048
|
+
return applyToPoint15(
|
|
8015
8049
|
parentNormalComponent.computeSchematicGlobalTransform(),
|
|
8016
8050
|
localPortPosition
|
|
8017
8051
|
);
|
|
@@ -8380,15 +8414,15 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
8380
8414
|
const { db } = this.root;
|
|
8381
8415
|
const schPort = db.schematic_port.get(this.schematic_port_id);
|
|
8382
8416
|
if (schPort) {
|
|
8383
|
-
const newCenter =
|
|
8417
|
+
const newCenter = applyToPoint15(transform, schPort.center);
|
|
8384
8418
|
db.schematic_port.update(this.schematic_port_id, {
|
|
8385
8419
|
center: newCenter
|
|
8386
8420
|
});
|
|
8387
8421
|
if (this.schematic_stem_line_id) {
|
|
8388
8422
|
const line = db.schematic_line.get(this.schematic_stem_line_id);
|
|
8389
8423
|
if (line) {
|
|
8390
|
-
const p1 =
|
|
8391
|
-
const p2 =
|
|
8424
|
+
const p1 = applyToPoint15(transform, { x: line.x1, y: line.y1 });
|
|
8425
|
+
const p2 = applyToPoint15(transform, { x: line.x2, y: line.y2 });
|
|
8392
8426
|
db.schematic_line.update(this.schematic_stem_line_id, {
|
|
8393
8427
|
x1: p1.x,
|
|
8394
8428
|
y1: p1.y,
|
|
@@ -12047,7 +12081,7 @@ import "zod";
|
|
|
12047
12081
|
|
|
12048
12082
|
// lib/components/primitive-components/TraceHint.ts
|
|
12049
12083
|
import { traceHintProps } from "@tscircuit/props";
|
|
12050
|
-
import { applyToPoint as
|
|
12084
|
+
import { applyToPoint as applyToPoint16 } from "transformation-matrix";
|
|
12051
12085
|
var TraceHint = class extends PrimitiveComponent2 {
|
|
12052
12086
|
matchedPort = null;
|
|
12053
12087
|
get config() {
|
|
@@ -12087,7 +12121,7 @@ var TraceHint = class extends PrimitiveComponent2 {
|
|
|
12087
12121
|
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
12088
12122
|
return offsets.map(
|
|
12089
12123
|
(offset) => ({
|
|
12090
|
-
...
|
|
12124
|
+
...applyToPoint16(globalTransform, offset),
|
|
12091
12125
|
via: offset.via,
|
|
12092
12126
|
to_layer: offset.to_layer,
|
|
12093
12127
|
trace_width: offset.trace_width
|
|
@@ -13112,7 +13146,7 @@ var applyComponentConstraintClusters = (group, packInput) => {
|
|
|
13112
13146
|
};
|
|
13113
13147
|
|
|
13114
13148
|
// lib/components/primitive-components/Group/Group_doInitialPcbLayoutPack/applyPackOutput.ts
|
|
13115
|
-
import { translate as translate5, rotate as rotate2, compose as
|
|
13149
|
+
import { translate as translate5, rotate as rotate2, compose as compose5 } from "transformation-matrix";
|
|
13116
13150
|
import {
|
|
13117
13151
|
transformPCBElements
|
|
13118
13152
|
} from "@tscircuit/circuit-json-util";
|
|
@@ -13167,7 +13201,7 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
|
|
|
13167
13201
|
const member = db.pcb_component.get(memberId);
|
|
13168
13202
|
if (!member) continue;
|
|
13169
13203
|
const originalCenter2 = member.center;
|
|
13170
|
-
const transformMatrix2 =
|
|
13204
|
+
const transformMatrix2 = compose5(
|
|
13171
13205
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
13172
13206
|
translate5(center.x + rotatedRel.x, center.y + rotatedRel.y),
|
|
13173
13207
|
rotate2(angleRad),
|
|
@@ -13201,7 +13235,7 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
|
|
|
13201
13235
|
}
|
|
13202
13236
|
const originalCenter2 = pcbComponent.center;
|
|
13203
13237
|
const rotationDegrees2 = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
|
|
13204
|
-
const transformMatrix2 =
|
|
13238
|
+
const transformMatrix2 = compose5(
|
|
13205
13239
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
13206
13240
|
translate5(center.x, center.y),
|
|
13207
13241
|
rotate2(rotationDegrees2 * Math.PI / 180),
|
|
@@ -13223,7 +13257,7 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
|
|
|
13223
13257
|
if (!pcbGroup) continue;
|
|
13224
13258
|
const originalCenter = pcbGroup.center;
|
|
13225
13259
|
const rotationDegrees = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
|
|
13226
|
-
const transformMatrix =
|
|
13260
|
+
const transformMatrix = compose5(
|
|
13227
13261
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
13228
13262
|
translate5(center.x, center.y),
|
|
13229
13263
|
rotate2(rotationDegrees * Math.PI / 180),
|
|
@@ -17035,7 +17069,7 @@ var Capacitor = class extends NormalComponent3 {
|
|
|
17035
17069
|
|
|
17036
17070
|
// lib/utils/extractPcbPrimitivesFromCircuitJson.ts
|
|
17037
17071
|
import { transformPCBElements as transformPCBElements2 } from "@tscircuit/circuit-json-util";
|
|
17038
|
-
import { compose as
|
|
17072
|
+
import { compose as compose6, inverse, rotate as rotate3, translate as translate6 } from "transformation-matrix";
|
|
17039
17073
|
var extractPcbPrimitivesFromCircuitJson = ({
|
|
17040
17074
|
pcbComponent,
|
|
17041
17075
|
db,
|
|
@@ -17044,7 +17078,7 @@ var extractPcbPrimitivesFromCircuitJson = ({
|
|
|
17044
17078
|
const componentCenter = pcbComponent.center || { x: 0, y: 0 };
|
|
17045
17079
|
const componentRotation = pcbComponent.rotation || 0;
|
|
17046
17080
|
const absoluteToComponentRelativeTransform = inverse(
|
|
17047
|
-
|
|
17081
|
+
compose6(
|
|
17048
17082
|
translate6(componentCenter.x, componentCenter.y),
|
|
17049
17083
|
rotate3(componentRotation * Math.PI / 180)
|
|
17050
17084
|
)
|
|
@@ -17993,7 +18027,7 @@ import {
|
|
|
17993
18027
|
checkPinMustBeConnected
|
|
17994
18028
|
} from "@tscircuit/checks";
|
|
17995
18029
|
import { getBoundsFromPoints as getBoundsFromPoints4 } from "@tscircuit/math-utils";
|
|
17996
|
-
import { compose as
|
|
18030
|
+
import { compose as compose7, translate as translate7 } from "transformation-matrix";
|
|
17997
18031
|
|
|
17998
18032
|
// lib/components/primitive-components/Group/Subcircuit_getSubcircuitPropHash.ts
|
|
17999
18033
|
var EXCLUDED_PROPS = /* @__PURE__ */ new Set([
|
|
@@ -18079,13 +18113,13 @@ function Subcircuit_getSubcircuitPropHash(subcircuit) {
|
|
|
18079
18113
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
18080
18114
|
import Debug14 from "debug";
|
|
18081
18115
|
import { isValidElement as isValidElement2 } from "react";
|
|
18082
|
-
import { identity as
|
|
18116
|
+
import { identity as identity5 } from "transformation-matrix";
|
|
18083
18117
|
|
|
18084
18118
|
// package.json
|
|
18085
18119
|
var package_default = {
|
|
18086
18120
|
name: "@tscircuit/core",
|
|
18087
18121
|
type: "module",
|
|
18088
|
-
version: "0.0.
|
|
18122
|
+
version: "0.0.1061",
|
|
18089
18123
|
types: "dist/index.d.ts",
|
|
18090
18124
|
main: "dist/index.js",
|
|
18091
18125
|
module: "dist/index.js",
|
|
@@ -18388,10 +18422,10 @@ var IsolatedCircuit = class {
|
|
|
18388
18422
|
throw new Error("project.preview is not yet implemented");
|
|
18389
18423
|
}
|
|
18390
18424
|
computeSchematicGlobalTransform() {
|
|
18391
|
-
return
|
|
18425
|
+
return identity5();
|
|
18392
18426
|
}
|
|
18393
18427
|
_computePcbGlobalTransformBeforeLayout() {
|
|
18394
|
-
return
|
|
18428
|
+
return identity5();
|
|
18395
18429
|
}
|
|
18396
18430
|
selectAll(selector) {
|
|
18397
18431
|
this._guessRootComponent();
|
|
@@ -18631,7 +18665,7 @@ var Board = class extends Group6 {
|
|
|
18631
18665
|
_computePcbGlobalTransformBeforeLayout() {
|
|
18632
18666
|
if (this._panelPositionOffset) {
|
|
18633
18667
|
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 };
|
|
18634
|
-
return
|
|
18668
|
+
return compose7(
|
|
18635
18669
|
parentTransform,
|
|
18636
18670
|
translate7(this._panelPositionOffset.x, this._panelPositionOffset.y)
|
|
18637
18671
|
);
|
|
@@ -20602,7 +20636,7 @@ var Constraint3 = class extends PrimitiveComponent2 {
|
|
|
20602
20636
|
|
|
20603
20637
|
// lib/components/primitive-components/FabricationNoteDimension.ts
|
|
20604
20638
|
import { fabricationNoteDimensionProps } from "@tscircuit/props";
|
|
20605
|
-
import { applyToPoint as
|
|
20639
|
+
import { applyToPoint as applyToPoint17 } from "transformation-matrix";
|
|
20606
20640
|
var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
20607
20641
|
fabrication_note_dimension_id = null;
|
|
20608
20642
|
isPcbPrimitive = true;
|
|
@@ -20621,13 +20655,13 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
|
20621
20655
|
this.renderError(
|
|
20622
20656
|
`FabricationNoteDimension could not find selector "${input}"`
|
|
20623
20657
|
);
|
|
20624
|
-
return
|
|
20658
|
+
return applyToPoint17(transform, { x: 0, y: 0 });
|
|
20625
20659
|
}
|
|
20626
20660
|
return target._getGlobalPcbPositionBeforeLayout();
|
|
20627
20661
|
}
|
|
20628
20662
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
20629
20663
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
20630
|
-
return
|
|
20664
|
+
return applyToPoint17(transform, { x: numericX, y: numericY });
|
|
20631
20665
|
}
|
|
20632
20666
|
doInitialPcbPrimitiveRender() {
|
|
20633
20667
|
if (this.root?.pcbDisabled) return;
|
|
@@ -20722,7 +20756,7 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
|
20722
20756
|
|
|
20723
20757
|
// lib/components/primitive-components/PcbNoteDimension.ts
|
|
20724
20758
|
import { pcbNoteDimensionProps } from "@tscircuit/props";
|
|
20725
|
-
import { applyToPoint as
|
|
20759
|
+
import { applyToPoint as applyToPoint18 } from "transformation-matrix";
|
|
20726
20760
|
var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
20727
20761
|
pcb_note_dimension_id = null;
|
|
20728
20762
|
isPcbPrimitive = true;
|
|
@@ -20739,7 +20773,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
20739
20773
|
);
|
|
20740
20774
|
if (!target) {
|
|
20741
20775
|
this.renderError(`PcbNoteDimension could not find selector "${input}"`);
|
|
20742
|
-
return
|
|
20776
|
+
return applyToPoint18(transform, { x: 0, y: 0 });
|
|
20743
20777
|
}
|
|
20744
20778
|
const targetPcbComponentId = target.pcb_component_id;
|
|
20745
20779
|
const root = this.root;
|
|
@@ -20756,7 +20790,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
20756
20790
|
}
|
|
20757
20791
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
20758
20792
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
20759
|
-
return
|
|
20793
|
+
return applyToPoint18(transform, { x: numericX, y: numericY });
|
|
20760
20794
|
}
|
|
20761
20795
|
doInitialPcbPrimitiveRender() {
|
|
20762
20796
|
if (this.root?.pcbDisabled) return;
|
|
@@ -20979,8 +21013,8 @@ var BreakoutPoint = class extends PrimitiveComponent2 {
|
|
|
20979
21013
|
// lib/components/primitive-components/NetLabel.ts
|
|
20980
21014
|
import { netLabelProps } from "@tscircuit/props";
|
|
20981
21015
|
import {
|
|
20982
|
-
applyToPoint as
|
|
20983
|
-
identity as
|
|
21016
|
+
applyToPoint as applyToPoint19,
|
|
21017
|
+
identity as identity6,
|
|
20984
21018
|
translate as translate8
|
|
20985
21019
|
} from "transformation-matrix";
|
|
20986
21020
|
import { calculateElbow as calculateElbow2 } from "calculate-elbow";
|
|
@@ -21030,8 +21064,8 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
21030
21064
|
const connectedPorts = this._getConnectedPorts();
|
|
21031
21065
|
if (connectedPorts.length > 0) {
|
|
21032
21066
|
const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
|
|
21033
|
-
const parentCenter =
|
|
21034
|
-
this.parent?.computeSchematicGlobalTransform?.() ??
|
|
21067
|
+
const parentCenter = applyToPoint19(
|
|
21068
|
+
this.parent?.computeSchematicGlobalTransform?.() ?? identity6(),
|
|
21035
21069
|
{ x: 0, y: 0 }
|
|
21036
21070
|
);
|
|
21037
21071
|
return translate8(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
|
|
@@ -21240,7 +21274,7 @@ var CourtyardCircle = class extends PrimitiveComponent2 {
|
|
|
21240
21274
|
// lib/components/primitive-components/CourtyardOutline.ts
|
|
21241
21275
|
import { courtyardOutlineProps } from "@tscircuit/props";
|
|
21242
21276
|
import { getBoundsFromPoints as getBoundsFromPoints6 } from "@tscircuit/math-utils";
|
|
21243
|
-
import { applyToPoint as
|
|
21277
|
+
import { applyToPoint as applyToPoint20 } from "transformation-matrix";
|
|
21244
21278
|
var CourtyardOutline = class extends PrimitiveComponent2 {
|
|
21245
21279
|
pcb_courtyard_outline_id = null;
|
|
21246
21280
|
isPcbPrimitive = true;
|
|
@@ -21268,7 +21302,7 @@ var CourtyardOutline = class extends PrimitiveComponent2 {
|
|
|
21268
21302
|
pcb_component_id,
|
|
21269
21303
|
layer,
|
|
21270
21304
|
outline: props.outline.map((p) => {
|
|
21271
|
-
const transformedPosition =
|
|
21305
|
+
const transformedPosition = applyToPoint20(transform, {
|
|
21272
21306
|
x: p.x,
|
|
21273
21307
|
y: p.y
|
|
21274
21308
|
});
|
|
@@ -22378,7 +22412,7 @@ var TestPoint = class extends NormalComponent3 {
|
|
|
22378
22412
|
|
|
22379
22413
|
// lib/components/primitive-components/SchematicText.ts
|
|
22380
22414
|
import { schematicTextProps } from "@tscircuit/props";
|
|
22381
|
-
import { applyToPoint as
|
|
22415
|
+
import { applyToPoint as applyToPoint21 } from "transformation-matrix";
|
|
22382
22416
|
var SchematicText = class extends PrimitiveComponent2 {
|
|
22383
22417
|
isSchematicPrimitive = true;
|
|
22384
22418
|
schematic_text_id;
|
|
@@ -22417,7 +22451,7 @@ var SchematicText = class extends PrimitiveComponent2 {
|
|
|
22417
22451
|
const { db } = this.root;
|
|
22418
22452
|
const text = db.schematic_text.get(this.schematic_text_id);
|
|
22419
22453
|
if (!text) return;
|
|
22420
|
-
const newPosition =
|
|
22454
|
+
const newPosition = applyToPoint21(transform, text.position);
|
|
22421
22455
|
db.schematic_text.update(this.schematic_text_id, {
|
|
22422
22456
|
position: { x: newPosition.x, y: newPosition.y }
|
|
22423
22457
|
});
|
|
@@ -22426,7 +22460,7 @@ var SchematicText = class extends PrimitiveComponent2 {
|
|
|
22426
22460
|
|
|
22427
22461
|
// lib/components/primitive-components/SchematicLine.ts
|
|
22428
22462
|
import { schematicLineProps } from "@tscircuit/props";
|
|
22429
|
-
import { applyToPoint as
|
|
22463
|
+
import { applyToPoint as applyToPoint22 } from "transformation-matrix";
|
|
22430
22464
|
var SchematicLine = class extends PrimitiveComponent2 {
|
|
22431
22465
|
isSchematicPrimitive = true;
|
|
22432
22466
|
get config() {
|
|
@@ -22466,8 +22500,8 @@ var SchematicLine = class extends PrimitiveComponent2 {
|
|
|
22466
22500
|
const { db } = this.root;
|
|
22467
22501
|
const line = db.schematic_line.get(this.schematic_line_id);
|
|
22468
22502
|
if (!line) return;
|
|
22469
|
-
const p1 =
|
|
22470
|
-
const p2 =
|
|
22503
|
+
const p1 = applyToPoint22(transform, { x: line.x1, y: line.y1 });
|
|
22504
|
+
const p2 = applyToPoint22(transform, { x: line.x2, y: line.y2 });
|
|
22471
22505
|
db.schematic_line.update(this.schematic_line_id, {
|
|
22472
22506
|
x1: p1.x,
|
|
22473
22507
|
y1: p1.y,
|
|
@@ -22479,7 +22513,7 @@ var SchematicLine = class extends PrimitiveComponent2 {
|
|
|
22479
22513
|
|
|
22480
22514
|
// lib/components/primitive-components/SchematicRect.ts
|
|
22481
22515
|
import { schematicRectProps } from "@tscircuit/props";
|
|
22482
|
-
import { applyToPoint as
|
|
22516
|
+
import { applyToPoint as applyToPoint23 } from "transformation-matrix";
|
|
22483
22517
|
var SchematicRect = class extends PrimitiveComponent2 {
|
|
22484
22518
|
isSchematicPrimitive = true;
|
|
22485
22519
|
get config() {
|
|
@@ -22523,11 +22557,11 @@ var SchematicRect = class extends PrimitiveComponent2 {
|
|
|
22523
22557
|
const { db } = this.root;
|
|
22524
22558
|
const rect = db.schematic_rect.get(this.schematic_rect_id);
|
|
22525
22559
|
if (!rect) return;
|
|
22526
|
-
const topLeft =
|
|
22560
|
+
const topLeft = applyToPoint23(transform, {
|
|
22527
22561
|
x: rect.center.x - rect.width / 2,
|
|
22528
22562
|
y: rect.center.y + rect.height / 2
|
|
22529
22563
|
});
|
|
22530
|
-
const bottomRight =
|
|
22564
|
+
const bottomRight = applyToPoint23(transform, {
|
|
22531
22565
|
x: rect.center.x + rect.width / 2,
|
|
22532
22566
|
y: rect.center.y - rect.height / 2
|
|
22533
22567
|
});
|
|
@@ -22547,7 +22581,7 @@ var SchematicRect = class extends PrimitiveComponent2 {
|
|
|
22547
22581
|
|
|
22548
22582
|
// lib/components/primitive-components/SchematicArc.ts
|
|
22549
22583
|
import { schematicArcProps } from "@tscircuit/props";
|
|
22550
|
-
import { applyToPoint as
|
|
22584
|
+
import { applyToPoint as applyToPoint24 } from "transformation-matrix";
|
|
22551
22585
|
var SchematicArc = class extends PrimitiveComponent2 {
|
|
22552
22586
|
isSchematicPrimitive = true;
|
|
22553
22587
|
get config() {
|
|
@@ -22591,8 +22625,8 @@ var SchematicArc = class extends PrimitiveComponent2 {
|
|
|
22591
22625
|
const { db } = this.root;
|
|
22592
22626
|
const arc = db.schematic_arc.get(this.schematic_arc_id);
|
|
22593
22627
|
if (!arc) return;
|
|
22594
|
-
const newCenter =
|
|
22595
|
-
const edgePoint =
|
|
22628
|
+
const newCenter = applyToPoint24(transform, arc.center);
|
|
22629
|
+
const edgePoint = applyToPoint24(transform, {
|
|
22596
22630
|
x: arc.center.x + arc.radius,
|
|
22597
22631
|
y: arc.center.y
|
|
22598
22632
|
});
|
|
@@ -22606,7 +22640,7 @@ var SchematicArc = class extends PrimitiveComponent2 {
|
|
|
22606
22640
|
|
|
22607
22641
|
// lib/components/primitive-components/SchematicCircle.ts
|
|
22608
22642
|
import { schematicCircleProps } from "@tscircuit/props";
|
|
22609
|
-
import { applyToPoint as
|
|
22643
|
+
import { applyToPoint as applyToPoint25 } from "transformation-matrix";
|
|
22610
22644
|
var SchematicCircle = class extends PrimitiveComponent2 {
|
|
22611
22645
|
isSchematicPrimitive = true;
|
|
22612
22646
|
get config() {
|
|
@@ -22649,8 +22683,8 @@ var SchematicCircle = class extends PrimitiveComponent2 {
|
|
|
22649
22683
|
const { db } = this.root;
|
|
22650
22684
|
const circle = db.schematic_circle.get(this.schematic_circle_id);
|
|
22651
22685
|
if (!circle) return;
|
|
22652
|
-
const newCenter =
|
|
22653
|
-
const edgePoint =
|
|
22686
|
+
const newCenter = applyToPoint25(transform, circle.center);
|
|
22687
|
+
const edgePoint = applyToPoint25(transform, {
|
|
22654
22688
|
x: circle.center.x + circle.radius,
|
|
22655
22689
|
y: circle.center.y
|
|
22656
22690
|
});
|
|
@@ -22794,7 +22828,7 @@ function svgPathToPoints(svgPath, samplesPerUnit = 10) {
|
|
|
22794
22828
|
}
|
|
22795
22829
|
|
|
22796
22830
|
// lib/components/primitive-components/SchematicPath.ts
|
|
22797
|
-
import { applyToPoint as
|
|
22831
|
+
import { applyToPoint as applyToPoint26 } from "transformation-matrix";
|
|
22798
22832
|
var SchematicPath = class extends PrimitiveComponent2 {
|
|
22799
22833
|
isSchematicPrimitive = true;
|
|
22800
22834
|
schematic_path_ids = [];
|
|
@@ -22859,7 +22893,7 @@ var SchematicPath = class extends PrimitiveComponent2 {
|
|
|
22859
22893
|
const path = db.schematic_path.get(pathId);
|
|
22860
22894
|
if (!path) continue;
|
|
22861
22895
|
const newPoints = path.points.map((point6) => {
|
|
22862
|
-
const transformed =
|
|
22896
|
+
const transformed = applyToPoint26(transform, point6);
|
|
22863
22897
|
return { x: transformed.x, y: transformed.y };
|
|
22864
22898
|
});
|
|
22865
22899
|
db.schematic_path.update(pathId, {
|
|
@@ -23221,7 +23255,7 @@ var SchematicCell = class extends PrimitiveComponent2 {
|
|
|
23221
23255
|
|
|
23222
23256
|
// lib/components/primitive-components/Symbol/Symbol.ts
|
|
23223
23257
|
import { symbolProps } from "@tscircuit/props";
|
|
23224
|
-
import { compose as
|
|
23258
|
+
import { compose as compose8, translate as translate9, scale as scale2 } from "transformation-matrix";
|
|
23225
23259
|
var SymbolComponent = class extends PrimitiveComponent2 {
|
|
23226
23260
|
isPrimitiveContainer = true;
|
|
23227
23261
|
schematic_symbol_id;
|
|
@@ -23276,6 +23310,14 @@ var SymbolComponent = class extends PrimitiveComponent2 {
|
|
|
23276
23310
|
const { db } = this.root;
|
|
23277
23311
|
const schematicElements = [];
|
|
23278
23312
|
for (const child of this.children) {
|
|
23313
|
+
if (child.componentName === "Port") {
|
|
23314
|
+
const portId = child.schematic_port_id;
|
|
23315
|
+
if (portId) {
|
|
23316
|
+
const port = db.schematic_port.get(portId);
|
|
23317
|
+
if (port) schematicElements.push(port);
|
|
23318
|
+
}
|
|
23319
|
+
continue;
|
|
23320
|
+
}
|
|
23279
23321
|
if (!child.isSchematicPrimitive) continue;
|
|
23280
23322
|
if (child.componentName === "SchematicLine") {
|
|
23281
23323
|
const line = db.schematic_line.get(child.schematic_line_id);
|
|
@@ -23323,7 +23365,7 @@ var SymbolComponent = class extends PrimitiveComponent2 {
|
|
|
23323
23365
|
const scaleX = targetWidth !== void 0 && currentWidth > 0 ? targetWidth / currentWidth : 1;
|
|
23324
23366
|
const scaleY = targetHeight !== void 0 && currentHeight > 0 ? targetHeight / currentHeight : 1;
|
|
23325
23367
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
23326
|
-
this.userCoordinateToResizedSymbolTransformMat =
|
|
23368
|
+
this.userCoordinateToResizedSymbolTransformMat = compose8(
|
|
23327
23369
|
translate9(globalPos.x, globalPos.y),
|
|
23328
23370
|
scale2(scaleX, scaleY),
|
|
23329
23371
|
translate9(-currentCenterX, -currentCenterY)
|