@tscircuit/schematic-viewer 1.1.5 → 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, {
@@ -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 self2 = Error.call(this, message);
1114
+ var self = Error.call(this, message);
1456
1115
  if (Object.setPrototypeOf) {
1457
- Object.setPrototypeOf(self2, peg$SyntaxError.prototype);
1116
+ Object.setPrototypeOf(self, peg$SyntaxError.prototype);
1458
1117
  }
1459
- self2.expected = expected;
1460
- self2.found = found;
1461
- self2.location = location;
1462
- self2.name = "SyntaxError";
1463
- return self2;
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
- ...(0, import_range.default)(1, total_ports + 1).map((portNum) => {
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;