@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
package/dist/Schematic.js
CHANGED
|
@@ -8567,14 +8567,17 @@ var Schematic = ({
|
|
|
8567
8567
|
const [elements, setElements] = (0, import_react2.useState)(initialElements);
|
|
8568
8568
|
const [project, setProject] = (0, import_react2.useState)(null);
|
|
8569
8569
|
(0, import_react2.useEffect)(() => {
|
|
8570
|
-
if (initialElements) {
|
|
8571
|
-
setProject((0, import_builder2.createProjectFromElements)(
|
|
8570
|
+
if (initialElements.length > 0) {
|
|
8571
|
+
setProject((0, import_builder2.createProjectFromElements)(initialElements));
|
|
8572
8572
|
return;
|
|
8573
8573
|
}
|
|
8574
8574
|
const projectBuilder = (0, import_builder2.createProjectBuilder)();
|
|
8575
8575
|
(0, import_react_fiber.createRoot)().render(children, projectBuilder).then(async (elements2) => {
|
|
8576
8576
|
setElements(elements2);
|
|
8577
8577
|
setProject((0, import_builder2.createProjectFromElements)(elements2));
|
|
8578
|
+
}).catch((e) => {
|
|
8579
|
+
console.error("ERROR RENDERING CIRCUIT");
|
|
8580
|
+
throw e;
|
|
8578
8581
|
});
|
|
8579
8582
|
}, [children]);
|
|
8580
8583
|
if (elements.length === 0)
|