@tscircuit/schematic-viewer 1.1.4 → 1.1.6
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
|
@@ -926,347 +926,6 @@ var require_svg_path_generator2 = __commonJS({
|
|
|
926
926
|
}
|
|
927
927
|
});
|
|
928
928
|
|
|
929
|
-
// node_modules/lodash/_baseRange.js
|
|
930
|
-
var require_baseRange = __commonJS({
|
|
931
|
-
"node_modules/lodash/_baseRange.js"(exports, module2) {
|
|
932
|
-
var nativeCeil = Math.ceil;
|
|
933
|
-
var nativeMax = Math.max;
|
|
934
|
-
function baseRange(start, end, step, fromRight) {
|
|
935
|
-
var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
|
|
936
|
-
while (length--) {
|
|
937
|
-
result[fromRight ? length : ++index] = start;
|
|
938
|
-
start += step;
|
|
939
|
-
}
|
|
940
|
-
return result;
|
|
941
|
-
}
|
|
942
|
-
module2.exports = baseRange;
|
|
943
|
-
}
|
|
944
|
-
});
|
|
945
|
-
|
|
946
|
-
// node_modules/lodash/eq.js
|
|
947
|
-
var require_eq = __commonJS({
|
|
948
|
-
"node_modules/lodash/eq.js"(exports, module2) {
|
|
949
|
-
function eq(value, other) {
|
|
950
|
-
return value === other || value !== value && other !== other;
|
|
951
|
-
}
|
|
952
|
-
module2.exports = eq;
|
|
953
|
-
}
|
|
954
|
-
});
|
|
955
|
-
|
|
956
|
-
// node_modules/lodash/_freeGlobal.js
|
|
957
|
-
var require_freeGlobal = __commonJS({
|
|
958
|
-
"node_modules/lodash/_freeGlobal.js"(exports, module2) {
|
|
959
|
-
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
960
|
-
module2.exports = freeGlobal;
|
|
961
|
-
}
|
|
962
|
-
});
|
|
963
|
-
|
|
964
|
-
// node_modules/lodash/_root.js
|
|
965
|
-
var require_root = __commonJS({
|
|
966
|
-
"node_modules/lodash/_root.js"(exports, module2) {
|
|
967
|
-
var freeGlobal = require_freeGlobal();
|
|
968
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
969
|
-
var root = freeGlobal || freeSelf || Function("return this")();
|
|
970
|
-
module2.exports = root;
|
|
971
|
-
}
|
|
972
|
-
});
|
|
973
|
-
|
|
974
|
-
// node_modules/lodash/_Symbol.js
|
|
975
|
-
var require_Symbol = __commonJS({
|
|
976
|
-
"node_modules/lodash/_Symbol.js"(exports, module2) {
|
|
977
|
-
var root = require_root();
|
|
978
|
-
var Symbol2 = root.Symbol;
|
|
979
|
-
module2.exports = Symbol2;
|
|
980
|
-
}
|
|
981
|
-
});
|
|
982
|
-
|
|
983
|
-
// node_modules/lodash/_getRawTag.js
|
|
984
|
-
var require_getRawTag = __commonJS({
|
|
985
|
-
"node_modules/lodash/_getRawTag.js"(exports, module2) {
|
|
986
|
-
var Symbol2 = require_Symbol();
|
|
987
|
-
var objectProto = Object.prototype;
|
|
988
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
989
|
-
var nativeObjectToString = objectProto.toString;
|
|
990
|
-
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
991
|
-
function getRawTag(value) {
|
|
992
|
-
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
|
|
993
|
-
try {
|
|
994
|
-
value[symToStringTag] = void 0;
|
|
995
|
-
var unmasked = true;
|
|
996
|
-
} catch (e) {
|
|
997
|
-
}
|
|
998
|
-
var result = nativeObjectToString.call(value);
|
|
999
|
-
if (unmasked) {
|
|
1000
|
-
if (isOwn) {
|
|
1001
|
-
value[symToStringTag] = tag;
|
|
1002
|
-
} else {
|
|
1003
|
-
delete value[symToStringTag];
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
return result;
|
|
1007
|
-
}
|
|
1008
|
-
module2.exports = getRawTag;
|
|
1009
|
-
}
|
|
1010
|
-
});
|
|
1011
|
-
|
|
1012
|
-
// node_modules/lodash/_objectToString.js
|
|
1013
|
-
var require_objectToString = __commonJS({
|
|
1014
|
-
"node_modules/lodash/_objectToString.js"(exports, module2) {
|
|
1015
|
-
var objectProto = Object.prototype;
|
|
1016
|
-
var nativeObjectToString = objectProto.toString;
|
|
1017
|
-
function objectToString(value) {
|
|
1018
|
-
return nativeObjectToString.call(value);
|
|
1019
|
-
}
|
|
1020
|
-
module2.exports = objectToString;
|
|
1021
|
-
}
|
|
1022
|
-
});
|
|
1023
|
-
|
|
1024
|
-
// node_modules/lodash/_baseGetTag.js
|
|
1025
|
-
var require_baseGetTag = __commonJS({
|
|
1026
|
-
"node_modules/lodash/_baseGetTag.js"(exports, module2) {
|
|
1027
|
-
var Symbol2 = require_Symbol();
|
|
1028
|
-
var getRawTag = require_getRawTag();
|
|
1029
|
-
var objectToString = require_objectToString();
|
|
1030
|
-
var nullTag = "[object Null]";
|
|
1031
|
-
var undefinedTag = "[object Undefined]";
|
|
1032
|
-
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
1033
|
-
function baseGetTag(value) {
|
|
1034
|
-
if (value == null) {
|
|
1035
|
-
return value === void 0 ? undefinedTag : nullTag;
|
|
1036
|
-
}
|
|
1037
|
-
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
1038
|
-
}
|
|
1039
|
-
module2.exports = baseGetTag;
|
|
1040
|
-
}
|
|
1041
|
-
});
|
|
1042
|
-
|
|
1043
|
-
// node_modules/lodash/isObject.js
|
|
1044
|
-
var require_isObject = __commonJS({
|
|
1045
|
-
"node_modules/lodash/isObject.js"(exports, module2) {
|
|
1046
|
-
function isObject2(value) {
|
|
1047
|
-
var type = typeof value;
|
|
1048
|
-
return value != null && (type == "object" || type == "function");
|
|
1049
|
-
}
|
|
1050
|
-
module2.exports = isObject2;
|
|
1051
|
-
}
|
|
1052
|
-
});
|
|
1053
|
-
|
|
1054
|
-
// node_modules/lodash/isFunction.js
|
|
1055
|
-
var require_isFunction = __commonJS({
|
|
1056
|
-
"node_modules/lodash/isFunction.js"(exports, module2) {
|
|
1057
|
-
var baseGetTag = require_baseGetTag();
|
|
1058
|
-
var isObject2 = require_isObject();
|
|
1059
|
-
var asyncTag = "[object AsyncFunction]";
|
|
1060
|
-
var funcTag = "[object Function]";
|
|
1061
|
-
var genTag = "[object GeneratorFunction]";
|
|
1062
|
-
var proxyTag = "[object Proxy]";
|
|
1063
|
-
function isFunction(value) {
|
|
1064
|
-
if (!isObject2(value)) {
|
|
1065
|
-
return false;
|
|
1066
|
-
}
|
|
1067
|
-
var tag = baseGetTag(value);
|
|
1068
|
-
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
1069
|
-
}
|
|
1070
|
-
module2.exports = isFunction;
|
|
1071
|
-
}
|
|
1072
|
-
});
|
|
1073
|
-
|
|
1074
|
-
// node_modules/lodash/isLength.js
|
|
1075
|
-
var require_isLength = __commonJS({
|
|
1076
|
-
"node_modules/lodash/isLength.js"(exports, module2) {
|
|
1077
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
1078
|
-
function isLength(value) {
|
|
1079
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
1080
|
-
}
|
|
1081
|
-
module2.exports = isLength;
|
|
1082
|
-
}
|
|
1083
|
-
});
|
|
1084
|
-
|
|
1085
|
-
// node_modules/lodash/isArrayLike.js
|
|
1086
|
-
var require_isArrayLike = __commonJS({
|
|
1087
|
-
"node_modules/lodash/isArrayLike.js"(exports, module2) {
|
|
1088
|
-
var isFunction = require_isFunction();
|
|
1089
|
-
var isLength = require_isLength();
|
|
1090
|
-
function isArrayLike(value) {
|
|
1091
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
1092
|
-
}
|
|
1093
|
-
module2.exports = isArrayLike;
|
|
1094
|
-
}
|
|
1095
|
-
});
|
|
1096
|
-
|
|
1097
|
-
// node_modules/lodash/_isIndex.js
|
|
1098
|
-
var require_isIndex = __commonJS({
|
|
1099
|
-
"node_modules/lodash/_isIndex.js"(exports, module2) {
|
|
1100
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
1101
|
-
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
1102
|
-
function isIndex(value, length) {
|
|
1103
|
-
var type = typeof value;
|
|
1104
|
-
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
1105
|
-
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
1106
|
-
}
|
|
1107
|
-
module2.exports = isIndex;
|
|
1108
|
-
}
|
|
1109
|
-
});
|
|
1110
|
-
|
|
1111
|
-
// node_modules/lodash/_isIterateeCall.js
|
|
1112
|
-
var require_isIterateeCall = __commonJS({
|
|
1113
|
-
"node_modules/lodash/_isIterateeCall.js"(exports, module2) {
|
|
1114
|
-
var eq = require_eq();
|
|
1115
|
-
var isArrayLike = require_isArrayLike();
|
|
1116
|
-
var isIndex = require_isIndex();
|
|
1117
|
-
var isObject2 = require_isObject();
|
|
1118
|
-
function isIterateeCall(value, index, object) {
|
|
1119
|
-
if (!isObject2(object)) {
|
|
1120
|
-
return false;
|
|
1121
|
-
}
|
|
1122
|
-
var type = typeof index;
|
|
1123
|
-
if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
|
|
1124
|
-
return eq(object[index], value);
|
|
1125
|
-
}
|
|
1126
|
-
return false;
|
|
1127
|
-
}
|
|
1128
|
-
module2.exports = isIterateeCall;
|
|
1129
|
-
}
|
|
1130
|
-
});
|
|
1131
|
-
|
|
1132
|
-
// node_modules/lodash/_trimmedEndIndex.js
|
|
1133
|
-
var require_trimmedEndIndex = __commonJS({
|
|
1134
|
-
"node_modules/lodash/_trimmedEndIndex.js"(exports, module2) {
|
|
1135
|
-
var reWhitespace = /\s/;
|
|
1136
|
-
function trimmedEndIndex(string) {
|
|
1137
|
-
var index = string.length;
|
|
1138
|
-
while (index-- && reWhitespace.test(string.charAt(index))) {
|
|
1139
|
-
}
|
|
1140
|
-
return index;
|
|
1141
|
-
}
|
|
1142
|
-
module2.exports = trimmedEndIndex;
|
|
1143
|
-
}
|
|
1144
|
-
});
|
|
1145
|
-
|
|
1146
|
-
// node_modules/lodash/_baseTrim.js
|
|
1147
|
-
var require_baseTrim = __commonJS({
|
|
1148
|
-
"node_modules/lodash/_baseTrim.js"(exports, module2) {
|
|
1149
|
-
var trimmedEndIndex = require_trimmedEndIndex();
|
|
1150
|
-
var reTrimStart = /^\s+/;
|
|
1151
|
-
function baseTrim(string) {
|
|
1152
|
-
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
|
|
1153
|
-
}
|
|
1154
|
-
module2.exports = baseTrim;
|
|
1155
|
-
}
|
|
1156
|
-
});
|
|
1157
|
-
|
|
1158
|
-
// node_modules/lodash/isObjectLike.js
|
|
1159
|
-
var require_isObjectLike = __commonJS({
|
|
1160
|
-
"node_modules/lodash/isObjectLike.js"(exports, module2) {
|
|
1161
|
-
function isObjectLike(value) {
|
|
1162
|
-
return value != null && typeof value == "object";
|
|
1163
|
-
}
|
|
1164
|
-
module2.exports = isObjectLike;
|
|
1165
|
-
}
|
|
1166
|
-
});
|
|
1167
|
-
|
|
1168
|
-
// node_modules/lodash/isSymbol.js
|
|
1169
|
-
var require_isSymbol = __commonJS({
|
|
1170
|
-
"node_modules/lodash/isSymbol.js"(exports, module2) {
|
|
1171
|
-
var baseGetTag = require_baseGetTag();
|
|
1172
|
-
var isObjectLike = require_isObjectLike();
|
|
1173
|
-
var symbolTag = "[object Symbol]";
|
|
1174
|
-
function isSymbol(value) {
|
|
1175
|
-
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
1176
|
-
}
|
|
1177
|
-
module2.exports = isSymbol;
|
|
1178
|
-
}
|
|
1179
|
-
});
|
|
1180
|
-
|
|
1181
|
-
// node_modules/lodash/toNumber.js
|
|
1182
|
-
var require_toNumber = __commonJS({
|
|
1183
|
-
"node_modules/lodash/toNumber.js"(exports, module2) {
|
|
1184
|
-
var baseTrim = require_baseTrim();
|
|
1185
|
-
var isObject2 = require_isObject();
|
|
1186
|
-
var isSymbol = require_isSymbol();
|
|
1187
|
-
var NAN = 0 / 0;
|
|
1188
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
1189
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
1190
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
1191
|
-
var freeParseInt = parseInt;
|
|
1192
|
-
function toNumber(value) {
|
|
1193
|
-
if (typeof value == "number") {
|
|
1194
|
-
return value;
|
|
1195
|
-
}
|
|
1196
|
-
if (isSymbol(value)) {
|
|
1197
|
-
return NAN;
|
|
1198
|
-
}
|
|
1199
|
-
if (isObject2(value)) {
|
|
1200
|
-
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
1201
|
-
value = isObject2(other) ? other + "" : other;
|
|
1202
|
-
}
|
|
1203
|
-
if (typeof value != "string") {
|
|
1204
|
-
return value === 0 ? value : +value;
|
|
1205
|
-
}
|
|
1206
|
-
value = baseTrim(value);
|
|
1207
|
-
var isBinary = reIsBinary.test(value);
|
|
1208
|
-
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
1209
|
-
}
|
|
1210
|
-
module2.exports = toNumber;
|
|
1211
|
-
}
|
|
1212
|
-
});
|
|
1213
|
-
|
|
1214
|
-
// node_modules/lodash/toFinite.js
|
|
1215
|
-
var require_toFinite = __commonJS({
|
|
1216
|
-
"node_modules/lodash/toFinite.js"(exports, module2) {
|
|
1217
|
-
var toNumber = require_toNumber();
|
|
1218
|
-
var INFINITY = 1 / 0;
|
|
1219
|
-
var MAX_INTEGER = 17976931348623157e292;
|
|
1220
|
-
function toFinite(value) {
|
|
1221
|
-
if (!value) {
|
|
1222
|
-
return value === 0 ? value : 0;
|
|
1223
|
-
}
|
|
1224
|
-
value = toNumber(value);
|
|
1225
|
-
if (value === INFINITY || value === -INFINITY) {
|
|
1226
|
-
var sign = value < 0 ? -1 : 1;
|
|
1227
|
-
return sign * MAX_INTEGER;
|
|
1228
|
-
}
|
|
1229
|
-
return value === value ? value : 0;
|
|
1230
|
-
}
|
|
1231
|
-
module2.exports = toFinite;
|
|
1232
|
-
}
|
|
1233
|
-
});
|
|
1234
|
-
|
|
1235
|
-
// node_modules/lodash/_createRange.js
|
|
1236
|
-
var require_createRange = __commonJS({
|
|
1237
|
-
"node_modules/lodash/_createRange.js"(exports, module2) {
|
|
1238
|
-
var baseRange = require_baseRange();
|
|
1239
|
-
var isIterateeCall = require_isIterateeCall();
|
|
1240
|
-
var toFinite = require_toFinite();
|
|
1241
|
-
function createRange(fromRight) {
|
|
1242
|
-
return function(start, end, step) {
|
|
1243
|
-
if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
|
|
1244
|
-
end = step = void 0;
|
|
1245
|
-
}
|
|
1246
|
-
start = toFinite(start);
|
|
1247
|
-
if (end === void 0) {
|
|
1248
|
-
end = start;
|
|
1249
|
-
start = 0;
|
|
1250
|
-
} else {
|
|
1251
|
-
end = toFinite(end);
|
|
1252
|
-
}
|
|
1253
|
-
step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
|
|
1254
|
-
return baseRange(start, end, step, fromRight);
|
|
1255
|
-
};
|
|
1256
|
-
}
|
|
1257
|
-
module2.exports = createRange;
|
|
1258
|
-
}
|
|
1259
|
-
});
|
|
1260
|
-
|
|
1261
|
-
// node_modules/lodash/range.js
|
|
1262
|
-
var require_range = __commonJS({
|
|
1263
|
-
"node_modules/lodash/range.js"(exports, module2) {
|
|
1264
|
-
var createRange = require_createRange();
|
|
1265
|
-
var range2 = createRange();
|
|
1266
|
-
module2.exports = range2;
|
|
1267
|
-
}
|
|
1268
|
-
});
|
|
1269
|
-
|
|
1270
929
|
// src/index.ts
|
|
1271
930
|
var src_exports = {};
|
|
1272
931
|
__export(src_exports, {
|
|
@@ -1275,7 +934,7 @@ __export(src_exports, {
|
|
|
1275
934
|
module.exports = __toCommonJS(src_exports);
|
|
1276
935
|
|
|
1277
936
|
// src/Schematic.tsx
|
|
1278
|
-
var
|
|
937
|
+
var import_react5 = require("react");
|
|
1279
938
|
var import_react_supergrid = require("react-supergrid");
|
|
1280
939
|
var import_builder3 = require("@tscircuit/builder");
|
|
1281
940
|
var import_react_fiber = require("@tscircuit/react-fiber");
|
|
@@ -1452,15 +1111,15 @@ function peg$subclass(child, parent) {
|
|
|
1452
1111
|
child.prototype = new C();
|
|
1453
1112
|
}
|
|
1454
1113
|
function peg$SyntaxError(message, expected, found, location) {
|
|
1455
|
-
var
|
|
1114
|
+
var self = Error.call(this, message);
|
|
1456
1115
|
if (Object.setPrototypeOf) {
|
|
1457
|
-
Object.setPrototypeOf(
|
|
1116
|
+
Object.setPrototypeOf(self, peg$SyntaxError.prototype);
|
|
1458
1117
|
}
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
return
|
|
1118
|
+
self.expected = expected;
|
|
1119
|
+
self.found = found;
|
|
1120
|
+
self.location = location;
|
|
1121
|
+
self.name = "SyntaxError";
|
|
1122
|
+
return self;
|
|
1464
1123
|
}
|
|
1465
1124
|
peg$subclass(peg$SyntaxError, Error);
|
|
1466
1125
|
function peg$padEnd(str, targetLength, padString) {
|
|
@@ -1945,7 +1604,6 @@ var SchematicTrace = ({ trace: { source, schematic } }) => {
|
|
|
1945
1604
|
var SchematicTrace_default = SchematicTrace;
|
|
1946
1605
|
|
|
1947
1606
|
// src/schematic-components/SchematicBug.tsx
|
|
1948
|
-
var import_range = __toESM(require_range());
|
|
1949
1607
|
var import_builder2 = require("@tscircuit/builder");
|
|
1950
1608
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1951
1609
|
var SchematicBug = ({ component: { source, schematic } }) => {
|
|
@@ -1957,6 +1615,7 @@ var SchematicBug = ({ component: { source, schematic } }) => {
|
|
|
1957
1615
|
let bugw = schematic.size.width;
|
|
1958
1616
|
let bugh = schematic.size.height;
|
|
1959
1617
|
const { total_ports, width, height } = (0, import_builder2.getPortArrangementSize)(port_arrangement);
|
|
1618
|
+
const port_indices = (0, import_builder2.getPortIndices)(port_arrangement);
|
|
1960
1619
|
if (isNaN(bugw))
|
|
1961
1620
|
bugw = width;
|
|
1962
1621
|
if (isNaN(bugh))
|
|
@@ -1967,7 +1626,7 @@ var SchematicBug = ({ component: { source, schematic } }) => {
|
|
|
1967
1626
|
strokeWidth: 0.02,
|
|
1968
1627
|
d: `M ${-bugw / 2} ${-bugh / 2} L ${bugw / 2} ${-bugh / 2} L ${bugw / 2} ${bugh / 2} L ${-bugw / 2} ${bugh / 2}Z`
|
|
1969
1628
|
},
|
|
1970
|
-
...
|
|
1629
|
+
...port_indices.map((portNum) => {
|
|
1971
1630
|
const pos = (0, import_builder2.getPortPosition)(port_arrangement, portNum);
|
|
1972
1631
|
const x2 = pos.side === "left" ? -bugw / 2 : pos.side === "right" ? bugw / 2 : pos.x;
|
|
1973
1632
|
const y2 = pos.side === "top" ? -bugh / 2 : pos.side === "bottom" ? bugh / 2 : pos.y;
|
|
@@ -2196,10 +1855,28 @@ var SchematicElement = ({
|
|
|
2196
1855
|
// src/Schematic.tsx
|
|
2197
1856
|
var import_use_mouse_matrix_transform = require("use-mouse-matrix-transform");
|
|
2198
1857
|
var import_react_error_boundary = require("react-error-boundary");
|
|
2199
|
-
|
|
1858
|
+
|
|
1859
|
+
// src/schematic-components/TableViewer.tsx
|
|
1860
|
+
var import_react4 = require("react");
|
|
2200
1861
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1862
|
+
var LazyTableViewer = (0, import_react4.lazy)(
|
|
1863
|
+
() => import("@tscircuit/table-viewer").then((m) => ({
|
|
1864
|
+
default: m.SoupTableViewer
|
|
1865
|
+
}))
|
|
1866
|
+
);
|
|
1867
|
+
var TableViewer = (params) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react4.Suspense, {
|
|
1868
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", {
|
|
1869
|
+
children: "Loading..."
|
|
1870
|
+
}),
|
|
1871
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LazyTableViewer, {
|
|
1872
|
+
...params
|
|
1873
|
+
})
|
|
1874
|
+
});
|
|
1875
|
+
|
|
1876
|
+
// src/Schematic.tsx
|
|
1877
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2201
1878
|
var fallbackRender = (elm) => ({ error, resetErrorBoundary }) => {
|
|
2202
|
-
return /* @__PURE__ */ (0,
|
|
1879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", {
|
|
2203
1880
|
style: { color: "red" },
|
|
2204
1881
|
children: [
|
|
2205
1882
|
"error rendering ",
|
|
@@ -2218,8 +1895,8 @@ var Schematic = ({
|
|
|
2218
1895
|
showTable
|
|
2219
1896
|
}) => {
|
|
2220
1897
|
initialSoup = initialSoup ?? initialElements ?? [];
|
|
2221
|
-
const [elements, setElements] = (0,
|
|
2222
|
-
const [project, setProject] = (0,
|
|
1898
|
+
const [elements, setElements] = (0, import_react5.useState)(initialSoup ?? []);
|
|
1899
|
+
const [project, setProject] = (0, import_react5.useState)(null);
|
|
2223
1900
|
const setCameraTransform = useRenderContext((s) => s.setCameraTransform);
|
|
2224
1901
|
const cameraTransform = useRenderContext((s) => s.camera_transform);
|
|
2225
1902
|
const [boundsRef, bounds] = useMeasure();
|
|
@@ -2228,7 +1905,7 @@ var Schematic = ({
|
|
|
2228
1905
|
setCameraTransform(transform2);
|
|
2229
1906
|
}
|
|
2230
1907
|
});
|
|
2231
|
-
const setElementsAndCamera = (0,
|
|
1908
|
+
const setElementsAndCamera = (0, import_react5.useCallback)(
|
|
2232
1909
|
(elements2) => {
|
|
2233
1910
|
const elmBounds = ref.current.getBoundingClientRect();
|
|
2234
1911
|
const { center, width, height } = elements2.some(
|
|
@@ -2253,7 +1930,7 @@ var Schematic = ({
|
|
|
2253
1930
|
},
|
|
2254
1931
|
[setElements, setTransform]
|
|
2255
1932
|
);
|
|
2256
|
-
(0,
|
|
1933
|
+
(0, import_react5.useEffect)(() => {
|
|
2257
1934
|
if (initialSoup.length > 0) {
|
|
2258
1935
|
setElementsAndCamera(initialSoup);
|
|
2259
1936
|
return;
|
|
@@ -2266,9 +1943,9 @@ var Schematic = ({
|
|
|
2266
1943
|
throw e;
|
|
2267
1944
|
});
|
|
2268
1945
|
}, [children]);
|
|
2269
|
-
return /* @__PURE__ */ (0,
|
|
1946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, {
|
|
2270
1947
|
children: [
|
|
2271
|
-
/* @__PURE__ */ (0,
|
|
1948
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", {
|
|
2272
1949
|
style: {
|
|
2273
1950
|
width: "100%",
|
|
2274
1951
|
backgroundColor: "rgba(255,255,255,0)",
|
|
@@ -2283,7 +1960,7 @@ var Schematic = ({
|
|
|
2283
1960
|
boundsRef(el);
|
|
2284
1961
|
},
|
|
2285
1962
|
children: [
|
|
2286
|
-
/* @__PURE__ */ (0,
|
|
1963
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_supergrid.SuperGrid, {
|
|
2287
1964
|
stringifyCoord: (x, y, z) => {
|
|
2288
1965
|
if (z === 0)
|
|
2289
1966
|
return "";
|
|
@@ -2293,16 +1970,16 @@ var Schematic = ({
|
|
|
2293
1970
|
height: bounds.height,
|
|
2294
1971
|
transform: cameraTransform
|
|
2295
1972
|
}),
|
|
2296
|
-
elements == null ? void 0 : elements.map((elm, i) => /* @__PURE__ */ (0,
|
|
1973
|
+
elements == null ? void 0 : elements.map((elm, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_error_boundary.ErrorBoundary, {
|
|
2297
1974
|
fallbackRender: fallbackRender(elm),
|
|
2298
|
-
children: /* @__PURE__ */ (0,
|
|
1975
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SchematicElement, {
|
|
2299
1976
|
element: elm,
|
|
2300
1977
|
allElements: elements
|
|
2301
1978
|
}, JSON.stringify(elm))
|
|
2302
1979
|
}, i))
|
|
2303
1980
|
]
|
|
2304
1981
|
}),
|
|
2305
|
-
showTable !== false && elements && /* @__PURE__ */ (0,
|
|
1982
|
+
showTable !== false && elements && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TableViewer, {
|
|
2306
1983
|
elements
|
|
2307
1984
|
})
|
|
2308
1985
|
]
|