@tscircuit/core 0.0.806 → 0.0.808
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 +1344 -373
- package/dist/index.js +71 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -37,6 +37,7 @@ __export(components_exports, {
|
|
|
37
37
|
Net: () => Net,
|
|
38
38
|
NetLabel: () => NetLabel,
|
|
39
39
|
NormalComponent: () => NormalComponent3,
|
|
40
|
+
Panel: () => Panel,
|
|
40
41
|
PcbNoteDimension: () => PcbNoteDimension,
|
|
41
42
|
PcbNoteLine: () => PcbNoteLine,
|
|
42
43
|
PcbNotePath: () => PcbNotePath,
|
|
@@ -1028,6 +1029,9 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1028
1029
|
if (this.lowercaseComponentName === "board" && component.lowercaseComponentName === "board") {
|
|
1029
1030
|
throw new Error("Nested boards are not supported");
|
|
1030
1031
|
}
|
|
1032
|
+
if (component.lowercaseComponentName === "panel") {
|
|
1033
|
+
throw new Error("<panel> must be a root-level element");
|
|
1034
|
+
}
|
|
1031
1035
|
if (!component.onAddToParent) {
|
|
1032
1036
|
throw new Error(
|
|
1033
1037
|
`Invalid JSX Element: Expected a React component but received "${JSON.stringify(
|
|
@@ -3023,6 +3027,19 @@ var createComponentsFromCircuitJson = ({
|
|
|
3023
3027
|
portHints: elm.port_hints
|
|
3024
3028
|
})
|
|
3025
3029
|
);
|
|
3030
|
+
} else if (elm.type === "pcb_smtpad" && elm.shape === "pill") {
|
|
3031
|
+
components.push(
|
|
3032
|
+
new SmtPad({
|
|
3033
|
+
shape: "pill",
|
|
3034
|
+
height: elm.height,
|
|
3035
|
+
width: elm.width,
|
|
3036
|
+
radius: elm.radius,
|
|
3037
|
+
portHints: elm.port_hints,
|
|
3038
|
+
pcbX: elm.x,
|
|
3039
|
+
pcbY: elm.y,
|
|
3040
|
+
layer: elm.layer
|
|
3041
|
+
})
|
|
3042
|
+
);
|
|
3026
3043
|
} else if (elm.type === "pcb_silkscreen_path") {
|
|
3027
3044
|
components.push(
|
|
3028
3045
|
new SilkscreenPath({
|
|
@@ -6710,7 +6727,14 @@ var Trace3 = class extends PrimitiveComponent2 {
|
|
|
6710
6727
|
const match = selector.match(/^net\.(.+)$/);
|
|
6711
6728
|
const netName = match ? match[1] : null;
|
|
6712
6729
|
if (!netName) return null;
|
|
6713
|
-
const
|
|
6730
|
+
const board = this.root?._getBoard();
|
|
6731
|
+
if (!board) {
|
|
6732
|
+
this.renderError(
|
|
6733
|
+
`Could not find a <board> ancestor for ${this}, so net "${selector}" cannot be resolved`
|
|
6734
|
+
);
|
|
6735
|
+
return null;
|
|
6736
|
+
}
|
|
6737
|
+
const allDescendants = board.getDescendants();
|
|
6714
6738
|
return allDescendants.find(
|
|
6715
6739
|
(d) => d.componentName === "Net" && d._parsedProps.name === netName
|
|
6716
6740
|
) || null;
|
|
@@ -13753,6 +13777,32 @@ var Board = class extends Group6 {
|
|
|
13753
13777
|
}
|
|
13754
13778
|
};
|
|
13755
13779
|
|
|
13780
|
+
// lib/components/normal-components/Panel.ts
|
|
13781
|
+
import { panelProps } from "@tscircuit/props";
|
|
13782
|
+
var Panel = class extends Group6 {
|
|
13783
|
+
get config() {
|
|
13784
|
+
return {
|
|
13785
|
+
componentName: "Panel",
|
|
13786
|
+
zodProps: panelProps
|
|
13787
|
+
};
|
|
13788
|
+
}
|
|
13789
|
+
get isGroup() {
|
|
13790
|
+
return true;
|
|
13791
|
+
}
|
|
13792
|
+
add(component) {
|
|
13793
|
+
if (component.lowercaseComponentName !== "board") {
|
|
13794
|
+
throw new Error("<panel> can only contain <board> elements");
|
|
13795
|
+
}
|
|
13796
|
+
super.add(component);
|
|
13797
|
+
}
|
|
13798
|
+
runRenderCycle() {
|
|
13799
|
+
if (!this.children.some((child) => child.componentName === "Board")) {
|
|
13800
|
+
throw new Error("<panel> must contain at least one <board>");
|
|
13801
|
+
}
|
|
13802
|
+
super.runRenderCycle();
|
|
13803
|
+
}
|
|
13804
|
+
};
|
|
13805
|
+
|
|
13756
13806
|
// lib/components/normal-components/Capacitor.ts
|
|
13757
13807
|
import { capacitorProps } from "@tscircuit/props";
|
|
13758
13808
|
|
|
@@ -17161,7 +17211,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
17161
17211
|
var package_default = {
|
|
17162
17212
|
name: "@tscircuit/core",
|
|
17163
17213
|
type: "module",
|
|
17164
|
-
version: "0.0.
|
|
17214
|
+
version: "0.0.807",
|
|
17165
17215
|
types: "dist/index.d.ts",
|
|
17166
17216
|
main: "dist/index.js",
|
|
17167
17217
|
module: "dist/index.js",
|
|
@@ -17321,9 +17371,11 @@ var RootCircuit = class {
|
|
|
17321
17371
|
* Get the main board for this Circuit.
|
|
17322
17372
|
*/
|
|
17323
17373
|
_getBoard() {
|
|
17324
|
-
|
|
17325
|
-
|
|
17326
|
-
|
|
17374
|
+
const directBoard = this.children.find((c) => c.componentName === "Board");
|
|
17375
|
+
if (directBoard) {
|
|
17376
|
+
return directBoard;
|
|
17377
|
+
}
|
|
17378
|
+
return void 0;
|
|
17327
17379
|
}
|
|
17328
17380
|
_guessRootComponent() {
|
|
17329
17381
|
if (this.firstChild) return;
|
|
@@ -17332,6 +17384,19 @@ var RootCircuit = class {
|
|
|
17332
17384
|
"Not able to guess root component: RootCircuit has no children (use circuit.add(...))"
|
|
17333
17385
|
);
|
|
17334
17386
|
}
|
|
17387
|
+
const panels = this.children.filter(
|
|
17388
|
+
(child) => child.lowercaseComponentName === "panel"
|
|
17389
|
+
);
|
|
17390
|
+
if (panels.length > 1) {
|
|
17391
|
+
throw new Error("Only one <panel> is allowed per circuit");
|
|
17392
|
+
}
|
|
17393
|
+
if (panels.length === 1) {
|
|
17394
|
+
if (this.children.length !== 1) {
|
|
17395
|
+
throw new Error("<panel> must be the root element of the circuit");
|
|
17396
|
+
}
|
|
17397
|
+
this.firstChild = panels[0];
|
|
17398
|
+
return;
|
|
17399
|
+
}
|
|
17335
17400
|
if (this.children.length === 1 && this.children[0].isGroup) {
|
|
17336
17401
|
this.firstChild = this.children[0];
|
|
17337
17402
|
return;
|
|
@@ -17699,6 +17764,7 @@ export {
|
|
|
17699
17764
|
Net,
|
|
17700
17765
|
NetLabel,
|
|
17701
17766
|
NormalComponent3 as NormalComponent,
|
|
17767
|
+
Panel,
|
|
17702
17768
|
PcbNoteDimension,
|
|
17703
17769
|
PcbNoteLine,
|
|
17704
17770
|
PcbNotePath,
|