@tscircuit/props 0.0.317 → 0.0.319
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/README.md +35 -0
- package/dist/index.d.ts +301 -166
- package/dist/index.js +121 -93
- package/dist/index.js.map +1 -1
- package/lib/common/cadModel.ts +5 -0
- package/lib/components/cadassembly.ts +28 -0
- package/lib/components/cadmodel.ts +28 -0
- package/lib/index.ts +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -86,6 +86,9 @@ var cadModelJscad = cadModelBase.extend({
|
|
|
86
86
|
var cadModelProp = z5.union([
|
|
87
87
|
z5.null(),
|
|
88
88
|
z5.string(),
|
|
89
|
+
z5.custom((v) => {
|
|
90
|
+
return v && typeof v === "object" && "type" in v && "props" in v;
|
|
91
|
+
}),
|
|
89
92
|
cadModelStl,
|
|
90
93
|
cadModelObj,
|
|
91
94
|
cadModelGltf,
|
|
@@ -1503,6 +1506,29 @@ var copperPourProps = z70.object({
|
|
|
1503
1506
|
});
|
|
1504
1507
|
expectTypesMatch(true);
|
|
1505
1508
|
|
|
1509
|
+
// lib/components/cadassembly.ts
|
|
1510
|
+
import { layer_ref as layer_ref7 } from "circuit-json";
|
|
1511
|
+
import { z as z71 } from "zod";
|
|
1512
|
+
var cadassemblyProps = z71.object({
|
|
1513
|
+
originalLayer: layer_ref7.default("top").optional(),
|
|
1514
|
+
children: z71.any().optional()
|
|
1515
|
+
});
|
|
1516
|
+
expectTypesMatch(true);
|
|
1517
|
+
|
|
1518
|
+
// lib/components/cadmodel.ts
|
|
1519
|
+
import { z as z72 } from "zod";
|
|
1520
|
+
var pcbPosition = z72.object({
|
|
1521
|
+
pcbX: distance.optional(),
|
|
1522
|
+
pcbY: distance.optional(),
|
|
1523
|
+
pcbZ: distance.optional()
|
|
1524
|
+
});
|
|
1525
|
+
var cadModelBaseWithUrl = cadModelBase.extend({
|
|
1526
|
+
modelUrl: z72.string()
|
|
1527
|
+
});
|
|
1528
|
+
var cadModelObject = cadModelBaseWithUrl.merge(pcbPosition);
|
|
1529
|
+
expectTypesMatch(true);
|
|
1530
|
+
var cadmodelProps = z72.union([z72.null(), z72.string(), cadModelObject]);
|
|
1531
|
+
|
|
1506
1532
|
// lib/components/power-source.ts
|
|
1507
1533
|
import { voltage as voltage3 } from "circuit-json";
|
|
1508
1534
|
var powerSourceProps = commonComponentProps.extend({
|
|
@@ -1511,9 +1537,9 @@ var powerSourceProps = commonComponentProps.extend({
|
|
|
1511
1537
|
|
|
1512
1538
|
// lib/components/voltagesource.ts
|
|
1513
1539
|
import { frequency as frequency3, rotation as rotation4, voltage as voltage4 } from "circuit-json";
|
|
1514
|
-
import { z as
|
|
1540
|
+
import { z as z73 } from "zod";
|
|
1515
1541
|
var voltageSourcePinLabels = ["pin1", "pin2", "pos", "neg"];
|
|
1516
|
-
var percentage =
|
|
1542
|
+
var percentage = z73.union([z73.string(), z73.number()]).transform((val) => {
|
|
1517
1543
|
if (typeof val === "string") {
|
|
1518
1544
|
if (val.endsWith("%")) {
|
|
1519
1545
|
return parseFloat(val.slice(0, -1)) / 100;
|
|
@@ -1522,13 +1548,13 @@ var percentage = z71.union([z71.string(), z71.number()]).transform((val) => {
|
|
|
1522
1548
|
}
|
|
1523
1549
|
return val;
|
|
1524
1550
|
}).pipe(
|
|
1525
|
-
|
|
1551
|
+
z73.number().min(0, "Duty cycle must be non-negative").max(1, "Duty cycle cannot be greater than 100%")
|
|
1526
1552
|
);
|
|
1527
1553
|
var voltageSourceProps = commonComponentProps.extend({
|
|
1528
1554
|
voltage: voltage4.optional(),
|
|
1529
1555
|
frequency: frequency3.optional(),
|
|
1530
1556
|
peakToPeakVoltage: voltage4.optional(),
|
|
1531
|
-
waveShape:
|
|
1557
|
+
waveShape: z73.enum(["sinewave", "square", "triangle", "sawtooth"]).optional(),
|
|
1532
1558
|
phase: rotation4.optional(),
|
|
1533
1559
|
dutyCycle: percentage.optional(),
|
|
1534
1560
|
connections: createConnectionsProp(voltageSourcePinLabels).optional()
|
|
@@ -1538,11 +1564,11 @@ expectTypesMatch(true);
|
|
|
1538
1564
|
|
|
1539
1565
|
// lib/components/schematic-box.ts
|
|
1540
1566
|
import { distance as distance19 } from "circuit-json";
|
|
1541
|
-
import { z as
|
|
1567
|
+
import { z as z75 } from "zod";
|
|
1542
1568
|
|
|
1543
1569
|
// lib/common/ninePointAnchor.ts
|
|
1544
|
-
import { z as
|
|
1545
|
-
var ninePointAnchor =
|
|
1570
|
+
import { z as z74 } from "zod";
|
|
1571
|
+
var ninePointAnchor = z74.enum([
|
|
1546
1572
|
"top_left",
|
|
1547
1573
|
"top_center",
|
|
1548
1574
|
"top_right",
|
|
@@ -1555,23 +1581,23 @@ var ninePointAnchor = z72.enum([
|
|
|
1555
1581
|
]);
|
|
1556
1582
|
|
|
1557
1583
|
// lib/components/schematic-box.ts
|
|
1558
|
-
var schematicBoxProps =
|
|
1584
|
+
var schematicBoxProps = z75.object({
|
|
1559
1585
|
schX: distance19.optional(),
|
|
1560
1586
|
schY: distance19.optional(),
|
|
1561
1587
|
width: distance19.optional(),
|
|
1562
1588
|
height: distance19.optional(),
|
|
1563
|
-
overlay:
|
|
1589
|
+
overlay: z75.array(z75.string()).optional(),
|
|
1564
1590
|
padding: distance19.optional(),
|
|
1565
1591
|
paddingLeft: distance19.optional(),
|
|
1566
1592
|
paddingRight: distance19.optional(),
|
|
1567
1593
|
paddingTop: distance19.optional(),
|
|
1568
1594
|
paddingBottom: distance19.optional(),
|
|
1569
|
-
title:
|
|
1595
|
+
title: z75.string().optional(),
|
|
1570
1596
|
titleAlignment: ninePointAnchor.default("top_left"),
|
|
1571
|
-
titleColor:
|
|
1597
|
+
titleColor: z75.string().optional(),
|
|
1572
1598
|
titleFontSize: distance19.optional(),
|
|
1573
|
-
titleInside:
|
|
1574
|
-
strokeStyle:
|
|
1599
|
+
titleInside: z75.boolean().default(false),
|
|
1600
|
+
strokeStyle: z75.enum(["solid", "dashed"]).default("solid")
|
|
1575
1601
|
}).refine(
|
|
1576
1602
|
(elm) => elm.width !== void 0 && elm.height !== void 0 || Array.isArray(elm.overlay) && elm.overlay.length > 0,
|
|
1577
1603
|
{
|
|
@@ -1586,8 +1612,8 @@ var schematicBoxProps = z73.object({
|
|
|
1586
1612
|
|
|
1587
1613
|
// lib/components/schematic-line.ts
|
|
1588
1614
|
import { distance as distance20 } from "circuit-json";
|
|
1589
|
-
import { z as
|
|
1590
|
-
var schematicLineProps =
|
|
1615
|
+
import { z as z76 } from "zod";
|
|
1616
|
+
var schematicLineProps = z76.object({
|
|
1591
1617
|
x1: distance20,
|
|
1592
1618
|
y1: distance20,
|
|
1593
1619
|
x2: distance20,
|
|
@@ -1596,11 +1622,11 @@ var schematicLineProps = z74.object({
|
|
|
1596
1622
|
|
|
1597
1623
|
// lib/components/schematic-text.ts
|
|
1598
1624
|
import { distance as distance21, rotation as rotation5 } from "circuit-json";
|
|
1599
|
-
import { z as
|
|
1625
|
+
import { z as z78 } from "zod";
|
|
1600
1626
|
|
|
1601
1627
|
// lib/common/fivePointAnchor.ts
|
|
1602
|
-
import { z as
|
|
1603
|
-
var fivePointAnchor =
|
|
1628
|
+
import { z as z77 } from "zod";
|
|
1629
|
+
var fivePointAnchor = z77.enum([
|
|
1604
1630
|
"center",
|
|
1605
1631
|
"left",
|
|
1606
1632
|
"right",
|
|
@@ -1609,32 +1635,32 @@ var fivePointAnchor = z75.enum([
|
|
|
1609
1635
|
]);
|
|
1610
1636
|
|
|
1611
1637
|
// lib/components/schematic-text.ts
|
|
1612
|
-
var schematicTextProps =
|
|
1638
|
+
var schematicTextProps = z78.object({
|
|
1613
1639
|
schX: distance21.optional(),
|
|
1614
1640
|
schY: distance21.optional(),
|
|
1615
|
-
text:
|
|
1616
|
-
fontSize:
|
|
1617
|
-
anchor:
|
|
1618
|
-
color:
|
|
1641
|
+
text: z78.string(),
|
|
1642
|
+
fontSize: z78.number().default(1),
|
|
1643
|
+
anchor: z78.union([fivePointAnchor.describe("legacy"), ninePointAnchor]).default("center"),
|
|
1644
|
+
color: z78.string().default("#000000"),
|
|
1619
1645
|
schRotation: rotation5.default(0)
|
|
1620
1646
|
});
|
|
1621
1647
|
|
|
1622
1648
|
// lib/components/schematic-path.ts
|
|
1623
1649
|
import { point as point5 } from "circuit-json";
|
|
1624
|
-
import { z as
|
|
1625
|
-
var schematicPathProps =
|
|
1626
|
-
points:
|
|
1627
|
-
isFilled:
|
|
1628
|
-
fillColor:
|
|
1650
|
+
import { z as z79 } from "zod";
|
|
1651
|
+
var schematicPathProps = z79.object({
|
|
1652
|
+
points: z79.array(point5),
|
|
1653
|
+
isFilled: z79.boolean().optional().default(false),
|
|
1654
|
+
fillColor: z79.enum(["red", "blue"]).optional()
|
|
1629
1655
|
});
|
|
1630
1656
|
|
|
1631
1657
|
// lib/components/schematic-table.ts
|
|
1632
1658
|
import { distance as distance22 } from "circuit-json";
|
|
1633
|
-
import { z as
|
|
1634
|
-
var schematicTableProps =
|
|
1659
|
+
import { z as z80 } from "zod";
|
|
1660
|
+
var schematicTableProps = z80.object({
|
|
1635
1661
|
schX: distance22.optional(),
|
|
1636
1662
|
schY: distance22.optional(),
|
|
1637
|
-
children:
|
|
1663
|
+
children: z80.any().optional(),
|
|
1638
1664
|
cellPadding: distance22.optional(),
|
|
1639
1665
|
borderWidth: distance22.optional(),
|
|
1640
1666
|
anchor: ninePointAnchor.optional(),
|
|
@@ -1644,53 +1670,53 @@ expectTypesMatch(true);
|
|
|
1644
1670
|
|
|
1645
1671
|
// lib/components/schematic-row.ts
|
|
1646
1672
|
import { distance as distance23 } from "circuit-json";
|
|
1647
|
-
import { z as
|
|
1648
|
-
var schematicRowProps =
|
|
1649
|
-
children:
|
|
1673
|
+
import { z as z81 } from "zod";
|
|
1674
|
+
var schematicRowProps = z81.object({
|
|
1675
|
+
children: z81.any().optional(),
|
|
1650
1676
|
height: distance23.optional()
|
|
1651
1677
|
});
|
|
1652
1678
|
expectTypesMatch(true);
|
|
1653
1679
|
|
|
1654
1680
|
// lib/components/schematic-cell.ts
|
|
1655
1681
|
import { distance as distance24 } from "circuit-json";
|
|
1656
|
-
import { z as
|
|
1657
|
-
var schematicCellProps =
|
|
1658
|
-
children:
|
|
1659
|
-
horizontalAlign:
|
|
1660
|
-
verticalAlign:
|
|
1682
|
+
import { z as z82 } from "zod";
|
|
1683
|
+
var schematicCellProps = z82.object({
|
|
1684
|
+
children: z82.string().optional(),
|
|
1685
|
+
horizontalAlign: z82.enum(["left", "center", "right"]).optional(),
|
|
1686
|
+
verticalAlign: z82.enum(["top", "middle", "bottom"]).optional(),
|
|
1661
1687
|
fontSize: distance24.optional(),
|
|
1662
|
-
rowSpan:
|
|
1663
|
-
colSpan:
|
|
1688
|
+
rowSpan: z82.number().optional(),
|
|
1689
|
+
colSpan: z82.number().optional(),
|
|
1664
1690
|
width: distance24.optional(),
|
|
1665
|
-
text:
|
|
1691
|
+
text: z82.string().optional()
|
|
1666
1692
|
});
|
|
1667
1693
|
expectTypesMatch(true);
|
|
1668
1694
|
|
|
1669
1695
|
// lib/components/silkscreen-text.ts
|
|
1670
|
-
import { layer_ref as
|
|
1671
|
-
import { z as
|
|
1696
|
+
import { layer_ref as layer_ref8, length as length5 } from "circuit-json";
|
|
1697
|
+
import { z as z83 } from "zod";
|
|
1672
1698
|
var silkscreenTextProps = pcbLayoutProps.extend({
|
|
1673
|
-
text:
|
|
1699
|
+
text: z83.string(),
|
|
1674
1700
|
anchorAlignment: ninePointAnchor.default("center"),
|
|
1675
|
-
font:
|
|
1701
|
+
font: z83.enum(["tscircuit2024"]).optional(),
|
|
1676
1702
|
fontSize: length5.optional(),
|
|
1677
1703
|
/**
|
|
1678
1704
|
* If true, text will knock out underlying silkscreen
|
|
1679
1705
|
*/
|
|
1680
|
-
isKnockout:
|
|
1706
|
+
isKnockout: z83.boolean().optional(),
|
|
1681
1707
|
knockoutPadding: length5.optional(),
|
|
1682
1708
|
knockoutPaddingLeft: length5.optional(),
|
|
1683
1709
|
knockoutPaddingRight: length5.optional(),
|
|
1684
1710
|
knockoutPaddingTop: length5.optional(),
|
|
1685
1711
|
knockoutPaddingBottom: length5.optional(),
|
|
1686
|
-
layers:
|
|
1712
|
+
layers: z83.array(layer_ref8).optional()
|
|
1687
1713
|
});
|
|
1688
1714
|
|
|
1689
1715
|
// lib/components/silkscreen-path.ts
|
|
1690
1716
|
import { length as length6, route_hint_point as route_hint_point5 } from "circuit-json";
|
|
1691
|
-
import { z as
|
|
1717
|
+
import { z as z84 } from "zod";
|
|
1692
1718
|
var silkscreenPathProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotation: true }).extend({
|
|
1693
|
-
route:
|
|
1719
|
+
route: z84.array(route_hint_point5),
|
|
1694
1720
|
strokeWidth: length6.optional()
|
|
1695
1721
|
});
|
|
1696
1722
|
|
|
@@ -1706,10 +1732,10 @@ var silkscreenLineProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotat
|
|
|
1706
1732
|
|
|
1707
1733
|
// lib/components/silkscreen-rect.ts
|
|
1708
1734
|
import { distance as distance26 } from "circuit-json";
|
|
1709
|
-
import { z as
|
|
1735
|
+
import { z as z85 } from "zod";
|
|
1710
1736
|
var silkscreenRectProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
1711
|
-
filled:
|
|
1712
|
-
stroke:
|
|
1737
|
+
filled: z85.boolean().default(true).optional(),
|
|
1738
|
+
stroke: z85.enum(["dashed", "solid", "none"]).optional(),
|
|
1713
1739
|
strokeWidth: distance26.optional(),
|
|
1714
1740
|
width: distance26,
|
|
1715
1741
|
height: distance26
|
|
@@ -1717,71 +1743,71 @@ var silkscreenRectProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
|
1717
1743
|
|
|
1718
1744
|
// lib/components/silkscreen-circle.ts
|
|
1719
1745
|
import { distance as distance27 } from "circuit-json";
|
|
1720
|
-
import { z as
|
|
1746
|
+
import { z as z86 } from "zod";
|
|
1721
1747
|
var silkscreenCircleProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
1722
|
-
isFilled:
|
|
1723
|
-
isOutline:
|
|
1748
|
+
isFilled: z86.boolean().optional(),
|
|
1749
|
+
isOutline: z86.boolean().optional(),
|
|
1724
1750
|
strokeWidth: distance27.optional(),
|
|
1725
1751
|
radius: distance27
|
|
1726
1752
|
});
|
|
1727
1753
|
|
|
1728
1754
|
// lib/components/trace-hint.ts
|
|
1729
|
-
import { distance as distance28, layer_ref as
|
|
1730
|
-
import { z as
|
|
1731
|
-
var routeHintPointProps =
|
|
1755
|
+
import { distance as distance28, layer_ref as layer_ref9, route_hint_point as route_hint_point6 } from "circuit-json";
|
|
1756
|
+
import { z as z87 } from "zod";
|
|
1757
|
+
var routeHintPointProps = z87.object({
|
|
1732
1758
|
x: distance28,
|
|
1733
1759
|
y: distance28,
|
|
1734
|
-
via:
|
|
1735
|
-
toLayer:
|
|
1760
|
+
via: z87.boolean().optional(),
|
|
1761
|
+
toLayer: layer_ref9.optional()
|
|
1736
1762
|
});
|
|
1737
|
-
var traceHintProps =
|
|
1738
|
-
for:
|
|
1763
|
+
var traceHintProps = z87.object({
|
|
1764
|
+
for: z87.string().optional().describe(
|
|
1739
1765
|
"Selector for the port you're targeting, not required if you're inside a trace"
|
|
1740
1766
|
),
|
|
1741
|
-
order:
|
|
1767
|
+
order: z87.number().optional(),
|
|
1742
1768
|
offset: route_hint_point6.or(routeHintPointProps).optional(),
|
|
1743
|
-
offsets:
|
|
1744
|
-
traceWidth:
|
|
1769
|
+
offsets: z87.array(route_hint_point6).or(z87.array(routeHintPointProps)).optional(),
|
|
1770
|
+
traceWidth: z87.number().optional()
|
|
1745
1771
|
});
|
|
1746
1772
|
|
|
1747
1773
|
// lib/components/port.ts
|
|
1748
|
-
import { z as
|
|
1774
|
+
import { z as z88 } from "zod";
|
|
1749
1775
|
var portProps = commonLayoutProps.extend({
|
|
1750
|
-
name:
|
|
1751
|
-
pinNumber:
|
|
1752
|
-
aliases:
|
|
1776
|
+
name: z88.string(),
|
|
1777
|
+
pinNumber: z88.number().optional(),
|
|
1778
|
+
aliases: z88.array(z88.string()).optional(),
|
|
1753
1779
|
direction
|
|
1754
1780
|
});
|
|
1755
1781
|
|
|
1756
1782
|
// lib/platformConfig.ts
|
|
1757
|
-
import { z as
|
|
1758
|
-
var unvalidatedCircuitJson =
|
|
1759
|
-
var footprintLibraryResult =
|
|
1760
|
-
footprintCircuitJson:
|
|
1783
|
+
import { z as z89 } from "zod";
|
|
1784
|
+
var unvalidatedCircuitJson = z89.array(z89.any()).describe("Circuit JSON");
|
|
1785
|
+
var footprintLibraryResult = z89.object({
|
|
1786
|
+
footprintCircuitJson: z89.array(z89.any()),
|
|
1761
1787
|
cadModel: cadModelProp.optional()
|
|
1762
1788
|
});
|
|
1763
|
-
var pathToCircuitJsonFn =
|
|
1764
|
-
var platformConfig =
|
|
1789
|
+
var pathToCircuitJsonFn = z89.function().args(z89.string()).returns(z89.promise(footprintLibraryResult)).describe("A function that takes a path and returns Circuit JSON");
|
|
1790
|
+
var platformConfig = z89.object({
|
|
1765
1791
|
partsEngine: partsEngine.optional(),
|
|
1766
1792
|
autorouter: autorouterProp.optional(),
|
|
1767
|
-
registryApiUrl:
|
|
1768
|
-
cloudAutorouterUrl:
|
|
1769
|
-
projectName:
|
|
1770
|
-
projectBaseUrl:
|
|
1771
|
-
version:
|
|
1772
|
-
url:
|
|
1773
|
-
printBoardInformationToSilkscreen:
|
|
1774
|
-
localCacheEngine:
|
|
1775
|
-
pcbDisabled:
|
|
1776
|
-
schematicDisabled:
|
|
1777
|
-
partsEngineDisabled:
|
|
1778
|
-
footprintLibraryMap:
|
|
1779
|
-
|
|
1780
|
-
|
|
1793
|
+
registryApiUrl: z89.string().optional(),
|
|
1794
|
+
cloudAutorouterUrl: z89.string().optional(),
|
|
1795
|
+
projectName: z89.string().optional(),
|
|
1796
|
+
projectBaseUrl: z89.string().optional(),
|
|
1797
|
+
version: z89.string().optional(),
|
|
1798
|
+
url: z89.string().optional(),
|
|
1799
|
+
printBoardInformationToSilkscreen: z89.boolean().optional(),
|
|
1800
|
+
localCacheEngine: z89.any().optional(),
|
|
1801
|
+
pcbDisabled: z89.boolean().optional(),
|
|
1802
|
+
schematicDisabled: z89.boolean().optional(),
|
|
1803
|
+
partsEngineDisabled: z89.boolean().optional(),
|
|
1804
|
+
footprintLibraryMap: z89.record(
|
|
1805
|
+
z89.string(),
|
|
1806
|
+
z89.union([
|
|
1781
1807
|
pathToCircuitJsonFn,
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1808
|
+
z89.record(
|
|
1809
|
+
z89.string(),
|
|
1810
|
+
z89.union([unvalidatedCircuitJson, pathToCircuitJsonFn])
|
|
1785
1811
|
)
|
|
1786
1812
|
])
|
|
1787
1813
|
).optional()
|
|
@@ -1808,6 +1834,8 @@ export {
|
|
|
1808
1834
|
cadModelStep,
|
|
1809
1835
|
cadModelStl,
|
|
1810
1836
|
cadModelWrl,
|
|
1837
|
+
cadassemblyProps,
|
|
1838
|
+
cadmodelProps,
|
|
1811
1839
|
capacitorPinLabels,
|
|
1812
1840
|
capacitorPins,
|
|
1813
1841
|
capacitorProps,
|