@tscircuit/schematic-viewer 0.0.1 → 0.0.2
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/dist/Schematic.d.ts +6 -0
- package/dist/Schematic.js +5 -2
- package/dist/Schematic.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8611 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/hooks/index.d.ts +1 -0
- package/dist/lib/hooks/use-maybe-promise.d.ts +3 -0
- package/dist/lib/render-context/index.d.ts +10 -0
- package/dist/lib/types/core.d.ts +149 -0
- package/dist/lib/types/index.d.ts +4 -0
- package/dist/lib/types/route-solver.d.ts +24 -0
- package/dist/lib/types/source-component.d.ts +44 -0
- package/dist/lib/types/util.d.ts +14 -0
- package/dist/lib/utils/direction-to-vec.d.ts +13 -0
- package/dist/lib/utils/get-svg-path-bounds.d.ts +10 -0
- package/dist/lib/utils/point-math.d.ts +20 -0
- package/dist/pages/_app.d.ts +5 -0
- package/dist/pages/index.d.ts +3 -0
- package/dist/pages/index.js +5 -2
- package/dist/pages/index.js.map +1 -1
- package/dist/pages/led-circuit-react.d.ts +3 -0
- package/dist/pages/led-circuit-react.js +6476 -21
- package/dist/pages/led-circuit-react.js.map +1 -1
- package/dist/pages/led-circuit.d.ts +3 -0
- package/dist/pages/led-circuit.js +5 -2
- package/dist/pages/led-circuit.js.map +1 -1
- package/dist/schematic-components/MovableGrid/MovableGrid.stories.d.ts +7 -0
- package/dist/schematic-components/MovableGrid/index.d.ts +3 -0
- package/dist/schematic-components/ProjectComponent.d.ts +10 -0
- package/dist/schematic-components/RenderError.d.ts +6 -0
- package/dist/schematic-components/SVGPathComponent.d.ts +19 -0
- package/dist/schematic-components/SchematicBug.d.ts +13 -0
- package/dist/schematic-components/SchematicComponent.d.ts +13 -0
- package/dist/schematic-components/SchematicGroup.d.ts +3 -0
- package/dist/schematic-components/SchematicPort.d.ts +13 -0
- package/dist/schematic-components/SchematicText.d.ts +10 -0
- package/dist/schematic-components/SchematicTrace.d.ts +13 -0
- package/dist/schematic-components/SimpleCapacitor.d.ts +13 -0
- package/dist/schematic-components/SimpleDiode.d.ts +13 -0
- package/dist/schematic-components/SimpleGround.d.ts +13 -0
- package/dist/schematic-components/SimpleInductor.d.ts +13 -0
- package/dist/schematic-components/SimplePowerSource.d.ts +13 -0
- package/dist/schematic-components/SimpleResistor.d.ts +13 -0
- package/dist/schematic-components/index.d.ts +18 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/tsconfig.json +1 -2
|
@@ -8570,14 +8570,17 @@ var Schematic = ({
|
|
|
8570
8570
|
const [elements, setElements] = (0, import_react2.useState)(initialElements);
|
|
8571
8571
|
const [project, setProject] = (0, import_react2.useState)(null);
|
|
8572
8572
|
(0, import_react2.useEffect)(() => {
|
|
8573
|
-
if (initialElements) {
|
|
8574
|
-
setProject((0, import_builder2.createProjectFromElements)(
|
|
8573
|
+
if (initialElements.length > 0) {
|
|
8574
|
+
setProject((0, import_builder2.createProjectFromElements)(initialElements));
|
|
8575
8575
|
return;
|
|
8576
8576
|
}
|
|
8577
8577
|
const projectBuilder = (0, import_builder2.createProjectBuilder)();
|
|
8578
8578
|
(0, import_react_fiber.createRoot)().render(children, projectBuilder).then(async (elements2) => {
|
|
8579
8579
|
setElements(elements2);
|
|
8580
8580
|
setProject((0, import_builder2.createProjectFromElements)(elements2));
|
|
8581
|
+
}).catch((e) => {
|
|
8582
|
+
console.error("ERROR RENDERING CIRCUIT");
|
|
8583
|
+
throw e;
|
|
8581
8584
|
});
|
|
8582
8585
|
}, [children]);
|
|
8583
8586
|
if (elements.length === 0)
|