Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions bun.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"react-cosmos-plugin-vite": "7.0.0-beta.0",
"react-dom": "19.1.0",
"react-use": "^17.4.0",
"tscircuit": "^0.0.1015",
"tscircuit": "^0.0.1040",
"tsup": "^8.0.2",
"type-fest": "^3.0.0",
"typescript": "^5.4.4",
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"
import { Circuit } from "@tscircuit/core"
import { useEffect, useMemo, useState } from "react"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"
import React from "react"

export const FabricationNoteDimension: React.FC = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"
import React from "react"

export const FabricationNoteRect: React.FC = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"
import { Circuit } from "@tscircuit/core"
import type { GraphicsObject } from "graphics-debug"
import { Fragment, useEffect, useMemo, useRef, useState } from "react"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type React from "react"
import type { AnyCircuitElement } from "circuit-json"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

const circuitJson: AnyCircuitElement[] = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Circuit } from "@tscircuit/core"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const BasicRectangleBoard = () => {
const circuit = new Circuit()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CanvasElementsRenderer } from "../components/CanvasElementsRenderer"
import { CanvasElementsRenderer } from "../../components/CanvasElementsRenderer"
import { ContextProviders } from "../../components/ContextProviders"
import { useState } from "react"
import { useMeasure } from "react-use"
import useMouseMatrixTransform from "use-mouse-matrix-transform"
Expand Down Expand Up @@ -123,26 +124,28 @@ const CanvasElementsTest = () => {
return (
<div ref={transformRef as any}>
<div ref={ref as any}>
<CanvasElementsRenderer
key={refDimensions.width}
elements={exampleSoup as any}
transform={transform}
height={600}
width={refDimensions.width}
grid={{
spacing: 1,
view_window: {
left: 0,
right: refDimensions.width || 500,
top: 600,
bottom: 0,
},
}}
allowEditing={false}
cancelPanDrag={() => {}}
onCreateEditEvent={() => {}}
onModifyEditEvent={() => {}}
/>
<ContextProviders>
<CanvasElementsRenderer
key={refDimensions.width}
elements={exampleSoup as any}
transform={transform}
height={600}
width={refDimensions.width}
grid={{
spacing: 1,
view_window: {
left: 0,
right: refDimensions.width || 500,
top: 600,
bottom: 0,
},
}}
allowEditing={false}
cancelPanDrag={() => {}}
onCreateEditEvent={() => {}}
onModifyEditEvent={() => {}}
/>
</ContextProviders>
</div>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const PlatedHoleRotatedPillWithRectPad: React.FC = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type React from "react"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

const silkscreenCircuitJson = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Circuit } from "@tscircuit/core"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

const ConnectedResistors = () => {
const circuit = new Circuit()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Circuit } from "@tscircuit/core"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const CoordinateFlip = () => {
const circuit = new Circuit()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type React from "react"
import type { AnyCircuitElement, PcbCopperPour } from "circuit-json"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const CopperPour: React.FC = () => {
const soup: AnyCircuitElement[] = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type React from "react"
import type { AnyCircuitElement } from "circuit-json"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const CopperText: React.FC = () => {
const soup: AnyCircuitElement[] = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

const CornerRadiusCircuitJson = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"
import { Circuit } from "@tscircuit/core"
import type { GraphicsObject } from "graphics-debug"
import { useEffect, useState } from "react"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"
import { circuitJson } from "./pcb-group.fixture"

export const DisablePcbGroupsComparison = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"
import type { PcbTraceError } from "circuit-json"

export const ErrorHoverHighlight: React.FC = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"
import { Circuit } from "@tscircuit/core"

export const ErrorInCircuit: React.FC = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Circuit } from "@tscircuit/core"
import type React from "react"
import { PCBViewer } from "../../PCBViewer"
import { PCBViewer } from "../../../PCBViewer"

export const FabricationPath: React.FC = () => {
const circuit = new Circuit()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Circuit } from "@tscircuit/core"
import type React from "react"
import { PCBViewer } from "../../PCBViewer"
import { PCBViewer } from "../../../PCBViewer"

export const FabricationNoteText: React.FC = () => {
const circuit = new Circuit()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Circuit } from "@tscircuit/core"
import { PCBViewer } from "../../PCBViewer"
import { PCBViewer } from "../../../PCBViewer"

const ClickToEnableInteractionDemo: React.FC = () => {
const circuit = new Circuit()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type React from "react"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"
import { AnyCircuitElement } from "circuit-json"

export const GroupAnchorHoverOffset: React.FC = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type React from "react"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"
import { AnyCircuitElement } from "circuit-json"

export const GroupToGroupAndBoardAnchor: React.FC = () => {
Expand Down Expand Up @@ -234,8 +234,8 @@ export const GroupToGroupAndBoardAnchor: React.FC = () => {
anchor_alignment: "center",
position_mode: "relative_to_group_anchor",
positioned_relative_to_pcb_group_id: "group_1",
display_offset_x: "Group Δx: 12.00mm",
display_offset_y: "Group Δy: 0.00mm",
display_offset_x: "12.00mm",
display_offset_y: "0.00mm",
pcb_component_ids: ["pcb_resistor_3", "pcb_resistor_4"],
},
// Group 3 - Positioned relative to Board center (0, 0) - clearly different from Group 1
Expand Down Expand Up @@ -326,8 +326,8 @@ export const GroupToGroupAndBoardAnchor: React.FC = () => {
anchor_alignment: "center",
position_mode: "relative_to_group_anchor",
positioned_relative_to_pcb_board_id: "pcb_board_0",
display_offset_x: "Board Δx: -7.00mm",
display_offset_y: "Board Δy: 8.00mm",
display_offset_x: "-7.00mm",
display_offset_y: "8.00mm",
pcb_component_ids: ["pcb_resistor_5", "pcb_resistor_6"],
},
] as AnyCircuitElement[]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const RectangularHole = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const RotatedPillHole = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"
import { Circuit } from "@tscircuit/core"

export const HoleExample: React.FC = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const HoleWithPolygonPadFixture = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Circuit } from "@tscircuit/core"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

const HoverBehaviorDemo: React.FC<{ focusOnHover?: boolean }> = ({
focusOnHover,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Circuit } from "@tscircuit/core"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const SpacedResistors = () => {
const circuit = new Circuit()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Circuit } from "@tscircuit/core"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const KeepoutRectExample = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import React from "react"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"
import { Circuit } from "@tscircuit/core"
import { MacroKeypad } from "./story-components/MacroKeypad"
import { MacroKeypad } from "../../assets/story-components/MacroKeypad"

export const KeyboardExample: React.FC = () => {
const circuit = new Circuit()

circuit.add(
<board width="10mm" height="10mm">
<MacroKeypad />
</board>,
)
circuit.add(<MacroKeypad />)

const soup = circuit.getCircuitJson()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import { PCBViewer } from "../PCBViewer"
import timer555 from "./assets/timer-555"
import { PCBViewer } from "../../PCBViewer"
import timer555 from "../../assets/timer-555"

export const LongLineErrorExample: React.FC = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type React from "react"
import { Circuit } from "@tscircuit/core"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

const ManualConfliictsWarningBox: React.FC = () => {
const circuit = new Circuit()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Circuit } from "@tscircuit/core"
import type React from "react"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const MultiLayerCircuit: React.FC = () => {
const circuit = new Circuit()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PCBViewer } from "../../PCBViewer"
import { PCBViewer } from "../../../PCBViewer"
import type { AnyCircuitElement } from "circuit-json"

const EightLayerCircuit = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { PCBViewer } from "../../PCBViewer"
import { PCBViewer } from "../../../PCBViewer"
import type { AnyCircuitElement } from "circuit-json"

export const FourLayerCircuit: React.FC = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PCBViewer } from "../../PCBViewer"
import { PCBViewer } from "../../../PCBViewer"
import type { AnyCircuitElement } from "circuit-json"

const OverlappingLayersTest = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { PCBViewer } from "../../PCBViewer"
import { PCBViewer } from "../../../PCBViewer"
import type { AnyCircuitElement } from "circuit-json"

export const SixLayerCircuit: React.FC = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { PCBViewer } from "../../PCBViewer"
import { PCBViewer } from "../../../PCBViewer"
import type { AnyCircuitElement } from "circuit-json"

export const TwoLayerCircuit: React.FC = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type React from "react"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const PcbGroupWithAnchor: React.FC = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const circuitJson = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Circuit } from "@tscircuit/core"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const PcbPanelMultipleBoardsExample: React.FC = () => {
const circuit = new Circuit()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const PcbPanelExample = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Circuit } from "@tscircuit/core"
import { PCBViewer } from "../PCBViewer"
import { PCBViewer } from "../../PCBViewer"

export const PcbNoteExample: React.FC = () => {
const circuit = new Circuit()
Expand Down
Loading