Skip to content

Commit

Permalink
updated the schematic-symbols to fix the baterry in core & formated
Browse files Browse the repository at this point in the history
  • Loading branch information
Abse2001 authored Oct 18, 2024
1 parent aec1834 commit 922dfca
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 36 deletions.
6 changes: 3 additions & 3 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Preview } from "@storybook/react";
import type { Preview } from "@storybook/react"

const preview: Preview = {
parameters: {
Expand All @@ -9,6 +9,6 @@ const preview: Preview = {
},
},
},
};
}

export default preview;
export default preview
Binary file modified bun.lockb
Binary file not shown.
16 changes: 8 additions & 8 deletions lib/sch/svg-object-fns/create-svg-objects-from-sch-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { getSvg, symbols } from "schematic-symbols"
import { parseSync } from "svgson"

interface PortArrangementCenter {
x: number
y: number
trueIndex: number
pinNumber: number
side: "left" | "right" | "top" | "bottom"
distanceFromEdge: number
x: number
y: number
trueIndex: number
pinNumber: number
side: "left" | "right" | "top" | "bottom"
distanceFromEdge: number
}

interface PortArrangement extends SchematicPort {
center: PortArrangementCenter
center: PortArrangementCenter
}

export function createSchematicComponent(
Expand Down Expand Up @@ -140,7 +140,7 @@ export function createSchematicComponent(
const portLength = 0.2
const circleRadius = 0.05

for (const port of (schematicPorts as PortArrangement[])) {
for (const port of schematicPorts as PortArrangement[]) {
const { x, y, pinNumber } = port.center
let endX = x
let endY = y
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"version": "0.0.40",
"description": "Convert Circuit JSON to SVG",
"main": "dist/index.js",
"files": [
"dist"
],
"files": ["dist"],
"scripts": {
"start": "storybook dev -p 6006",
"prepublish": "npm run build",
Expand Down Expand Up @@ -48,7 +46,7 @@
"@tscircuit/soup-util": "^0.0.28",
"@types/node": "^22.5.5",
"circuit-json": "*",
"schematic-symbols": "^0.0.32",
"schematic-symbols": "^0.0.79",
"svgson": "^5.3.1",
"transformation-matrix": "^2.16.1"
}
Expand Down
5 changes: 4 additions & 1 deletion stories/net-label-not-overlap.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React, { useEffect, useState } from "react"
import { circuitJsonToSchematicSvg, convertCircuitJsonToPcbSvg } from "../lib/index.js"
import {
circuitJsonToSchematicSvg,
convertCircuitJsonToPcbSvg,
} from "../lib/index.js"

const soup: any = [
{
Expand Down
12 changes: 6 additions & 6 deletions stories/schematic-resistor-capacitor.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { convertCircuitJsonToSchematicSvg } from "../lib/index.js";
import { convertCircuitJsonToSchematicSvg } from "../lib/index.js"

const soup: any = [
{
Expand Down Expand Up @@ -788,15 +788,15 @@ const soup: any = [
source_component_id: "source_component_1",
footprinter_string: "0402",
},
];
]

export const ResistorCapacitorSch = () => {
const result = convertCircuitJsonToSchematicSvg(soup);
const result = convertCircuitJsonToSchematicSvg(soup)

return <div dangerouslySetInnerHTML={{ __html: result }} />;
};
return <div dangerouslySetInnerHTML={{ __html: result }} />
}

export default {
title: "Resistor and Capacitor Schematic",
component: ResistorCapacitorSch,
};
}
4 changes: 3 additions & 1 deletion tests/pcb/silkscreen-with-hole-and-trace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1075,5 +1075,7 @@ const pcbSoup: any[] = [
]

test("Silkscreen with PCB Plated Hole", () => {
expect(convertCircuitJsonToPcbSvg(pcbSoup)).toMatchSvgSnapshot(import.meta.path)
expect(convertCircuitJsonToPcbSvg(pcbSoup)).toMatchSvgSnapshot(
import.meta.path,
)
})
2 changes: 1 addition & 1 deletion tests/sch/__snapshots__/kicad-theme-demo.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/sch/__snapshots__/resistor.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions tests/sch/kicad-theme-demo.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, it } from "bun:test";
import { convertCircuitJsonToSchematicSvg } from "lib/index";
import { getTestFixture } from "tests/fixtures/get-test-fixture";
import { expect, it } from "bun:test"
import { convertCircuitJsonToSchematicSvg } from "lib/index"
import { getTestFixture } from "tests/fixtures/get-test-fixture"

it("example 4: kicad theme demo", async () => {
const { project } = getTestFixture();
const { project } = getTestFixture()

project.add(
<board width="10mm" height="10mm">
Expand Down Expand Up @@ -48,11 +48,11 @@ it("example 4: kicad theme demo", async () => {
},
}}
/>
</board>
);
</board>,
)

expect(
// @ts-ignore
convertCircuitJsonToSchematicSvg(project.getCircuitJson())
).toMatchSvgSnapshot(import.meta.path);
});
convertCircuitJsonToSchematicSvg(project.getCircuitJson()),
).toMatchSvgSnapshot(import.meta.path)
})
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"paths": {
"lib/*": ["lib/*"]
},

"verbatimModuleSyntax": true,
// Enable strict type checking so you can catch bugs early
"strict": true,
Expand All @@ -27,5 +27,5 @@
"es2022"
// "dom"
]
},
}
}

0 comments on commit 922dfca

Please sign in to comment.