@tscircuit/schematic-viewer 0.0.9 → 1.0.1

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.
@@ -0,0 +1,27 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout code
13
+ uses: actions/checkout@v3
14
+
15
+ - name: Setup Node.js
16
+ uses: actions/setup-node@v2
17
+ with:
18
+ node-version: 18
19
+
20
+ - name: Install dependencies
21
+ run: yarn install
22
+
23
+ - name: Semantic Release
24
+ env:
25
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
27
+ run: yarn semantic-release
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/schematic-viewer",
3
- "version": "0.0.9",
3
+ "version": "1.0.1",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -10,14 +10,20 @@
10
10
  "yalc": "npm run build && yalc push"
11
11
  },
12
12
  "peerDependencies": {
13
- "@tscircuit/react-fiber": "^0.0.5",
14
- "react": "^18.2.0"
13
+ "@tscircuit/react-fiber": "*",
14
+ "react": "*"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@babel/core": "^7.18.9",
18
18
  "@chakra-ui/react": "^2.2.4",
19
19
  "@emotion/react": "^11",
20
20
  "@emotion/styled": "^11",
21
+ "@semantic-release/changelog": "^6.0.3",
22
+ "@semantic-release/commit-analyzer": "^10.0.1",
23
+ "@semantic-release/git": "^10.0.1",
24
+ "@semantic-release/github": "^9.0.3",
25
+ "@semantic-release/npm": "^10.0.4",
26
+ "@semantic-release/release-notes-generator": "^11.0.4",
21
27
  "@storybook/addon-actions": "^6.5.9",
22
28
  "@storybook/addon-essentials": "^6.5.9",
23
29
  "@storybook/addon-interactions": "^6.5.9",
@@ -37,9 +43,9 @@
37
43
  "parse-svg-path": "^0.1.2",
38
44
  "react": "^18.2.0",
39
45
  "react-dom": "^18.2.0",
40
- "react-no-ssr": "^1.1.0",
41
46
  "react-use-measure": "^2.1.1",
42
47
  "rectilinear-router": "^1.0.1",
48
+ "semantic-release": "^21.0.6",
43
49
  "svg-path-bounds": "^1.0.2",
44
50
  "svg-path-generator": "^1.1.0",
45
51
  "transformation-matrix": "^2.12.0",
@@ -49,8 +55,8 @@
49
55
  "zustand": "^4.0.0"
50
56
  },
51
57
  "dependencies": {
52
- "@tscircuit/builder": "^1.0.12",
53
- "@tscircuit/react-fiber": "^0.0.5",
58
+ "@tscircuit/builder": "^1.1.1",
59
+ "@tscircuit/react-fiber": "*",
54
60
  "react-error-boundary": "^4.0.4",
55
61
  "use-mouse-matrix-transform": "^1.0.2"
56
62
  }
@@ -0,0 +1,15 @@
1
+ module.exports = {
2
+ branches: ["main"], // change this to your default branch if not `main`
3
+ plugins: [
4
+ "@semantic-release/commit-analyzer",
5
+ "@semantic-release/release-notes-generator",
6
+ ["@semantic-release/npm", { npmPublish: true }],
7
+ [
8
+ "@semantic-release/git",
9
+ {
10
+ assets: ["package.json"],
11
+ message: "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
12
+ }
13
+ ]
14
+ ],
15
+ }
package/src/Schematic.tsx CHANGED
@@ -26,9 +26,11 @@ const fallbackRender =
26
26
  export const Schematic = ({
27
27
  children,
28
28
  elements: initialElements = [],
29
+ style,
29
30
  }: {
30
31
  children?: any
31
32
  elements?: any
33
+ style?: any
32
34
  }) => {
33
35
  const [elements, setElements] = useState<any>(initialElements)
34
36
  const [project, setProject] = useState<any>(null)
@@ -59,7 +61,18 @@ export const Schematic = ({
59
61
  if (elements.length === 0) return null
60
62
 
61
63
  return (
62
- <div ref={ref}>
64
+ <div
65
+ style={{
66
+ width: "100%",
67
+ backgroundColor: "rgba(255,255,255,0)",
68
+ minHeight: 200,
69
+ overflow: "hidden",
70
+ position: "relative",
71
+ cursor: "grab",
72
+ ...style,
73
+ }}
74
+ ref={ref}
75
+ >
63
76
  {elements.map((elm) => (
64
77
  <ErrorBoundary fallbackRender={fallbackRender(elm)}>
65
78
  <SchematicElement
@@ -3,7 +3,7 @@ import { Schematic } from "Schematic"
3
3
 
4
4
  export const ExampleCircuit = () => {
5
5
  return (
6
- <Schematic>
6
+ <Schematic style={{ height: 500 }}>
7
7
  <resistor name="R1" resistance="10 ohm" center={[2, 1]} />
8
8
  <capacitor
9
9
  name="C1"
@@ -89,10 +89,8 @@ export default () => {
89
89
  if (!elements) return null
90
90
  return (
91
91
  <>
92
- <Schematic elements={elements} />
93
- <pre style={{ marginTop: 600 }}>
94
- {JSON.stringify(elements, null, " ")}
95
- </pre>
92
+ <Schematic style={{ height: 400 }} elements={elements} />
93
+ <pre>{JSON.stringify(elements, null, " ")}</pre>
96
94
  </>
97
95
  )
98
96
  }
package/tsconfig.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "baseUrl": "./src",
18
18
  "resolveJsonModule": true,
19
19
  "isolatedModules": true,
20
- "jsx": "react-jsx",
20
+ "jsx": "preserve",
21
21
  "incremental": false
22
22
  },
23
23
  "include": [
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- declare const Schematic: ({ children, elements: initialElements, }: {
2
- children?: any;
3
- elements?: any;
4
- }) => JSX.Element;
5
-
6
- export { Schematic };