@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/dist/index.js CHANGED
@@ -1,34 +1,13 @@
1
- 'use strict';
2
-
3
- var react = require('react');
4
- var reactSupergrid = require('react-supergrid');
5
- var builder = require('@tscircuit/builder');
6
- var TscReactFiber = require('@tscircuit/react-fiber');
7
- var jsxRuntime = require('react/jsx-runtime');
8
- var useMouseMatrixTransform = require('use-mouse-matrix-transform');
9
- var reactErrorBoundary = require('react-error-boundary');
10
-
11
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
-
13
- var TscReactFiber__default = /*#__PURE__*/_interopDefault(TscReactFiber);
14
-
15
1
  var __create = Object.create;
16
2
  var __defProp = Object.defineProperty;
17
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
18
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
19
5
  var __getProtoOf = Object.getPrototypeOf;
20
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
21
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
22
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
23
- }) : x)(function(x) {
24
- if (typeof require !== "undefined")
25
- return require.apply(this, arguments);
26
- throw new Error('Dynamic require of "' + x + '" is not supported');
27
- });
28
7
  var __esm = (fn, res) => function __init() {
29
8
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
30
9
  };
31
- var __commonJS = (cb, mod) => function __require2() {
10
+ var __commonJS = (cb, mod) => function __require() {
32
11
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
33
12
  };
34
13
  var __export = (target, all) => {
@@ -56,7 +35,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
56
35
  // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js
57
36
  var require_use_sync_external_store_shim_production_min = __commonJS({
58
37
  "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js"(exports) {
59
- var e = __require("react");
38
+ "use strict";
39
+ var e = require("react");
60
40
  function h(a, b) {
61
41
  return a === b && (0 !== a || 1 / a === 1 / b) || a !== a && b !== b;
62
42
  }
@@ -102,12 +82,14 @@ var require_use_sync_external_store_shim_production_min = __commonJS({
102
82
  // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
103
83
  var require_use_sync_external_store_shim_development = __commonJS({
104
84
  "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
85
+ "use strict";
105
86
  if (process.env.NODE_ENV !== "production") {
106
87
  (function() {
88
+ "use strict";
107
89
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
108
90
  __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
109
91
  }
110
- var React = __require("react");
92
+ var React = require("react");
111
93
  var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
112
94
  function error(format) {
113
95
  {
@@ -221,11 +203,12 @@ var require_use_sync_external_store_shim_development = __commonJS({
221
203
 
222
204
  // node_modules/use-sync-external-store/shim/index.js
223
205
  var require_shim = __commonJS({
224
- "node_modules/use-sync-external-store/shim/index.js"(exports, module) {
206
+ "node_modules/use-sync-external-store/shim/index.js"(exports, module2) {
207
+ "use strict";
225
208
  if (process.env.NODE_ENV === "production") {
226
- module.exports = require_use_sync_external_store_shim_production_min();
209
+ module2.exports = require_use_sync_external_store_shim_production_min();
227
210
  } else {
228
- module.exports = require_use_sync_external_store_shim_development();
211
+ module2.exports = require_use_sync_external_store_shim_development();
229
212
  }
230
213
  }
231
214
  });
@@ -233,7 +216,8 @@ var require_shim = __commonJS({
233
216
  // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js
234
217
  var require_with_selector_production_min = __commonJS({
235
218
  "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js"(exports) {
236
- var h = __require("react");
219
+ "use strict";
220
+ var h = require("react");
237
221
  var n = require_shim();
238
222
  function p(a, b) {
239
223
  return a === b && (0 !== a || 1 / a === 1 / b) || a !== a && b !== b;
@@ -294,12 +278,14 @@ var require_with_selector_production_min = __commonJS({
294
278
  // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
295
279
  var require_with_selector_development = __commonJS({
296
280
  "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) {
281
+ "use strict";
297
282
  if (process.env.NODE_ENV !== "production") {
298
283
  (function() {
284
+ "use strict";
299
285
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
300
286
  __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
301
287
  }
302
- var React = __require("react");
288
+ var React = require("react");
303
289
  var shim = require_shim();
304
290
  function is(x, y) {
305
291
  return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
@@ -381,19 +367,20 @@ var require_with_selector_development = __commonJS({
381
367
 
382
368
  // node_modules/use-sync-external-store/shim/with-selector.js
383
369
  var require_with_selector = __commonJS({
384
- "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) {
370
+ "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module2) {
371
+ "use strict";
385
372
  if (process.env.NODE_ENV === "production") {
386
- module.exports = require_with_selector_production_min();
373
+ module2.exports = require_with_selector_production_min();
387
374
  } else {
388
- module.exports = require_with_selector_development();
375
+ module2.exports = require_with_selector_development();
389
376
  }
390
377
  }
391
378
  });
392
379
 
393
380
  // node_modules/parse-svg-path/index.js
394
381
  var require_parse_svg_path = __commonJS({
395
- "node_modules/parse-svg-path/index.js"(exports, module) {
396
- module.exports = parse;
382
+ "node_modules/parse-svg-path/index.js"(exports, module2) {
383
+ module2.exports = parse;
397
384
  var length = { a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0 };
398
385
  var segment = /([astvzqmhlc])([^astvzqmhlc]*)/ig;
399
386
  function parse(path) {
@@ -428,8 +415,8 @@ var require_parse_svg_path = __commonJS({
428
415
 
429
416
  // node_modules/abs-svg-path/index.js
430
417
  var require_abs_svg_path = __commonJS({
431
- "node_modules/abs-svg-path/index.js"(exports, module) {
432
- module.exports = absolutize;
418
+ "node_modules/abs-svg-path/index.js"(exports, module2) {
419
+ module2.exports = absolutize;
433
420
  function absolutize(path) {
434
421
  var startX = 0;
435
422
  var startY = 0;
@@ -641,8 +628,9 @@ var init_modules = __esm({
641
628
 
642
629
  // node_modules/normalize-svg-path/index.js
643
630
  var require_normalize_svg_path = __commonJS({
644
- "node_modules/normalize-svg-path/index.js"(exports, module) {
645
- module.exports = normalize;
631
+ "node_modules/normalize-svg-path/index.js"(exports, module2) {
632
+ "use strict";
633
+ module2.exports = normalize;
646
634
  var arcToCurve = (init_modules(), __toCommonJS(modules_exports));
647
635
  function normalize(path) {
648
636
  var prev;
@@ -754,8 +742,9 @@ var require_normalize_svg_path = __commonJS({
754
742
 
755
743
  // node_modules/is-svg-path/index.js
756
744
  var require_is_svg_path = __commonJS({
757
- "node_modules/is-svg-path/index.js"(exports, module) {
758
- module.exports = function isPath(str) {
745
+ "node_modules/is-svg-path/index.js"(exports, module2) {
746
+ "use strict";
747
+ module2.exports = function isPath(str) {
759
748
  if (typeof str !== "string")
760
749
  return false;
761
750
  str = str.trim();
@@ -768,12 +757,13 @@ var require_is_svg_path = __commonJS({
768
757
 
769
758
  // node_modules/svg-path-bounds/index.js
770
759
  var require_svg_path_bounds = __commonJS({
771
- "node_modules/svg-path-bounds/index.js"(exports, module) {
760
+ "node_modules/svg-path-bounds/index.js"(exports, module2) {
761
+ "use strict";
772
762
  var parse = require_parse_svg_path();
773
763
  var abs = require_abs_svg_path();
774
764
  var normalize = require_normalize_svg_path();
775
765
  var isSvgPath = require_is_svg_path();
776
- module.exports = pathBounds;
766
+ module2.exports = pathBounds;
777
767
  function pathBounds(path) {
778
768
  if (Array.isArray(path) && path.length === 1 && typeof path[0] === "string")
779
769
  path = path[0];
@@ -809,7 +799,7 @@ var require_svg_path_bounds = __commonJS({
809
799
 
810
800
  // node_modules/debounce/index.js
811
801
  var require_debounce = __commonJS({
812
- "node_modules/debounce/index.js"(exports, module) {
802
+ "node_modules/debounce/index.js"(exports, module2) {
813
803
  function debounce(func, wait, immediate) {
814
804
  var timeout, args, context, timestamp, result;
815
805
  if (null == wait)
@@ -826,6 +816,7 @@ var require_debounce = __commonJS({
826
816
  }
827
817
  }
828
818
  }
819
+ ;
829
820
  var debounced = function() {
830
821
  context = this;
831
822
  args = arguments;
@@ -856,13 +847,13 @@ var require_debounce = __commonJS({
856
847
  return debounced;
857
848
  }
858
849
  debounce.debounce = debounce;
859
- module.exports = debounce;
850
+ module2.exports = debounce;
860
851
  }
861
852
  });
862
853
 
863
854
  // node_modules/svg-path-generator/lib/svg-path-generator.js
864
855
  var require_svg_path_generator = __commonJS({
865
- "node_modules/svg-path-generator/lib/svg-path-generator.js"(exports, module) {
856
+ "node_modules/svg-path-generator/lib/svg-path-generator.js"(exports, module2) {
866
857
  function SvgPathGenerator(path) {
867
858
  if (!(this instanceof SvgPathGenerator)) {
868
859
  return new SvgPathGenerator(path);
@@ -870,7 +861,7 @@ var require_svg_path_generator = __commonJS({
870
861
  this.currentPath = (path || "") + " ";
871
862
  this.isRelative = false;
872
863
  }
873
- module.exports = SvgPathGenerator;
864
+ module2.exports = SvgPathGenerator;
874
865
  SvgPathGenerator.prototype.toString = function() {
875
866
  return this.end();
876
867
  };
@@ -934,11 +925,24 @@ var require_svg_path_generator = __commonJS({
934
925
 
935
926
  // node_modules/svg-path-generator/index.js
936
927
  var require_svg_path_generator2 = __commonJS({
937
- "node_modules/svg-path-generator/index.js"(exports, module) {
938
- module.exports = require_svg_path_generator();
928
+ "node_modules/svg-path-generator/index.js"(exports, module2) {
929
+ module2.exports = require_svg_path_generator();
939
930
  }
940
931
  });
941
932
 
933
+ // src/index.ts
934
+ var src_exports = {};
935
+ __export(src_exports, {
936
+ Schematic: () => Schematic
937
+ });
938
+ module.exports = __toCommonJS(src_exports);
939
+
940
+ // src/Schematic.tsx
941
+ var import_react6 = require("react");
942
+ var import_react_supergrid = require("react-supergrid");
943
+ var import_builder3 = require("@tscircuit/builder");
944
+ var import_react_fiber = __toESM(require("@tscircuit/react-fiber"));
945
+
942
946
  // src/lib/utils/collect-element-refs.ts
943
947
  var collectElementRefs = (elm, allElms) => {
944
948
  const source_port = allElms.find(
@@ -999,6 +1003,7 @@ var createStoreImpl = (createState) => {
999
1003
  var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
1000
1004
 
1001
1005
  // node_modules/zustand/esm/index.js
1006
+ var import_react = require("react");
1002
1007
  var import_with_selector = __toESM(require_with_selector());
1003
1008
  var { useSyncExternalStoreWithSelector } = import_with_selector.default;
1004
1009
  function useStore(api, selector = api.getState, equalityFn) {
@@ -1009,7 +1014,7 @@ function useStore(api, selector = api.getState, equalityFn) {
1009
1014
  selector,
1010
1015
  equalityFn
1011
1016
  );
1012
- react.useDebugValue(slice);
1017
+ (0, import_react.useDebugValue)(slice);
1013
1018
  return slice;
1014
1019
  }
1015
1020
  var createImpl = (createState) => {
@@ -1080,6 +1085,9 @@ function compose(...matrices) {
1080
1085
  return transform(...matrices);
1081
1086
  }
1082
1087
 
1088
+ // node_modules/transformation-matrix/src/rotate.js
1089
+ var { cos, sin, PI } = Math;
1090
+
1083
1091
  // node_modules/transformation-matrix/src/scale.js
1084
1092
  function scale(sx, sy = void 0, cx = void 0, cy = void 0) {
1085
1093
  if (isUndefined(sy))
@@ -1102,6 +1110,9 @@ function scale(sx, sy = void 0, cx = void 0, cy = void 0) {
1102
1110
  ]);
1103
1111
  }
1104
1112
 
1113
+ // node_modules/transformation-matrix/src/skew.js
1114
+ var { tan } = Math;
1115
+
1105
1116
  // node_modules/transformation-matrix/src/fromTransformAttribute.autogenerated.js
1106
1117
  function peg$subclass(child, parent) {
1107
1118
  function C() {
@@ -1250,6 +1261,10 @@ function getSVGPathBounds(ds) {
1250
1261
  return { minX, maxX, minY, maxY, width: maxX - minX, height: maxY - minY };
1251
1262
  }
1252
1263
  var get_svg_path_bounds_default = getSVGPathBounds;
1264
+
1265
+ // src/schematic-components/SVGPathComponent.tsx
1266
+ var import_react2 = require("react");
1267
+ var import_jsx_runtime = require("react/jsx-runtime");
1253
1268
  var SVGPathComponent = ({
1254
1269
  size,
1255
1270
  center,
@@ -1260,22 +1275,25 @@ var SVGPathComponent = ({
1260
1275
  }) => {
1261
1276
  const ct = useCameraTransform();
1262
1277
  const pathBounds = get_svg_path_bounds_default(paths.map((p) => p.d));
1263
- Math.abs(pathBounds.width / pathBounds.height - size.width / size.height) > 0.01;
1278
+ const badRatio = Math.abs(pathBounds.width / pathBounds.height - size.width / size.height) > 0.01;
1279
+ if (badRatio) {
1280
+ }
1264
1281
  pathBounds.height = Math.max(pathBounds.height, 1);
1265
1282
  pathBounds.width = Math.max(pathBounds.width, 1);
1266
1283
  const absoluteCenter = applyToPoint(ct, center);
1267
1284
  const actualAbsWidth = size.width * ct.a;
1268
- const actualAbsHeight = size.height * ct.d;
1285
+ const actualAbsHeight = size.height * Math.abs(ct.d);
1269
1286
  const absoluteSize = {
1270
1287
  width: Math.max(1, actualAbsWidth),
1271
1288
  height: Math.max(1, actualAbsHeight)
1272
1289
  };
1273
- const [hovering, setHovering] = react.useState(false);
1290
+ const [hovering, setHovering] = (0, import_react2.useState)(false);
1274
1291
  const svgLeft = absoluteCenter.x - absoluteSize.width / 2;
1275
1292
  const svgTop = absoluteCenter.y - absoluteSize.height / 2;
1276
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1277
- hovering && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1278
- /* @__PURE__ */ jsxRuntime.jsx(
1293
+ const viewBox = `${pathBounds.minX} ${pathBounds.minY} ${pathBounds.width} ${pathBounds.height}`;
1294
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1295
+ hovering && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1296
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1279
1297
  "div",
1280
1298
  {
1281
1299
  style: {
@@ -1291,7 +1309,7 @@ var SVGPathComponent = ({
1291
1309
  }
1292
1310
  }
1293
1311
  ),
1294
- /* @__PURE__ */ jsxRuntime.jsx(
1312
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1295
1313
  "div",
1296
1314
  {
1297
1315
  style: {
@@ -1309,7 +1327,7 @@ var SVGPathComponent = ({
1309
1327
  }
1310
1328
  )
1311
1329
  ] }),
1312
- /* @__PURE__ */ jsxRuntime.jsx(
1330
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1313
1331
  "svg",
1314
1332
  {
1315
1333
  onMouseOver: () => setHovering(Boolean(hoverContent)),
@@ -1319,7 +1337,11 @@ var SVGPathComponent = ({
1319
1337
  // backgroundColor: hovering ? "rgba(0, 0, 255, 0.5)" : "transparent",
1320
1338
  cursor: hovering ? "pointer" : void 0,
1321
1339
  zIndex,
1322
- transform: rotation === 0 ? "" : `rotate(${rotation}rad)`,
1340
+ transform: [
1341
+ "scale(1, -1)",
1342
+ // TODO based on ct.d
1343
+ rotation === 0 ? "" : `rotate(${rotation}rad)`
1344
+ ].join(" "),
1323
1345
  left: svgLeft,
1324
1346
  top: svgTop
1325
1347
  // backgroundColor: badRatio ? "rgba(255, 0, 0, 0.5)" : "transparent",
@@ -1327,8 +1349,8 @@ var SVGPathComponent = ({
1327
1349
  overflow: "visible",
1328
1350
  width: absoluteSize.width,
1329
1351
  height: absoluteSize.height,
1330
- viewBox: `${pathBounds.minX} ${pathBounds.minY} ${pathBounds.width} ${pathBounds.height}`,
1331
- children: paths.map((p, i) => /* @__PURE__ */ jsxRuntime.jsx(
1352
+ viewBox,
1353
+ children: paths.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1332
1354
  "path",
1333
1355
  {
1334
1356
  fill: p.fill ?? "none",
@@ -1344,8 +1366,11 @@ var SVGPathComponent = ({
1344
1366
  ] });
1345
1367
  };
1346
1368
  var SVGPathComponent_default = SVGPathComponent;
1369
+
1370
+ // src/schematic-components/SimpleResistor.tsx
1371
+ var import_jsx_runtime2 = require("react/jsx-runtime");
1347
1372
  var SimpleResistor = ({ component: { source, schematic } }) => {
1348
- return /* @__PURE__ */ jsxRuntime.jsx(
1373
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1349
1374
  SVGPathComponent_default,
1350
1375
  {
1351
1376
  rotation: schematic.rotation,
@@ -1361,10 +1386,13 @@ var SimpleResistor = ({ component: { source, schematic } }) => {
1361
1386
  }
1362
1387
  );
1363
1388
  };
1389
+
1390
+ // src/schematic-components/SimpleCapacitor.tsx
1391
+ var import_jsx_runtime3 = require("react/jsx-runtime");
1364
1392
  var SimpleCapacitor = ({
1365
1393
  component: { source, schematic }
1366
1394
  }) => {
1367
- return /* @__PURE__ */ jsxRuntime.jsx(
1395
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1368
1396
  SVGPathComponent_default,
1369
1397
  {
1370
1398
  rotation: schematic.rotation,
@@ -1380,6 +1408,13 @@ var SimpleCapacitor = ({
1380
1408
  );
1381
1409
  };
1382
1410
 
1411
+ // src/lib/hooks/use-maybe-promise.ts
1412
+ var import_react3 = require("react");
1413
+
1414
+ // src/schematic-components/ProjectComponent.tsx
1415
+ var import_builder = require("@tscircuit/builder");
1416
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1417
+
1383
1418
  // src/lib/utils/direction-to-vec.ts
1384
1419
  var directionToVec = (direction) => {
1385
1420
  if (direction === "up")
@@ -1393,17 +1428,20 @@ var directionToVec = (direction) => {
1393
1428
  else
1394
1429
  throw new Error("Invalid direction");
1395
1430
  };
1431
+
1432
+ // src/schematic-components/SchematicPort.tsx
1433
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1396
1434
  var SchematicPort = ({
1397
1435
  port: { source_port, source_component, schematic }
1398
1436
  }) => {
1399
1437
  const hoverName = source_component?.name ? `.${source_component.name} > .${source_port?.name ?? source_port?.pin_number}` : `.${source_port?.name ?? source_port?.pin_number}`;
1400
- return /* @__PURE__ */ jsxRuntime.jsx(
1438
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1401
1439
  SVGPathComponent,
1402
1440
  {
1403
1441
  rotation: 0,
1404
- hoverContent: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1442
+ hoverContent: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
1405
1443
  hoverName,
1406
- /* @__PURE__ */ jsxRuntime.jsx("br", {}),
1444
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("br", {}),
1407
1445
  source_port?.pin_number && `Pin ${source_port.pin_number}`
1408
1446
  ] }),
1409
1447
  center: schematic.center,
@@ -1427,6 +1465,7 @@ var SchematicPort = ({
1427
1465
  var SchematicPort_default = SchematicPort;
1428
1466
 
1429
1467
  // node_modules/react-use-measure/dist/web.js
1468
+ var import_react4 = require("react");
1430
1469
  var import_debounce = __toESM(require_debounce());
1431
1470
  function useMeasure(_temp) {
1432
1471
  let {
@@ -1444,7 +1483,7 @@ function useMeasure(_temp) {
1444
1483
  if (!ResizeObserver) {
1445
1484
  throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");
1446
1485
  }
1447
- const [bounds, set] = react.useState({
1486
+ const [bounds, set] = (0, import_react4.useState)({
1448
1487
  left: 0,
1449
1488
  top: 0,
1450
1489
  width: 0,
@@ -1454,7 +1493,7 @@ function useMeasure(_temp) {
1454
1493
  x: 0,
1455
1494
  y: 0
1456
1495
  });
1457
- const state = react.useRef({
1496
+ const state = (0, import_react4.useRef)({
1458
1497
  element: null,
1459
1498
  scrollContainers: null,
1460
1499
  resizeObserver: null,
@@ -1462,12 +1501,12 @@ function useMeasure(_temp) {
1462
1501
  });
1463
1502
  const scrollDebounce = debounce ? typeof debounce === "number" ? debounce : debounce.scroll : null;
1464
1503
  const resizeDebounce = debounce ? typeof debounce === "number" ? debounce : debounce.resize : null;
1465
- const mounted = react.useRef(false);
1466
- react.useEffect(() => {
1504
+ const mounted = (0, import_react4.useRef)(false);
1505
+ (0, import_react4.useEffect)(() => {
1467
1506
  mounted.current = true;
1468
1507
  return () => void (mounted.current = false);
1469
1508
  });
1470
- const [forceRefresh, resizeChange, scrollChange] = react.useMemo(() => {
1509
+ const [forceRefresh, resizeChange, scrollChange] = (0, import_react4.useMemo)(() => {
1471
1510
  const callback = () => {
1472
1511
  if (!state.current.element)
1473
1512
  return;
@@ -1533,22 +1572,22 @@ function useMeasure(_temp) {
1533
1572
  };
1534
1573
  useOnWindowScroll(scrollChange, Boolean(scroll));
1535
1574
  useOnWindowResize(resizeChange);
1536
- react.useEffect(() => {
1575
+ (0, import_react4.useEffect)(() => {
1537
1576
  removeListeners();
1538
1577
  addListeners();
1539
1578
  }, [scroll, scrollChange, resizeChange]);
1540
- react.useEffect(() => removeListeners, []);
1579
+ (0, import_react4.useEffect)(() => removeListeners, []);
1541
1580
  return [ref, bounds, forceRefresh];
1542
1581
  }
1543
1582
  function useOnWindowResize(onWindowResize) {
1544
- react.useEffect(() => {
1583
+ (0, import_react4.useEffect)(() => {
1545
1584
  const cb = onWindowResize;
1546
1585
  window.addEventListener("resize", cb);
1547
1586
  return () => void window.removeEventListener("resize", cb);
1548
1587
  }, [onWindowResize]);
1549
1588
  }
1550
1589
  function useOnWindowScroll(onScroll, enabled) {
1551
- react.useEffect(() => {
1590
+ (0, import_react4.useEffect)(() => {
1552
1591
  if (enabled) {
1553
1592
  const cb = onScroll;
1554
1593
  window.addEventListener("scroll", cb, {
@@ -1574,6 +1613,9 @@ function findScrollContainers(element) {
1574
1613
  }
1575
1614
  var keys = ["x", "y", "top", "bottom", "left", "right", "width", "height"];
1576
1615
  var areBoundsEqual = (a, b) => keys.every((key) => a[key] === b[key]);
1616
+
1617
+ // src/schematic-components/SchematicText.tsx
1618
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1577
1619
  var SchematicText = ({ schematic_text }) => {
1578
1620
  const ct = useCameraTransform();
1579
1621
  const { text, position, anchor } = schematic_text;
@@ -1587,7 +1629,7 @@ var SchematicText = ({ schematic_text }) => {
1587
1629
  } else if (anchor === "right") {
1588
1630
  offset = [-bounds.width, -bounds.height / 2];
1589
1631
  }
1590
- return /* @__PURE__ */ jsxRuntime.jsx(
1632
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1591
1633
  "div",
1592
1634
  {
1593
1635
  ref: boundsRef,
@@ -1605,8 +1647,11 @@ var SchematicText_default = SchematicText;
1605
1647
 
1606
1648
  // src/schematic-components/SchematicTrace.tsx
1607
1649
  var import_svg_path_generator = __toESM(require_svg_path_generator2());
1650
+
1651
+ // src/schematic-components/RenderError.tsx
1652
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1608
1653
  var RenderError_default = ({ text }) => {
1609
- return /* @__PURE__ */ jsxRuntime.jsx(
1654
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1610
1655
  "div",
1611
1656
  {
1612
1657
  style: {
@@ -1624,10 +1669,13 @@ var RenderError_default = ({ text }) => {
1624
1669
  }
1625
1670
  );
1626
1671
  };
1672
+
1673
+ // src/schematic-components/SchematicTrace.tsx
1674
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1627
1675
  var SchematicTrace = ({ trace: { source, schematic } }) => {
1628
1676
  const edges = schematic.edges;
1629
1677
  if (edges.length === 0) {
1630
- return /* @__PURE__ */ jsxRuntime.jsx(RenderError_default, { text: `Route with 0 edges (${source.source_trace_id})` });
1678
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RenderError_default, { text: `Route with 0 edges (${source.source_trace_id})` });
1631
1679
  }
1632
1680
  const path = (0, import_svg_path_generator.default)();
1633
1681
  for (let i = 0; i < edges.length; i++) {
@@ -1642,7 +1690,7 @@ var SchematicTrace = ({ trace: { source, schematic } }) => {
1642
1690
  x: pathBounds.minX + pathBounds.width / 2,
1643
1691
  y: pathBounds.minY + pathBounds.height / 2
1644
1692
  };
1645
- return /* @__PURE__ */ jsxRuntime.jsx(
1693
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1646
1694
  SVGPathComponent_default,
1647
1695
  {
1648
1696
  rotation: 0,
@@ -1659,6 +1707,10 @@ var SchematicTrace = ({ trace: { source, schematic } }) => {
1659
1707
  );
1660
1708
  };
1661
1709
  var SchematicTrace_default = SchematicTrace;
1710
+
1711
+ // src/schematic-components/SchematicBug.tsx
1712
+ var import_builder2 = require("@tscircuit/builder");
1713
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1662
1714
  var SchematicBug = ({ component: { source, schematic } }) => {
1663
1715
  const port_arrangement = {
1664
1716
  top_size: 0,
@@ -1667,8 +1719,8 @@ var SchematicBug = ({ component: { source, schematic } }) => {
1667
1719
  };
1668
1720
  let bugw = schematic.size.width;
1669
1721
  let bugh = schematic.size.height;
1670
- const { total_ports, width, height } = builder.getPortArrangementSize(port_arrangement);
1671
- const port_indices = builder.getPortIndices(port_arrangement);
1722
+ const { total_ports, width, height } = (0, import_builder2.getPortArrangementSize)(port_arrangement);
1723
+ const port_indices = (0, import_builder2.getPortIndices)(port_arrangement);
1672
1724
  if (isNaN(bugw))
1673
1725
  bugw = width;
1674
1726
  if (isNaN(bugh))
@@ -1680,7 +1732,7 @@ var SchematicBug = ({ component: { source, schematic } }) => {
1680
1732
  d: `M ${-bugw / 2} ${-bugh / 2} L ${bugw / 2} ${-bugh / 2} L ${bugw / 2} ${bugh / 2} L ${-bugw / 2} ${bugh / 2}Z`
1681
1733
  },
1682
1734
  ...port_indices.map((portNum) => {
1683
- const pos = builder.getPortPosition(port_arrangement, portNum);
1735
+ const pos = (0, import_builder2.getPortPosition)(port_arrangement, portNum);
1684
1736
  const x2 = pos.side === "left" ? -bugw / 2 : pos.side === "right" ? bugw / 2 : pos.x;
1685
1737
  const y2 = pos.side === "top" ? -bugh / 2 : pos.side === "bottom" ? bugh / 2 : pos.y;
1686
1738
  return {
@@ -1695,7 +1747,7 @@ var SchematicBug = ({ component: { source, schematic } }) => {
1695
1747
  x: schematic.center.x + (actualSize.minX + actualSize.maxX) / 2,
1696
1748
  y: schematic.center.y + (actualSize.minY + actualSize.maxY) / 2
1697
1749
  };
1698
- return /* @__PURE__ */ jsxRuntime.jsx(
1750
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1699
1751
  SVGPathComponent_default,
1700
1752
  {
1701
1753
  rotation: schematic.rotation,
@@ -1705,10 +1757,13 @@ var SchematicBug = ({ component: { source, schematic } }) => {
1705
1757
  }
1706
1758
  );
1707
1759
  };
1760
+
1761
+ // src/schematic-components/SimplePowerSource.tsx
1762
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1708
1763
  var SimplePowerSource = ({
1709
1764
  component: { source, schematic }
1710
1765
  }) => {
1711
- return /* @__PURE__ */ jsxRuntime.jsx(
1766
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1712
1767
  SVGPathComponent_default,
1713
1768
  {
1714
1769
  rotation: schematic.rotation,
@@ -1724,8 +1779,11 @@ var SimplePowerSource = ({
1724
1779
  }
1725
1780
  );
1726
1781
  };
1782
+
1783
+ // src/schematic-components/SimpleGround.tsx
1784
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1727
1785
  var SimpleGround = ({ component: { source, schematic } }) => {
1728
- return /* @__PURE__ */ jsxRuntime.jsx(
1786
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1729
1787
  SVGPathComponent_default,
1730
1788
  {
1731
1789
  rotation: schematic.rotation,
@@ -1741,8 +1799,11 @@ var SimpleGround = ({ component: { source, schematic } }) => {
1741
1799
  }
1742
1800
  );
1743
1801
  };
1802
+
1803
+ // src/schematic-components/SimpleInductor.tsx
1804
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1744
1805
  var SimpleInductor = ({ component: { source, schematic } }) => {
1745
- return /* @__PURE__ */ jsxRuntime.jsx(
1806
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1746
1807
  SVGPathComponent_default,
1747
1808
  {
1748
1809
  rotation: schematic.rotation,
@@ -1759,34 +1820,40 @@ var SimpleInductor = ({ component: { source, schematic } }) => {
1759
1820
  }
1760
1821
  );
1761
1822
  };
1823
+
1824
+ // src/schematic-components/SimpleDiode.tsx
1825
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1826
+
1827
+ // src/schematic-components/SchematicComponent.tsx
1828
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1762
1829
  var SchematicComponent = ({ component }) => {
1763
1830
  const { source, schematic } = component;
1764
1831
  if (!source.ftype)
1765
1832
  return null;
1766
1833
  switch (source.ftype) {
1767
1834
  case "simple_resistor": {
1768
- return /* @__PURE__ */ jsxRuntime.jsx(SimpleResistor, { component: { source, schematic } });
1835
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimpleResistor, { component: { source, schematic } });
1769
1836
  }
1770
1837
  case "simple_capacitor": {
1771
- return /* @__PURE__ */ jsxRuntime.jsx(SimpleCapacitor, { component: { source, schematic } });
1838
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimpleCapacitor, { component: { source, schematic } });
1772
1839
  }
1773
1840
  case "simple_power_source": {
1774
- return /* @__PURE__ */ jsxRuntime.jsx(SimplePowerSource, { component: { source, schematic } });
1841
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimplePowerSource, { component: { source, schematic } });
1775
1842
  }
1776
1843
  case "simple_ground": {
1777
- return /* @__PURE__ */ jsxRuntime.jsx(SimpleGround, { component: { source, schematic } });
1844
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimpleGround, { component: { source, schematic } });
1778
1845
  }
1779
1846
  case "simple_inductor": {
1780
- return /* @__PURE__ */ jsxRuntime.jsx(SimpleInductor, { component: { source, schematic } });
1847
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimpleInductor, { component: { source, schematic } });
1781
1848
  }
1782
1849
  case "simple_bug": {
1783
- return /* @__PURE__ */ jsxRuntime.jsx(SchematicBug, { component: { source, schematic } });
1850
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SchematicBug, { component: { source, schematic } });
1784
1851
  }
1785
1852
  case "simple_diode": {
1786
1853
  return null;
1787
1854
  }
1788
1855
  default: {
1789
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1856
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
1790
1857
  "unknown ftype: ",
1791
1858
  component.source.ftype
1792
1859
  ] });
@@ -1794,9 +1861,12 @@ var SchematicComponent = ({ component }) => {
1794
1861
  }
1795
1862
  };
1796
1863
  var SchematicComponent_default = SchematicComponent;
1864
+
1865
+ // src/schematic-components/SchematicBox.tsx
1866
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1797
1867
  var SchematicBox = ({ box: { schematic } }) => {
1798
1868
  const { width: w, height: h } = schematic;
1799
- return /* @__PURE__ */ jsxRuntime.jsx(
1869
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1800
1870
  SVGPathComponent,
1801
1871
  {
1802
1872
  rotation: 0,
@@ -1816,8 +1886,11 @@ var SchematicBox_default = SchematicBox;
1816
1886
 
1817
1887
  // src/schematic-components/SchematicLine.tsx
1818
1888
  var import_svg_path_generator2 = __toESM(require_svg_path_generator2());
1889
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1819
1890
  var SchematicLine = ({ line: { schematic } }) => {
1820
1891
  const { x1, x2, y1, y2 } = schematic;
1892
+ const dx = x2 - x1;
1893
+ const dy = y2 - y1;
1821
1894
  const path = (0, import_svg_path_generator2.default)();
1822
1895
  path.moveTo(x1, y1);
1823
1896
  path.lineTo(x2, y2);
@@ -1829,7 +1902,7 @@ var SchematicLine = ({ line: { schematic } }) => {
1829
1902
  x: pathBounds.minX + pathBounds.width / 2,
1830
1903
  y: pathBounds.minY + pathBounds.height / 2
1831
1904
  };
1832
- return /* @__PURE__ */ jsxRuntime.jsx(
1905
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1833
1906
  SVGPathComponent,
1834
1907
  {
1835
1908
  rotation: 0,
@@ -1849,6 +1922,7 @@ var SchematicLine_default = SchematicLine;
1849
1922
 
1850
1923
  // src/schematic-components/SchematicPath.tsx
1851
1924
  var import_svg_path_generator3 = __toESM(require_svg_path_generator2());
1925
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1852
1926
  var SchematicPath = (props) => {
1853
1927
  const { points, is_filled, is_closed, fill_color } = props.path.schematic;
1854
1928
  if (points.length === 0)
@@ -1869,7 +1943,7 @@ var SchematicPath = (props) => {
1869
1943
  x: pathBounds.minX + pathBounds.width / 2,
1870
1944
  y: pathBounds.minY + pathBounds.height / 2
1871
1945
  };
1872
- return /* @__PURE__ */ jsxRuntime.jsx(
1946
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1873
1947
  SVGPathComponent,
1874
1948
  {
1875
1949
  rotation: 0,
@@ -1887,12 +1961,15 @@ var SchematicPath = (props) => {
1887
1961
  );
1888
1962
  };
1889
1963
  var SchematicPath_default = SchematicPath;
1964
+
1965
+ // src/schematic-components/SchematicElement.tsx
1966
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1890
1967
  var SchematicElement = ({
1891
1968
  element,
1892
1969
  allElements
1893
1970
  }) => {
1894
1971
  if (element.type === "schematic_component") {
1895
- return /* @__PURE__ */ jsxRuntime.jsx(
1972
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1896
1973
  SchematicComponent_default,
1897
1974
  {
1898
1975
  component: collectElementRefs(element, allElements)
@@ -1900,69 +1977,80 @@ var SchematicElement = ({
1900
1977
  );
1901
1978
  }
1902
1979
  if (element.type === "schematic_trace") {
1903
- return /* @__PURE__ */ jsxRuntime.jsx(SchematicTrace_default, { trace: collectElementRefs(element, allElements) });
1980
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicTrace_default, { trace: collectElementRefs(element, allElements) });
1904
1981
  }
1905
1982
  if (element.type === "schematic_port") {
1906
- return /* @__PURE__ */ jsxRuntime.jsx(SchematicPort_default, { port: collectElementRefs(element, allElements) });
1983
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicPort_default, { port: collectElementRefs(element, allElements) });
1907
1984
  }
1908
1985
  if (element.type === "schematic_box") {
1909
- return /* @__PURE__ */ jsxRuntime.jsx(SchematicBox_default, { box: collectElementRefs(element, allElements) });
1986
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicBox_default, { box: collectElementRefs(element, allElements) });
1910
1987
  }
1911
1988
  if (element.type === "schematic_line") {
1912
- return /* @__PURE__ */ jsxRuntime.jsx(SchematicLine_default, { line: collectElementRefs(element, allElements) });
1989
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicLine_default, { line: collectElementRefs(element, allElements) });
1913
1990
  }
1914
1991
  if (element.type === "schematic_path") {
1915
- return /* @__PURE__ */ jsxRuntime.jsx(SchematicPath_default, { path: collectElementRefs(element, allElements) });
1992
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicPath_default, { path: collectElementRefs(element, allElements) });
1916
1993
  }
1917
1994
  if (element.type === "schematic_text") {
1918
- return /* @__PURE__ */ jsxRuntime.jsx(SchematicText_default, { schematic_text: element });
1995
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicText_default, { schematic_text: element });
1919
1996
  }
1920
1997
  if (element.type === "source_error") {
1921
- return /* @__PURE__ */ jsxRuntime.jsx(RenderError_default, { text: element.message });
1998
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RenderError_default, { text: element.message });
1922
1999
  }
1923
2000
  return null;
1924
2001
  };
1925
- var LazyTableViewer = react.lazy(
1926
- () => import('@tscircuit/table-viewer').then((m) => ({
2002
+
2003
+ // src/Schematic.tsx
2004
+ var import_use_mouse_matrix_transform = require("use-mouse-matrix-transform");
2005
+ var import_react_error_boundary = require("react-error-boundary");
2006
+
2007
+ // src/schematic-components/TableViewer.tsx
2008
+ var import_react5 = require("react");
2009
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2010
+ var LazyTableViewer = (0, import_react5.lazy)(
2011
+ () => import("@tscircuit/table-viewer").then((m) => ({
1927
2012
  default: m.SoupTableViewer
1928
2013
  }))
1929
2014
  );
1930
- var TableViewer = (params) => /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntime.jsx(LazyTableViewer, { ...params }) });
1931
- var ErrorBoundary = reactErrorBoundary.ErrorBoundary;
2015
+ var TableViewer = (params) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react5.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: "Loading..." }), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LazyTableViewer, { ...params }) });
2016
+
2017
+ // src/Schematic.tsx
2018
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2019
+ var ErrorBoundary = import_react_error_boundary.ErrorBoundary;
1932
2020
  var fallbackRender = (elm) => ({ error, resetErrorBoundary }) => {
1933
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { color: "red" }, children: [
2021
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { color: "red" }, children: [
1934
2022
  "error rendering ",
1935
2023
  elm.type,
1936
2024
  ": ",
1937
2025
  error.toString()
1938
2026
  ] });
1939
2027
  };
1940
- var toMMSINeg = (v, z) => v >= 0 ? reactSupergrid.toMMSI(v, z) : `-${reactSupergrid.toMMSI(-v, z)}`;
2028
+ var toMMSINeg = (v, z) => v >= 0 ? (0, import_react_supergrid.toMMSI)(v, z) : `-${(0, import_react_supergrid.toMMSI)(-v, z)}`;
1941
2029
  var Schematic = ({
1942
2030
  children,
1943
2031
  elements: initialElements,
1944
2032
  soup: initialSoup,
1945
2033
  style,
1946
- showTable
2034
+ showTable = false
1947
2035
  }) => {
1948
2036
  initialSoup = initialSoup ?? initialElements ?? [];
1949
- const [elements, setElements] = react.useState(initialSoup ?? []);
1950
- const [project, setProject] = react.useState(null);
2037
+ const [elements, setElements] = (0, import_react6.useState)(initialSoup ?? []);
2038
+ const [project, setProject] = (0, import_react6.useState)(null);
1951
2039
  const setCameraTransform = useRenderContext((s) => s.setCameraTransform);
1952
2040
  const cameraTransform = useRenderContext((s) => s.camera_transform);
1953
2041
  const [boundsRef, bounds] = useMeasure();
1954
- const { ref, setTransform } = useMouseMatrixTransform.useMouseMatrixTransform({
2042
+ const { ref, setTransform } = (0, import_use_mouse_matrix_transform.useMouseMatrixTransform)({
1955
2043
  onSetTransform: (transform2) => {
1956
2044
  setCameraTransform(transform2);
1957
2045
  }
1958
2046
  // initialTransform: compose(scale(100, 100, 0, 0)),
1959
2047
  });
1960
- const setElementsAndCamera = react.useCallback(
2048
+ const setElementsAndCamera = (0, import_react6.useCallback)(
1961
2049
  (elements2) => {
1962
2050
  const elmBounds = ref.current.getBoundingClientRect();
1963
2051
  const { center, width, height } = elements2.some(
1964
2052
  (e) => e.type.startsWith("schematic_")
1965
- ) ? builder.findBoundsAndCenter(
2053
+ ) ? (0, import_builder3.findBoundsAndCenter)(
1966
2054
  elements2.filter((e) => e.type.startsWith("schematic_"))
1967
2055
  ) : { center: { x: 0, y: 0 }, width: 1e-3, height: 1e-3 };
1968
2056
  const scaleFactor = Math.min(
@@ -1971,33 +2059,33 @@ var Schematic = ({
1971
2059
  100
1972
2060
  );
1973
2061
  setElements(elements2);
1974
- setProject(builder.createProjectFromElements(elements2));
2062
+ setProject((0, import_builder3.createProjectFromElements)(elements2));
1975
2063
  setTransform(
1976
2064
  compose(
1977
2065
  translate((elmBounds.width ?? 0) / 2, (elmBounds.height ?? 0) / 2),
1978
2066
  // translate(100, 0),
1979
- scale(scaleFactor, scaleFactor, 0, 0),
2067
+ scale(scaleFactor, -scaleFactor, 0, 0),
1980
2068
  translate(-center.x, -center.y)
1981
2069
  )
1982
2070
  );
1983
2071
  },
1984
2072
  [setElements, setTransform]
1985
2073
  );
1986
- react.useEffect(() => {
2074
+ (0, import_react6.useEffect)(() => {
1987
2075
  if (initialSoup.length > 0) {
1988
2076
  setElementsAndCamera(initialSoup);
1989
2077
  return;
1990
2078
  }
1991
- const projectBuilder = builder.createProjectBuilder();
1992
- (TscReactFiber.createRoot ?? TscReactFiber__default.default.createRoot)().render(children, projectBuilder).then(async (elements2) => {
2079
+ const projectBuilder = (0, import_builder3.createProjectBuilder)();
2080
+ (import_react_fiber.createRoot ?? import_react_fiber.default.createRoot)().render(children, projectBuilder).then(async (elements2) => {
1993
2081
  setElementsAndCamera(elements2);
1994
2082
  }).catch((e) => {
1995
2083
  console.error("ERROR RENDERING CIRCUIT");
1996
2084
  throw e;
1997
2085
  });
1998
2086
  }, [children]);
1999
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2000
- /* @__PURE__ */ jsxRuntime.jsxs(
2087
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
2088
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2001
2089
  "div",
2002
2090
  {
2003
2091
  style: {
@@ -2015,8 +2103,8 @@ var Schematic = ({
2015
2103
  boundsRef(el);
2016
2104
  },
2017
2105
  children: [
2018
- /* @__PURE__ */ jsxRuntime.jsx(
2019
- reactSupergrid.SuperGrid,
2106
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2107
+ import_react_supergrid.SuperGrid,
2020
2108
  {
2021
2109
  stringifyCoord: (x, y, z) => {
2022
2110
  if (z === 0)
@@ -2028,7 +2116,7 @@ var Schematic = ({
2028
2116
  transform: cameraTransform
2029
2117
  }
2030
2118
  ),
2031
- elements?.map((elm, i) => /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { fallbackRender: fallbackRender(elm), children: /* @__PURE__ */ jsxRuntime.jsx(
2119
+ elements?.map((elm, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorBoundary, { fallbackRender: fallbackRender(elm), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2032
2120
  SchematicElement,
2033
2121
  {
2034
2122
  element: elm,
@@ -2039,9 +2127,13 @@ var Schematic = ({
2039
2127
  ]
2040
2128
  }
2041
2129
  ),
2042
- showTable !== false && elements && /* @__PURE__ */ jsxRuntime.jsx(TableViewer, { elements })
2130
+ showTable !== false && elements && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TableViewer, { elements })
2043
2131
  ] });
2044
2132
  };
2133
+ // Annotate the CommonJS export names for ESM import in node:
2134
+ 0 && (module.exports = {
2135
+ Schematic
2136
+ });
2045
2137
  /*! Bundled license information:
2046
2138
 
2047
2139
  use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js:
@@ -2088,7 +2180,4 @@ use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.developme
2088
2180
  * LICENSE file in the root directory of this source tree.
2089
2181
  *)
2090
2182
  */
2091
-
2092
- exports.Schematic = Schematic;
2093
- //# sourceMappingURL=out.js.map
2094
2183
  //# sourceMappingURL=index.js.map