@tscircuit/core 0.0.928 → 0.0.930
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 +1154 -8
- package/dist/index.js +94 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __export(components_exports, {
|
|
|
26
26
|
FabricationNotePath: () => FabricationNotePath,
|
|
27
27
|
FabricationNoteRect: () => FabricationNoteRect,
|
|
28
28
|
FabricationNoteText: () => FabricationNoteText,
|
|
29
|
+
Fiducial: () => Fiducial,
|
|
29
30
|
Footprint: () => Footprint,
|
|
30
31
|
Fuse: () => Fuse,
|
|
31
32
|
Group: () => Group6,
|
|
@@ -13680,6 +13681,39 @@ function Group_doInitialPcbComponentAnchorAlignment(group) {
|
|
|
13680
13681
|
});
|
|
13681
13682
|
}
|
|
13682
13683
|
|
|
13684
|
+
// lib/components/primitive-components/Group/utils/computeCenterFromAnchorPosition.ts
|
|
13685
|
+
function computeCenterFromAnchorPosition(anchorPosition, ctx) {
|
|
13686
|
+
const { width, height, pcbAnchorAlignment } = ctx;
|
|
13687
|
+
if (!pcbAnchorAlignment) return anchorPosition;
|
|
13688
|
+
const alignment = pcbAnchorAlignment;
|
|
13689
|
+
if (typeof width !== "number" || typeof height !== "number") {
|
|
13690
|
+
console.log("width or height is not a number");
|
|
13691
|
+
return anchorPosition;
|
|
13692
|
+
}
|
|
13693
|
+
const ax = anchorPosition.x;
|
|
13694
|
+
const ay = anchorPosition.y;
|
|
13695
|
+
switch (alignment) {
|
|
13696
|
+
case "top_left":
|
|
13697
|
+
return { x: ax + width / 2, y: ay - height / 2 };
|
|
13698
|
+
case "top_center":
|
|
13699
|
+
return { x: ax, y: ay - height / 2 };
|
|
13700
|
+
case "top_right":
|
|
13701
|
+
return { x: ax - width / 2, y: ay - height / 2 };
|
|
13702
|
+
case "center_left":
|
|
13703
|
+
return { x: ax + width / 2, y: ay };
|
|
13704
|
+
case "center_right":
|
|
13705
|
+
return { x: ax - width / 2, y: ay };
|
|
13706
|
+
case "bottom_left":
|
|
13707
|
+
return { x: ax + width / 2, y: ay + height / 2 };
|
|
13708
|
+
case "bottom_center":
|
|
13709
|
+
return { x: ax, y: ay + height / 2 };
|
|
13710
|
+
case "bottom_right":
|
|
13711
|
+
return { x: ax - width / 2, y: ay + height / 2 };
|
|
13712
|
+
default:
|
|
13713
|
+
return anchorPosition;
|
|
13714
|
+
}
|
|
13715
|
+
}
|
|
13716
|
+
|
|
13683
13717
|
// lib/components/primitive-components/Group/Group.ts
|
|
13684
13718
|
var Group6 = class extends NormalComponent3 {
|
|
13685
13719
|
pcb_group_id = null;
|
|
@@ -13742,17 +13776,22 @@ var Group6 = class extends NormalComponent3 {
|
|
|
13742
13776
|
x: distance8.parse(point2.x),
|
|
13743
13777
|
y: distance8.parse(point2.y)
|
|
13744
13778
|
})) : void 0;
|
|
13779
|
+
const ctx = this.props;
|
|
13780
|
+
const anchorPosition = this._getGlobalPcbPositionBeforeLayout();
|
|
13781
|
+
const center = computeCenterFromAnchorPosition(anchorPosition, ctx);
|
|
13745
13782
|
const pcb_group = db.pcb_group.insert({
|
|
13746
13783
|
is_subcircuit: this.isSubcircuit,
|
|
13747
13784
|
subcircuit_id: this.subcircuit_id ?? this.getSubcircuit()?.subcircuit_id,
|
|
13748
13785
|
name: this.name,
|
|
13749
|
-
|
|
13786
|
+
anchor_position: anchorPosition,
|
|
13787
|
+
center,
|
|
13750
13788
|
...hasOutline ? { outline: numericOutline } : { width: 0, height: 0 },
|
|
13751
13789
|
pcb_component_ids: [],
|
|
13752
13790
|
source_group_id: this.source_group_id,
|
|
13753
13791
|
autorouter_configuration: props.autorouter ? {
|
|
13754
13792
|
trace_clearance: props.autorouter.traceClearance
|
|
13755
|
-
} : void 0
|
|
13793
|
+
} : void 0,
|
|
13794
|
+
anchor_alignment: props.pcbAnchorAlignment ?? null
|
|
13756
13795
|
});
|
|
13757
13796
|
this.pcb_group_id = pcb_group.pcb_group_id;
|
|
13758
13797
|
for (const child of this.children) {
|
|
@@ -14311,8 +14350,7 @@ var Group6 = class extends NormalComponent3 {
|
|
|
14311
14350
|
},
|
|
14312
14351
|
0
|
|
14313
14352
|
);
|
|
14314
|
-
if (!
|
|
14315
|
-
return "pack";
|
|
14353
|
+
if (!hasManualEdits && unpositionedDirectChildrenCount > 1) return "pack";
|
|
14316
14354
|
return "none";
|
|
14317
14355
|
}
|
|
14318
14356
|
doInitialPcbLayout() {
|
|
@@ -17921,6 +17959,54 @@ var SilkscreenLine = class extends PrimitiveComponent2 {
|
|
|
17921
17959
|
}
|
|
17922
17960
|
};
|
|
17923
17961
|
|
|
17962
|
+
// lib/components/primitive-components/Fiducial.ts
|
|
17963
|
+
import "zod";
|
|
17964
|
+
import { distance as distance11 } from "circuit-json";
|
|
17965
|
+
import { fiducialProps } from "@tscircuit/props";
|
|
17966
|
+
var Fiducial = class extends PrimitiveComponent2 {
|
|
17967
|
+
pcb_smtpad_id = null;
|
|
17968
|
+
isPcbPrimitive = true;
|
|
17969
|
+
get config() {
|
|
17970
|
+
return {
|
|
17971
|
+
componentName: "Fiducial",
|
|
17972
|
+
zodProps: fiducialProps,
|
|
17973
|
+
sourceFtype: "simple_fiducial"
|
|
17974
|
+
};
|
|
17975
|
+
}
|
|
17976
|
+
doInitialPcbPrimitiveRender() {
|
|
17977
|
+
if (this.root?.pcbDisabled) return;
|
|
17978
|
+
const { db } = this.root;
|
|
17979
|
+
const { _parsedProps: props } = this;
|
|
17980
|
+
const position = this._getGlobalPcbPositionBeforeLayout();
|
|
17981
|
+
const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
|
|
17982
|
+
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
|
|
17983
|
+
const pcb_smtpad = db.pcb_smtpad.insert({
|
|
17984
|
+
pcb_component_id,
|
|
17985
|
+
layer: maybeFlipLayer(props.layer || "top"),
|
|
17986
|
+
shape: "circle",
|
|
17987
|
+
x: position.x,
|
|
17988
|
+
y: position.y,
|
|
17989
|
+
radius: distance11.parse(props.padDiameter) / 2,
|
|
17990
|
+
soldermask_margin: props.soldermaskPullback ? distance11.parse(props.soldermaskPullback) : distance11.parse(props.padDiameter) / 2,
|
|
17991
|
+
is_covered_with_solder_mask: true
|
|
17992
|
+
});
|
|
17993
|
+
this.pcb_smtpad_id = pcb_smtpad.pcb_smtpad_id;
|
|
17994
|
+
}
|
|
17995
|
+
getPcbSize() {
|
|
17996
|
+
const { _parsedProps: props } = this;
|
|
17997
|
+
const d = distance11.parse(props.padDiameter);
|
|
17998
|
+
return { width: d, height: d };
|
|
17999
|
+
}
|
|
18000
|
+
_setPositionFromLayout(newCenter) {
|
|
18001
|
+
if (!this.pcb_smtpad_id) return;
|
|
18002
|
+
const { db } = this.root;
|
|
18003
|
+
db.pcb_smtpad.update(this.pcb_smtpad_id, {
|
|
18004
|
+
x: newCenter.x,
|
|
18005
|
+
y: newCenter.y
|
|
18006
|
+
});
|
|
18007
|
+
}
|
|
18008
|
+
};
|
|
18009
|
+
|
|
17924
18010
|
// lib/components/primitive-components/Via.ts
|
|
17925
18011
|
import { viaProps } from "@tscircuit/props";
|
|
17926
18012
|
import "zod";
|
|
@@ -19546,7 +19632,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
19546
19632
|
var package_default = {
|
|
19547
19633
|
name: "@tscircuit/core",
|
|
19548
19634
|
type: "module",
|
|
19549
|
-
version: "0.0.
|
|
19635
|
+
version: "0.0.929",
|
|
19550
19636
|
types: "dist/index.d.ts",
|
|
19551
19637
|
main: "dist/index.js",
|
|
19552
19638
|
module: "dist/index.js",
|
|
@@ -19590,7 +19676,7 @@ var package_default = {
|
|
|
19590
19676
|
"@tscircuit/math-utils": "^0.0.29",
|
|
19591
19677
|
"@tscircuit/miniflex": "^0.0.4",
|
|
19592
19678
|
"@tscircuit/ngspice-spice-engine": "^0.0.8",
|
|
19593
|
-
"@tscircuit/props": "^0.0.
|
|
19679
|
+
"@tscircuit/props": "^0.0.429",
|
|
19594
19680
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
19595
19681
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
19596
19682
|
"@tscircuit/schematic-trace-solver": "^v0.0.45",
|
|
@@ -19604,7 +19690,7 @@ var package_default = {
|
|
|
19604
19690
|
"bun-match-svg": "0.0.12",
|
|
19605
19691
|
"calculate-elbow": "^0.0.12",
|
|
19606
19692
|
"chokidar-cli": "^3.0.0",
|
|
19607
|
-
"circuit-json": "^0.0.
|
|
19693
|
+
"circuit-json": "^0.0.335",
|
|
19608
19694
|
"circuit-json-to-bpc": "^0.0.13",
|
|
19609
19695
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
19610
19696
|
"circuit-json-to-gltf": "^0.0.31",
|
|
@@ -20117,6 +20203,7 @@ export {
|
|
|
20117
20203
|
FabricationNotePath,
|
|
20118
20204
|
FabricationNoteRect,
|
|
20119
20205
|
FabricationNoteText,
|
|
20206
|
+
Fiducial,
|
|
20120
20207
|
Footprint,
|
|
20121
20208
|
Fuse,
|
|
20122
20209
|
Group6 as Group,
|
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.930",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@tscircuit/math-utils": "^0.0.29",
|
|
46
46
|
"@tscircuit/miniflex": "^0.0.4",
|
|
47
47
|
"@tscircuit/ngspice-spice-engine": "^0.0.8",
|
|
48
|
-
"@tscircuit/props": "^0.0.
|
|
48
|
+
"@tscircuit/props": "^0.0.429",
|
|
49
49
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
50
50
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
51
51
|
"@tscircuit/schematic-trace-solver": "^v0.0.45",
|