@tscircuit/schematic-viewer 1.1.21 → 1.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/schematic-viewer",
3
- "version": "1.1.21",
3
+ "version": "1.2.0",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "repository": "tscircuit/schematic-viewer",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "react-error-boundary": "^4.0.4",
62
- "react-supergrid": "^1.0.8",
62
+ "react-supergrid": "^1.0.10",
63
63
  "use-mouse-matrix-transform": "^1.1.12"
64
64
  }
65
65
  }
package/src/Schematic.tsx CHANGED
@@ -39,7 +39,7 @@ export const Schematic = ({
39
39
  elements: initialElements,
40
40
  soup: initialSoup,
41
41
  style,
42
- showTable,
42
+ showTable = false,
43
43
  }: {
44
44
  children?: any
45
45
 
@@ -88,7 +88,7 @@ export const Schematic = ({
88
88
  compose(
89
89
  translate((elmBounds.width ?? 0) / 2, (elmBounds.height ?? 0) / 2),
90
90
  // translate(100, 0),
91
- scale(scaleFactor, scaleFactor, 0, 0),
91
+ scale(scaleFactor, -scaleFactor, 0, 0),
92
92
  translate(-center.x, -center.y)
93
93
  )
94
94
  )
@@ -41,7 +41,7 @@ export const SVGPathComponent = ({
41
41
  pathBounds.width = Math.max(pathBounds.width, 1)
42
42
  const absoluteCenter = applyToPoint(ct, center)
43
43
  const actualAbsWidth = size.width * ct.a
44
- const actualAbsHeight = size.height * ct.d
44
+ const actualAbsHeight = size.height * Math.abs(ct.d)
45
45
  const absoluteSize = {
46
46
  width: Math.max(1, actualAbsWidth),
47
47
  height: Math.max(1, actualAbsHeight),
@@ -52,6 +52,8 @@ export const SVGPathComponent = ({
52
52
  const svgLeft = absoluteCenter.x - absoluteSize.width / 2
53
53
  const svgTop = absoluteCenter.y - absoluteSize.height / 2
54
54
 
55
+ const viewBox = `${pathBounds.minX} ${pathBounds.minY} ${pathBounds.width} ${pathBounds.height}`
56
+
55
57
  return (
56
58
  <>
57
59
  {hovering && (
@@ -94,7 +96,10 @@ export const SVGPathComponent = ({
94
96
  // backgroundColor: hovering ? "rgba(0, 0, 255, 0.5)" : "transparent",
95
97
  cursor: hovering ? "pointer" : undefined,
96
98
  zIndex,
97
- transform: rotation === 0 ? "" : `rotate(${rotation}rad)`,
99
+ transform: [
100
+ "scale(1, -1)", // TODO based on ct.d
101
+ rotation === 0 ? "" : `rotate(${rotation}rad)`,
102
+ ].join(" "),
98
103
  left: svgLeft,
99
104
  top: svgTop,
100
105
  // backgroundColor: badRatio ? "rgba(255, 0, 0, 0.5)" : "transparent",
@@ -102,7 +107,7 @@ export const SVGPathComponent = ({
102
107
  overflow="visible"
103
108
  width={absoluteSize.width}
104
109
  height={absoluteSize.height}
105
- viewBox={`${pathBounds.minX} ${pathBounds.minY} ${pathBounds.width} ${pathBounds.height}`}
110
+ viewBox={viewBox}
106
111
  >
107
112
  {paths.map((p, i) => (
108
113
  <path
package/tsup.config.ts CHANGED
@@ -3,9 +3,6 @@ import { defineConfig } from "tsup"
3
3
  export default defineConfig({
4
4
  tsconfig: "./tsconfig.json",
5
5
  entry: ["./src/index.ts"],
6
- format: ["cjs"],
7
- treeshake: true,
8
6
  dts: true,
9
7
  sourcemap: true,
10
- clean: true,
11
8
  })