@tscircuit/schematic-viewer 1.3.0 → 1.4.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.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/biome.json +45 -0
  3. package/dist/index.d.ts +3 -4
  4. package/dist/index.js +734 -688
  5. package/dist/index.js.map +1 -1
  6. package/package.json +8 -7
  7. package/src/Schematic.tsx +141 -65
  8. package/src/lib/render-context/index.ts +1 -1
  9. package/src/lib/types/core.ts +14 -49
  10. package/src/lib/types/source-component.ts +6 -1
  11. package/src/lib/utils/collect-element-refs.ts +5 -4
  12. package/src/lib/utils/colors.ts +235 -0
  13. package/src/lib/utils/direction-to-vec.ts +3 -3
  14. package/src/schematic-components/SVGPathComponent.tsx +71 -112
  15. package/src/schematic-components/SchematicChip.tsx +222 -0
  16. package/src/schematic-components/SchematicComponent.tsx +25 -22
  17. package/src/schematic-components/SchematicComponentFromSymbol.tsx +46 -0
  18. package/src/schematic-components/SchematicElement.tsx +0 -28
  19. package/src/schematic-components/SchematicNetLabel.tsx +3 -0
  20. package/src/schematic-components/SchematicText.tsx +4 -6
  21. package/src/schematic-components/SchematicTrace.tsx +4 -3
  22. package/src/schematic-components/TableViewer.tsx +1 -1
  23. package/src/schematic-components/index.tsx +6 -14
  24. package/src/stories/basics/schematic-net-label.stories.tsx +2 -0
  25. package/src/stories/basics/schematic-net-labels-2.stories.tsx +22 -20
  26. package/src/stories/bug-connections.stories.tsx +18 -13
  27. package/src/stories/bug-high-port-numbers.stories.tsx +107 -85
  28. package/src/stories/bug-one-sided.stories.tsx +17 -15
  29. package/src/stories/bug-pin-spacing.stories.tsx +19 -17
  30. package/src/stories/bugs/bug1-y-flip.stories.tsx +7 -5
  31. package/src/stories/bugs/bug3-scaling-trace.stories.tsx +11 -5
  32. package/src/stories/bugs/bug4-schematic-line.stories.tsx +0 -1
  33. package/src/stories/bugs/bug5-diode.stories.tsx +3 -2
  34. package/src/stories/bugs/bug6-trace-scaling.stories.tsx +5 -41
  35. package/src/stories/bugs/bug8-autolayout.stories.tsx +20 -29
  36. package/src/stories/circuit-components/diode.stories.tsx +3 -1
  37. package/src/stories/circuit-components/resistor.stories.tsx +3 -1
  38. package/src/stories/led-circuit-react.stories.tsx +35 -48
  39. package/src/stories/rotated-resistor.stories.tsx +10 -8
  40. package/src/stories/three-sided-bug.stories.tsx +17 -15
  41. package/src/pages/led-circuit.tsx +0 -96
  42. package/src/schematic-components/ProjectComponent.tsx +0 -70
  43. package/src/schematic-components/SchematicBox.tsx +0 -29
  44. package/src/schematic-components/SchematicBug.tsx +0 -107
  45. package/src/schematic-components/SchematicLine.tsx +0 -48
  46. package/src/schematic-components/SchematicPath.tsx +0 -51
  47. package/src/schematic-components/SchematicPort.tsx +0 -63
  48. package/src/schematic-components/SimpleCapacitor.tsx +0 -29
  49. package/src/schematic-components/SimpleDiode.tsx +0 -42
  50. package/src/schematic-components/SimpleGround.tsx +0 -30
  51. package/src/schematic-components/SimpleInductor.tsx +0 -29
  52. package/src/schematic-components/SimplePowerSource.tsx +0 -43
  53. package/src/schematic-components/SimpleResistor.tsx +0 -28
  54. package/src/stories/led-circuit-builder.stories.tsx +0 -104
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/@tscircuit%2Fschematic-viewer.svg)](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/biome.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
3
+ "organizeImports": {
4
+ "enabled": true
5
+ },
6
+ "formatter": {
7
+ "enabled": true,
8
+ "indentStyle": "space"
9
+ },
10
+ "files": {
11
+ "ignore": ["cosmos-export", "dist", "package.json"]
12
+ },
13
+ "javascript": {
14
+ "formatter": {
15
+ "jsxQuoteStyle": "double",
16
+ "quoteProperties": "asNeeded",
17
+ "trailingCommas": "all",
18
+ "semicolons": "asNeeded",
19
+ "arrowParentheses": "always",
20
+ "bracketSpacing": true,
21
+ "bracketSameLine": false
22
+ }
23
+ },
24
+ "linter": {
25
+ "enabled": true,
26
+ "rules": {
27
+ "recommended": true,
28
+ "suspicious": {
29
+ "noExplicitAny": "off"
30
+ },
31
+ "style": {
32
+ "noNonNullAssertion": "off",
33
+ "useNumberNamespace": "off",
34
+ "useFilenamingConvention": {
35
+ "level": "error",
36
+ "options": {
37
+ "strictCase": true,
38
+ "requireAscii": true,
39
+ "filenameCases": ["kebab-case", "export"]
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
package/dist/index.d.ts CHANGED
@@ -1,16 +1,15 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { AnyCircuitElement } from 'circuit-json';
3
+ import React from 'react';
3
4
 
4
5
  interface SchematicProps {
5
6
  children?: any;
6
- /** @deprecated use soup */
7
- elements?: any;
8
7
  soup?: AnyCircuitElement[];
9
- style?: any;
8
+ style?: React.CSSProperties;
10
9
  showTable?: boolean;
11
10
  _soupPostProcessor?: (soup: AnyCircuitElement[]) => AnyCircuitElement[];
12
11
  }
13
12
  declare const Schematic: (props: SchematicProps) => react_jsx_runtime.JSX.Element;
14
- declare const SchematicWithoutContext: ({ children, elements: initialElements, soup: initialSoup, style, showTable, _soupPostProcessor, }: SchematicProps) => react_jsx_runtime.JSX.Element;
13
+ declare const SchematicWithoutContext: ({ children, soup, style, showTable, _soupPostProcessor, }: SchematicProps) => react_jsx_runtime.JSX.Element;
15
14
 
16
15
  export { Schematic, SchematicProps, SchematicWithoutContext };