@tscircuit/schematic-viewer 1.2.14 → 1.4.0
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/.github/workflows/chromatic.yml +30 -0
- package/.github/workflows/npm-build.yml +26 -0
- package/.github/workflows/npm-typecheck.yml +26 -0
- package/README.md +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.js +690 -664
- package/dist/index.js.map +1 -1
- package/package.json +21 -12
- package/renovate.json +12 -1
- package/src/Schematic.tsx +148 -77
- package/src/lib/types/core.ts +14 -49
- package/src/lib/types/source-component.ts +6 -0
- package/src/lib/utils/collect-element-refs.ts +4 -3
- package/src/lib/utils/colors.ts +236 -0
- package/src/schematic-components/SVGPathComponent.tsx +84 -144
- package/src/schematic-components/SchematicChip.tsx +183 -0
- package/src/schematic-components/SchematicComponent.tsx +18 -24
- package/src/schematic-components/SchematicComponentFromSymbol.tsx +44 -0
- package/src/schematic-components/SchematicElement.tsx +4 -38
- package/src/schematic-components/SchematicTrace.tsx +4 -3
- package/src/schematic-components/index.tsx +7 -14
- package/src/stories/basics/schematic-net-label.stories.tsx +112 -166
- package/src/stories/basics/schematic-net-labels-2.stories.tsx +22 -20
- package/src/stories/bug-connections.stories.tsx +9 -6
- package/src/stories/bug-high-port-numbers.stories.tsx +99 -82
- package/src/stories/bug-pin-spacing.stories.tsx +1 -0
- package/src/stories/bugs/bug1-y-flip.stories.tsx +3 -2
- package/src/stories/bugs/bug3-scaling-trace.stories.tsx +11 -5
- package/src/stories/bugs/bug4-schematic-line.stories.tsx +0 -1
- package/src/stories/bugs/bug5-diode.stories.tsx +0 -1
- package/src/stories/bugs/bug8-autolayout.stories.tsx +22 -31
- package/src/stories/circuit-components/diode.stories.tsx +3 -1
- package/src/stories/circuit-components/resistor.stories.tsx +3 -1
- package/src/stories/component-drawing-example.stories.tsx +2 -2
- package/src/stories/led-circuit-react.stories.tsx +40 -45
- package/src/stories/net-alias.stories.tsx +1 -1
- package/src/stories/off-center-render.stories.tsx +6 -6
- package/src/stories/rotated-resistor.stories.tsx +1 -1
- package/src/stories/schematic-path.stories.tsx +1 -1
- package/src/stories/three-sided-bug.stories.tsx +8 -8
- package/src/pages/led-circuit.tsx +0 -96
- package/src/schematic-components/ProjectComponent.tsx +0 -70
- package/src/schematic-components/SchematicBox.tsx +0 -29
- package/src/schematic-components/SchematicBug.tsx +0 -90
- package/src/schematic-components/SchematicLine.tsx +0 -48
- package/src/schematic-components/SchematicPath.tsx +0 -51
- package/src/schematic-components/SchematicPort.tsx +0 -63
- package/src/schematic-components/SimpleCapacitor.tsx +0 -29
- package/src/schematic-components/SimpleDiode.tsx +0 -42
- package/src/schematic-components/SimpleGround.tsx +0 -30
- package/src/schematic-components/SimpleInductor.tsx +0 -29
- package/src/schematic-components/SimplePowerSource.tsx +0 -43
- package/src/schematic-components/SimpleResistor.tsx +0 -28
- package/src/stories/led-circuit-builder.stories.tsx +0 -104
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: "Chromatic"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
chromatic:
|
|
13
|
+
name: Run Chromatic
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout code
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
- uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: 20
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
# ⚠️ See your package manager's documentation for the correct command to install dependencies in a CI environment.
|
|
25
|
+
run: npm ci
|
|
26
|
+
- name: Run Chromatic
|
|
27
|
+
uses: chromaui/action@latest
|
|
28
|
+
with:
|
|
29
|
+
# ⚠️ Make sure to configure a `CHROMATIC_PROJECT_TOKEN` repository secret
|
|
30
|
+
projectToken: chpt_d88a6beb0734bbe
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
|
|
2
|
+
name: Build
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [main]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v3
|
|
16
|
+
|
|
17
|
+
- name: Use Node.js
|
|
18
|
+
uses: actions/setup-node@v3
|
|
19
|
+
with:
|
|
20
|
+
node-version: "20"
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: npm ci
|
|
24
|
+
|
|
25
|
+
- name: Run build
|
|
26
|
+
run: npm run build
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
|
|
2
|
+
name: Type Check
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [main]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
type-check:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v3
|
|
16
|
+
|
|
17
|
+
- name: Use Node.js
|
|
18
|
+
uses: actions/setup-node@v3
|
|
19
|
+
with:
|
|
20
|
+
node-version: "20"
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: npm ci
|
|
24
|
+
|
|
25
|
+
- name: Run typecheck
|
|
26
|
+
run: npx tsc --noEmit
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/@tscircuit%2Fschematic-viewer)
|
|
4
4
|
|
|
5
|
-
[Examples](https://schematic-viewer.vercel.app/) · [TSCircuit](https://tscircuit.com) · [Open in CodeSandbox](https://codesandbox.io/s/github/tscircuit/schematic-viewer)
|
|
5
|
+
[Examples](https://schematic-viewer.vercel.app/) · [TSCircuit](https://tscircuit.com) · [Open in CodeSandbox](https://codesandbox.io/s/github/tscircuit/schematic-viewer) · [discord](https://tscircuit.com/join)
|
|
6
6
|
|
|
7
7
|
View schematics from [tscircuit jsx](https://tscircuit.com).
|
|
8
8
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { AnyCircuitElement } from 'circuit-json';
|
|
3
|
+
import React from 'react';
|
|
3
4
|
|
|
4
5
|
interface SchematicProps {
|
|
5
6
|
children?: any;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
soup?: AnySoupElement[];
|
|
9
|
-
style?: any;
|
|
7
|
+
soup?: AnyCircuitElement[];
|
|
8
|
+
style?: React.CSSProperties;
|
|
10
9
|
showTable?: boolean;
|
|
11
|
-
_soupPostProcessor?: (soup:
|
|
10
|
+
_soupPostProcessor?: (soup: AnyCircuitElement[]) => AnyCircuitElement[];
|
|
12
11
|
}
|
|
13
12
|
declare const Schematic: (props: SchematicProps) => react_jsx_runtime.JSX.Element;
|
|
14
|
-
declare const SchematicWithoutContext: ({ children,
|
|
13
|
+
declare const SchematicWithoutContext: ({ children, soup, style, showTable, _soupPostProcessor, }: SchematicProps) => react_jsx_runtime.JSX.Element;
|
|
15
14
|
|
|
16
15
|
export { Schematic, SchematicProps, SchematicWithoutContext };
|