@tscircuit/cli 0.1.184 → 0.1.185
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/main.js +206 -177
- package/package.json +10 -3
package/dist/main.js
CHANGED
|
@@ -262643,7 +262643,7 @@ var init_dist6 = __esm(() => {
|
|
|
262643
262643
|
package_default2 = {
|
|
262644
262644
|
name: "circuit-to-svg",
|
|
262645
262645
|
type: "module",
|
|
262646
|
-
version: "0.0.
|
|
262646
|
+
version: "0.0.171",
|
|
262647
262647
|
description: "Convert Circuit JSON to SVG",
|
|
262648
262648
|
main: "dist/index.js",
|
|
262649
262649
|
files: [
|
|
@@ -262686,7 +262686,7 @@ var init_dist6 = __esm(() => {
|
|
|
262686
262686
|
"vite-tsconfig-paths": "^5.0.1",
|
|
262687
262687
|
"@tscircuit/checks": "^0.0.44",
|
|
262688
262688
|
"@tscircuit/circuit-json-util": "^0.0.47",
|
|
262689
|
-
"@tscircuit/footprinter": "^0.0.
|
|
262689
|
+
"@tscircuit/footprinter": "^0.0.203"
|
|
262690
262690
|
},
|
|
262691
262691
|
peerDependencies: {
|
|
262692
262692
|
"circuit-json": "*",
|
|
@@ -434909,7 +434909,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
434909
434909
|
import { execSync as execSync2 } from "node:child_process";
|
|
434910
434910
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
434911
434911
|
// package.json
|
|
434912
|
-
var version = "0.1.
|
|
434912
|
+
var version = "0.1.184";
|
|
434913
434913
|
var package_default = {
|
|
434914
434914
|
name: "@tscircuit/cli",
|
|
434915
434915
|
version,
|
|
@@ -434949,21 +434949,28 @@ var package_default = {
|
|
|
434949
434949
|
"jwt-decode": "^4.0.0",
|
|
434950
434950
|
kleur: "^4.1.5",
|
|
434951
434951
|
ky: "^1.7.4",
|
|
434952
|
-
"looks-same": "^9.0.1",
|
|
434953
434952
|
"make-vfs": "^1.0.15",
|
|
434954
434953
|
"perfect-cli": "^1.0.20",
|
|
434955
434954
|
prompts: "^2.4.2",
|
|
434956
434955
|
redaxios: "^0.5.1",
|
|
434957
434956
|
semver: "^7.6.3",
|
|
434958
434957
|
tempy: "^3.1.0",
|
|
434959
|
-
tscircuit: "^0.0.
|
|
434958
|
+
tscircuit: "^0.0.555",
|
|
434960
434959
|
tsx: "^4.7.1",
|
|
434961
434960
|
"typed-ky": "^0.0.4",
|
|
434962
434961
|
zod: "3"
|
|
434963
434962
|
},
|
|
434963
|
+
dependencies: {
|
|
434964
|
+
"looks-same": "^9.0.1"
|
|
434965
|
+
},
|
|
434964
434966
|
peerDependencies: {
|
|
434965
434967
|
tscircuit: "*"
|
|
434966
434968
|
},
|
|
434969
|
+
peerDependenciesMeta: {
|
|
434970
|
+
tscircuit: {
|
|
434971
|
+
optional: true
|
|
434972
|
+
}
|
|
434973
|
+
},
|
|
434967
434974
|
bin: {
|
|
434968
434975
|
tsci: "./cli/entrypoint.js"
|
|
434969
434976
|
},
|
|
@@ -451805,8 +451812,9 @@ init_zod();
|
|
|
451805
451812
|
init_dist();
|
|
451806
451813
|
var import_transformation_matrix72 = __toESM2(require_build_commonjs(), 1);
|
|
451807
451814
|
var import_transformation_matrix73 = __toESM2(require_build_commonjs(), 1);
|
|
451808
|
-
init_dist5();
|
|
451809
451815
|
var import_transformation_matrix74 = __toESM2(require_build_commonjs(), 1);
|
|
451816
|
+
init_dist5();
|
|
451817
|
+
var import_transformation_matrix75 = __toESM2(require_build_commonjs(), 1);
|
|
451810
451818
|
init_zod();
|
|
451811
451819
|
var import_react2 = __toESM2(require_react(), 1);
|
|
451812
451820
|
init_dist5();
|
|
@@ -453245,7 +453253,7 @@ var calculateElbow = (point1, point22, options = {}) => {
|
|
|
453245
453253
|
// node_modules/@tscircuit/core/dist/index.js
|
|
453246
453254
|
init_dist();
|
|
453247
453255
|
init_dist4();
|
|
453248
|
-
var
|
|
453256
|
+
var import_transformation_matrix76 = __toESM2(require_build_commonjs(), 1);
|
|
453249
453257
|
|
|
453250
453258
|
// node_modules/@tscircuit/capacity-autorouter/dist/index.js
|
|
453251
453259
|
var import_object_hash = __toESM2(require_object_hash(), 1);
|
|
@@ -468832,11 +468840,11 @@ var package_default3 = {
|
|
|
468832
468840
|
// node_modules/@tscircuit/core/dist/index.js
|
|
468833
468841
|
init_dist();
|
|
468834
468842
|
var import_debug21 = __toESM2(require_src2(), 1);
|
|
468835
|
-
var
|
|
468843
|
+
var import_transformation_matrix77 = __toESM2(require_build_commonjs(), 1);
|
|
468836
468844
|
init_dist2();
|
|
468837
468845
|
init_dist2();
|
|
468838
468846
|
init_dist2();
|
|
468839
|
-
var
|
|
468847
|
+
var import_transformation_matrix78 = __toESM2(require_build_commonjs(), 1);
|
|
468840
468848
|
init_dist2();
|
|
468841
468849
|
init_dist2();
|
|
468842
468850
|
init_dist4();
|
|
@@ -476869,7 +476877,7 @@ var layoutSchematicGraphVariants = (variants, {
|
|
|
476869
476877
|
var import_debug22 = __toESM2(require_src2(), 1);
|
|
476870
476878
|
init_dist2();
|
|
476871
476879
|
init_dist4();
|
|
476872
|
-
var
|
|
476880
|
+
var import_transformation_matrix79 = __toESM2(require_build_commonjs(), 1);
|
|
476873
476881
|
init_dist2();
|
|
476874
476882
|
|
|
476875
476883
|
// node_modules/@tscircuit/checks/dist/index.js
|
|
@@ -477441,7 +477449,6 @@ function formatSiUnit(value2) {
|
|
|
477441
477449
|
}
|
|
477442
477450
|
|
|
477443
477451
|
// node_modules/@tscircuit/core/dist/index.js
|
|
477444
|
-
var import_transformation_matrix79 = __toESM2(require_build_commonjs(), 1);
|
|
477445
477452
|
var import_transformation_matrix80 = __toESM2(require_build_commonjs(), 1);
|
|
477446
477453
|
var import_transformation_matrix81 = __toESM2(require_build_commonjs(), 1);
|
|
477447
477454
|
init_dist2();
|
|
@@ -479550,6 +479557,157 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
479550
479557
|
return { width: textWidth * fontSize, height: textHeight * fontSize };
|
|
479551
479558
|
}
|
|
479552
479559
|
};
|
|
479560
|
+
var Cutout = class extends PrimitiveComponent2 {
|
|
479561
|
+
pcb_cutout_id = null;
|
|
479562
|
+
isPcbPrimitive = true;
|
|
479563
|
+
get config() {
|
|
479564
|
+
return {
|
|
479565
|
+
componentName: "Cutout",
|
|
479566
|
+
zodProps: cutoutProps
|
|
479567
|
+
};
|
|
479568
|
+
}
|
|
479569
|
+
doInitialPcbPrimitiveRender() {
|
|
479570
|
+
if (this.root?.pcbDisabled)
|
|
479571
|
+
return;
|
|
479572
|
+
const { db } = this.root;
|
|
479573
|
+
const { _parsedProps: props } = this;
|
|
479574
|
+
const subcircuit = this.getSubcircuit();
|
|
479575
|
+
const pcb_group_id = this.getGroup()?.pcb_group_id ?? undefined;
|
|
479576
|
+
const globalPosition = this._getGlobalPcbPositionBeforeLayout();
|
|
479577
|
+
let inserted_pcb_cutout = undefined;
|
|
479578
|
+
if (props.shape === "rect") {
|
|
479579
|
+
const rectData = {
|
|
479580
|
+
shape: "rect",
|
|
479581
|
+
center: globalPosition,
|
|
479582
|
+
width: props.width,
|
|
479583
|
+
height: props.height,
|
|
479584
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? undefined,
|
|
479585
|
+
pcb_group_id
|
|
479586
|
+
};
|
|
479587
|
+
inserted_pcb_cutout = db.pcb_cutout.insert(rectData);
|
|
479588
|
+
} else if (props.shape === "circle") {
|
|
479589
|
+
const circleData = {
|
|
479590
|
+
shape: "circle",
|
|
479591
|
+
center: globalPosition,
|
|
479592
|
+
radius: props.radius,
|
|
479593
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? undefined,
|
|
479594
|
+
pcb_group_id
|
|
479595
|
+
};
|
|
479596
|
+
inserted_pcb_cutout = db.pcb_cutout.insert(circleData);
|
|
479597
|
+
} else if (props.shape === "polygon") {
|
|
479598
|
+
const transform2 = this._computePcbGlobalTransformBeforeLayout();
|
|
479599
|
+
const transformedPoints = props.points.map((p) => import_transformation_matrix74.applyToPoint(transform2, p));
|
|
479600
|
+
const polygonData = {
|
|
479601
|
+
shape: "polygon",
|
|
479602
|
+
points: transformedPoints,
|
|
479603
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? undefined,
|
|
479604
|
+
pcb_group_id
|
|
479605
|
+
};
|
|
479606
|
+
inserted_pcb_cutout = db.pcb_cutout.insert(polygonData);
|
|
479607
|
+
}
|
|
479608
|
+
if (inserted_pcb_cutout) {
|
|
479609
|
+
this.pcb_cutout_id = inserted_pcb_cutout.pcb_cutout_id;
|
|
479610
|
+
}
|
|
479611
|
+
}
|
|
479612
|
+
getPcbSize() {
|
|
479613
|
+
const { _parsedProps: props } = this;
|
|
479614
|
+
if (props.shape === "rect") {
|
|
479615
|
+
return { width: props.width, height: props.height };
|
|
479616
|
+
}
|
|
479617
|
+
if (props.shape === "circle") {
|
|
479618
|
+
return { width: props.radius * 2, height: props.radius * 2 };
|
|
479619
|
+
}
|
|
479620
|
+
if (props.shape === "polygon") {
|
|
479621
|
+
if (props.points.length === 0)
|
|
479622
|
+
return { width: 0, height: 0 };
|
|
479623
|
+
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
479624
|
+
for (const point4 of props.points) {
|
|
479625
|
+
minX = Math.min(minX, point4.x);
|
|
479626
|
+
maxX = Math.max(maxX, point4.x);
|
|
479627
|
+
minY = Math.min(minY, point4.y);
|
|
479628
|
+
maxY = Math.max(maxY, point4.y);
|
|
479629
|
+
}
|
|
479630
|
+
return { width: maxX - minX, height: maxY - minY };
|
|
479631
|
+
}
|
|
479632
|
+
return { width: 0, height: 0 };
|
|
479633
|
+
}
|
|
479634
|
+
_getPcbCircuitJsonBounds() {
|
|
479635
|
+
if (!this.pcb_cutout_id)
|
|
479636
|
+
return super._getPcbCircuitJsonBounds();
|
|
479637
|
+
const { db } = this.root;
|
|
479638
|
+
const cutout = db.pcb_cutout.get(this.pcb_cutout_id);
|
|
479639
|
+
if (!cutout)
|
|
479640
|
+
return super._getPcbCircuitJsonBounds();
|
|
479641
|
+
if (cutout.shape === "rect") {
|
|
479642
|
+
return {
|
|
479643
|
+
center: cutout.center,
|
|
479644
|
+
bounds: {
|
|
479645
|
+
left: cutout.center.x - cutout.width / 2,
|
|
479646
|
+
top: cutout.center.y + cutout.height / 2,
|
|
479647
|
+
right: cutout.center.x + cutout.width / 2,
|
|
479648
|
+
bottom: cutout.center.y - cutout.height / 2
|
|
479649
|
+
},
|
|
479650
|
+
width: cutout.width,
|
|
479651
|
+
height: cutout.height
|
|
479652
|
+
};
|
|
479653
|
+
} else if (cutout.shape === "circle") {
|
|
479654
|
+
return {
|
|
479655
|
+
center: cutout.center,
|
|
479656
|
+
bounds: {
|
|
479657
|
+
left: cutout.center.x - cutout.radius,
|
|
479658
|
+
top: cutout.center.y + cutout.radius,
|
|
479659
|
+
right: cutout.center.x + cutout.radius,
|
|
479660
|
+
bottom: cutout.center.y - cutout.radius
|
|
479661
|
+
},
|
|
479662
|
+
width: cutout.radius * 2,
|
|
479663
|
+
height: cutout.radius * 2
|
|
479664
|
+
};
|
|
479665
|
+
} else if (cutout.shape === "polygon") {
|
|
479666
|
+
if (cutout.points.length === 0)
|
|
479667
|
+
return super._getPcbCircuitJsonBounds();
|
|
479668
|
+
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
479669
|
+
for (const point4 of cutout.points) {
|
|
479670
|
+
minX = Math.min(minX, point4.x);
|
|
479671
|
+
maxX = Math.max(maxX, point4.x);
|
|
479672
|
+
minY = Math.min(minY, point4.y);
|
|
479673
|
+
maxY = Math.max(maxY, point4.y);
|
|
479674
|
+
}
|
|
479675
|
+
return {
|
|
479676
|
+
center: { x: (minX + maxX) / 2, y: (minY + maxY) / 2 },
|
|
479677
|
+
bounds: { left: minX, top: maxY, right: maxX, bottom: minY },
|
|
479678
|
+
width: maxX - minX,
|
|
479679
|
+
height: maxY - minY
|
|
479680
|
+
};
|
|
479681
|
+
}
|
|
479682
|
+
return super._getPcbCircuitJsonBounds();
|
|
479683
|
+
}
|
|
479684
|
+
_setPositionFromLayout(newCenter) {
|
|
479685
|
+
if (!this.pcb_cutout_id)
|
|
479686
|
+
return;
|
|
479687
|
+
const { db } = this.root;
|
|
479688
|
+
const cutout = db.pcb_cutout.get(this.pcb_cutout_id);
|
|
479689
|
+
if (!cutout)
|
|
479690
|
+
return;
|
|
479691
|
+
if (cutout.shape === "rect" || cutout.shape === "circle") {
|
|
479692
|
+
db.pcb_cutout.update(this.pcb_cutout_id, {
|
|
479693
|
+
...cutout,
|
|
479694
|
+
center: newCenter
|
|
479695
|
+
});
|
|
479696
|
+
} else if (cutout.shape === "polygon") {
|
|
479697
|
+
const oldCenter = this._getPcbCircuitJsonBounds().center;
|
|
479698
|
+
const dx = newCenter.x - oldCenter.x;
|
|
479699
|
+
const dy = newCenter.y - oldCenter.y;
|
|
479700
|
+
const newPoints = cutout.points.map((p) => ({
|
|
479701
|
+
x: p.x + dx,
|
|
479702
|
+
y: p.y + dy
|
|
479703
|
+
}));
|
|
479704
|
+
db.pcb_cutout.update(this.pcb_cutout_id, {
|
|
479705
|
+
...cutout,
|
|
479706
|
+
points: newPoints
|
|
479707
|
+
});
|
|
479708
|
+
}
|
|
479709
|
+
}
|
|
479710
|
+
};
|
|
479553
479711
|
var createPinrowSilkscreenText = ({
|
|
479554
479712
|
elm,
|
|
479555
479713
|
pinLabels,
|
|
@@ -479658,6 +479816,28 @@ var createComponentsFromCircuitJson = ({
|
|
|
479658
479816
|
pcbY: elm.y,
|
|
479659
479817
|
diameter: elm.hole_diameter
|
|
479660
479818
|
}));
|
|
479819
|
+
} else if (elm.type === "pcb_cutout") {
|
|
479820
|
+
if (elm.shape === "rect") {
|
|
479821
|
+
components.push(new Cutout({
|
|
479822
|
+
pcbX: elm.center.x,
|
|
479823
|
+
pcbY: elm.center.y,
|
|
479824
|
+
shape: "rect",
|
|
479825
|
+
width: elm.width,
|
|
479826
|
+
height: elm.height
|
|
479827
|
+
}));
|
|
479828
|
+
} else if (elm.shape === "circle") {
|
|
479829
|
+
components.push(new Cutout({
|
|
479830
|
+
pcbX: elm.center.x,
|
|
479831
|
+
pcbY: elm.center.y,
|
|
479832
|
+
shape: "circle",
|
|
479833
|
+
radius: elm.radius
|
|
479834
|
+
}));
|
|
479835
|
+
} else if (elm.shape === "polygon") {
|
|
479836
|
+
components.push(new Cutout({
|
|
479837
|
+
shape: "polygon",
|
|
479838
|
+
points: elm.points
|
|
479839
|
+
}));
|
|
479840
|
+
}
|
|
479661
479841
|
} else if (elm.type === "pcb_silkscreen_text") {
|
|
479662
479842
|
const ccwRotation = calculateCcwRotation(componentRotation, elm.ccw_rotation);
|
|
479663
479843
|
if (footprint.includes("pinrow") && elm.text.includes("PIN")) {
|
|
@@ -479673,7 +479853,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
479673
479853
|
anchorAlignment: elm.anchor_alignment || "center",
|
|
479674
479854
|
text: componentName,
|
|
479675
479855
|
fontSize: elm.font_size + 0.2,
|
|
479676
|
-
pcbX: isNaN(elm.anchor_position.x) ? 0 : elm.anchor_position.x,
|
|
479856
|
+
pcbX: Number.isNaN(elm.anchor_position.x) ? 0 : elm.anchor_position.x,
|
|
479677
479857
|
pcbY: elm.anchor_position.y,
|
|
479678
479858
|
pcbRotation: ccwRotation ?? 0
|
|
479679
479859
|
}));
|
|
@@ -479887,8 +480067,8 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
479887
480067
|
throw new Error(`Couldn't find schematicSymbolPortDef for port ${this.getString()}, searched internally connected ports and none had a schematicSymbolPortDef. Why are we trying to get the schematic position of this port?`);
|
|
479888
480068
|
}
|
|
479889
480069
|
}
|
|
479890
|
-
const transform2 =
|
|
479891
|
-
return
|
|
480070
|
+
const transform2 = import_transformation_matrix75.compose(this.parent.computeSchematicGlobalTransform(), import_transformation_matrix75.translate(-symbol8.center.x, -symbol8.center.y));
|
|
480071
|
+
return import_transformation_matrix75.applyToPoint(transform2, schematicSymbolPortDef);
|
|
479892
480072
|
}
|
|
479893
480073
|
const parentBoxDim = this?.parent?._getSchematicBoxDimensions();
|
|
479894
480074
|
if (parentBoxDim && this.props.pinNumber !== undefined) {
|
|
@@ -479896,7 +480076,7 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
479896
480076
|
if (!localPortPosition) {
|
|
479897
480077
|
throw new Error(`Couldn't find position for schematic_port for port ${this.getString()} inside of the schematic box`);
|
|
479898
480078
|
}
|
|
479899
|
-
return
|
|
480079
|
+
return import_transformation_matrix75.applyToPoint(this.parent.computeSchematicGlobalTransform(), localPortPosition);
|
|
479900
480080
|
}
|
|
479901
480081
|
throw new Error(`Couldn't find position for schematic_port for port ${this.getString()}`);
|
|
479902
480082
|
}
|
|
@@ -483386,7 +483566,7 @@ var TraceHint = class extends PrimitiveComponent2 {
|
|
|
483386
483566
|
return [];
|
|
483387
483567
|
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
483388
483568
|
return offsets.map((offset) => ({
|
|
483389
|
-
...
|
|
483569
|
+
...import_transformation_matrix77.applyToPoint(globalTransform, offset),
|
|
483390
483570
|
via: offset.via,
|
|
483391
483571
|
to_layer: offset.to_layer,
|
|
483392
483572
|
trace_width: offset.trace_width
|
|
@@ -484018,7 +484198,7 @@ function Group_doInitialPcbLayoutGrid(group) {
|
|
|
484018
484198
|
const newCenter = { x: targetCellCenterX, y: targetCellCenterY };
|
|
484019
484199
|
const deltaX = newCenter.x - oldCenter.x;
|
|
484020
484200
|
const deltaY = newCenter.y - oldCenter.y;
|
|
484021
|
-
const mat =
|
|
484201
|
+
const mat = import_transformation_matrix79.translate(deltaX, deltaY);
|
|
484022
484202
|
const related = db.toArray().filter((e) => e.pcb_component_id === child.pcb_component_id);
|
|
484023
484203
|
const moved = transformPCBElements(related, mat);
|
|
484024
484204
|
for (const elm of moved) {
|
|
@@ -484037,8 +484217,8 @@ function Group_doInitialPcbLayoutGrid(group) {
|
|
|
484037
484217
|
}
|
|
484038
484218
|
if (group.pcb_group_id) {
|
|
484039
484219
|
db.pcb_group.update(group.pcb_group_id, {
|
|
484040
|
-
width: totalGridWidth,
|
|
484041
|
-
height: totalGridHeight,
|
|
484220
|
+
width: props.width ?? totalGridWidth,
|
|
484221
|
+
height: props.height ?? totalGridHeight,
|
|
484042
484222
|
center: groupCenter
|
|
484043
484223
|
});
|
|
484044
484224
|
}
|
|
@@ -484177,8 +484357,8 @@ var Group = class extends NormalComponent {
|
|
|
484177
484357
|
centerY += (padTop - padBottom) / 2;
|
|
484178
484358
|
}
|
|
484179
484359
|
db.pcb_group.update(this.pcb_group_id, {
|
|
484180
|
-
width,
|
|
484181
|
-
height,
|
|
484360
|
+
width: Number(props.width ?? width),
|
|
484361
|
+
height: Number(props.height ?? height),
|
|
484182
484362
|
center: {
|
|
484183
484363
|
x: centerX,
|
|
484184
484364
|
y: centerY
|
|
@@ -484889,7 +485069,7 @@ var Board = class extends Group {
|
|
|
484889
485069
|
this.pcb_board_id = null;
|
|
484890
485070
|
}
|
|
484891
485071
|
_computePcbGlobalTransformBeforeLayout() {
|
|
484892
|
-
return
|
|
485072
|
+
return import_transformation_matrix76.identity();
|
|
484893
485073
|
}
|
|
484894
485074
|
doInitialPcbDesignRuleChecks() {
|
|
484895
485075
|
if (this.root?.pcbDisabled)
|
|
@@ -485569,7 +485749,7 @@ var FabricationNotePath = class extends PrimitiveComponent2 {
|
|
|
485569
485749
|
layer,
|
|
485570
485750
|
color: props.color,
|
|
485571
485751
|
route: props.route.map((p) => {
|
|
485572
|
-
const transformedPosition =
|
|
485752
|
+
const transformedPosition = import_transformation_matrix80.applyToPoint(transform2, {
|
|
485573
485753
|
x: p.x,
|
|
485574
485754
|
y: p.y
|
|
485575
485755
|
});
|
|
@@ -485787,8 +485967,8 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
485787
485967
|
const connectedPorts = this._getConnectedPorts();
|
|
485788
485968
|
if (connectedPorts.length > 0) {
|
|
485789
485969
|
const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
|
|
485790
|
-
const parentCenter =
|
|
485791
|
-
return
|
|
485970
|
+
const parentCenter = import_transformation_matrix81.applyToPoint(this.parent?.computeSchematicGlobalTransform?.() ?? import_transformation_matrix81.identity(), { x: 0, y: 0 });
|
|
485971
|
+
return import_transformation_matrix81.translate(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
|
|
485792
485972
|
}
|
|
485793
485973
|
}
|
|
485794
485974
|
return super.computeSchematicPropsTransform();
|
|
@@ -486032,157 +486212,6 @@ var Via = class extends PrimitiveComponent2 {
|
|
|
486032
486212
|
this.pcb_via_id = pcb_via2.pcb_via_id;
|
|
486033
486213
|
}
|
|
486034
486214
|
};
|
|
486035
|
-
var Cutout = class extends PrimitiveComponent2 {
|
|
486036
|
-
pcb_cutout_id = null;
|
|
486037
|
-
isPcbPrimitive = true;
|
|
486038
|
-
get config() {
|
|
486039
|
-
return {
|
|
486040
|
-
componentName: "Cutout",
|
|
486041
|
-
zodProps: cutoutProps
|
|
486042
|
-
};
|
|
486043
|
-
}
|
|
486044
|
-
doInitialPcbPrimitiveRender() {
|
|
486045
|
-
if (this.root?.pcbDisabled)
|
|
486046
|
-
return;
|
|
486047
|
-
const { db } = this.root;
|
|
486048
|
-
const { _parsedProps: props } = this;
|
|
486049
|
-
const subcircuit = this.getSubcircuit();
|
|
486050
|
-
const pcb_group_id = this.getGroup()?.pcb_group_id ?? undefined;
|
|
486051
|
-
const globalPosition = this._getGlobalPcbPositionBeforeLayout();
|
|
486052
|
-
let inserted_pcb_cutout = undefined;
|
|
486053
|
-
if (props.shape === "rect") {
|
|
486054
|
-
const rectData = {
|
|
486055
|
-
shape: "rect",
|
|
486056
|
-
center: globalPosition,
|
|
486057
|
-
width: props.width,
|
|
486058
|
-
height: props.height,
|
|
486059
|
-
subcircuit_id: subcircuit?.subcircuit_id ?? undefined,
|
|
486060
|
-
pcb_group_id
|
|
486061
|
-
};
|
|
486062
|
-
inserted_pcb_cutout = db.pcb_cutout.insert(rectData);
|
|
486063
|
-
} else if (props.shape === "circle") {
|
|
486064
|
-
const circleData = {
|
|
486065
|
-
shape: "circle",
|
|
486066
|
-
center: globalPosition,
|
|
486067
|
-
radius: props.radius,
|
|
486068
|
-
subcircuit_id: subcircuit?.subcircuit_id ?? undefined,
|
|
486069
|
-
pcb_group_id
|
|
486070
|
-
};
|
|
486071
|
-
inserted_pcb_cutout = db.pcb_cutout.insert(circleData);
|
|
486072
|
-
} else if (props.shape === "polygon") {
|
|
486073
|
-
const transform2 = this._computePcbGlobalTransformBeforeLayout();
|
|
486074
|
-
const transformedPoints = props.points.map((p) => import_transformation_matrix81.applyToPoint(transform2, p));
|
|
486075
|
-
const polygonData = {
|
|
486076
|
-
shape: "polygon",
|
|
486077
|
-
points: transformedPoints,
|
|
486078
|
-
subcircuit_id: subcircuit?.subcircuit_id ?? undefined,
|
|
486079
|
-
pcb_group_id
|
|
486080
|
-
};
|
|
486081
|
-
inserted_pcb_cutout = db.pcb_cutout.insert(polygonData);
|
|
486082
|
-
}
|
|
486083
|
-
if (inserted_pcb_cutout) {
|
|
486084
|
-
this.pcb_cutout_id = inserted_pcb_cutout.pcb_cutout_id;
|
|
486085
|
-
}
|
|
486086
|
-
}
|
|
486087
|
-
getPcbSize() {
|
|
486088
|
-
const { _parsedProps: props } = this;
|
|
486089
|
-
if (props.shape === "rect") {
|
|
486090
|
-
return { width: props.width, height: props.height };
|
|
486091
|
-
}
|
|
486092
|
-
if (props.shape === "circle") {
|
|
486093
|
-
return { width: props.radius * 2, height: props.radius * 2 };
|
|
486094
|
-
}
|
|
486095
|
-
if (props.shape === "polygon") {
|
|
486096
|
-
if (props.points.length === 0)
|
|
486097
|
-
return { width: 0, height: 0 };
|
|
486098
|
-
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
486099
|
-
for (const point4 of props.points) {
|
|
486100
|
-
minX = Math.min(minX, point4.x);
|
|
486101
|
-
maxX = Math.max(maxX, point4.x);
|
|
486102
|
-
minY = Math.min(minY, point4.y);
|
|
486103
|
-
maxY = Math.max(maxY, point4.y);
|
|
486104
|
-
}
|
|
486105
|
-
return { width: maxX - minX, height: maxY - minY };
|
|
486106
|
-
}
|
|
486107
|
-
return { width: 0, height: 0 };
|
|
486108
|
-
}
|
|
486109
|
-
_getPcbCircuitJsonBounds() {
|
|
486110
|
-
if (!this.pcb_cutout_id)
|
|
486111
|
-
return super._getPcbCircuitJsonBounds();
|
|
486112
|
-
const { db } = this.root;
|
|
486113
|
-
const cutout = db.pcb_cutout.get(this.pcb_cutout_id);
|
|
486114
|
-
if (!cutout)
|
|
486115
|
-
return super._getPcbCircuitJsonBounds();
|
|
486116
|
-
if (cutout.shape === "rect") {
|
|
486117
|
-
return {
|
|
486118
|
-
center: cutout.center,
|
|
486119
|
-
bounds: {
|
|
486120
|
-
left: cutout.center.x - cutout.width / 2,
|
|
486121
|
-
top: cutout.center.y + cutout.height / 2,
|
|
486122
|
-
right: cutout.center.x + cutout.width / 2,
|
|
486123
|
-
bottom: cutout.center.y - cutout.height / 2
|
|
486124
|
-
},
|
|
486125
|
-
width: cutout.width,
|
|
486126
|
-
height: cutout.height
|
|
486127
|
-
};
|
|
486128
|
-
} else if (cutout.shape === "circle") {
|
|
486129
|
-
return {
|
|
486130
|
-
center: cutout.center,
|
|
486131
|
-
bounds: {
|
|
486132
|
-
left: cutout.center.x - cutout.radius,
|
|
486133
|
-
top: cutout.center.y + cutout.radius,
|
|
486134
|
-
right: cutout.center.x + cutout.radius,
|
|
486135
|
-
bottom: cutout.center.y - cutout.radius
|
|
486136
|
-
},
|
|
486137
|
-
width: cutout.radius * 2,
|
|
486138
|
-
height: cutout.radius * 2
|
|
486139
|
-
};
|
|
486140
|
-
} else if (cutout.shape === "polygon") {
|
|
486141
|
-
if (cutout.points.length === 0)
|
|
486142
|
-
return super._getPcbCircuitJsonBounds();
|
|
486143
|
-
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
486144
|
-
for (const point4 of cutout.points) {
|
|
486145
|
-
minX = Math.min(minX, point4.x);
|
|
486146
|
-
maxX = Math.max(maxX, point4.x);
|
|
486147
|
-
minY = Math.min(minY, point4.y);
|
|
486148
|
-
maxY = Math.max(maxY, point4.y);
|
|
486149
|
-
}
|
|
486150
|
-
return {
|
|
486151
|
-
center: { x: (minX + maxX) / 2, y: (minY + maxY) / 2 },
|
|
486152
|
-
bounds: { left: minX, top: maxY, right: maxX, bottom: minY },
|
|
486153
|
-
width: maxX - minX,
|
|
486154
|
-
height: maxY - minY
|
|
486155
|
-
};
|
|
486156
|
-
}
|
|
486157
|
-
return super._getPcbCircuitJsonBounds();
|
|
486158
|
-
}
|
|
486159
|
-
_setPositionFromLayout(newCenter) {
|
|
486160
|
-
if (!this.pcb_cutout_id)
|
|
486161
|
-
return;
|
|
486162
|
-
const { db } = this.root;
|
|
486163
|
-
const cutout = db.pcb_cutout.get(this.pcb_cutout_id);
|
|
486164
|
-
if (!cutout)
|
|
486165
|
-
return;
|
|
486166
|
-
if (cutout.shape === "rect" || cutout.shape === "circle") {
|
|
486167
|
-
db.pcb_cutout.update(this.pcb_cutout_id, {
|
|
486168
|
-
...cutout,
|
|
486169
|
-
center: newCenter
|
|
486170
|
-
});
|
|
486171
|
-
} else if (cutout.shape === "polygon") {
|
|
486172
|
-
const oldCenter = this._getPcbCircuitJsonBounds().center;
|
|
486173
|
-
const dx = newCenter.x - oldCenter.x;
|
|
486174
|
-
const dy = newCenter.y - oldCenter.y;
|
|
486175
|
-
const newPoints = cutout.points.map((p) => ({
|
|
486176
|
-
x: p.x + dx,
|
|
486177
|
-
y: p.y + dy
|
|
486178
|
-
}));
|
|
486179
|
-
db.pcb_cutout.update(this.pcb_cutout_id, {
|
|
486180
|
-
...cutout,
|
|
486181
|
-
points: newPoints
|
|
486182
|
-
});
|
|
486183
|
-
}
|
|
486184
|
-
}
|
|
486185
|
-
};
|
|
486186
486215
|
var Battery = class extends NormalComponent {
|
|
486187
486216
|
get config() {
|
|
486188
486217
|
return {
|
|
@@ -487033,7 +487062,7 @@ var SchematicCell = class extends PrimitiveComponent2 {
|
|
|
487033
487062
|
var package_default4 = {
|
|
487034
487063
|
name: "@tscircuit/core",
|
|
487035
487064
|
type: "module",
|
|
487036
|
-
version: "0.0.
|
|
487065
|
+
version: "0.0.575",
|
|
487037
487066
|
types: "dist/index.d.ts",
|
|
487038
487067
|
main: "dist/index.js",
|
|
487039
487068
|
module: "dist/index.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.185",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@babel/standalone": "^7.26.9",
|
|
@@ -37,21 +37,28 @@
|
|
|
37
37
|
"jwt-decode": "^4.0.0",
|
|
38
38
|
"kleur": "^4.1.5",
|
|
39
39
|
"ky": "^1.7.4",
|
|
40
|
-
"looks-same": "^9.0.1",
|
|
41
40
|
"make-vfs": "^1.0.15",
|
|
42
41
|
"perfect-cli": "^1.0.20",
|
|
43
42
|
"prompts": "^2.4.2",
|
|
44
43
|
"redaxios": "^0.5.1",
|
|
45
44
|
"semver": "^7.6.3",
|
|
46
45
|
"tempy": "^3.1.0",
|
|
47
|
-
"tscircuit": "^0.0.
|
|
46
|
+
"tscircuit": "^0.0.555",
|
|
48
47
|
"tsx": "^4.7.1",
|
|
49
48
|
"typed-ky": "^0.0.4",
|
|
50
49
|
"zod": "3"
|
|
51
50
|
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"looks-same": "^9.0.1"
|
|
53
|
+
},
|
|
52
54
|
"peerDependencies": {
|
|
53
55
|
"tscircuit": "*"
|
|
54
56
|
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"tscircuit": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
55
62
|
"bin": {
|
|
56
63
|
"tsci": "./cli/entrypoint.js"
|
|
57
64
|
},
|