@tscircuit/common 0.0.16 → 0.0.18
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 +7 -1
- package/dist/index.js +219 -0
- package/package.json +37 -37
package/dist/index.d.ts
CHANGED
|
@@ -33,4 +33,10 @@ type ProMicroBoardProps = ChipProps & BoardProps & {
|
|
|
33
33
|
};
|
|
34
34
|
declare const ProMicroBoard: ({ children, ...rest }: ProMicroBoardProps) => react_jsx_runtime.JSX.Element;
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
type ViaGridBoardProps = ChipProps & BoardProps & {
|
|
37
|
+
children?: any;
|
|
38
|
+
boardName?: string;
|
|
39
|
+
};
|
|
40
|
+
declare const ViaGridBoard: ({ children, ...rest }: ViaGridBoardProps) => react_jsx_runtime.JSX.Element;
|
|
41
|
+
|
|
42
|
+
export { ArduinoShield, MicroModBoard, ProMicroBoard, RaspberryPiHatBoard, ViaGridBoard, XiaoBoard };
|
package/dist/index.js
CHANGED
|
@@ -3455,11 +3455,230 @@ var ProMicroBoard = (_a) => {
|
|
|
3455
3455
|
})
|
|
3456
3456
|
);
|
|
3457
3457
|
};
|
|
3458
|
+
|
|
3459
|
+
// node_modules/@tscircuit/math-utils/dist/chunk-U45EKA3R.js
|
|
3460
|
+
function grid({
|
|
3461
|
+
rows,
|
|
3462
|
+
cols,
|
|
3463
|
+
xSpacing,
|
|
3464
|
+
ySpacing,
|
|
3465
|
+
width,
|
|
3466
|
+
height,
|
|
3467
|
+
offsetX = 0,
|
|
3468
|
+
offsetY = 0,
|
|
3469
|
+
yDirection = "cartesian",
|
|
3470
|
+
centered = true
|
|
3471
|
+
}) {
|
|
3472
|
+
const effectiveXSpacing = xSpacing != null ? xSpacing : 1;
|
|
3473
|
+
const effectiveYSpacing = ySpacing != null ? ySpacing : 1;
|
|
3474
|
+
const totalWidth = width != null ? width : cols * effectiveXSpacing;
|
|
3475
|
+
const totalHeight = height != null ? height : rows * effectiveYSpacing;
|
|
3476
|
+
const centeringOffsetX = centered ? -totalWidth / 2 : 0;
|
|
3477
|
+
const centeringOffsetY = centered ? -totalHeight / 2 : 0;
|
|
3478
|
+
const cellWidth = width ? width / cols : effectiveXSpacing;
|
|
3479
|
+
const cellHeight = height ? height / rows : effectiveYSpacing;
|
|
3480
|
+
const cells = [];
|
|
3481
|
+
for (let row = 0; row < rows; row++) {
|
|
3482
|
+
for (let col = 0; col < cols; col++) {
|
|
3483
|
+
const index = row * cols + col;
|
|
3484
|
+
const centerX = offsetX + centeringOffsetX + col * cellWidth + cellWidth / 2;
|
|
3485
|
+
const rawCenterY = offsetY + row * cellHeight + cellHeight / 2;
|
|
3486
|
+
const centerY = yDirection === "cartesian" ? offsetY + centeringOffsetY + (rows - 1 - row) * cellHeight + cellHeight / 2 : offsetY + centeringOffsetY + row * cellHeight + cellHeight / 2;
|
|
3487
|
+
cells.push({
|
|
3488
|
+
index,
|
|
3489
|
+
center: { x: centerX, y: centerY },
|
|
3490
|
+
topLeft: {
|
|
3491
|
+
x: centerX - cellWidth / 2,
|
|
3492
|
+
y: centerY + cellHeight / 2
|
|
3493
|
+
},
|
|
3494
|
+
bottomRight: {
|
|
3495
|
+
x: centerX + cellWidth / 2,
|
|
3496
|
+
y: centerY - cellHeight / 2
|
|
3497
|
+
},
|
|
3498
|
+
row,
|
|
3499
|
+
col
|
|
3500
|
+
});
|
|
3501
|
+
}
|
|
3502
|
+
}
|
|
3503
|
+
return cells;
|
|
3504
|
+
}
|
|
3505
|
+
|
|
3506
|
+
// lib/ViaGridBoard/viaGridElements.tsx
|
|
3507
|
+
var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
|
|
3508
|
+
var ViaGridVia = (props) => {
|
|
3509
|
+
const _a = props, { viaIndex } = _a, restProps = __objRest(_a, ["viaIndex"]);
|
|
3510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3511
|
+
"via",
|
|
3512
|
+
__spreadValues({
|
|
3513
|
+
name: `via_${viaIndex}`,
|
|
3514
|
+
fromLayer: "top",
|
|
3515
|
+
toLayer: "bottom",
|
|
3516
|
+
outerDiameter: "1.5mm",
|
|
3517
|
+
holeDiameter: "0.3mm"
|
|
3518
|
+
}, restProps)
|
|
3519
|
+
);
|
|
3520
|
+
};
|
|
3521
|
+
var ViaGridPlus = (props) => {
|
|
3522
|
+
const _a = props, { startIndex } = _a, restProps = __objRest(_a, ["startIndex"]);
|
|
3523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("group", __spreadProps(__spreadValues({}, restProps), { children: [
|
|
3524
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ViaGridVia, { pcbX: 0, pcbY: 0, viaIndex: startIndex }),
|
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ViaGridVia, { pcbX: 2.5, pcbY: 0, viaIndex: startIndex + 1 }),
|
|
3526
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ViaGridVia, { pcbX: 0, pcbY: 2.5, viaIndex: startIndex + 2 }),
|
|
3527
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ViaGridVia, { pcbX: -2.5, pcbY: 0, viaIndex: startIndex + 3 }),
|
|
3528
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ViaGridVia, { pcbX: 0, pcbY: -2.5, viaIndex: startIndex + 4 })
|
|
3529
|
+
] }));
|
|
3530
|
+
};
|
|
3531
|
+
var pacmanPolygonOutline = new OutlineBuilder(-0.2, -0.2).lineTo(-0.2, 2.5).arcTo(-2.5, 0, { radius: 2.5, sweep: true }).arcTo(0, -2.5, { radius: 2.5, sweep: true }).arcTo(2.5, -0.2, { radius: 2.5, sweep: true }).lineTo(-0.2, -0.2).toArray();
|
|
3532
|
+
|
|
3533
|
+
// lib/ViaGridBoard/ViaGridBoard.circuit.tsx
|
|
3534
|
+
var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
|
|
3535
|
+
var ViaGridBoard = (_a) => {
|
|
3536
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
3537
|
+
const { boardProps, chipProps = {} } = splitBoardAndChipProps(__spreadValues({}, rest));
|
|
3538
|
+
const resolvedName = `${chipProps.name}_chip`;
|
|
3539
|
+
const _a2 = chipProps, { name: _ } = _a2, chipRest = __objRest(_a2, ["name"]);
|
|
3540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3541
|
+
"board",
|
|
3542
|
+
__spreadProps(__spreadValues({}, boardProps), {
|
|
3543
|
+
width: "100mm",
|
|
3544
|
+
height: "65mm",
|
|
3545
|
+
boardAnchorPosition: { x: 0, y: 0 },
|
|
3546
|
+
boardAnchorAlignment: "bottom_left",
|
|
3547
|
+
children: [
|
|
3548
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3549
|
+
"pcbnoterect",
|
|
3550
|
+
{
|
|
3551
|
+
pcbX: 50,
|
|
3552
|
+
pcbY: 32.5,
|
|
3553
|
+
width: 90,
|
|
3554
|
+
height: 55,
|
|
3555
|
+
strokeWidth: 0.3,
|
|
3556
|
+
color: "blue"
|
|
3557
|
+
}
|
|
3558
|
+
),
|
|
3559
|
+
["BL", "TL", "TR", "BR"].map((cornerPositionName, index) => {
|
|
3560
|
+
const x = (cornerPositionName.includes("R") ? 90 : 0) + 5;
|
|
3561
|
+
const y = (cornerPositionName.includes("T") ? 55 : 0) + 5;
|
|
3562
|
+
const rotation = index * 90;
|
|
3563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3564
|
+
"chip",
|
|
3565
|
+
{
|
|
3566
|
+
name: cornerPositionName,
|
|
3567
|
+
pcbX: x,
|
|
3568
|
+
pcbY: y,
|
|
3569
|
+
noSchematicRepresentation: true,
|
|
3570
|
+
pcbRotation: -rotation,
|
|
3571
|
+
footprint: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("footprint", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3572
|
+
"smtpad",
|
|
3573
|
+
{
|
|
3574
|
+
pcbX: "0mm",
|
|
3575
|
+
pcbY: "0mm",
|
|
3576
|
+
layer: "top",
|
|
3577
|
+
shape: "polygon",
|
|
3578
|
+
portHints: ["pin1"],
|
|
3579
|
+
points: pacmanPolygonOutline
|
|
3580
|
+
}
|
|
3581
|
+
) })
|
|
3582
|
+
},
|
|
3583
|
+
"pacman_" + cornerPositionName
|
|
3584
|
+
);
|
|
3585
|
+
}),
|
|
3586
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ViaGridPlus, { pcbX: 30, pcbY: 25, startIndex: 0 }),
|
|
3587
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ViaGridPlus, { pcbX: 70, pcbY: 25, startIndex: 5 }),
|
|
3588
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ViaGridPlus, { pcbX: 30, pcbY: 40, startIndex: 10 }),
|
|
3589
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ViaGridPlus, { pcbX: 70, pcbY: 40, startIndex: 15 }),
|
|
3590
|
+
horizontalEdgeViaGridCells.map((cell) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3591
|
+
ViaGridVia,
|
|
3592
|
+
{
|
|
3593
|
+
pcbX: cell.center.x,
|
|
3594
|
+
pcbY: cell.center.y,
|
|
3595
|
+
viaIndex: cell.index + 20
|
|
3596
|
+
},
|
|
3597
|
+
cell.index
|
|
3598
|
+
)),
|
|
3599
|
+
verticalEdgeViaGridCells.map((cell) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3600
|
+
ViaGridVia,
|
|
3601
|
+
{
|
|
3602
|
+
pcbX: cell.center.x,
|
|
3603
|
+
pcbY: cell.center.y,
|
|
3604
|
+
viaIndex: cell.index + 54
|
|
3605
|
+
},
|
|
3606
|
+
cell.index
|
|
3607
|
+
)),
|
|
3608
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3609
|
+
"chip",
|
|
3610
|
+
{
|
|
3611
|
+
name: "TOP_RECT",
|
|
3612
|
+
noSchematicRepresentation: true,
|
|
3613
|
+
footprint: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("footprint", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3614
|
+
"smtpad",
|
|
3615
|
+
{
|
|
3616
|
+
pcbX: "50mm",
|
|
3617
|
+
pcbY: "62.5mm",
|
|
3618
|
+
layer: "top",
|
|
3619
|
+
shape: "rect",
|
|
3620
|
+
width: "40mm",
|
|
3621
|
+
height: "3mm",
|
|
3622
|
+
portHints: ["pin1"],
|
|
3623
|
+
cornerRadius: 0.5
|
|
3624
|
+
}
|
|
3625
|
+
) })
|
|
3626
|
+
}
|
|
3627
|
+
),
|
|
3628
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3629
|
+
"silkscreentext",
|
|
3630
|
+
{
|
|
3631
|
+
text: "VIAGRID TOP",
|
|
3632
|
+
fontSize: "1.5mm",
|
|
3633
|
+
pcbX: 50,
|
|
3634
|
+
pcbY: 2.5
|
|
3635
|
+
}
|
|
3636
|
+
),
|
|
3637
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("net", { name: "GND" })
|
|
3638
|
+
]
|
|
3639
|
+
})
|
|
3640
|
+
);
|
|
3641
|
+
};
|
|
3642
|
+
var horizontalEdgeViaGridCells = grid({
|
|
3643
|
+
rows: 2,
|
|
3644
|
+
cols: 17,
|
|
3645
|
+
// width: 80,
|
|
3646
|
+
// height: 45,
|
|
3647
|
+
xSpacing: 5,
|
|
3648
|
+
// if you want to provide the spacing instead of width
|
|
3649
|
+
ySpacing: 45,
|
|
3650
|
+
// if you want to provide the spacing instead of height
|
|
3651
|
+
offsetX: 90 / 2 + 5,
|
|
3652
|
+
// optional
|
|
3653
|
+
offsetY: 55 / 2 + 5,
|
|
3654
|
+
// optional
|
|
3655
|
+
yDirection: "up-is-negative"
|
|
3656
|
+
// optional, default: "cartesian"
|
|
3657
|
+
// centered: true // optional, default: true
|
|
3658
|
+
});
|
|
3659
|
+
var verticalEdgeViaGridCells = grid({
|
|
3660
|
+
rows: 8,
|
|
3661
|
+
cols: 2,
|
|
3662
|
+
// width: 80,
|
|
3663
|
+
// height: 45,
|
|
3664
|
+
xSpacing: 80,
|
|
3665
|
+
// if you want to provide the spacing instead of width
|
|
3666
|
+
ySpacing: 5,
|
|
3667
|
+
// if you want to provide the spacing instead of height
|
|
3668
|
+
offsetX: 90 / 2 + 5,
|
|
3669
|
+
// optional
|
|
3670
|
+
offsetY: 55 / 2 + 5,
|
|
3671
|
+
// optional
|
|
3672
|
+
yDirection: "up-is-negative"
|
|
3673
|
+
// optional, default: "cartesian"
|
|
3674
|
+
// centered: true // optional, default: true
|
|
3675
|
+
});
|
|
3458
3676
|
export {
|
|
3459
3677
|
ArduinoShield,
|
|
3460
3678
|
MicroModBoard,
|
|
3461
3679
|
ProMicroBoard,
|
|
3462
3680
|
RaspberryPiHatBoard,
|
|
3681
|
+
ViaGridBoard,
|
|
3463
3682
|
XiaoBoard
|
|
3464
3683
|
};
|
|
3465
3684
|
/*! Bundled license information:
|
package/package.json
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tscircuit/common",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": "./dist/index.js",
|
|
11
|
-
"types": "./dist/index.d.ts"
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"files": [
|
|
15
|
-
"dist"
|
|
16
|
-
],
|
|
17
|
-
"keywords": [
|
|
18
|
-
"tscircuit"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"dev": "tsci dev",
|
|
22
|
-
"build": "npm run build:lib",
|
|
23
|
-
"build:lib": "tsup --dts --format esm ./index.tsx",
|
|
24
|
-
"build:circuit": "tsci build",
|
|
25
|
-
"snapshot": "tsci snapshot",
|
|
26
|
-
"snapshot:update": "tsci snapshot --update --3d",
|
|
27
|
-
"start": "bunx tsci dev",
|
|
28
|
-
"format": "biome format --write",
|
|
29
|
-
"format:check": "biome format"
|
|
30
|
-
},
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"@biomejs/biome": "^2.2.4",
|
|
33
|
-
"@types/react": "^19.1.12",
|
|
34
|
-
"tscircuit": "^0.0.
|
|
35
|
-
"tsup": "^8.5.0"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@tscircuit/common",
|
|
3
|
+
"version": "0.0.18",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"keywords": [
|
|
18
|
+
"tscircuit"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"dev": "tsci dev",
|
|
22
|
+
"build": "npm run build:lib",
|
|
23
|
+
"build:lib": "tsup --dts --format esm ./index.tsx",
|
|
24
|
+
"build:circuit": "tsci build",
|
|
25
|
+
"snapshot": "tsci snapshot",
|
|
26
|
+
"snapshot:update": "tsci snapshot --update --3d",
|
|
27
|
+
"start": "bunx tsci dev",
|
|
28
|
+
"format": "biome format --write",
|
|
29
|
+
"format:check": "biome format"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@biomejs/biome": "^2.2.4",
|
|
33
|
+
"@types/react": "^19.1.12",
|
|
34
|
+
"tscircuit": "^0.0.860",
|
|
35
|
+
"tsup": "^8.5.0"
|
|
36
|
+
}
|
|
37
|
+
}
|