easyeda 0.0.195 → 0.0.197
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/browser/index.js +1344 -581
- package/dist/browser/index.js.map +1 -1
- package/dist/{chunk-UZMC3PUZ.js → chunk-E6OHT5YV.js} +1586 -823
- package/dist/chunk-E6OHT5YV.js.map +1 -0
- package/dist/cli/main.js +8 -8
- package/dist/cli/main.js.map +1 -1
- package/dist/lib/index.js +1 -1
- package/package.json +7 -7
- package/dist/chunk-UZMC3PUZ.js.map +0 -1
package/dist/browser/index.js
CHANGED
|
@@ -315,7 +315,6 @@ var ShapesArraySchema = z.array(ShapeItemSchema);
|
|
|
315
315
|
|
|
316
316
|
// lib/schemas/single-letter-shape-schema.ts
|
|
317
317
|
import { z as z2 } from "zod";
|
|
318
|
-
import "@tscircuit/mm";
|
|
319
318
|
|
|
320
319
|
// lib/utils/easyeda-unit-to-mm.ts
|
|
321
320
|
var mil10ToMm = (value) => value * 10 * 0.0254;
|
|
@@ -389,7 +388,7 @@ var parseArc = (str) => {
|
|
|
389
388
|
const x2 = Number(parts[8]) || 0;
|
|
390
389
|
const y2 = Number(parts[9]) || 0;
|
|
391
390
|
const parsedLineWidth = Number(lineWidth);
|
|
392
|
-
const finalLineWidth = isNaN(parsedLineWidth) ? 1 : parsedLineWidth;
|
|
391
|
+
const finalLineWidth = Number.isNaN(parsedLineWidth) ? 1 : parsedLineWidth;
|
|
393
392
|
return {
|
|
394
393
|
type: "ARC",
|
|
395
394
|
start: { x: x1, y: y1 },
|
|
@@ -427,14 +426,14 @@ var parsePin = (pinString) => {
|
|
|
427
426
|
const path = pathMatch ? pathMatch[1] : "";
|
|
428
427
|
const arrowMatch = pinString.match(/\^\^0~(.+)$/);
|
|
429
428
|
const arrow = arrowMatch ? arrowMatch[1] : "";
|
|
430
|
-
const r = parseFloat(rotation2);
|
|
429
|
+
const r = Number.parseFloat(rotation2);
|
|
431
430
|
return {
|
|
432
431
|
type: "PIN",
|
|
433
432
|
visibility,
|
|
434
433
|
id,
|
|
435
|
-
pinNumber: isNaN(Number(pinNumber)) ? pinNumber : Number(pinNumber),
|
|
436
|
-
x: parseFloat(x),
|
|
437
|
-
y: parseFloat(y),
|
|
434
|
+
pinNumber: Number.isNaN(Number(pinNumber)) ? pinNumber : Number(pinNumber),
|
|
435
|
+
x: Number.parseFloat(x),
|
|
436
|
+
y: Number.parseFloat(y),
|
|
438
437
|
rotation: Number.isNaN(r) ? 0 : r,
|
|
439
438
|
label,
|
|
440
439
|
labelColor,
|
|
@@ -748,8 +747,10 @@ __export(dist_exports, {
|
|
|
748
747
|
layer_ref: () => layer_ref,
|
|
749
748
|
layer_string: () => layer_string,
|
|
750
749
|
length: () => length,
|
|
750
|
+
ninePointAnchor: () => ninePointAnchor,
|
|
751
751
|
pcb_autorouting_error: () => pcb_autorouting_error,
|
|
752
752
|
pcb_board: () => pcb_board,
|
|
753
|
+
pcb_breakout_point: () => pcb_breakout_point,
|
|
753
754
|
pcb_component: () => pcb_component,
|
|
754
755
|
pcb_cutout: () => pcb_cutout,
|
|
755
756
|
pcb_cutout_circle: () => pcb_cutout_circle,
|
|
@@ -757,6 +758,8 @@ __export(dist_exports, {
|
|
|
757
758
|
pcb_cutout_rect: () => pcb_cutout_rect,
|
|
758
759
|
pcb_fabrication_note_path: () => pcb_fabrication_note_path,
|
|
759
760
|
pcb_fabrication_note_text: () => pcb_fabrication_note_text,
|
|
761
|
+
pcb_ground_plane: () => pcb_ground_plane,
|
|
762
|
+
pcb_ground_plane_region: () => pcb_ground_plane_region,
|
|
760
763
|
pcb_group: () => pcb_group,
|
|
761
764
|
pcb_hole: () => pcb_hole,
|
|
762
765
|
pcb_hole_circle_or_square_shape: () => pcb_hole_circle_or_square_shape,
|
|
@@ -780,6 +783,7 @@ __export(dist_exports, {
|
|
|
780
783
|
pcb_smtpad_pill: () => pcb_smtpad_pill,
|
|
781
784
|
pcb_solder_paste: () => pcb_solder_paste,
|
|
782
785
|
pcb_text: () => pcb_text,
|
|
786
|
+
pcb_thermal_spoke: () => pcb_thermal_spoke,
|
|
783
787
|
pcb_trace: () => pcb_trace,
|
|
784
788
|
pcb_trace_error: () => pcb_trace_error,
|
|
785
789
|
pcb_trace_hint: () => pcb_trace_hint,
|
|
@@ -806,6 +810,7 @@ __export(dist_exports, {
|
|
|
806
810
|
schematic_debug_rect: () => schematic_debug_rect,
|
|
807
811
|
schematic_error: () => schematic_error,
|
|
808
812
|
schematic_group: () => schematic_group,
|
|
813
|
+
schematic_layout_error: () => schematic_layout_error,
|
|
809
814
|
schematic_line: () => schematic_line,
|
|
810
815
|
schematic_manual_edit_conflict_warning: () => schematic_manual_edit_conflict_warning,
|
|
811
816
|
schematic_net_label: () => schematic_net_label,
|
|
@@ -819,13 +824,12 @@ __export(dist_exports, {
|
|
|
819
824
|
source_component_base: () => source_component_base,
|
|
820
825
|
source_failed_to_create_component_error: () => source_failed_to_create_component_error,
|
|
821
826
|
source_group: () => source_group,
|
|
822
|
-
source_led: () => source_led,
|
|
823
827
|
source_missing_property_error: () => source_missing_property_error,
|
|
824
828
|
source_net: () => source_net,
|
|
829
|
+
source_pcb_ground_plane: () => source_pcb_ground_plane,
|
|
825
830
|
source_port: () => source_port,
|
|
826
831
|
source_project_metadata: () => source_project_metadata,
|
|
827
832
|
source_simple_battery: () => source_simple_battery,
|
|
828
|
-
source_simple_bug: () => source_simple_bug,
|
|
829
833
|
source_simple_capacitor: () => source_simple_capacitor,
|
|
830
834
|
source_simple_chip: () => source_simple_chip,
|
|
831
835
|
source_simple_crystal: () => source_simple_crystal,
|
|
@@ -841,6 +845,7 @@ __export(dist_exports, {
|
|
|
841
845
|
source_simple_resistor: () => source_simple_resistor,
|
|
842
846
|
source_simple_resonator: () => source_simple_resonator,
|
|
843
847
|
source_simple_switch: () => source_simple_switch,
|
|
848
|
+
source_simple_test_point: () => source_simple_test_point,
|
|
844
849
|
source_simple_transistor: () => source_simple_transistor,
|
|
845
850
|
source_trace: () => source_trace,
|
|
846
851
|
supplier_name: () => supplier_name,
|
|
@@ -868,18 +873,18 @@ var nanoid = (size2 = 21) => {
|
|
|
868
873
|
};
|
|
869
874
|
|
|
870
875
|
// node_modules/circuit-json/dist/index.mjs
|
|
871
|
-
import { z as z8 } from "zod";
|
|
872
876
|
import { z as z6 } from "zod";
|
|
873
|
-
import { z as z7 } from "zod";
|
|
874
877
|
import { z as z9 } from "zod";
|
|
878
|
+
import { z as z7 } from "zod";
|
|
879
|
+
import { z as z8 } from "zod";
|
|
875
880
|
import { z as z10 } from "zod";
|
|
876
881
|
import { z as z11 } from "zod";
|
|
877
882
|
import { z as z12 } from "zod";
|
|
878
883
|
import { z as z13 } from "zod";
|
|
879
884
|
import { z as z14 } from "zod";
|
|
880
885
|
import { z as z15 } from "zod";
|
|
881
|
-
import { z as z16 } from "zod";
|
|
882
886
|
import { z as z31 } from "zod";
|
|
887
|
+
import { z as z16 } from "zod";
|
|
883
888
|
import { z as z17 } from "zod";
|
|
884
889
|
import { z as z18 } from "zod";
|
|
885
890
|
import { z as z19 } from "zod";
|
|
@@ -903,8 +908,8 @@ import { z as z37 } from "zod";
|
|
|
903
908
|
import { z as z38 } from "zod";
|
|
904
909
|
import { z as z39 } from "zod";
|
|
905
910
|
import { z as z40 } from "zod";
|
|
906
|
-
import { z as z43 } from "zod";
|
|
907
911
|
import { z as z41 } from "zod";
|
|
912
|
+
import { z as z43 } from "zod";
|
|
908
913
|
import { z as z422 } from "zod";
|
|
909
914
|
import { z as z44 } from "zod";
|
|
910
915
|
import { z as z45 } from "zod";
|
|
@@ -946,6 +951,11 @@ import { z as z80 } from "zod";
|
|
|
946
951
|
import { z as z81 } from "zod";
|
|
947
952
|
import { z as z82 } from "zod";
|
|
948
953
|
import { z as z83 } from "zod";
|
|
954
|
+
import { z as z84 } from "zod";
|
|
955
|
+
import { z as z85 } from "zod";
|
|
956
|
+
import { z as z86 } from "zod";
|
|
957
|
+
import { z as z87 } from "zod";
|
|
958
|
+
import { z as z88 } from "zod";
|
|
949
959
|
var unitMappings = {
|
|
950
960
|
Hz: {
|
|
951
961
|
baseUnit: "Hz",
|
|
@@ -1171,25 +1181,59 @@ var battery_capacity = z4.number().or(z4.string().endsWith("mAh")).transform((v)
|
|
|
1171
1181
|
}
|
|
1172
1182
|
return v;
|
|
1173
1183
|
}).describe("Battery capacity in mAh");
|
|
1184
|
+
var expectTypesMatch = (shouldBe) => {
|
|
1185
|
+
};
|
|
1186
|
+
expectTypesMatch("extra props b");
|
|
1187
|
+
expectTypesMatch("missing props b");
|
|
1188
|
+
expectTypesMatch(true);
|
|
1189
|
+
expectTypesMatch("mismatched prop types: a");
|
|
1190
|
+
var expectStringUnionsMatch = (shouldBe) => {
|
|
1191
|
+
};
|
|
1192
|
+
expectStringUnionsMatch(true);
|
|
1193
|
+
expectStringUnionsMatch(
|
|
1194
|
+
'T1 has extra: "c", T2 has extra: "d"'
|
|
1195
|
+
);
|
|
1196
|
+
expectStringUnionsMatch('T1 has extra: "c"');
|
|
1197
|
+
expectStringUnionsMatch('T2 has extra: "c"');
|
|
1198
|
+
expectStringUnionsMatch(
|
|
1199
|
+
'T1 has extra: "d", T2 has extra: "c"'
|
|
1200
|
+
);
|
|
1201
|
+
expectStringUnionsMatch(true);
|
|
1174
1202
|
var point = z22.object({
|
|
1175
1203
|
x: distance,
|
|
1176
1204
|
y: distance
|
|
1177
1205
|
});
|
|
1178
1206
|
var position = point;
|
|
1207
|
+
expectTypesMatch(true);
|
|
1208
|
+
expectTypesMatch(true);
|
|
1179
1209
|
var point3 = z32.object({
|
|
1180
1210
|
x: distance,
|
|
1181
1211
|
y: distance,
|
|
1182
1212
|
z: distance
|
|
1183
1213
|
});
|
|
1184
1214
|
var position3 = point3;
|
|
1215
|
+
expectTypesMatch(true);
|
|
1185
1216
|
var size = z42.object({
|
|
1186
1217
|
width: z42.number(),
|
|
1187
1218
|
height: z42.number()
|
|
1188
1219
|
});
|
|
1220
|
+
expectTypesMatch(true);
|
|
1189
1221
|
var getZodPrefixedIdWithDefault = (prefix) => {
|
|
1190
1222
|
return z5.string().optional().default(() => `${prefix}_${nanoid(10)}`);
|
|
1191
1223
|
};
|
|
1192
|
-
var
|
|
1224
|
+
var ninePointAnchor = z6.enum([
|
|
1225
|
+
"top_left",
|
|
1226
|
+
"top_center",
|
|
1227
|
+
"top_right",
|
|
1228
|
+
"center_left",
|
|
1229
|
+
"center",
|
|
1230
|
+
"center_right",
|
|
1231
|
+
"bottom_left",
|
|
1232
|
+
"bottom_center",
|
|
1233
|
+
"bottom_right"
|
|
1234
|
+
]);
|
|
1235
|
+
expectTypesMatch(true);
|
|
1236
|
+
var supplier_name = z7.enum([
|
|
1193
1237
|
"jlcpcb",
|
|
1194
1238
|
"macrofab",
|
|
1195
1239
|
"pcbway",
|
|
@@ -1197,126 +1241,118 @@ var supplier_name = z6.enum([
|
|
|
1197
1241
|
"mouser",
|
|
1198
1242
|
"lcsc"
|
|
1199
1243
|
]);
|
|
1200
|
-
var expectTypesMatch = (shouldBe) => {
|
|
1201
|
-
};
|
|
1202
|
-
expectTypesMatch("extra props b");
|
|
1203
|
-
expectTypesMatch("missing props b");
|
|
1204
1244
|
expectTypesMatch(true);
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
)
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
)
|
|
1217
|
-
expectStringUnionsMatch(true);
|
|
1218
|
-
var source_component_base = z7.object({
|
|
1219
|
-
type: z7.literal("source_component"),
|
|
1220
|
-
ftype: z7.string().optional(),
|
|
1221
|
-
source_component_id: z7.string(),
|
|
1222
|
-
name: z7.string(),
|
|
1223
|
-
manufacturer_part_number: z7.string().optional(),
|
|
1224
|
-
supplier_part_numbers: z7.record(supplier_name, z7.array(z7.string())).optional(),
|
|
1225
|
-
display_value: z7.string().optional(),
|
|
1226
|
-
are_pins_interchangeable: z7.boolean().optional(),
|
|
1227
|
-
internally_connected_source_port_ids: z7.array(z7.array(z7.string())).optional(),
|
|
1228
|
-
source_group_id: z7.string().optional()
|
|
1245
|
+
var source_component_base = z8.object({
|
|
1246
|
+
type: z8.literal("source_component"),
|
|
1247
|
+
ftype: z8.string().optional(),
|
|
1248
|
+
source_component_id: z8.string(),
|
|
1249
|
+
name: z8.string(),
|
|
1250
|
+
manufacturer_part_number: z8.string().optional(),
|
|
1251
|
+
supplier_part_numbers: z8.record(supplier_name, z8.array(z8.string())).optional(),
|
|
1252
|
+
display_value: z8.string().optional(),
|
|
1253
|
+
are_pins_interchangeable: z8.boolean().optional(),
|
|
1254
|
+
internally_connected_source_port_ids: z8.array(z8.array(z8.string())).optional(),
|
|
1255
|
+
source_group_id: z8.string().optional(),
|
|
1256
|
+
subcircuit_id: z8.string().optional()
|
|
1229
1257
|
});
|
|
1230
1258
|
expectTypesMatch(true);
|
|
1231
1259
|
var source_simple_capacitor = source_component_base.extend({
|
|
1232
|
-
ftype:
|
|
1260
|
+
ftype: z9.literal("simple_capacitor"),
|
|
1233
1261
|
capacitance,
|
|
1234
1262
|
max_voltage_rating: voltage.optional(),
|
|
1235
|
-
display_capacitance:
|
|
1263
|
+
display_capacitance: z9.string().optional(),
|
|
1236
1264
|
max_decoupling_trace_length: distance.optional()
|
|
1237
1265
|
});
|
|
1238
1266
|
expectTypesMatch(true);
|
|
1239
1267
|
var source_simple_resistor = source_component_base.extend({
|
|
1240
|
-
ftype:
|
|
1268
|
+
ftype: z10.literal("simple_resistor"),
|
|
1241
1269
|
resistance,
|
|
1242
|
-
display_resistance:
|
|
1270
|
+
display_resistance: z10.string().optional()
|
|
1243
1271
|
});
|
|
1244
1272
|
expectTypesMatch(true);
|
|
1245
1273
|
var source_simple_diode = source_component_base.extend({
|
|
1246
|
-
ftype:
|
|
1274
|
+
ftype: z11.literal("simple_diode")
|
|
1247
1275
|
});
|
|
1248
1276
|
expectTypesMatch(true);
|
|
1249
1277
|
var source_simple_led = source_simple_diode.extend({
|
|
1250
|
-
ftype:
|
|
1251
|
-
color:
|
|
1252
|
-
wavelength:
|
|
1278
|
+
ftype: z12.literal("simple_led"),
|
|
1279
|
+
color: z12.string().optional(),
|
|
1280
|
+
wavelength: z12.string().optional()
|
|
1253
1281
|
});
|
|
1254
1282
|
expectTypesMatch(true);
|
|
1255
1283
|
var source_simple_ground = source_component_base.extend({
|
|
1256
|
-
ftype:
|
|
1284
|
+
ftype: z13.literal("simple_ground")
|
|
1257
1285
|
});
|
|
1258
1286
|
expectTypesMatch(true);
|
|
1259
|
-
var source_simple_bug = source_component_base.extend({
|
|
1260
|
-
ftype: z13.literal("simple_bug")
|
|
1261
|
-
}).describe("@deprecated");
|
|
1262
1287
|
var source_simple_chip = source_component_base.extend({
|
|
1263
1288
|
ftype: z14.literal("simple_chip")
|
|
1264
1289
|
});
|
|
1265
1290
|
expectTypesMatch(true);
|
|
1266
|
-
var source_led = source_simple_diode.extend({
|
|
1267
|
-
ftype: z15.literal("led")
|
|
1268
|
-
});
|
|
1269
|
-
expectTypesMatch(true);
|
|
1270
1291
|
var source_simple_power_source = source_component_base.extend({
|
|
1271
|
-
ftype:
|
|
1292
|
+
ftype: z15.literal("simple_power_source"),
|
|
1272
1293
|
voltage
|
|
1273
1294
|
});
|
|
1274
1295
|
expectTypesMatch(true);
|
|
1275
1296
|
var source_simple_fuse = source_component_base.extend({
|
|
1276
|
-
ftype:
|
|
1277
|
-
current_rating_amps:
|
|
1278
|
-
voltage_rating_volts:
|
|
1297
|
+
ftype: z16.literal("simple_fuse"),
|
|
1298
|
+
current_rating_amps: z16.number().describe("Nominal current in amps the fuse is rated for"),
|
|
1299
|
+
voltage_rating_volts: z16.number().describe("Voltage rating in volts, e.g. \xB15V would be 5")
|
|
1279
1300
|
});
|
|
1280
1301
|
expectTypesMatch(true);
|
|
1281
1302
|
var source_simple_battery = source_component_base.extend({
|
|
1282
|
-
ftype:
|
|
1303
|
+
ftype: z17.literal("simple_battery"),
|
|
1283
1304
|
capacity: battery_capacity
|
|
1284
1305
|
});
|
|
1285
1306
|
expectTypesMatch(true);
|
|
1286
1307
|
var source_simple_inductor = source_component_base.extend({
|
|
1287
|
-
ftype:
|
|
1288
|
-
inductance
|
|
1308
|
+
ftype: z18.literal("simple_inductor"),
|
|
1309
|
+
inductance,
|
|
1310
|
+
max_current_rating: z18.number().optional()
|
|
1289
1311
|
});
|
|
1290
1312
|
expectTypesMatch(true);
|
|
1291
1313
|
var source_simple_push_button = source_component_base.extend({
|
|
1292
|
-
ftype:
|
|
1314
|
+
ftype: z19.literal("simple_push_button")
|
|
1293
1315
|
});
|
|
1294
1316
|
expectTypesMatch(true);
|
|
1295
1317
|
var source_simple_potentiometer = source_component_base.extend({
|
|
1296
|
-
ftype:
|
|
1318
|
+
ftype: z20.literal("simple_potentiometer"),
|
|
1297
1319
|
max_resistance: resistance
|
|
1298
1320
|
});
|
|
1321
|
+
expectTypesMatch(
|
|
1322
|
+
true
|
|
1323
|
+
);
|
|
1299
1324
|
var source_simple_crystal = source_component_base.extend({
|
|
1300
|
-
ftype:
|
|
1301
|
-
frequency:
|
|
1302
|
-
load_capacitance:
|
|
1325
|
+
ftype: z21.literal("simple_crystal"),
|
|
1326
|
+
frequency: z21.number().describe("Frequency in Hz"),
|
|
1327
|
+
load_capacitance: z21.number().optional().describe("Load capacitance in pF")
|
|
1303
1328
|
});
|
|
1304
1329
|
expectTypesMatch(true);
|
|
1305
1330
|
var source_simple_pin_header = source_component_base.extend({
|
|
1306
|
-
ftype:
|
|
1307
|
-
pin_count:
|
|
1308
|
-
gender:
|
|
1331
|
+
ftype: z222.literal("simple_pin_header"),
|
|
1332
|
+
pin_count: z222.number(),
|
|
1333
|
+
gender: z222.enum(["male", "female"]).optional().default("male")
|
|
1309
1334
|
});
|
|
1335
|
+
expectTypesMatch(true);
|
|
1310
1336
|
var source_simple_resonator = source_component_base.extend({
|
|
1311
|
-
ftype:
|
|
1337
|
+
ftype: z23.literal("simple_resonator"),
|
|
1312
1338
|
load_capacitance: capacitance,
|
|
1313
1339
|
equivalent_series_resistance: resistance.optional(),
|
|
1314
1340
|
frequency
|
|
1315
1341
|
});
|
|
1316
1342
|
expectTypesMatch(true);
|
|
1317
1343
|
var source_simple_transistor = source_component_base.extend({
|
|
1318
|
-
ftype:
|
|
1319
|
-
transistor_type:
|
|
1344
|
+
ftype: z24.literal("simple_transistor"),
|
|
1345
|
+
transistor_type: z24.enum(["npn", "pnp"])
|
|
1346
|
+
});
|
|
1347
|
+
expectTypesMatch(true);
|
|
1348
|
+
var source_simple_test_point = source_component_base.extend({
|
|
1349
|
+
ftype: z25.literal("simple_test_point"),
|
|
1350
|
+
footprint_variant: z25.enum(["pad", "through_hole"]).optional(),
|
|
1351
|
+
pad_shape: z25.enum(["rect", "circle"]).optional(),
|
|
1352
|
+
pad_diameter: z25.union([z25.number(), z25.string()]).optional(),
|
|
1353
|
+
hole_diameter: z25.union([z25.number(), z25.string()]).optional(),
|
|
1354
|
+
width: z25.union([z25.number(), z25.string()]).optional(),
|
|
1355
|
+
height: z25.union([z25.number(), z25.string()]).optional()
|
|
1320
1356
|
});
|
|
1321
1357
|
expectTypesMatch(true);
|
|
1322
1358
|
var source_simple_mosfet = source_component_base.extend({
|
|
@@ -1333,6 +1369,7 @@ var source_project_metadata = z28.object({
|
|
|
1333
1369
|
type: z28.literal("source_project_metadata"),
|
|
1334
1370
|
name: z28.string().optional(),
|
|
1335
1371
|
software_used_string: z28.string().optional(),
|
|
1372
|
+
project_url: z28.string().optional(),
|
|
1336
1373
|
created_at: z28.string().datetime().optional()
|
|
1337
1374
|
});
|
|
1338
1375
|
expectTypesMatch(true);
|
|
@@ -1343,7 +1380,8 @@ var source_missing_property_error = z29.object({
|
|
|
1343
1380
|
),
|
|
1344
1381
|
source_component_id: z29.string(),
|
|
1345
1382
|
property_name: z29.string(),
|
|
1346
|
-
|
|
1383
|
+
subcircuit_id: z29.string().optional(),
|
|
1384
|
+
error_type: z29.literal("source_missing_property_error").default("source_missing_property_error"),
|
|
1347
1385
|
message: z29.string()
|
|
1348
1386
|
}).describe("The source code is missing a property");
|
|
1349
1387
|
expectTypesMatch(true);
|
|
@@ -1352,6 +1390,7 @@ var source_failed_to_create_component_error = z30.object({
|
|
|
1352
1390
|
source_failed_to_create_component_error_id: getZodPrefixedIdWithDefault(
|
|
1353
1391
|
"source_failed_to_create_component_error"
|
|
1354
1392
|
),
|
|
1393
|
+
error_type: z30.literal("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),
|
|
1355
1394
|
component_name: z30.string().optional(),
|
|
1356
1395
|
subcircuit_id: z30.string().optional(),
|
|
1357
1396
|
parent_source_component_id: z30.string().optional(),
|
|
@@ -1373,8 +1412,6 @@ var any_source_component = z31.union([
|
|
|
1373
1412
|
source_simple_led,
|
|
1374
1413
|
source_simple_ground,
|
|
1375
1414
|
source_simple_chip,
|
|
1376
|
-
source_simple_bug,
|
|
1377
|
-
source_led,
|
|
1378
1415
|
source_simple_power_source,
|
|
1379
1416
|
source_simple_battery,
|
|
1380
1417
|
source_simple_inductor,
|
|
@@ -1385,12 +1422,14 @@ var any_source_component = z31.union([
|
|
|
1385
1422
|
source_simple_resonator,
|
|
1386
1423
|
source_simple_switch,
|
|
1387
1424
|
source_simple_transistor,
|
|
1425
|
+
source_simple_test_point,
|
|
1388
1426
|
source_simple_mosfet,
|
|
1389
1427
|
source_simple_fuse,
|
|
1390
1428
|
source_project_metadata,
|
|
1391
1429
|
source_missing_property_error,
|
|
1392
1430
|
source_failed_to_create_component_error
|
|
1393
1431
|
]);
|
|
1432
|
+
expectTypesMatch(true);
|
|
1394
1433
|
var source_port = z322.object({
|
|
1395
1434
|
type: z322.literal("source_port"),
|
|
1396
1435
|
pin_number: z322.number().optional(),
|
|
@@ -1398,7 +1437,8 @@ var source_port = z322.object({
|
|
|
1398
1437
|
name: z322.string(),
|
|
1399
1438
|
source_port_id: z322.string(),
|
|
1400
1439
|
source_component_id: z322.string(),
|
|
1401
|
-
subcircuit_id: z322.string().optional()
|
|
1440
|
+
subcircuit_id: z322.string().optional(),
|
|
1441
|
+
subcircuit_connectivity_map_key: z322.string().optional()
|
|
1402
1442
|
});
|
|
1403
1443
|
expectTypesMatch(true);
|
|
1404
1444
|
var source_trace = z33.object({
|
|
@@ -1421,6 +1461,7 @@ var source_group = z34.object({
|
|
|
1421
1461
|
is_subcircuit: z34.boolean().optional(),
|
|
1422
1462
|
name: z34.string().optional()
|
|
1423
1463
|
});
|
|
1464
|
+
expectTypesMatch(true);
|
|
1424
1465
|
var source_net = z35.object({
|
|
1425
1466
|
type: z35.literal("source_net"),
|
|
1426
1467
|
source_net_id: z35.string(),
|
|
@@ -1431,132 +1472,135 @@ var source_net = z35.object({
|
|
|
1431
1472
|
is_digital_signal: z35.boolean().optional(),
|
|
1432
1473
|
is_analog_signal: z35.boolean().optional(),
|
|
1433
1474
|
trace_width: z35.number().optional(),
|
|
1434
|
-
subcircuit_id: z35.string().optional()
|
|
1475
|
+
subcircuit_id: z35.string().optional(),
|
|
1476
|
+
subcircuit_connectivity_map_key: z35.string().optional()
|
|
1435
1477
|
});
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1478
|
+
expectTypesMatch(true);
|
|
1479
|
+
var source_pcb_ground_plane = z36.object({
|
|
1480
|
+
type: z36.literal("source_pcb_ground_plane"),
|
|
1481
|
+
source_pcb_ground_plane_id: z36.string(),
|
|
1482
|
+
source_group_id: z36.string(),
|
|
1483
|
+
source_net_id: z36.string(),
|
|
1484
|
+
subcircuit_id: z36.string().optional()
|
|
1485
|
+
}).describe("Defines a ground plane in the source domain");
|
|
1486
|
+
expectTypesMatch(true);
|
|
1487
|
+
var schematic_box = z37.object({
|
|
1488
|
+
type: z37.literal("schematic_box"),
|
|
1489
|
+
schematic_component_id: z37.string().optional(),
|
|
1439
1490
|
width: distance,
|
|
1440
1491
|
height: distance,
|
|
1441
|
-
is_dashed:
|
|
1492
|
+
is_dashed: z37.boolean().default(false),
|
|
1442
1493
|
x: distance,
|
|
1443
|
-
y: distance
|
|
1494
|
+
y: distance,
|
|
1495
|
+
subcircuit_id: z37.string().optional()
|
|
1444
1496
|
}).describe("Draws a box on the schematic");
|
|
1445
1497
|
expectTypesMatch(true);
|
|
1446
|
-
var schematic_path =
|
|
1447
|
-
type:
|
|
1448
|
-
schematic_component_id:
|
|
1449
|
-
fill_color:
|
|
1450
|
-
is_filled:
|
|
1451
|
-
points:
|
|
1498
|
+
var schematic_path = z38.object({
|
|
1499
|
+
type: z38.literal("schematic_path"),
|
|
1500
|
+
schematic_component_id: z38.string(),
|
|
1501
|
+
fill_color: z38.enum(["red", "blue"]).optional(),
|
|
1502
|
+
is_filled: z38.boolean().optional(),
|
|
1503
|
+
points: z38.array(point),
|
|
1504
|
+
subcircuit_id: z38.string().optional()
|
|
1452
1505
|
});
|
|
1453
1506
|
expectTypesMatch(true);
|
|
1454
|
-
var schematic_pin_styles =
|
|
1455
|
-
|
|
1507
|
+
var schematic_pin_styles = z39.record(
|
|
1508
|
+
z39.object({
|
|
1456
1509
|
left_margin: length.optional(),
|
|
1457
1510
|
right_margin: length.optional(),
|
|
1458
1511
|
top_margin: length.optional(),
|
|
1459
1512
|
bottom_margin: length.optional()
|
|
1460
1513
|
})
|
|
1461
1514
|
);
|
|
1462
|
-
var schematic_component_port_arrangement_by_size =
|
|
1463
|
-
left_size:
|
|
1464
|
-
right_size:
|
|
1465
|
-
top_size:
|
|
1466
|
-
bottom_size:
|
|
1515
|
+
var schematic_component_port_arrangement_by_size = z39.object({
|
|
1516
|
+
left_size: z39.number(),
|
|
1517
|
+
right_size: z39.number(),
|
|
1518
|
+
top_size: z39.number().optional(),
|
|
1519
|
+
bottom_size: z39.number().optional()
|
|
1467
1520
|
});
|
|
1468
1521
|
expectTypesMatch(true);
|
|
1469
|
-
var schematic_component_port_arrangement_by_sides =
|
|
1470
|
-
left_side:
|
|
1471
|
-
pins:
|
|
1522
|
+
var schematic_component_port_arrangement_by_sides = z39.object({
|
|
1523
|
+
left_side: z39.object({
|
|
1524
|
+
pins: z39.array(z39.number()),
|
|
1472
1525
|
// @ts-ignore
|
|
1473
|
-
direction:
|
|
1526
|
+
direction: z39.enum(["top-to-bottom", "bottom-to-top"]).optional()
|
|
1474
1527
|
}).optional(),
|
|
1475
|
-
right_side:
|
|
1476
|
-
pins:
|
|
1528
|
+
right_side: z39.object({
|
|
1529
|
+
pins: z39.array(z39.number()),
|
|
1477
1530
|
// @ts-ignore
|
|
1478
|
-
direction:
|
|
1531
|
+
direction: z39.enum(["top-to-bottom", "bottom-to-top"]).optional()
|
|
1479
1532
|
}).optional(),
|
|
1480
|
-
top_side:
|
|
1481
|
-
pins:
|
|
1533
|
+
top_side: z39.object({
|
|
1534
|
+
pins: z39.array(z39.number()),
|
|
1482
1535
|
// @ts-ignore
|
|
1483
|
-
direction:
|
|
1536
|
+
direction: z39.enum(["left-to-right", "right-to-left"]).optional()
|
|
1484
1537
|
}).optional(),
|
|
1485
|
-
bottom_side:
|
|
1486
|
-
pins:
|
|
1538
|
+
bottom_side: z39.object({
|
|
1539
|
+
pins: z39.array(z39.number()),
|
|
1487
1540
|
// @ts-ignore
|
|
1488
|
-
direction:
|
|
1541
|
+
direction: z39.enum(["left-to-right", "right-to-left"]).optional()
|
|
1489
1542
|
}).optional()
|
|
1490
1543
|
});
|
|
1491
1544
|
expectTypesMatch(true);
|
|
1492
|
-
var port_arrangement =
|
|
1545
|
+
var port_arrangement = z39.union([
|
|
1493
1546
|
schematic_component_port_arrangement_by_size,
|
|
1494
1547
|
schematic_component_port_arrangement_by_sides
|
|
1495
1548
|
]);
|
|
1496
|
-
var schematic_component =
|
|
1497
|
-
type:
|
|
1549
|
+
var schematic_component = z39.object({
|
|
1550
|
+
type: z39.literal("schematic_component"),
|
|
1498
1551
|
size,
|
|
1499
1552
|
center: point,
|
|
1500
|
-
source_component_id:
|
|
1501
|
-
schematic_component_id:
|
|
1553
|
+
source_component_id: z39.string(),
|
|
1554
|
+
schematic_component_id: z39.string(),
|
|
1502
1555
|
pin_spacing: length.optional(),
|
|
1503
1556
|
pin_styles: schematic_pin_styles.optional(),
|
|
1504
1557
|
box_width: length.optional(),
|
|
1505
|
-
symbol_name:
|
|
1558
|
+
symbol_name: z39.string().optional(),
|
|
1506
1559
|
port_arrangement: port_arrangement.optional(),
|
|
1507
|
-
port_labels:
|
|
1508
|
-
symbol_display_value:
|
|
1509
|
-
subcircuit_id:
|
|
1510
|
-
schematic_group_id:
|
|
1560
|
+
port_labels: z39.record(z39.string()).optional(),
|
|
1561
|
+
symbol_display_value: z39.string().optional(),
|
|
1562
|
+
subcircuit_id: z39.string().optional(),
|
|
1563
|
+
schematic_group_id: z39.string().optional()
|
|
1511
1564
|
});
|
|
1512
1565
|
expectTypesMatch(true);
|
|
1513
|
-
var schematic_line =
|
|
1514
|
-
type:
|
|
1515
|
-
schematic_component_id:
|
|
1566
|
+
var schematic_line = z40.object({
|
|
1567
|
+
type: z40.literal("schematic_line"),
|
|
1568
|
+
schematic_component_id: z40.string(),
|
|
1516
1569
|
x1: distance,
|
|
1517
1570
|
x2: distance,
|
|
1518
1571
|
y1: distance,
|
|
1519
|
-
y2: distance
|
|
1572
|
+
y2: distance,
|
|
1573
|
+
subcircuit_id: z40.string().optional()
|
|
1520
1574
|
});
|
|
1521
1575
|
expectTypesMatch(true);
|
|
1522
|
-
var schematic_trace =
|
|
1523
|
-
type:
|
|
1524
|
-
schematic_trace_id:
|
|
1525
|
-
source_trace_id:
|
|
1526
|
-
junctions:
|
|
1527
|
-
|
|
1528
|
-
x:
|
|
1529
|
-
y:
|
|
1576
|
+
var schematic_trace = z41.object({
|
|
1577
|
+
type: z41.literal("schematic_trace"),
|
|
1578
|
+
schematic_trace_id: z41.string(),
|
|
1579
|
+
source_trace_id: z41.string(),
|
|
1580
|
+
junctions: z41.array(
|
|
1581
|
+
z41.object({
|
|
1582
|
+
x: z41.number(),
|
|
1583
|
+
y: z41.number()
|
|
1530
1584
|
})
|
|
1531
1585
|
),
|
|
1532
|
-
edges:
|
|
1533
|
-
|
|
1534
|
-
from:
|
|
1535
|
-
x:
|
|
1536
|
-
y:
|
|
1586
|
+
edges: z41.array(
|
|
1587
|
+
z41.object({
|
|
1588
|
+
from: z41.object({
|
|
1589
|
+
x: z41.number(),
|
|
1590
|
+
y: z41.number()
|
|
1537
1591
|
}),
|
|
1538
|
-
to:
|
|
1539
|
-
x:
|
|
1540
|
-
y:
|
|
1592
|
+
to: z41.object({
|
|
1593
|
+
x: z41.number(),
|
|
1594
|
+
y: z41.number()
|
|
1541
1595
|
}),
|
|
1542
|
-
is_crossing:
|
|
1543
|
-
from_schematic_port_id:
|
|
1544
|
-
to_schematic_port_id:
|
|
1596
|
+
is_crossing: z41.boolean().optional(),
|
|
1597
|
+
from_schematic_port_id: z41.string().optional(),
|
|
1598
|
+
to_schematic_port_id: z41.string().optional()
|
|
1545
1599
|
})
|
|
1546
|
-
)
|
|
1600
|
+
),
|
|
1601
|
+
subcircuit_id: z41.string().optional()
|
|
1547
1602
|
});
|
|
1548
1603
|
expectTypesMatch(true);
|
|
1549
|
-
var ninePointAnchor = z41.enum([
|
|
1550
|
-
"top_left",
|
|
1551
|
-
"top_center",
|
|
1552
|
-
"top_right",
|
|
1553
|
-
"center_left",
|
|
1554
|
-
"center",
|
|
1555
|
-
"center_right",
|
|
1556
|
-
"bottom_left",
|
|
1557
|
-
"bottom_center",
|
|
1558
|
-
"bottom_right"
|
|
1559
|
-
]);
|
|
1560
1604
|
var fivePointAnchor = z422.enum([
|
|
1561
1605
|
"center",
|
|
1562
1606
|
"left",
|
|
@@ -1564,6 +1608,7 @@ var fivePointAnchor = z422.enum([
|
|
|
1564
1608
|
"top",
|
|
1565
1609
|
"bottom"
|
|
1566
1610
|
]);
|
|
1611
|
+
expectTypesMatch(true);
|
|
1567
1612
|
var schematic_text = z43.object({
|
|
1568
1613
|
type: z43.literal("schematic_text"),
|
|
1569
1614
|
schematic_component_id: z43.string().optional(),
|
|
@@ -1576,7 +1621,8 @@ var schematic_text = z43.object({
|
|
|
1576
1621
|
}),
|
|
1577
1622
|
rotation: z43.number().default(0),
|
|
1578
1623
|
anchor: z43.union([fivePointAnchor.describe("legacy"), ninePointAnchor]).default("center"),
|
|
1579
|
-
color: z43.string().default("#000000")
|
|
1624
|
+
color: z43.string().default("#000000"),
|
|
1625
|
+
subcircuit_id: z43.string().optional()
|
|
1580
1626
|
});
|
|
1581
1627
|
expectTypesMatch(true);
|
|
1582
1628
|
var schematic_port = z44.object({
|
|
@@ -1590,7 +1636,9 @@ var schematic_port = z44.object({
|
|
|
1590
1636
|
side_of_component: z44.enum(["top", "bottom", "left", "right"]).optional(),
|
|
1591
1637
|
true_ccw_index: z44.number().optional(),
|
|
1592
1638
|
pin_number: z44.number().optional(),
|
|
1593
|
-
display_pin_label: z44.string().optional()
|
|
1639
|
+
display_pin_label: z44.string().optional(),
|
|
1640
|
+
subcircuit_id: z44.string().optional(),
|
|
1641
|
+
is_connected: z44.boolean().optional()
|
|
1594
1642
|
}).describe("Defines a port on a schematic component");
|
|
1595
1643
|
expectTypesMatch(true);
|
|
1596
1644
|
var schematic_net_label = z45.object({
|
|
@@ -1603,75 +1651,93 @@ var schematic_net_label = z45.object({
|
|
|
1603
1651
|
anchor_position: point.optional(),
|
|
1604
1652
|
anchor_side: z45.enum(["top", "bottom", "left", "right"]),
|
|
1605
1653
|
text: z45.string(),
|
|
1606
|
-
symbol_name: z45.string().optional()
|
|
1654
|
+
symbol_name: z45.string().optional(),
|
|
1655
|
+
is_movable: z45.boolean().optional(),
|
|
1656
|
+
subcircuit_id: z45.string().optional()
|
|
1607
1657
|
});
|
|
1608
1658
|
expectTypesMatch(true);
|
|
1609
1659
|
var schematic_error = z46.object({
|
|
1610
1660
|
type: z46.literal("schematic_error"),
|
|
1611
1661
|
schematic_error_id: z46.string(),
|
|
1612
1662
|
// eventually each error type should be broken out into a dir of files
|
|
1613
|
-
error_type: z46.literal("schematic_port_not_found"),
|
|
1614
|
-
message: z46.string()
|
|
1663
|
+
error_type: z46.literal("schematic_port_not_found").default("schematic_port_not_found"),
|
|
1664
|
+
message: z46.string(),
|
|
1665
|
+
subcircuit_id: z46.string().optional()
|
|
1615
1666
|
}).describe("Defines a schematic error on the schematic");
|
|
1616
1667
|
expectTypesMatch(true);
|
|
1617
|
-
var
|
|
1618
|
-
type: z47.literal("
|
|
1619
|
-
|
|
1668
|
+
var schematic_layout_error = z47.object({
|
|
1669
|
+
type: z47.literal("schematic_layout_error"),
|
|
1670
|
+
schematic_layout_error_id: getZodPrefixedIdWithDefault(
|
|
1671
|
+
"schematic_layout_error"
|
|
1672
|
+
),
|
|
1673
|
+
error_type: z47.literal("schematic_layout_error").default("schematic_layout_error"),
|
|
1674
|
+
message: z47.string(),
|
|
1675
|
+
source_group_id: z47.string(),
|
|
1676
|
+
schematic_group_id: z47.string(),
|
|
1677
|
+
subcircuit_id: z47.string().optional()
|
|
1678
|
+
}).describe("Error emitted when schematic layout fails for a group");
|
|
1679
|
+
expectTypesMatch(true);
|
|
1680
|
+
var schematic_debug_object_base = z48.object({
|
|
1681
|
+
type: z48.literal("schematic_debug_object"),
|
|
1682
|
+
label: z48.string().optional(),
|
|
1683
|
+
subcircuit_id: z48.string().optional()
|
|
1620
1684
|
});
|
|
1621
1685
|
var schematic_debug_rect = schematic_debug_object_base.extend({
|
|
1622
|
-
shape:
|
|
1686
|
+
shape: z48.literal("rect"),
|
|
1623
1687
|
center: point,
|
|
1624
1688
|
size
|
|
1625
1689
|
});
|
|
1626
1690
|
var schematic_debug_line = schematic_debug_object_base.extend({
|
|
1627
|
-
shape:
|
|
1691
|
+
shape: z48.literal("line"),
|
|
1628
1692
|
start: point,
|
|
1629
1693
|
end: point
|
|
1630
1694
|
});
|
|
1631
1695
|
var schematic_debug_point = schematic_debug_object_base.extend({
|
|
1632
|
-
shape:
|
|
1696
|
+
shape: z48.literal("point"),
|
|
1633
1697
|
center: point
|
|
1634
1698
|
});
|
|
1635
|
-
var schematic_debug_object =
|
|
1699
|
+
var schematic_debug_object = z48.discriminatedUnion("shape", [
|
|
1636
1700
|
schematic_debug_rect,
|
|
1637
1701
|
schematic_debug_line,
|
|
1638
1702
|
schematic_debug_point
|
|
1639
1703
|
]);
|
|
1640
1704
|
expectTypesMatch(true);
|
|
1641
|
-
var schematic_voltage_probe =
|
|
1642
|
-
type:
|
|
1643
|
-
schematic_voltage_probe_id:
|
|
1705
|
+
var schematic_voltage_probe = z49.object({
|
|
1706
|
+
type: z49.literal("schematic_voltage_probe"),
|
|
1707
|
+
schematic_voltage_probe_id: z49.string(),
|
|
1644
1708
|
position: point,
|
|
1645
|
-
schematic_trace_id:
|
|
1646
|
-
voltage: voltage.optional()
|
|
1709
|
+
schematic_trace_id: z49.string(),
|
|
1710
|
+
voltage: voltage.optional(),
|
|
1711
|
+
subcircuit_id: z49.string().optional()
|
|
1647
1712
|
}).describe("Defines a voltage probe measurement point on a schematic trace");
|
|
1648
1713
|
expectTypesMatch(true);
|
|
1649
|
-
var schematic_manual_edit_conflict_warning =
|
|
1650
|
-
type:
|
|
1714
|
+
var schematic_manual_edit_conflict_warning = z50.object({
|
|
1715
|
+
type: z50.literal("schematic_manual_edit_conflict_warning"),
|
|
1651
1716
|
schematic_manual_edit_conflict_warning_id: getZodPrefixedIdWithDefault(
|
|
1652
1717
|
"schematic_manual_edit_conflict_warning"
|
|
1653
1718
|
),
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1719
|
+
warning_type: z50.literal("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),
|
|
1720
|
+
message: z50.string(),
|
|
1721
|
+
schematic_component_id: z50.string(),
|
|
1722
|
+
schematic_group_id: z50.string().optional(),
|
|
1723
|
+
subcircuit_id: z50.string().optional(),
|
|
1724
|
+
source_component_id: z50.string()
|
|
1659
1725
|
}).describe(
|
|
1660
1726
|
"Warning emitted when a component has both manual placement and explicit schX/schY coordinates"
|
|
1661
1727
|
);
|
|
1662
1728
|
expectTypesMatch(true);
|
|
1663
|
-
var schematic_group =
|
|
1664
|
-
type:
|
|
1729
|
+
var schematic_group = z51.object({
|
|
1730
|
+
type: z51.literal("schematic_group"),
|
|
1665
1731
|
schematic_group_id: getZodPrefixedIdWithDefault("schematic_group"),
|
|
1666
|
-
source_group_id:
|
|
1667
|
-
is_subcircuit:
|
|
1668
|
-
subcircuit_id:
|
|
1732
|
+
source_group_id: z51.string(),
|
|
1733
|
+
is_subcircuit: z51.boolean().optional(),
|
|
1734
|
+
subcircuit_id: z51.string().optional(),
|
|
1669
1735
|
width: length,
|
|
1670
1736
|
height: length,
|
|
1671
1737
|
center: point,
|
|
1672
|
-
schematic_component_ids:
|
|
1673
|
-
name:
|
|
1674
|
-
description:
|
|
1738
|
+
schematic_component_ids: z51.array(z51.string()),
|
|
1739
|
+
name: z51.string().optional(),
|
|
1740
|
+
description: z51.string().optional()
|
|
1675
1741
|
}).describe("Defines a group of components on the schematic");
|
|
1676
1742
|
expectTypesMatch(true);
|
|
1677
1743
|
var all_layers = [
|
|
@@ -1684,9 +1750,9 @@ var all_layers = [
|
|
|
1684
1750
|
"inner5",
|
|
1685
1751
|
"inner6"
|
|
1686
1752
|
];
|
|
1687
|
-
var layer_string =
|
|
1753
|
+
var layer_string = z52.enum(all_layers);
|
|
1688
1754
|
var layer_ref = layer_string.or(
|
|
1689
|
-
|
|
1755
|
+
z52.object({
|
|
1690
1756
|
name: layer_string
|
|
1691
1757
|
})
|
|
1692
1758
|
).transform((layer) => {
|
|
@@ -1695,41 +1761,45 @@ var layer_ref = layer_string.or(
|
|
|
1695
1761
|
}
|
|
1696
1762
|
return layer.name;
|
|
1697
1763
|
});
|
|
1698
|
-
|
|
1699
|
-
var
|
|
1764
|
+
expectTypesMatch(true);
|
|
1765
|
+
var visible_layer = z52.enum(["top", "bottom"]);
|
|
1766
|
+
var pcb_route_hint = z53.object({
|
|
1700
1767
|
x: distance,
|
|
1701
1768
|
y: distance,
|
|
1702
|
-
via:
|
|
1769
|
+
via: z53.boolean().optional(),
|
|
1703
1770
|
via_to_layer: layer_ref.optional()
|
|
1704
1771
|
});
|
|
1705
|
-
var pcb_route_hints =
|
|
1706
|
-
|
|
1772
|
+
var pcb_route_hints = z53.array(pcb_route_hint);
|
|
1773
|
+
expectTypesMatch(true);
|
|
1774
|
+
expectTypesMatch(true);
|
|
1775
|
+
var route_hint_point = z54.object({
|
|
1707
1776
|
x: distance,
|
|
1708
1777
|
y: distance,
|
|
1709
|
-
via:
|
|
1778
|
+
via: z54.boolean().optional(),
|
|
1710
1779
|
to_layer: layer_ref.optional(),
|
|
1711
1780
|
trace_width: distance.optional()
|
|
1712
1781
|
});
|
|
1713
|
-
|
|
1714
|
-
|
|
1782
|
+
expectTypesMatch(true);
|
|
1783
|
+
var pcb_component = z55.object({
|
|
1784
|
+
type: z55.literal("pcb_component"),
|
|
1715
1785
|
pcb_component_id: getZodPrefixedIdWithDefault("pcb_component"),
|
|
1716
|
-
source_component_id:
|
|
1786
|
+
source_component_id: z55.string(),
|
|
1717
1787
|
center: point,
|
|
1718
1788
|
layer: layer_ref,
|
|
1719
1789
|
rotation,
|
|
1720
1790
|
width: length,
|
|
1721
1791
|
height: length,
|
|
1722
|
-
subcircuit_id:
|
|
1723
|
-
pcb_group_id:
|
|
1792
|
+
subcircuit_id: z55.string().optional(),
|
|
1793
|
+
pcb_group_id: z55.string().optional()
|
|
1724
1794
|
}).describe("Defines a component on the PCB");
|
|
1725
1795
|
expectTypesMatch(true);
|
|
1726
|
-
var pcb_hole_circle_or_square =
|
|
1727
|
-
type:
|
|
1796
|
+
var pcb_hole_circle_or_square = z56.object({
|
|
1797
|
+
type: z56.literal("pcb_hole"),
|
|
1728
1798
|
pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
|
|
1729
|
-
pcb_group_id:
|
|
1730
|
-
subcircuit_id:
|
|
1731
|
-
hole_shape:
|
|
1732
|
-
hole_diameter:
|
|
1799
|
+
pcb_group_id: z56.string().optional(),
|
|
1800
|
+
subcircuit_id: z56.string().optional(),
|
|
1801
|
+
hole_shape: z56.enum(["circle", "square"]),
|
|
1802
|
+
hole_diameter: z56.number(),
|
|
1733
1803
|
x: distance,
|
|
1734
1804
|
y: distance
|
|
1735
1805
|
});
|
|
@@ -1737,14 +1807,14 @@ var pcb_hole_circle_or_square_shape = pcb_hole_circle_or_square.describe(
|
|
|
1737
1807
|
"Defines a circular or square hole on the PCB"
|
|
1738
1808
|
);
|
|
1739
1809
|
expectTypesMatch(true);
|
|
1740
|
-
var pcb_hole_oval =
|
|
1741
|
-
type:
|
|
1810
|
+
var pcb_hole_oval = z56.object({
|
|
1811
|
+
type: z56.literal("pcb_hole"),
|
|
1742
1812
|
pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
|
|
1743
|
-
pcb_group_id:
|
|
1744
|
-
subcircuit_id:
|
|
1745
|
-
hole_shape:
|
|
1746
|
-
hole_width:
|
|
1747
|
-
hole_height:
|
|
1813
|
+
pcb_group_id: z56.string().optional(),
|
|
1814
|
+
subcircuit_id: z56.string().optional(),
|
|
1815
|
+
hole_shape: z56.literal("oval"),
|
|
1816
|
+
hole_width: z56.number(),
|
|
1817
|
+
hole_height: z56.number(),
|
|
1748
1818
|
x: distance,
|
|
1749
1819
|
y: distance
|
|
1750
1820
|
});
|
|
@@ -1753,76 +1823,76 @@ var pcb_hole_oval_shape = pcb_hole_oval.describe(
|
|
|
1753
1823
|
);
|
|
1754
1824
|
expectTypesMatch(true);
|
|
1755
1825
|
var pcb_hole = pcb_hole_circle_or_square.or(pcb_hole_oval);
|
|
1756
|
-
var pcb_plated_hole_circle =
|
|
1757
|
-
type:
|
|
1758
|
-
shape:
|
|
1759
|
-
pcb_group_id:
|
|
1760
|
-
subcircuit_id:
|
|
1761
|
-
outer_diameter:
|
|
1762
|
-
hole_diameter:
|
|
1826
|
+
var pcb_plated_hole_circle = z57.object({
|
|
1827
|
+
type: z57.literal("pcb_plated_hole"),
|
|
1828
|
+
shape: z57.literal("circle"),
|
|
1829
|
+
pcb_group_id: z57.string().optional(),
|
|
1830
|
+
subcircuit_id: z57.string().optional(),
|
|
1831
|
+
outer_diameter: z57.number(),
|
|
1832
|
+
hole_diameter: z57.number(),
|
|
1763
1833
|
x: distance,
|
|
1764
1834
|
y: distance,
|
|
1765
|
-
layers:
|
|
1766
|
-
port_hints:
|
|
1767
|
-
pcb_component_id:
|
|
1768
|
-
pcb_port_id:
|
|
1835
|
+
layers: z57.array(layer_ref),
|
|
1836
|
+
port_hints: z57.array(z57.string()).optional(),
|
|
1837
|
+
pcb_component_id: z57.string().optional(),
|
|
1838
|
+
pcb_port_id: z57.string().optional(),
|
|
1769
1839
|
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
|
|
1770
1840
|
});
|
|
1771
|
-
var pcb_plated_hole_oval =
|
|
1772
|
-
type:
|
|
1773
|
-
shape:
|
|
1774
|
-
pcb_group_id:
|
|
1775
|
-
subcircuit_id:
|
|
1776
|
-
outer_width:
|
|
1777
|
-
outer_height:
|
|
1778
|
-
hole_width:
|
|
1779
|
-
hole_height:
|
|
1841
|
+
var pcb_plated_hole_oval = z57.object({
|
|
1842
|
+
type: z57.literal("pcb_plated_hole"),
|
|
1843
|
+
shape: z57.enum(["oval", "pill"]),
|
|
1844
|
+
pcb_group_id: z57.string().optional(),
|
|
1845
|
+
subcircuit_id: z57.string().optional(),
|
|
1846
|
+
outer_width: z57.number(),
|
|
1847
|
+
outer_height: z57.number(),
|
|
1848
|
+
hole_width: z57.number(),
|
|
1849
|
+
hole_height: z57.number(),
|
|
1780
1850
|
x: distance,
|
|
1781
1851
|
y: distance,
|
|
1782
|
-
layers:
|
|
1783
|
-
port_hints:
|
|
1784
|
-
pcb_component_id:
|
|
1785
|
-
pcb_port_id:
|
|
1852
|
+
layers: z57.array(layer_ref),
|
|
1853
|
+
port_hints: z57.array(z57.string()).optional(),
|
|
1854
|
+
pcb_component_id: z57.string().optional(),
|
|
1855
|
+
pcb_port_id: z57.string().optional(),
|
|
1786
1856
|
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
|
|
1787
1857
|
});
|
|
1788
|
-
var pcb_circular_hole_with_rect_pad =
|
|
1789
|
-
type:
|
|
1790
|
-
shape:
|
|
1791
|
-
pcb_group_id:
|
|
1792
|
-
subcircuit_id:
|
|
1793
|
-
hole_shape:
|
|
1794
|
-
pad_shape:
|
|
1795
|
-
hole_diameter:
|
|
1796
|
-
rect_pad_width:
|
|
1797
|
-
rect_pad_height:
|
|
1858
|
+
var pcb_circular_hole_with_rect_pad = z57.object({
|
|
1859
|
+
type: z57.literal("pcb_plated_hole"),
|
|
1860
|
+
shape: z57.literal("circular_hole_with_rect_pad"),
|
|
1861
|
+
pcb_group_id: z57.string().optional(),
|
|
1862
|
+
subcircuit_id: z57.string().optional(),
|
|
1863
|
+
hole_shape: z57.literal("circle"),
|
|
1864
|
+
pad_shape: z57.literal("rect"),
|
|
1865
|
+
hole_diameter: z57.number(),
|
|
1866
|
+
rect_pad_width: z57.number(),
|
|
1867
|
+
rect_pad_height: z57.number(),
|
|
1798
1868
|
x: distance,
|
|
1799
1869
|
y: distance,
|
|
1800
|
-
layers:
|
|
1801
|
-
port_hints:
|
|
1802
|
-
pcb_component_id:
|
|
1803
|
-
pcb_port_id:
|
|
1870
|
+
layers: z57.array(layer_ref),
|
|
1871
|
+
port_hints: z57.array(z57.string()).optional(),
|
|
1872
|
+
pcb_component_id: z57.string().optional(),
|
|
1873
|
+
pcb_port_id: z57.string().optional(),
|
|
1804
1874
|
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
|
|
1805
1875
|
});
|
|
1806
|
-
var pcb_pill_hole_with_rect_pad =
|
|
1807
|
-
type:
|
|
1808
|
-
shape:
|
|
1809
|
-
pcb_group_id:
|
|
1810
|
-
subcircuit_id:
|
|
1811
|
-
hole_shape:
|
|
1812
|
-
pad_shape:
|
|
1813
|
-
hole_width:
|
|
1814
|
-
hole_height:
|
|
1815
|
-
rect_pad_width:
|
|
1816
|
-
rect_pad_height:
|
|
1876
|
+
var pcb_pill_hole_with_rect_pad = z57.object({
|
|
1877
|
+
type: z57.literal("pcb_plated_hole"),
|
|
1878
|
+
shape: z57.literal("pill_hole_with_rect_pad"),
|
|
1879
|
+
pcb_group_id: z57.string().optional(),
|
|
1880
|
+
subcircuit_id: z57.string().optional(),
|
|
1881
|
+
hole_shape: z57.literal("pill"),
|
|
1882
|
+
pad_shape: z57.literal("rect"),
|
|
1883
|
+
hole_width: z57.number(),
|
|
1884
|
+
hole_height: z57.number(),
|
|
1885
|
+
rect_pad_width: z57.number(),
|
|
1886
|
+
rect_pad_height: z57.number(),
|
|
1817
1887
|
x: distance,
|
|
1818
1888
|
y: distance,
|
|
1819
|
-
layers:
|
|
1820
|
-
port_hints:
|
|
1821
|
-
pcb_component_id:
|
|
1822
|
-
pcb_port_id:
|
|
1889
|
+
layers: z57.array(layer_ref),
|
|
1890
|
+
port_hints: z57.array(z57.string()).optional(),
|
|
1891
|
+
pcb_component_id: z57.string().optional(),
|
|
1892
|
+
pcb_port_id: z57.string().optional(),
|
|
1823
1893
|
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
|
|
1824
1894
|
});
|
|
1825
|
-
var pcb_plated_hole =
|
|
1895
|
+
var pcb_plated_hole = z57.union([
|
|
1826
1896
|
pcb_plated_hole_circle,
|
|
1827
1897
|
pcb_plated_hole_oval,
|
|
1828
1898
|
pcb_circular_hole_with_rect_pad,
|
|
@@ -1834,161 +1904,175 @@ expectTypesMatch(
|
|
|
1834
1904
|
expectTypesMatch(true);
|
|
1835
1905
|
expectTypesMatch(true);
|
|
1836
1906
|
expectTypesMatch(true);
|
|
1837
|
-
var pcb_port =
|
|
1838
|
-
type:
|
|
1907
|
+
var pcb_port = z58.object({
|
|
1908
|
+
type: z58.literal("pcb_port"),
|
|
1839
1909
|
pcb_port_id: getZodPrefixedIdWithDefault("pcb_port"),
|
|
1840
|
-
pcb_group_id:
|
|
1841
|
-
subcircuit_id:
|
|
1842
|
-
source_port_id:
|
|
1843
|
-
pcb_component_id:
|
|
1910
|
+
pcb_group_id: z58.string().optional(),
|
|
1911
|
+
subcircuit_id: z58.string().optional(),
|
|
1912
|
+
source_port_id: z58.string(),
|
|
1913
|
+
pcb_component_id: z58.string(),
|
|
1844
1914
|
x: distance,
|
|
1845
1915
|
y: distance,
|
|
1846
|
-
layers:
|
|
1916
|
+
layers: z58.array(layer_ref)
|
|
1847
1917
|
}).describe("Defines a port on the PCB");
|
|
1848
1918
|
expectTypesMatch(true);
|
|
1849
|
-
var pcb_smtpad_circle =
|
|
1850
|
-
type:
|
|
1851
|
-
shape:
|
|
1919
|
+
var pcb_smtpad_circle = z59.object({
|
|
1920
|
+
type: z59.literal("pcb_smtpad"),
|
|
1921
|
+
shape: z59.literal("circle"),
|
|
1852
1922
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
1853
|
-
pcb_group_id:
|
|
1854
|
-
subcircuit_id:
|
|
1923
|
+
pcb_group_id: z59.string().optional(),
|
|
1924
|
+
subcircuit_id: z59.string().optional(),
|
|
1855
1925
|
x: distance,
|
|
1856
1926
|
y: distance,
|
|
1857
|
-
radius:
|
|
1927
|
+
radius: z59.number(),
|
|
1858
1928
|
layer: layer_ref,
|
|
1859
|
-
port_hints:
|
|
1860
|
-
pcb_component_id:
|
|
1861
|
-
pcb_port_id:
|
|
1929
|
+
port_hints: z59.array(z59.string()).optional(),
|
|
1930
|
+
pcb_component_id: z59.string().optional(),
|
|
1931
|
+
pcb_port_id: z59.string().optional()
|
|
1862
1932
|
});
|
|
1863
|
-
var pcb_smtpad_rect =
|
|
1864
|
-
type:
|
|
1865
|
-
shape:
|
|
1933
|
+
var pcb_smtpad_rect = z59.object({
|
|
1934
|
+
type: z59.literal("pcb_smtpad"),
|
|
1935
|
+
shape: z59.literal("rect"),
|
|
1866
1936
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
1867
|
-
pcb_group_id:
|
|
1868
|
-
subcircuit_id:
|
|
1937
|
+
pcb_group_id: z59.string().optional(),
|
|
1938
|
+
subcircuit_id: z59.string().optional(),
|
|
1869
1939
|
x: distance,
|
|
1870
1940
|
y: distance,
|
|
1871
|
-
width:
|
|
1872
|
-
height:
|
|
1941
|
+
width: z59.number(),
|
|
1942
|
+
height: z59.number(),
|
|
1873
1943
|
layer: layer_ref,
|
|
1874
|
-
port_hints:
|
|
1875
|
-
pcb_component_id:
|
|
1876
|
-
pcb_port_id:
|
|
1944
|
+
port_hints: z59.array(z59.string()).optional(),
|
|
1945
|
+
pcb_component_id: z59.string().optional(),
|
|
1946
|
+
pcb_port_id: z59.string().optional()
|
|
1877
1947
|
});
|
|
1878
|
-
var pcb_smtpad_rotated_rect =
|
|
1879
|
-
type:
|
|
1880
|
-
shape:
|
|
1948
|
+
var pcb_smtpad_rotated_rect = z59.object({
|
|
1949
|
+
type: z59.literal("pcb_smtpad"),
|
|
1950
|
+
shape: z59.literal("rotated_rect"),
|
|
1881
1951
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
1882
|
-
pcb_group_id:
|
|
1883
|
-
subcircuit_id:
|
|
1952
|
+
pcb_group_id: z59.string().optional(),
|
|
1953
|
+
subcircuit_id: z59.string().optional(),
|
|
1884
1954
|
x: distance,
|
|
1885
1955
|
y: distance,
|
|
1886
|
-
width:
|
|
1887
|
-
height:
|
|
1956
|
+
width: z59.number(),
|
|
1957
|
+
height: z59.number(),
|
|
1888
1958
|
ccw_rotation: rotation,
|
|
1889
1959
|
layer: layer_ref,
|
|
1890
|
-
port_hints:
|
|
1891
|
-
pcb_component_id:
|
|
1892
|
-
pcb_port_id:
|
|
1960
|
+
port_hints: z59.array(z59.string()).optional(),
|
|
1961
|
+
pcb_component_id: z59.string().optional(),
|
|
1962
|
+
pcb_port_id: z59.string().optional()
|
|
1893
1963
|
});
|
|
1894
|
-
var pcb_smtpad_pill =
|
|
1895
|
-
type:
|
|
1896
|
-
shape:
|
|
1964
|
+
var pcb_smtpad_pill = z59.object({
|
|
1965
|
+
type: z59.literal("pcb_smtpad"),
|
|
1966
|
+
shape: z59.literal("pill"),
|
|
1897
1967
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
1898
|
-
pcb_group_id:
|
|
1899
|
-
subcircuit_id:
|
|
1968
|
+
pcb_group_id: z59.string().optional(),
|
|
1969
|
+
subcircuit_id: z59.string().optional(),
|
|
1900
1970
|
x: distance,
|
|
1901
1971
|
y: distance,
|
|
1902
|
-
width:
|
|
1903
|
-
height:
|
|
1904
|
-
radius:
|
|
1972
|
+
width: z59.number(),
|
|
1973
|
+
height: z59.number(),
|
|
1974
|
+
radius: z59.number(),
|
|
1905
1975
|
layer: layer_ref,
|
|
1906
|
-
port_hints:
|
|
1907
|
-
pcb_component_id:
|
|
1908
|
-
pcb_port_id:
|
|
1976
|
+
port_hints: z59.array(z59.string()).optional(),
|
|
1977
|
+
pcb_component_id: z59.string().optional(),
|
|
1978
|
+
pcb_port_id: z59.string().optional()
|
|
1979
|
+
});
|
|
1980
|
+
var pcb_smtpad_polygon = z59.object({
|
|
1981
|
+
type: z59.literal("pcb_smtpad"),
|
|
1982
|
+
shape: z59.literal("polygon"),
|
|
1983
|
+
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
1984
|
+
pcb_group_id: z59.string().optional(),
|
|
1985
|
+
subcircuit_id: z59.string().optional(),
|
|
1986
|
+
points: z59.array(point),
|
|
1987
|
+
layer: layer_ref,
|
|
1988
|
+
port_hints: z59.array(z59.string()).optional(),
|
|
1989
|
+
pcb_component_id: z59.string().optional(),
|
|
1990
|
+
pcb_port_id: z59.string().optional()
|
|
1909
1991
|
});
|
|
1910
|
-
var pcb_smtpad =
|
|
1992
|
+
var pcb_smtpad = z59.discriminatedUnion("shape", [
|
|
1911
1993
|
pcb_smtpad_circle,
|
|
1912
1994
|
pcb_smtpad_rect,
|
|
1913
1995
|
pcb_smtpad_rotated_rect,
|
|
1914
|
-
pcb_smtpad_pill
|
|
1996
|
+
pcb_smtpad_pill,
|
|
1997
|
+
pcb_smtpad_polygon
|
|
1915
1998
|
]).describe("Defines an SMT pad on the PCB");
|
|
1916
1999
|
expectTypesMatch(true);
|
|
1917
2000
|
expectTypesMatch(true);
|
|
1918
2001
|
expectTypesMatch(true);
|
|
1919
2002
|
expectTypesMatch(true);
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
2003
|
+
expectTypesMatch(true);
|
|
2004
|
+
var pcb_solder_paste_circle = z60.object({
|
|
2005
|
+
type: z60.literal("pcb_solder_paste"),
|
|
2006
|
+
shape: z60.literal("circle"),
|
|
1923
2007
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
1924
|
-
pcb_group_id:
|
|
1925
|
-
subcircuit_id:
|
|
2008
|
+
pcb_group_id: z60.string().optional(),
|
|
2009
|
+
subcircuit_id: z60.string().optional(),
|
|
1926
2010
|
x: distance,
|
|
1927
2011
|
y: distance,
|
|
1928
|
-
radius:
|
|
2012
|
+
radius: z60.number(),
|
|
1929
2013
|
layer: layer_ref,
|
|
1930
|
-
pcb_component_id:
|
|
1931
|
-
pcb_smtpad_id:
|
|
2014
|
+
pcb_component_id: z60.string().optional(),
|
|
2015
|
+
pcb_smtpad_id: z60.string().optional()
|
|
1932
2016
|
});
|
|
1933
|
-
var pcb_solder_paste_rect =
|
|
1934
|
-
type:
|
|
1935
|
-
shape:
|
|
2017
|
+
var pcb_solder_paste_rect = z60.object({
|
|
2018
|
+
type: z60.literal("pcb_solder_paste"),
|
|
2019
|
+
shape: z60.literal("rect"),
|
|
1936
2020
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
1937
|
-
pcb_group_id:
|
|
1938
|
-
subcircuit_id:
|
|
2021
|
+
pcb_group_id: z60.string().optional(),
|
|
2022
|
+
subcircuit_id: z60.string().optional(),
|
|
1939
2023
|
x: distance,
|
|
1940
2024
|
y: distance,
|
|
1941
|
-
width:
|
|
1942
|
-
height:
|
|
2025
|
+
width: z60.number(),
|
|
2026
|
+
height: z60.number(),
|
|
1943
2027
|
layer: layer_ref,
|
|
1944
|
-
pcb_component_id:
|
|
1945
|
-
pcb_smtpad_id:
|
|
2028
|
+
pcb_component_id: z60.string().optional(),
|
|
2029
|
+
pcb_smtpad_id: z60.string().optional()
|
|
1946
2030
|
});
|
|
1947
|
-
var pcb_solder_paste_pill =
|
|
1948
|
-
type:
|
|
1949
|
-
shape:
|
|
2031
|
+
var pcb_solder_paste_pill = z60.object({
|
|
2032
|
+
type: z60.literal("pcb_solder_paste"),
|
|
2033
|
+
shape: z60.literal("pill"),
|
|
1950
2034
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
1951
|
-
pcb_group_id:
|
|
1952
|
-
subcircuit_id:
|
|
2035
|
+
pcb_group_id: z60.string().optional(),
|
|
2036
|
+
subcircuit_id: z60.string().optional(),
|
|
1953
2037
|
x: distance,
|
|
1954
2038
|
y: distance,
|
|
1955
|
-
width:
|
|
1956
|
-
height:
|
|
1957
|
-
radius:
|
|
2039
|
+
width: z60.number(),
|
|
2040
|
+
height: z60.number(),
|
|
2041
|
+
radius: z60.number(),
|
|
1958
2042
|
layer: layer_ref,
|
|
1959
|
-
pcb_component_id:
|
|
1960
|
-
pcb_smtpad_id:
|
|
2043
|
+
pcb_component_id: z60.string().optional(),
|
|
2044
|
+
pcb_smtpad_id: z60.string().optional()
|
|
1961
2045
|
});
|
|
1962
|
-
var pcb_solder_paste_rotated_rect =
|
|
1963
|
-
type:
|
|
1964
|
-
shape:
|
|
2046
|
+
var pcb_solder_paste_rotated_rect = z60.object({
|
|
2047
|
+
type: z60.literal("pcb_solder_paste"),
|
|
2048
|
+
shape: z60.literal("rotated_rect"),
|
|
1965
2049
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
1966
|
-
pcb_group_id:
|
|
1967
|
-
subcircuit_id:
|
|
2050
|
+
pcb_group_id: z60.string().optional(),
|
|
2051
|
+
subcircuit_id: z60.string().optional(),
|
|
1968
2052
|
x: distance,
|
|
1969
2053
|
y: distance,
|
|
1970
|
-
width:
|
|
1971
|
-
height:
|
|
2054
|
+
width: z60.number(),
|
|
2055
|
+
height: z60.number(),
|
|
1972
2056
|
ccw_rotation: distance,
|
|
1973
2057
|
layer: layer_ref,
|
|
1974
|
-
pcb_component_id:
|
|
1975
|
-
pcb_smtpad_id:
|
|
2058
|
+
pcb_component_id: z60.string().optional(),
|
|
2059
|
+
pcb_smtpad_id: z60.string().optional()
|
|
1976
2060
|
});
|
|
1977
|
-
var pcb_solder_paste_oval =
|
|
1978
|
-
type:
|
|
1979
|
-
shape:
|
|
2061
|
+
var pcb_solder_paste_oval = z60.object({
|
|
2062
|
+
type: z60.literal("pcb_solder_paste"),
|
|
2063
|
+
shape: z60.literal("oval"),
|
|
1980
2064
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
1981
|
-
pcb_group_id:
|
|
1982
|
-
subcircuit_id:
|
|
2065
|
+
pcb_group_id: z60.string().optional(),
|
|
2066
|
+
subcircuit_id: z60.string().optional(),
|
|
1983
2067
|
x: distance,
|
|
1984
2068
|
y: distance,
|
|
1985
|
-
width:
|
|
1986
|
-
height:
|
|
2069
|
+
width: z60.number(),
|
|
2070
|
+
height: z60.number(),
|
|
1987
2071
|
layer: layer_ref,
|
|
1988
|
-
pcb_component_id:
|
|
1989
|
-
pcb_smtpad_id:
|
|
2072
|
+
pcb_component_id: z60.string().optional(),
|
|
2073
|
+
pcb_smtpad_id: z60.string().optional()
|
|
1990
2074
|
});
|
|
1991
|
-
var pcb_solder_paste =
|
|
2075
|
+
var pcb_solder_paste = z60.union([
|
|
1992
2076
|
pcb_solder_paste_circle,
|
|
1993
2077
|
pcb_solder_paste_rect,
|
|
1994
2078
|
pcb_solder_paste_pill,
|
|
@@ -2002,82 +2086,85 @@ expectTypesMatch(
|
|
|
2002
2086
|
true
|
|
2003
2087
|
);
|
|
2004
2088
|
expectTypesMatch(true);
|
|
2005
|
-
var pcb_text =
|
|
2006
|
-
type:
|
|
2089
|
+
var pcb_text = z61.object({
|
|
2090
|
+
type: z61.literal("pcb_text"),
|
|
2007
2091
|
pcb_text_id: getZodPrefixedIdWithDefault("pcb_text"),
|
|
2008
|
-
pcb_group_id:
|
|
2009
|
-
subcircuit_id:
|
|
2010
|
-
text:
|
|
2092
|
+
pcb_group_id: z61.string().optional(),
|
|
2093
|
+
subcircuit_id: z61.string().optional(),
|
|
2094
|
+
text: z61.string(),
|
|
2011
2095
|
center: point,
|
|
2012
2096
|
layer: layer_ref,
|
|
2013
2097
|
width: length,
|
|
2014
2098
|
height: length,
|
|
2015
|
-
lines:
|
|
2099
|
+
lines: z61.number(),
|
|
2016
2100
|
// @ts-ignore
|
|
2017
|
-
align:
|
|
2101
|
+
align: z61.enum(["bottom-left"])
|
|
2018
2102
|
}).describe("Defines text on the PCB");
|
|
2019
2103
|
expectTypesMatch(true);
|
|
2020
|
-
var pcb_trace_route_point_wire =
|
|
2021
|
-
route_type:
|
|
2104
|
+
var pcb_trace_route_point_wire = z62.object({
|
|
2105
|
+
route_type: z62.literal("wire"),
|
|
2022
2106
|
x: distance,
|
|
2023
2107
|
y: distance,
|
|
2024
2108
|
width: distance,
|
|
2025
|
-
start_pcb_port_id:
|
|
2026
|
-
end_pcb_port_id:
|
|
2109
|
+
start_pcb_port_id: z62.string().optional(),
|
|
2110
|
+
end_pcb_port_id: z62.string().optional(),
|
|
2027
2111
|
layer: layer_ref
|
|
2028
2112
|
});
|
|
2029
|
-
var pcb_trace_route_point_via =
|
|
2030
|
-
route_type:
|
|
2113
|
+
var pcb_trace_route_point_via = z62.object({
|
|
2114
|
+
route_type: z62.literal("via"),
|
|
2031
2115
|
x: distance,
|
|
2032
2116
|
y: distance,
|
|
2033
2117
|
hole_diameter: distance.optional(),
|
|
2034
2118
|
outer_diameter: distance.optional(),
|
|
2035
|
-
from_layer:
|
|
2036
|
-
to_layer:
|
|
2119
|
+
from_layer: z62.string(),
|
|
2120
|
+
to_layer: z62.string()
|
|
2037
2121
|
});
|
|
2038
|
-
var pcb_trace_route_point =
|
|
2122
|
+
var pcb_trace_route_point = z62.union([
|
|
2039
2123
|
pcb_trace_route_point_wire,
|
|
2040
2124
|
pcb_trace_route_point_via
|
|
2041
2125
|
]);
|
|
2042
|
-
var pcb_trace =
|
|
2043
|
-
type:
|
|
2044
|
-
source_trace_id:
|
|
2045
|
-
pcb_component_id:
|
|
2126
|
+
var pcb_trace = z62.object({
|
|
2127
|
+
type: z62.literal("pcb_trace"),
|
|
2128
|
+
source_trace_id: z62.string().optional(),
|
|
2129
|
+
pcb_component_id: z62.string().optional(),
|
|
2046
2130
|
pcb_trace_id: getZodPrefixedIdWithDefault("pcb_trace"),
|
|
2047
|
-
pcb_group_id:
|
|
2048
|
-
subcircuit_id:
|
|
2049
|
-
route_thickness_mode:
|
|
2050
|
-
route_order_index:
|
|
2051
|
-
should_round_corners:
|
|
2052
|
-
trace_length:
|
|
2053
|
-
route:
|
|
2131
|
+
pcb_group_id: z62.string().optional(),
|
|
2132
|
+
subcircuit_id: z62.string().optional(),
|
|
2133
|
+
route_thickness_mode: z62.enum(["constant", "interpolated"]).default("constant").optional(),
|
|
2134
|
+
route_order_index: z62.number().optional(),
|
|
2135
|
+
should_round_corners: z62.boolean().optional(),
|
|
2136
|
+
trace_length: z62.number().optional(),
|
|
2137
|
+
route: z62.array(pcb_trace_route_point)
|
|
2054
2138
|
}).describe("Defines a trace on the PCB");
|
|
2055
2139
|
expectTypesMatch(true);
|
|
2056
2140
|
expectTypesMatch(true);
|
|
2057
|
-
var pcb_trace_error =
|
|
2058
|
-
type:
|
|
2141
|
+
var pcb_trace_error = z63.object({
|
|
2142
|
+
type: z63.literal("pcb_trace_error"),
|
|
2059
2143
|
pcb_trace_error_id: getZodPrefixedIdWithDefault("pcb_trace_error"),
|
|
2060
|
-
error_type:
|
|
2061
|
-
message:
|
|
2144
|
+
error_type: z63.literal("pcb_trace_error").default("pcb_trace_error"),
|
|
2145
|
+
message: z63.string(),
|
|
2062
2146
|
center: point.optional(),
|
|
2063
|
-
pcb_trace_id:
|
|
2064
|
-
source_trace_id:
|
|
2065
|
-
pcb_component_ids:
|
|
2066
|
-
pcb_port_ids:
|
|
2147
|
+
pcb_trace_id: z63.string(),
|
|
2148
|
+
source_trace_id: z63.string(),
|
|
2149
|
+
pcb_component_ids: z63.array(z63.string()),
|
|
2150
|
+
pcb_port_ids: z63.array(z63.string()),
|
|
2151
|
+
subcircuit_id: z63.string().optional()
|
|
2067
2152
|
}).describe("Defines a trace error on the PCB");
|
|
2068
2153
|
expectTypesMatch(true);
|
|
2069
|
-
var pcb_port_not_matched_error =
|
|
2070
|
-
type:
|
|
2154
|
+
var pcb_port_not_matched_error = z64.object({
|
|
2155
|
+
type: z64.literal("pcb_port_not_matched_error"),
|
|
2071
2156
|
pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
|
|
2072
|
-
|
|
2073
|
-
|
|
2157
|
+
error_type: z64.literal("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),
|
|
2158
|
+
message: z64.string(),
|
|
2159
|
+
pcb_component_ids: z64.array(z64.string()),
|
|
2160
|
+
subcircuit_id: z64.string().optional()
|
|
2074
2161
|
}).describe("Defines a trace error on the PCB where a port is not matched");
|
|
2075
2162
|
expectTypesMatch(true);
|
|
2076
|
-
var pcb_via =
|
|
2077
|
-
type:
|
|
2163
|
+
var pcb_via = z65.object({
|
|
2164
|
+
type: z65.literal("pcb_via"),
|
|
2078
2165
|
pcb_via_id: getZodPrefixedIdWithDefault("pcb_via"),
|
|
2079
|
-
pcb_group_id:
|
|
2080
|
-
subcircuit_id:
|
|
2166
|
+
pcb_group_id: z65.string().optional(),
|
|
2167
|
+
subcircuit_id: z65.string().optional(),
|
|
2081
2168
|
x: distance,
|
|
2082
2169
|
y: distance,
|
|
2083
2170
|
outer_diameter: distance.default("0.6mm"),
|
|
@@ -2086,44 +2173,47 @@ var pcb_via = z64.object({
|
|
|
2086
2173
|
from_layer: layer_ref.optional(),
|
|
2087
2174
|
/** @deprecated */
|
|
2088
2175
|
to_layer: layer_ref.optional(),
|
|
2089
|
-
layers:
|
|
2090
|
-
pcb_trace_id:
|
|
2176
|
+
layers: z65.array(layer_ref),
|
|
2177
|
+
pcb_trace_id: z65.string().optional()
|
|
2091
2178
|
}).describe("Defines a via on the PCB");
|
|
2092
2179
|
expectTypesMatch(true);
|
|
2093
|
-
var pcb_board =
|
|
2094
|
-
type:
|
|
2180
|
+
var pcb_board = z66.object({
|
|
2181
|
+
type: z66.literal("pcb_board"),
|
|
2095
2182
|
pcb_board_id: getZodPrefixedIdWithDefault("pcb_board"),
|
|
2096
|
-
is_subcircuit:
|
|
2097
|
-
subcircuit_id:
|
|
2183
|
+
is_subcircuit: z66.boolean().optional(),
|
|
2184
|
+
subcircuit_id: z66.string().optional(),
|
|
2098
2185
|
width: length,
|
|
2099
2186
|
height: length,
|
|
2100
2187
|
center: point,
|
|
2101
2188
|
thickness: length.optional().default(1.4),
|
|
2102
|
-
num_layers:
|
|
2103
|
-
outline:
|
|
2104
|
-
material:
|
|
2189
|
+
num_layers: z66.number().optional().default(4),
|
|
2190
|
+
outline: z66.array(point).optional(),
|
|
2191
|
+
material: z66.enum(["fr4", "fr1"]).default("fr4")
|
|
2105
2192
|
}).describe("Defines the board outline of the PCB");
|
|
2106
2193
|
expectTypesMatch(true);
|
|
2107
|
-
var pcb_placement_error =
|
|
2108
|
-
type:
|
|
2194
|
+
var pcb_placement_error = z67.object({
|
|
2195
|
+
type: z67.literal("pcb_placement_error"),
|
|
2109
2196
|
pcb_placement_error_id: getZodPrefixedIdWithDefault("pcb_placement_error"),
|
|
2110
|
-
|
|
2197
|
+
error_type: z67.literal("pcb_placement_error").default("pcb_placement_error"),
|
|
2198
|
+
message: z67.string(),
|
|
2199
|
+
subcircuit_id: z67.string().optional()
|
|
2111
2200
|
}).describe("Defines a placement error on the PCB");
|
|
2112
2201
|
expectTypesMatch(true);
|
|
2113
|
-
var pcb_trace_hint =
|
|
2114
|
-
type:
|
|
2202
|
+
var pcb_trace_hint = z68.object({
|
|
2203
|
+
type: z68.literal("pcb_trace_hint"),
|
|
2115
2204
|
pcb_trace_hint_id: getZodPrefixedIdWithDefault("pcb_trace_hint"),
|
|
2116
|
-
pcb_port_id:
|
|
2117
|
-
pcb_component_id:
|
|
2118
|
-
route:
|
|
2205
|
+
pcb_port_id: z68.string(),
|
|
2206
|
+
pcb_component_id: z68.string(),
|
|
2207
|
+
route: z68.array(route_hint_point),
|
|
2208
|
+
subcircuit_id: z68.string().optional()
|
|
2119
2209
|
}).describe("A hint that can be used during generation of a PCB trace");
|
|
2120
2210
|
expectTypesMatch(true);
|
|
2121
|
-
var pcb_silkscreen_line =
|
|
2122
|
-
type:
|
|
2211
|
+
var pcb_silkscreen_line = z69.object({
|
|
2212
|
+
type: z69.literal("pcb_silkscreen_line"),
|
|
2123
2213
|
pcb_silkscreen_line_id: getZodPrefixedIdWithDefault("pcb_silkscreen_line"),
|
|
2124
|
-
pcb_component_id:
|
|
2125
|
-
pcb_group_id:
|
|
2126
|
-
subcircuit_id:
|
|
2214
|
+
pcb_component_id: z69.string(),
|
|
2215
|
+
pcb_group_id: z69.string().optional(),
|
|
2216
|
+
subcircuit_id: z69.string().optional(),
|
|
2127
2217
|
stroke_width: distance.default("0.1mm"),
|
|
2128
2218
|
x1: distance,
|
|
2129
2219
|
y1: distance,
|
|
@@ -2132,142 +2222,146 @@ var pcb_silkscreen_line = z68.object({
|
|
|
2132
2222
|
layer: visible_layer
|
|
2133
2223
|
}).describe("Defines a silkscreen line on the PCB");
|
|
2134
2224
|
expectTypesMatch(true);
|
|
2135
|
-
var pcb_silkscreen_path =
|
|
2136
|
-
type:
|
|
2225
|
+
var pcb_silkscreen_path = z70.object({
|
|
2226
|
+
type: z70.literal("pcb_silkscreen_path"),
|
|
2137
2227
|
pcb_silkscreen_path_id: getZodPrefixedIdWithDefault("pcb_silkscreen_path"),
|
|
2138
|
-
pcb_component_id:
|
|
2139
|
-
pcb_group_id:
|
|
2140
|
-
subcircuit_id:
|
|
2228
|
+
pcb_component_id: z70.string(),
|
|
2229
|
+
pcb_group_id: z70.string().optional(),
|
|
2230
|
+
subcircuit_id: z70.string().optional(),
|
|
2141
2231
|
layer: visible_layer,
|
|
2142
|
-
route:
|
|
2232
|
+
route: z70.array(point),
|
|
2143
2233
|
stroke_width: length
|
|
2144
2234
|
}).describe("Defines a silkscreen path on the PCB");
|
|
2145
2235
|
expectTypesMatch(true);
|
|
2146
|
-
var pcb_silkscreen_text =
|
|
2147
|
-
type:
|
|
2236
|
+
var pcb_silkscreen_text = z71.object({
|
|
2237
|
+
type: z71.literal("pcb_silkscreen_text"),
|
|
2148
2238
|
pcb_silkscreen_text_id: getZodPrefixedIdWithDefault("pcb_silkscreen_text"),
|
|
2149
|
-
pcb_group_id:
|
|
2150
|
-
subcircuit_id:
|
|
2151
|
-
font:
|
|
2239
|
+
pcb_group_id: z71.string().optional(),
|
|
2240
|
+
subcircuit_id: z71.string().optional(),
|
|
2241
|
+
font: z71.literal("tscircuit2024").default("tscircuit2024"),
|
|
2152
2242
|
font_size: distance.default("0.2mm"),
|
|
2153
|
-
pcb_component_id:
|
|
2154
|
-
text:
|
|
2155
|
-
ccw_rotation:
|
|
2243
|
+
pcb_component_id: z71.string(),
|
|
2244
|
+
text: z71.string(),
|
|
2245
|
+
ccw_rotation: z71.number().optional(),
|
|
2156
2246
|
layer: layer_ref,
|
|
2157
|
-
is_mirrored:
|
|
2247
|
+
is_mirrored: z71.boolean().default(false).optional(),
|
|
2158
2248
|
anchor_position: point.default({ x: 0, y: 0 }),
|
|
2159
2249
|
anchor_alignment: ninePointAnchor.default("center")
|
|
2160
2250
|
}).describe("Defines silkscreen text on the PCB");
|
|
2161
2251
|
expectTypesMatch(true);
|
|
2162
|
-
var pcb_silkscreen_rect =
|
|
2163
|
-
type:
|
|
2252
|
+
var pcb_silkscreen_rect = z72.object({
|
|
2253
|
+
type: z72.literal("pcb_silkscreen_rect"),
|
|
2164
2254
|
pcb_silkscreen_rect_id: getZodPrefixedIdWithDefault("pcb_silkscreen_rect"),
|
|
2165
|
-
pcb_component_id:
|
|
2166
|
-
pcb_group_id:
|
|
2167
|
-
subcircuit_id:
|
|
2255
|
+
pcb_component_id: z72.string(),
|
|
2256
|
+
pcb_group_id: z72.string().optional(),
|
|
2257
|
+
subcircuit_id: z72.string().optional(),
|
|
2168
2258
|
center: point,
|
|
2169
2259
|
width: length,
|
|
2170
2260
|
height: length,
|
|
2171
2261
|
layer: layer_ref,
|
|
2172
|
-
stroke_width: length.default("1mm")
|
|
2262
|
+
stroke_width: length.default("1mm"),
|
|
2263
|
+
is_filled: z72.boolean().default(true).optional(),
|
|
2264
|
+
has_stroke: z72.boolean().optional(),
|
|
2265
|
+
is_stroke_dashed: z72.boolean().optional()
|
|
2173
2266
|
}).describe("Defines a silkscreen rect on the PCB");
|
|
2174
2267
|
expectTypesMatch(true);
|
|
2175
|
-
var pcb_silkscreen_circle =
|
|
2176
|
-
type:
|
|
2268
|
+
var pcb_silkscreen_circle = z73.object({
|
|
2269
|
+
type: z73.literal("pcb_silkscreen_circle"),
|
|
2177
2270
|
pcb_silkscreen_circle_id: getZodPrefixedIdWithDefault(
|
|
2178
2271
|
"pcb_silkscreen_circle"
|
|
2179
2272
|
),
|
|
2180
|
-
pcb_component_id:
|
|
2181
|
-
pcb_group_id:
|
|
2182
|
-
subcircuit_id:
|
|
2273
|
+
pcb_component_id: z73.string(),
|
|
2274
|
+
pcb_group_id: z73.string().optional(),
|
|
2275
|
+
subcircuit_id: z73.string().optional(),
|
|
2183
2276
|
center: point,
|
|
2184
2277
|
radius: length,
|
|
2185
2278
|
layer: visible_layer,
|
|
2186
2279
|
stroke_width: length.default("1mm")
|
|
2187
2280
|
}).describe("Defines a silkscreen circle on the PCB");
|
|
2188
2281
|
expectTypesMatch(true);
|
|
2189
|
-
var pcb_silkscreen_oval =
|
|
2190
|
-
type:
|
|
2282
|
+
var pcb_silkscreen_oval = z74.object({
|
|
2283
|
+
type: z74.literal("pcb_silkscreen_oval"),
|
|
2191
2284
|
pcb_silkscreen_oval_id: getZodPrefixedIdWithDefault("pcb_silkscreen_oval"),
|
|
2192
|
-
pcb_component_id:
|
|
2193
|
-
pcb_group_id:
|
|
2194
|
-
subcircuit_id:
|
|
2285
|
+
pcb_component_id: z74.string(),
|
|
2286
|
+
pcb_group_id: z74.string().optional(),
|
|
2287
|
+
subcircuit_id: z74.string().optional(),
|
|
2195
2288
|
center: point,
|
|
2196
2289
|
radius_x: distance,
|
|
2197
2290
|
radius_y: distance,
|
|
2198
2291
|
layer: visible_layer
|
|
2199
2292
|
}).describe("Defines a silkscreen oval on the PCB");
|
|
2200
2293
|
expectTypesMatch(true);
|
|
2201
|
-
var pcb_fabrication_note_text =
|
|
2202
|
-
type:
|
|
2294
|
+
var pcb_fabrication_note_text = z75.object({
|
|
2295
|
+
type: z75.literal("pcb_fabrication_note_text"),
|
|
2203
2296
|
pcb_fabrication_note_text_id: getZodPrefixedIdWithDefault(
|
|
2204
2297
|
"pcb_fabrication_note_text"
|
|
2205
2298
|
),
|
|
2206
|
-
subcircuit_id:
|
|
2207
|
-
pcb_group_id:
|
|
2208
|
-
font:
|
|
2299
|
+
subcircuit_id: z75.string().optional(),
|
|
2300
|
+
pcb_group_id: z75.string().optional(),
|
|
2301
|
+
font: z75.literal("tscircuit2024").default("tscircuit2024"),
|
|
2209
2302
|
font_size: distance.default("1mm"),
|
|
2210
|
-
pcb_component_id:
|
|
2211
|
-
text:
|
|
2303
|
+
pcb_component_id: z75.string(),
|
|
2304
|
+
text: z75.string(),
|
|
2212
2305
|
layer: visible_layer,
|
|
2213
2306
|
anchor_position: point.default({ x: 0, y: 0 }),
|
|
2214
|
-
anchor_alignment:
|
|
2215
|
-
color:
|
|
2307
|
+
anchor_alignment: z75.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
2308
|
+
color: z75.string().optional()
|
|
2216
2309
|
}).describe(
|
|
2217
2310
|
"Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"
|
|
2218
2311
|
);
|
|
2219
2312
|
expectTypesMatch(true);
|
|
2220
|
-
var pcb_fabrication_note_path =
|
|
2221
|
-
type:
|
|
2313
|
+
var pcb_fabrication_note_path = z76.object({
|
|
2314
|
+
type: z76.literal("pcb_fabrication_note_path"),
|
|
2222
2315
|
pcb_fabrication_note_path_id: getZodPrefixedIdWithDefault(
|
|
2223
2316
|
"pcb_fabrication_note_path"
|
|
2224
2317
|
),
|
|
2225
|
-
pcb_component_id:
|
|
2226
|
-
subcircuit_id:
|
|
2318
|
+
pcb_component_id: z76.string(),
|
|
2319
|
+
subcircuit_id: z76.string().optional(),
|
|
2227
2320
|
layer: layer_ref,
|
|
2228
|
-
route:
|
|
2321
|
+
route: z76.array(point),
|
|
2229
2322
|
stroke_width: length,
|
|
2230
|
-
color:
|
|
2323
|
+
color: z76.string().optional()
|
|
2231
2324
|
}).describe(
|
|
2232
2325
|
"Defines a fabrication path on the PCB for fabricators or assemblers"
|
|
2233
2326
|
);
|
|
2234
2327
|
expectTypesMatch(true);
|
|
2235
|
-
var pcb_keepout =
|
|
2236
|
-
type:
|
|
2237
|
-
shape:
|
|
2238
|
-
pcb_group_id:
|
|
2239
|
-
subcircuit_id:
|
|
2328
|
+
var pcb_keepout = z77.object({
|
|
2329
|
+
type: z77.literal("pcb_keepout"),
|
|
2330
|
+
shape: z77.literal("rect"),
|
|
2331
|
+
pcb_group_id: z77.string().optional(),
|
|
2332
|
+
subcircuit_id: z77.string().optional(),
|
|
2240
2333
|
center: point,
|
|
2241
2334
|
width: distance,
|
|
2242
2335
|
height: distance,
|
|
2243
|
-
pcb_keepout_id:
|
|
2244
|
-
layers:
|
|
2336
|
+
pcb_keepout_id: z77.string(),
|
|
2337
|
+
layers: z77.array(z77.string()),
|
|
2245
2338
|
// Specify layers where the keepout applies
|
|
2246
|
-
description:
|
|
2339
|
+
description: z77.string().optional()
|
|
2247
2340
|
// Optional description of the keepout
|
|
2248
2341
|
}).or(
|
|
2249
|
-
|
|
2250
|
-
type:
|
|
2251
|
-
shape:
|
|
2252
|
-
pcb_group_id:
|
|
2253
|
-
subcircuit_id:
|
|
2342
|
+
z77.object({
|
|
2343
|
+
type: z77.literal("pcb_keepout"),
|
|
2344
|
+
shape: z77.literal("circle"),
|
|
2345
|
+
pcb_group_id: z77.string().optional(),
|
|
2346
|
+
subcircuit_id: z77.string().optional(),
|
|
2254
2347
|
center: point,
|
|
2255
2348
|
radius: distance,
|
|
2256
|
-
pcb_keepout_id:
|
|
2257
|
-
layers:
|
|
2349
|
+
pcb_keepout_id: z77.string(),
|
|
2350
|
+
layers: z77.array(z77.string()),
|
|
2258
2351
|
// Specify layers where the keepout applies
|
|
2259
|
-
description:
|
|
2352
|
+
description: z77.string().optional()
|
|
2260
2353
|
// Optional description of the keepout
|
|
2261
2354
|
})
|
|
2262
2355
|
);
|
|
2263
|
-
|
|
2264
|
-
|
|
2356
|
+
expectTypesMatch(true);
|
|
2357
|
+
var pcb_cutout_base = z78.object({
|
|
2358
|
+
type: z78.literal("pcb_cutout"),
|
|
2265
2359
|
pcb_cutout_id: getZodPrefixedIdWithDefault("pcb_cutout"),
|
|
2266
|
-
pcb_group_id:
|
|
2267
|
-
subcircuit_id:
|
|
2360
|
+
pcb_group_id: z78.string().optional(),
|
|
2361
|
+
subcircuit_id: z78.string().optional()
|
|
2268
2362
|
});
|
|
2269
2363
|
var pcb_cutout_rect = pcb_cutout_base.extend({
|
|
2270
|
-
shape:
|
|
2364
|
+
shape: z78.literal("rect"),
|
|
2271
2365
|
center: point,
|
|
2272
2366
|
width: length,
|
|
2273
2367
|
height: length,
|
|
@@ -2275,94 +2369,149 @@ var pcb_cutout_rect = pcb_cutout_base.extend({
|
|
|
2275
2369
|
});
|
|
2276
2370
|
expectTypesMatch(true);
|
|
2277
2371
|
var pcb_cutout_circle = pcb_cutout_base.extend({
|
|
2278
|
-
shape:
|
|
2372
|
+
shape: z78.literal("circle"),
|
|
2279
2373
|
center: point,
|
|
2280
2374
|
radius: length
|
|
2281
2375
|
});
|
|
2282
2376
|
expectTypesMatch(true);
|
|
2283
2377
|
var pcb_cutout_polygon = pcb_cutout_base.extend({
|
|
2284
|
-
shape:
|
|
2285
|
-
points:
|
|
2378
|
+
shape: z78.literal("polygon"),
|
|
2379
|
+
points: z78.array(point)
|
|
2286
2380
|
});
|
|
2287
2381
|
expectTypesMatch(true);
|
|
2288
|
-
var pcb_cutout =
|
|
2382
|
+
var pcb_cutout = z78.discriminatedUnion("shape", [
|
|
2289
2383
|
pcb_cutout_rect,
|
|
2290
2384
|
pcb_cutout_circle,
|
|
2291
2385
|
pcb_cutout_polygon
|
|
2292
2386
|
]).describe("Defines a cutout on the PCB, removing board material.");
|
|
2293
2387
|
expectTypesMatch(true);
|
|
2294
|
-
var pcb_missing_footprint_error =
|
|
2295
|
-
type:
|
|
2388
|
+
var pcb_missing_footprint_error = z79.object({
|
|
2389
|
+
type: z79.literal("pcb_missing_footprint_error"),
|
|
2296
2390
|
pcb_missing_footprint_error_id: getZodPrefixedIdWithDefault(
|
|
2297
2391
|
"pcb_missing_footprint_error"
|
|
2298
2392
|
),
|
|
2299
|
-
pcb_group_id:
|
|
2300
|
-
subcircuit_id:
|
|
2301
|
-
error_type:
|
|
2302
|
-
source_component_id:
|
|
2303
|
-
message:
|
|
2393
|
+
pcb_group_id: z79.string().optional(),
|
|
2394
|
+
subcircuit_id: z79.string().optional(),
|
|
2395
|
+
error_type: z79.literal("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),
|
|
2396
|
+
source_component_id: z79.string(),
|
|
2397
|
+
message: z79.string()
|
|
2304
2398
|
}).describe("Defines a missing footprint error on the PCB");
|
|
2305
2399
|
expectTypesMatch(
|
|
2306
2400
|
true
|
|
2307
2401
|
);
|
|
2308
|
-
var pcb_group =
|
|
2309
|
-
type:
|
|
2402
|
+
var pcb_group = z80.object({
|
|
2403
|
+
type: z80.literal("pcb_group"),
|
|
2310
2404
|
pcb_group_id: getZodPrefixedIdWithDefault("pcb_group"),
|
|
2311
|
-
source_group_id:
|
|
2312
|
-
is_subcircuit:
|
|
2313
|
-
subcircuit_id:
|
|
2405
|
+
source_group_id: z80.string(),
|
|
2406
|
+
is_subcircuit: z80.boolean().optional(),
|
|
2407
|
+
subcircuit_id: z80.string().optional(),
|
|
2314
2408
|
width: length,
|
|
2315
2409
|
height: length,
|
|
2316
2410
|
center: point,
|
|
2317
|
-
pcb_component_ids:
|
|
2318
|
-
name:
|
|
2319
|
-
description:
|
|
2411
|
+
pcb_component_ids: z80.array(z80.string()),
|
|
2412
|
+
name: z80.string().optional(),
|
|
2413
|
+
description: z80.string().optional(),
|
|
2414
|
+
autorouter_configuration: z80.object({
|
|
2415
|
+
trace_clearance: length
|
|
2416
|
+
}).optional(),
|
|
2417
|
+
autorouter_used_string: z80.string().optional()
|
|
2320
2418
|
}).describe("Defines a group of components on the PCB");
|
|
2321
2419
|
expectTypesMatch(true);
|
|
2322
|
-
var pcb_autorouting_error =
|
|
2323
|
-
type:
|
|
2420
|
+
var pcb_autorouting_error = z81.object({
|
|
2421
|
+
type: z81.literal("pcb_autorouting_error"),
|
|
2324
2422
|
pcb_error_id: getZodPrefixedIdWithDefault("pcb_autorouting_error"),
|
|
2325
|
-
|
|
2423
|
+
error_type: z81.literal("pcb_autorouting_error").default("pcb_autorouting_error"),
|
|
2424
|
+
message: z81.string(),
|
|
2425
|
+
subcircuit_id: z81.string().optional()
|
|
2326
2426
|
}).describe("The autorouting has failed to route a portion of the board");
|
|
2327
2427
|
expectTypesMatch(true);
|
|
2328
|
-
var pcb_manual_edit_conflict_warning =
|
|
2329
|
-
type:
|
|
2428
|
+
var pcb_manual_edit_conflict_warning = z82.object({
|
|
2429
|
+
type: z82.literal("pcb_manual_edit_conflict_warning"),
|
|
2330
2430
|
pcb_manual_edit_conflict_warning_id: getZodPrefixedIdWithDefault(
|
|
2331
2431
|
"pcb_manual_edit_conflict_warning"
|
|
2332
2432
|
),
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2433
|
+
warning_type: z82.literal("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),
|
|
2434
|
+
message: z82.string(),
|
|
2435
|
+
pcb_component_id: z82.string(),
|
|
2436
|
+
pcb_group_id: z82.string().optional(),
|
|
2437
|
+
subcircuit_id: z82.string().optional(),
|
|
2438
|
+
source_component_id: z82.string()
|
|
2338
2439
|
}).describe(
|
|
2339
2440
|
"Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"
|
|
2340
2441
|
);
|
|
2341
2442
|
expectTypesMatch(true);
|
|
2342
|
-
var
|
|
2343
|
-
type:
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2443
|
+
var pcb_breakout_point = z83.object({
|
|
2444
|
+
type: z83.literal("pcb_breakout_point"),
|
|
2445
|
+
pcb_breakout_point_id: getZodPrefixedIdWithDefault("pcb_breakout_point"),
|
|
2446
|
+
pcb_group_id: z83.string(),
|
|
2447
|
+
subcircuit_id: z83.string().optional(),
|
|
2448
|
+
source_trace_id: z83.string().optional(),
|
|
2449
|
+
source_port_id: z83.string().optional(),
|
|
2450
|
+
source_net_id: z83.string().optional(),
|
|
2451
|
+
x: distance,
|
|
2452
|
+
y: distance
|
|
2453
|
+
}).describe(
|
|
2454
|
+
"Defines a routing target within a pcb_group for a source_trace or source_net"
|
|
2455
|
+
);
|
|
2456
|
+
expectTypesMatch(true);
|
|
2457
|
+
var pcb_ground_plane = z84.object({
|
|
2458
|
+
type: z84.literal("pcb_ground_plane"),
|
|
2459
|
+
pcb_ground_plane_id: getZodPrefixedIdWithDefault("pcb_ground_plane"),
|
|
2460
|
+
source_pcb_ground_plane_id: z84.string(),
|
|
2461
|
+
source_net_id: z84.string(),
|
|
2462
|
+
pcb_group_id: z84.string().optional(),
|
|
2463
|
+
subcircuit_id: z84.string().optional()
|
|
2464
|
+
}).describe("Defines a ground plane on the PCB");
|
|
2465
|
+
expectTypesMatch(true);
|
|
2466
|
+
var pcb_ground_plane_region = z85.object({
|
|
2467
|
+
type: z85.literal("pcb_ground_plane_region"),
|
|
2468
|
+
pcb_ground_plane_region_id: getZodPrefixedIdWithDefault(
|
|
2469
|
+
"pcb_ground_plane_region"
|
|
2470
|
+
),
|
|
2471
|
+
pcb_ground_plane_id: z85.string(),
|
|
2472
|
+
pcb_group_id: z85.string().optional(),
|
|
2473
|
+
subcircuit_id: z85.string().optional(),
|
|
2474
|
+
layer: layer_ref,
|
|
2475
|
+
points: z85.array(point)
|
|
2476
|
+
}).describe("Defines a polygon region of a ground plane");
|
|
2477
|
+
expectTypesMatch(true);
|
|
2478
|
+
var pcb_thermal_spoke = z86.object({
|
|
2479
|
+
type: z86.literal("pcb_thermal_spoke"),
|
|
2480
|
+
pcb_thermal_spoke_id: getZodPrefixedIdWithDefault("pcb_thermal_spoke"),
|
|
2481
|
+
pcb_ground_plane_id: z86.string(),
|
|
2482
|
+
shape: z86.string(),
|
|
2483
|
+
spoke_count: z86.number(),
|
|
2484
|
+
spoke_thickness: distance,
|
|
2485
|
+
spoke_inner_diameter: distance,
|
|
2486
|
+
spoke_outer_diameter: distance,
|
|
2487
|
+
pcb_plated_hole_id: z86.string().optional(),
|
|
2488
|
+
subcircuit_id: z86.string().optional()
|
|
2489
|
+
}).describe("Pattern for connecting a ground plane to a plated hole");
|
|
2490
|
+
expectTypesMatch(true);
|
|
2491
|
+
var cad_component = z87.object({
|
|
2492
|
+
type: z87.literal("cad_component"),
|
|
2493
|
+
cad_component_id: z87.string(),
|
|
2494
|
+
pcb_component_id: z87.string(),
|
|
2495
|
+
source_component_id: z87.string(),
|
|
2347
2496
|
position: point3,
|
|
2348
2497
|
rotation: point3.optional(),
|
|
2349
2498
|
size: point3.optional(),
|
|
2350
2499
|
layer: layer_ref.optional(),
|
|
2500
|
+
subcircuit_id: z87.string().optional(),
|
|
2351
2501
|
// These are all ways to generate/load the 3d model
|
|
2352
|
-
footprinter_string:
|
|
2353
|
-
model_obj_url:
|
|
2354
|
-
model_stl_url:
|
|
2355
|
-
model_3mf_url:
|
|
2356
|
-
model_jscad:
|
|
2502
|
+
footprinter_string: z87.string().optional(),
|
|
2503
|
+
model_obj_url: z87.string().optional(),
|
|
2504
|
+
model_stl_url: z87.string().optional(),
|
|
2505
|
+
model_3mf_url: z87.string().optional(),
|
|
2506
|
+
model_jscad: z87.any().optional()
|
|
2357
2507
|
}).describe("Defines a component on the PCB");
|
|
2358
|
-
|
|
2508
|
+
expectTypesMatch(true);
|
|
2509
|
+
var any_circuit_element = z88.union([
|
|
2359
2510
|
source_trace,
|
|
2360
2511
|
source_port,
|
|
2361
2512
|
any_source_component,
|
|
2362
|
-
source_led,
|
|
2363
2513
|
source_net,
|
|
2364
2514
|
source_group,
|
|
2365
|
-
source_simple_bug,
|
|
2366
2515
|
source_simple_chip,
|
|
2367
2516
|
source_simple_capacitor,
|
|
2368
2517
|
source_simple_diode,
|
|
@@ -2375,9 +2524,11 @@ var any_circuit_element = z83.union([
|
|
|
2375
2524
|
source_simple_resonator,
|
|
2376
2525
|
source_simple_switch,
|
|
2377
2526
|
source_simple_transistor,
|
|
2527
|
+
source_simple_test_point,
|
|
2378
2528
|
source_simple_mosfet,
|
|
2379
2529
|
source_simple_potentiometer,
|
|
2380
2530
|
source_simple_push_button,
|
|
2531
|
+
source_pcb_ground_plane,
|
|
2381
2532
|
source_project_metadata,
|
|
2382
2533
|
pcb_component,
|
|
2383
2534
|
pcb_hole,
|
|
@@ -2406,7 +2557,11 @@ var any_circuit_element = z83.union([
|
|
|
2406
2557
|
pcb_fabrication_note_path,
|
|
2407
2558
|
pcb_fabrication_note_text,
|
|
2408
2559
|
pcb_autorouting_error,
|
|
2560
|
+
pcb_breakout_point,
|
|
2409
2561
|
pcb_cutout,
|
|
2562
|
+
pcb_ground_plane,
|
|
2563
|
+
pcb_ground_plane_region,
|
|
2564
|
+
pcb_thermal_spoke,
|
|
2410
2565
|
schematic_box,
|
|
2411
2566
|
schematic_text,
|
|
2412
2567
|
schematic_line,
|
|
@@ -2415,6 +2570,7 @@ var any_circuit_element = z83.union([
|
|
|
2415
2570
|
schematic_trace,
|
|
2416
2571
|
schematic_path,
|
|
2417
2572
|
schematic_error,
|
|
2573
|
+
schematic_layout_error,
|
|
2418
2574
|
schematic_net_label,
|
|
2419
2575
|
schematic_debug_object,
|
|
2420
2576
|
schematic_voltage_probe,
|
|
@@ -2426,16 +2582,85 @@ var any_soup_element = any_circuit_element;
|
|
|
2426
2582
|
expectTypesMatch(true);
|
|
2427
2583
|
expectStringUnionsMatch(true);
|
|
2428
2584
|
|
|
2429
|
-
// node_modules/@tscircuit/
|
|
2585
|
+
// node_modules/@tscircuit/circuit-json-util/dist/index.js
|
|
2430
2586
|
import { applyToPoint, decomposeTSR } from "transformation-matrix";
|
|
2431
|
-
|
|
2432
|
-
|
|
2587
|
+
function connect(map, a, b) {
|
|
2588
|
+
if (!a || !b)
|
|
2589
|
+
return;
|
|
2590
|
+
let setA = map.get(a);
|
|
2591
|
+
if (!setA) {
|
|
2592
|
+
setA = /* @__PURE__ */ new Set();
|
|
2593
|
+
map.set(a, setA);
|
|
2594
|
+
}
|
|
2595
|
+
setA.add(b);
|
|
2596
|
+
let setB = map.get(b);
|
|
2597
|
+
if (!setB) {
|
|
2598
|
+
setB = /* @__PURE__ */ new Set();
|
|
2599
|
+
map.set(b, setB);
|
|
2600
|
+
}
|
|
2601
|
+
setB.add(a);
|
|
2602
|
+
}
|
|
2603
|
+
function buildSubtree(soup, opts) {
|
|
2604
|
+
if (!opts.subcircuit_id && !opts.source_group_id)
|
|
2605
|
+
return [...soup];
|
|
2606
|
+
const idMap = /* @__PURE__ */ new Map();
|
|
2607
|
+
for (const elm of soup) {
|
|
2608
|
+
const idVal = elm[`${elm.type}_id`];
|
|
2609
|
+
if (typeof idVal === "string") {
|
|
2610
|
+
idMap.set(idVal, elm);
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
const adj = /* @__PURE__ */ new Map();
|
|
2614
|
+
for (const elm of soup) {
|
|
2615
|
+
const entries = Object.entries(elm);
|
|
2616
|
+
for (const [key, val] of entries) {
|
|
2617
|
+
if (key.endsWith("_id") && typeof val === "string") {
|
|
2618
|
+
const other = idMap.get(val);
|
|
2619
|
+
connect(adj, elm, other);
|
|
2620
|
+
} else if (key.endsWith("_ids") && Array.isArray(val)) {
|
|
2621
|
+
for (const v of val) {
|
|
2622
|
+
if (typeof v === "string") {
|
|
2623
|
+
const other = idMap.get(v);
|
|
2624
|
+
connect(adj, elm, other);
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
const queue = [];
|
|
2631
|
+
const included = /* @__PURE__ */ new Set();
|
|
2632
|
+
for (const elm of soup) {
|
|
2633
|
+
if (opts.subcircuit_id && elm.subcircuit_id === opts.subcircuit_id || opts.source_group_id && (elm.source_group_id === opts.source_group_id || Array.isArray(elm.member_source_group_ids) && elm.member_source_group_ids.includes(
|
|
2634
|
+
opts.source_group_id
|
|
2635
|
+
))) {
|
|
2636
|
+
queue.push(elm);
|
|
2637
|
+
included.add(elm);
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
while (queue.length > 0) {
|
|
2641
|
+
const elm = queue.shift();
|
|
2642
|
+
const neighbors = adj.get(elm);
|
|
2643
|
+
if (!neighbors)
|
|
2644
|
+
continue;
|
|
2645
|
+
for (const n of neighbors) {
|
|
2646
|
+
if (!included.has(n)) {
|
|
2647
|
+
included.add(n);
|
|
2648
|
+
queue.push(n);
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
return soup.filter((e) => included.has(e));
|
|
2653
|
+
}
|
|
2654
|
+
var cju = (circuitJsonInput, options = {}) => {
|
|
2655
|
+
const circuitJson = circuitJsonInput;
|
|
2656
|
+
let internalStore = circuitJson._internal_store;
|
|
2433
2657
|
if (!internalStore) {
|
|
2434
2658
|
internalStore = {
|
|
2435
|
-
counts: {}
|
|
2659
|
+
counts: {},
|
|
2660
|
+
editCount: 0
|
|
2436
2661
|
};
|
|
2437
|
-
|
|
2438
|
-
for (const elm of
|
|
2662
|
+
circuitJson._internal_store = internalStore;
|
|
2663
|
+
for (const elm of circuitJson) {
|
|
2439
2664
|
const type = elm.type;
|
|
2440
2665
|
const idVal = elm[`${type}_id`];
|
|
2441
2666
|
if (!idVal)
|
|
@@ -2452,12 +2677,23 @@ var su = (soup, options = {}) => {
|
|
|
2452
2677
|
const su2 = new Proxy(
|
|
2453
2678
|
{},
|
|
2454
2679
|
{
|
|
2455
|
-
get: (proxy_target,
|
|
2456
|
-
if (
|
|
2457
|
-
return () =>
|
|
2680
|
+
get: (proxy_target, prop) => {
|
|
2681
|
+
if (prop === "toArray") {
|
|
2682
|
+
return () => {
|
|
2683
|
+
;
|
|
2684
|
+
circuitJson.editCount = internalStore.editCount;
|
|
2685
|
+
return circuitJson;
|
|
2686
|
+
};
|
|
2458
2687
|
}
|
|
2688
|
+
if (prop === "editCount") {
|
|
2689
|
+
return internalStore.editCount;
|
|
2690
|
+
}
|
|
2691
|
+
if (prop === "subtree") {
|
|
2692
|
+
return (opts) => cju(buildSubtree(circuitJson, opts), options);
|
|
2693
|
+
}
|
|
2694
|
+
const component_type = prop;
|
|
2459
2695
|
return {
|
|
2460
|
-
get: (id) =>
|
|
2696
|
+
get: (id) => circuitJson.find(
|
|
2461
2697
|
(e) => e.type === component_type && e[`${component_type}_id`] === id
|
|
2462
2698
|
),
|
|
2463
2699
|
getUsing: (using) => {
|
|
@@ -2469,24 +2705,24 @@ var su = (soup, options = {}) => {
|
|
|
2469
2705
|
}
|
|
2470
2706
|
const join_key = keys[0];
|
|
2471
2707
|
const join_type = join_key.replace("_id", "");
|
|
2472
|
-
const joiner =
|
|
2708
|
+
const joiner = circuitJson.find(
|
|
2473
2709
|
(e) => e.type === join_type && e[join_key] === using[join_key]
|
|
2474
2710
|
);
|
|
2475
2711
|
if (!joiner)
|
|
2476
2712
|
return null;
|
|
2477
|
-
return
|
|
2713
|
+
return circuitJson.find(
|
|
2478
2714
|
(e) => e.type === component_type && e[`${component_type}_id`] === joiner[`${component_type}_id`]
|
|
2479
2715
|
);
|
|
2480
2716
|
},
|
|
2481
2717
|
getWhere: (where) => {
|
|
2482
2718
|
const keys = Object.keys(where);
|
|
2483
|
-
return
|
|
2719
|
+
return circuitJson.find(
|
|
2484
2720
|
(e) => e.type === component_type && keys.every((key) => e[key] === where[key])
|
|
2485
2721
|
);
|
|
2486
2722
|
},
|
|
2487
2723
|
list: (where) => {
|
|
2488
2724
|
const keys = !where ? [] : Object.keys(where);
|
|
2489
|
-
return
|
|
2725
|
+
return circuitJson.filter(
|
|
2490
2726
|
(e) => e.type === component_type && keys.every((key) => e[key] === where[key])
|
|
2491
2727
|
);
|
|
2492
2728
|
},
|
|
@@ -2503,31 +2739,560 @@ var su = (soup, options = {}) => {
|
|
|
2503
2739
|
const parser = dist_exports[component_type] ?? any_soup_element;
|
|
2504
2740
|
parser.parse(newElm);
|
|
2505
2741
|
}
|
|
2506
|
-
|
|
2742
|
+
circuitJson.push(newElm);
|
|
2743
|
+
internalStore.editCount++;
|
|
2507
2744
|
return newElm;
|
|
2508
2745
|
},
|
|
2509
2746
|
delete: (id) => {
|
|
2510
|
-
const elm =
|
|
2747
|
+
const elm = circuitJson.find(
|
|
2511
2748
|
(e) => e[`${component_type}_id`] === id
|
|
2512
2749
|
);
|
|
2513
2750
|
if (!elm)
|
|
2514
2751
|
return;
|
|
2515
|
-
|
|
2752
|
+
circuitJson.splice(circuitJson.indexOf(elm), 1);
|
|
2753
|
+
internalStore.editCount++;
|
|
2516
2754
|
},
|
|
2517
2755
|
update: (id, newProps) => {
|
|
2518
|
-
const elm =
|
|
2756
|
+
const elm = circuitJson.find(
|
|
2757
|
+
(e) => e.type === component_type && e[`${component_type}_id`] === id
|
|
2758
|
+
);
|
|
2759
|
+
if (!elm)
|
|
2760
|
+
return null;
|
|
2761
|
+
Object.assign(elm, newProps);
|
|
2762
|
+
internalStore.editCount++;
|
|
2763
|
+
return elm;
|
|
2764
|
+
},
|
|
2765
|
+
select: (selector) => {
|
|
2766
|
+
if (component_type === "source_component") {
|
|
2767
|
+
return circuitJson.find(
|
|
2768
|
+
(e) => e.type === "source_component" && e.name === selector.replace(/\./g, "")
|
|
2769
|
+
);
|
|
2770
|
+
} else if (component_type === "pcb_port" || component_type === "source_port" || component_type === "schematic_port") {
|
|
2771
|
+
const [component_name, port_selector] = selector.replace(/\./g, "").split(/[\s\>]+/);
|
|
2772
|
+
const source_component = circuitJson.find(
|
|
2773
|
+
(e) => e.type === "source_component" && e.name === component_name
|
|
2774
|
+
);
|
|
2775
|
+
if (!source_component)
|
|
2776
|
+
return null;
|
|
2777
|
+
const source_port2 = circuitJson.find(
|
|
2778
|
+
(e) => e.type === "source_port" && e.source_component_id === source_component.source_component_id && (e.name === port_selector || (e.port_hints ?? []).includes(port_selector))
|
|
2779
|
+
);
|
|
2780
|
+
if (!source_port2)
|
|
2781
|
+
return null;
|
|
2782
|
+
if (component_type === "source_port")
|
|
2783
|
+
return source_port2;
|
|
2784
|
+
if (component_type === "pcb_port") {
|
|
2785
|
+
return circuitJson.find(
|
|
2786
|
+
(e) => e.type === "pcb_port" && e.source_port_id === source_port2.source_port_id
|
|
2787
|
+
);
|
|
2788
|
+
} else if (component_type === "schematic_port") {
|
|
2789
|
+
return circuitJson.find(
|
|
2790
|
+
(e) => e.type === "schematic_port" && e.source_port_id === source_port2.source_port_id
|
|
2791
|
+
);
|
|
2792
|
+
}
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
};
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
);
|
|
2799
|
+
return su2;
|
|
2800
|
+
};
|
|
2801
|
+
cju.unparsed = cju;
|
|
2802
|
+
var su = cju;
|
|
2803
|
+
function createIdKey(element) {
|
|
2804
|
+
const type = element.type;
|
|
2805
|
+
return `${type}:${element[`${type}_id`]}`;
|
|
2806
|
+
}
|
|
2807
|
+
var cjuIndexed = (soup, options = {}) => {
|
|
2808
|
+
let internalStore = soup._internal_store_indexed;
|
|
2809
|
+
if (!internalStore) {
|
|
2810
|
+
internalStore = {
|
|
2811
|
+
counts: {},
|
|
2812
|
+
editCount: 0,
|
|
2813
|
+
indexes: {}
|
|
2814
|
+
};
|
|
2815
|
+
for (const elm of soup) {
|
|
2816
|
+
const type = elm.type;
|
|
2817
|
+
const idVal = elm[`${type}_id`];
|
|
2818
|
+
if (!idVal)
|
|
2819
|
+
continue;
|
|
2820
|
+
const idNum = Number.parseInt(idVal.split("_").pop() || "");
|
|
2821
|
+
if (!Number.isNaN(idNum)) {
|
|
2822
|
+
internalStore.counts[type] = Math.max(
|
|
2823
|
+
internalStore.counts[type] ?? 0,
|
|
2824
|
+
idNum
|
|
2825
|
+
);
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
const indexConfig = options.indexConfig || {};
|
|
2829
|
+
const indexes = internalStore.indexes;
|
|
2830
|
+
if (indexConfig.byId) {
|
|
2831
|
+
indexes.byId = /* @__PURE__ */ new Map();
|
|
2832
|
+
}
|
|
2833
|
+
if (indexConfig.byType) {
|
|
2834
|
+
indexes.byType = /* @__PURE__ */ new Map();
|
|
2835
|
+
}
|
|
2836
|
+
if (indexConfig.byRelation) {
|
|
2837
|
+
indexes.byRelation = /* @__PURE__ */ new Map();
|
|
2838
|
+
}
|
|
2839
|
+
if (indexConfig.bySubcircuit) {
|
|
2840
|
+
indexes.bySubcircuit = /* @__PURE__ */ new Map();
|
|
2841
|
+
}
|
|
2842
|
+
if (indexConfig.byCustomField && indexConfig.byCustomField.length > 0) {
|
|
2843
|
+
indexes.byCustomField = /* @__PURE__ */ new Map();
|
|
2844
|
+
for (const field of indexConfig.byCustomField) {
|
|
2845
|
+
indexes.byCustomField.set(field, /* @__PURE__ */ new Map());
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
for (const element of soup) {
|
|
2849
|
+
if (indexConfig.byId) {
|
|
2850
|
+
const idKey = createIdKey(element);
|
|
2851
|
+
indexes.byId.set(idKey, element);
|
|
2852
|
+
}
|
|
2853
|
+
if (indexConfig.byType) {
|
|
2854
|
+
const elementsOfType = indexes.byType.get(element.type) || [];
|
|
2855
|
+
elementsOfType.push(element);
|
|
2856
|
+
indexes.byType.set(element.type, elementsOfType);
|
|
2857
|
+
}
|
|
2858
|
+
if (indexConfig.byRelation) {
|
|
2859
|
+
const elementEntries = Object.entries(element);
|
|
2860
|
+
for (const [key, value] of elementEntries) {
|
|
2861
|
+
if (key.endsWith("_id") && key !== `${element.type}_id` && typeof value === "string") {
|
|
2862
|
+
const relationTypeMap = indexes.byRelation.get(key) || /* @__PURE__ */ new Map();
|
|
2863
|
+
const relatedElements = relationTypeMap.get(value) || [];
|
|
2864
|
+
relatedElements.push(element);
|
|
2865
|
+
relationTypeMap.set(value, relatedElements);
|
|
2866
|
+
indexes.byRelation.set(key, relationTypeMap);
|
|
2867
|
+
}
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
if (indexConfig.bySubcircuit && "subcircuit_id" in element) {
|
|
2871
|
+
const subcircuitId = element.subcircuit_id;
|
|
2872
|
+
if (subcircuitId && typeof subcircuitId === "string") {
|
|
2873
|
+
const subcircuitElements = indexes.bySubcircuit.get(subcircuitId) || [];
|
|
2874
|
+
subcircuitElements.push(element);
|
|
2875
|
+
indexes.bySubcircuit.set(subcircuitId, subcircuitElements);
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
if (indexConfig.byCustomField && indexes.byCustomField) {
|
|
2879
|
+
for (const field of indexConfig.byCustomField) {
|
|
2880
|
+
if (field in element) {
|
|
2881
|
+
const fieldValue = element[field];
|
|
2882
|
+
if (fieldValue !== void 0 && (typeof fieldValue === "string" || typeof fieldValue === "number")) {
|
|
2883
|
+
const fieldValueStr = String(fieldValue);
|
|
2884
|
+
const fieldMap = indexes.byCustomField.get(field);
|
|
2885
|
+
const elementsWithFieldValue = fieldMap.get(fieldValueStr) || [];
|
|
2886
|
+
elementsWithFieldValue.push(element);
|
|
2887
|
+
fieldMap.set(fieldValueStr, elementsWithFieldValue);
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
;
|
|
2894
|
+
soup._internal_store_indexed = internalStore;
|
|
2895
|
+
}
|
|
2896
|
+
const suIndexed = new Proxy(
|
|
2897
|
+
{},
|
|
2898
|
+
{
|
|
2899
|
+
get: (proxy_target, prop) => {
|
|
2900
|
+
if (prop === "toArray") {
|
|
2901
|
+
return () => {
|
|
2902
|
+
;
|
|
2903
|
+
soup.editCount = internalStore.editCount;
|
|
2904
|
+
return soup;
|
|
2905
|
+
};
|
|
2906
|
+
}
|
|
2907
|
+
if (prop === "editCount") {
|
|
2908
|
+
return internalStore.editCount;
|
|
2909
|
+
}
|
|
2910
|
+
const component_type = prop;
|
|
2911
|
+
return {
|
|
2912
|
+
get: (id) => {
|
|
2913
|
+
const indexConfig = options.indexConfig || {};
|
|
2914
|
+
if (indexConfig.byId && internalStore.indexes.byId) {
|
|
2915
|
+
return internalStore.indexes.byId.get(
|
|
2916
|
+
`${component_type}:${id}`
|
|
2917
|
+
) || null;
|
|
2918
|
+
}
|
|
2919
|
+
if (indexConfig.byType && internalStore.indexes.byType) {
|
|
2920
|
+
const elementsOfType = internalStore.indexes.byType.get(component_type) || [];
|
|
2921
|
+
return elementsOfType.find(
|
|
2922
|
+
(e) => e[`${component_type}_id`] === id
|
|
2923
|
+
) || null;
|
|
2924
|
+
}
|
|
2925
|
+
return soup.find(
|
|
2519
2926
|
(e) => e.type === component_type && e[`${component_type}_id`] === id
|
|
2927
|
+
) || null;
|
|
2928
|
+
},
|
|
2929
|
+
getUsing: (using) => {
|
|
2930
|
+
const indexConfig = options.indexConfig || {};
|
|
2931
|
+
const keys = Object.keys(using);
|
|
2932
|
+
if (keys.length !== 1) {
|
|
2933
|
+
throw new Error(
|
|
2934
|
+
"getUsing requires exactly one key, e.g. { pcb_component_id }"
|
|
2935
|
+
);
|
|
2936
|
+
}
|
|
2937
|
+
const join_key = keys[0];
|
|
2938
|
+
const join_type = join_key.replace("_id", "");
|
|
2939
|
+
if (indexConfig.byRelation && internalStore.indexes.byRelation) {
|
|
2940
|
+
const relationMap = internalStore.indexes.byRelation.get(join_key);
|
|
2941
|
+
if (relationMap) {
|
|
2942
|
+
const relatedElements = relationMap.get(using[join_key]) || [];
|
|
2943
|
+
const joiner2 = relatedElements.find((e) => e.type === join_type);
|
|
2944
|
+
if (!joiner2)
|
|
2945
|
+
return null;
|
|
2946
|
+
const joinerId = joiner2[`${component_type}_id`];
|
|
2947
|
+
if (indexConfig.byId && internalStore.indexes.byId) {
|
|
2948
|
+
return internalStore.indexes.byId.get(
|
|
2949
|
+
`${component_type}:${joinerId}`
|
|
2950
|
+
) || null;
|
|
2951
|
+
}
|
|
2952
|
+
if (indexConfig.byType && internalStore.indexes.byType) {
|
|
2953
|
+
const elementsOfType = internalStore.indexes.byType.get(component_type) || [];
|
|
2954
|
+
return elementsOfType.find(
|
|
2955
|
+
(e) => e[`${component_type}_id`] === joinerId
|
|
2956
|
+
) || null;
|
|
2957
|
+
}
|
|
2958
|
+
return soup.find(
|
|
2959
|
+
(e) => e.type === component_type && e[`${component_type}_id`] === joinerId
|
|
2960
|
+
) || null;
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
const joiner = soup.find(
|
|
2964
|
+
(e) => e.type === join_type && e[join_key] === using[join_key]
|
|
2520
2965
|
);
|
|
2966
|
+
if (!joiner)
|
|
2967
|
+
return null;
|
|
2968
|
+
return soup.find(
|
|
2969
|
+
(e) => e.type === component_type && e[`${component_type}_id`] === joiner[`${component_type}_id`]
|
|
2970
|
+
) || null;
|
|
2971
|
+
},
|
|
2972
|
+
getWhere: (where) => {
|
|
2973
|
+
const indexConfig = options.indexConfig || {};
|
|
2974
|
+
const keys = Object.keys(where);
|
|
2975
|
+
if (keys.length === 1 && indexConfig.byCustomField && internalStore.indexes.byCustomField) {
|
|
2976
|
+
const field = keys[0];
|
|
2977
|
+
const fieldMap = internalStore.indexes.byCustomField.get(field);
|
|
2978
|
+
if (fieldMap) {
|
|
2979
|
+
const fieldValue = String(where[field]);
|
|
2980
|
+
const elementsWithFieldValue = fieldMap.get(fieldValue) || [];
|
|
2981
|
+
return elementsWithFieldValue.find(
|
|
2982
|
+
(e) => e.type === component_type
|
|
2983
|
+
) || null;
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
if ("subcircuit_id" in where && indexConfig.bySubcircuit && internalStore.indexes.bySubcircuit) {
|
|
2987
|
+
const subcircuitId = where.subcircuit_id;
|
|
2988
|
+
const subcircuitElements = internalStore.indexes.bySubcircuit.get(subcircuitId) || [];
|
|
2989
|
+
return subcircuitElements.find(
|
|
2990
|
+
(e) => e.type === component_type && keys.every((key) => e[key] === where[key])
|
|
2991
|
+
) || null;
|
|
2992
|
+
}
|
|
2993
|
+
if (indexConfig.byType && internalStore.indexes.byType) {
|
|
2994
|
+
const elementsOfType = internalStore.indexes.byType.get(component_type) || [];
|
|
2995
|
+
return elementsOfType.find(
|
|
2996
|
+
(e) => keys.every((key) => e[key] === where[key])
|
|
2997
|
+
) || null;
|
|
2998
|
+
}
|
|
2999
|
+
return soup.find(
|
|
3000
|
+
(e) => e.type === component_type && keys.every((key) => e[key] === where[key])
|
|
3001
|
+
) || null;
|
|
3002
|
+
},
|
|
3003
|
+
list: (where) => {
|
|
3004
|
+
const indexConfig = options.indexConfig || {};
|
|
3005
|
+
const keys = !where ? [] : Object.keys(where);
|
|
3006
|
+
if (keys.length === 0 && indexConfig.byType && internalStore.indexes.byType) {
|
|
3007
|
+
return internalStore.indexes.byType.get(component_type) || [];
|
|
3008
|
+
}
|
|
3009
|
+
if (keys.length === 1 && keys[0] === "subcircuit_id" && indexConfig.bySubcircuit && internalStore.indexes.bySubcircuit) {
|
|
3010
|
+
const subcircuitId = where.subcircuit_id;
|
|
3011
|
+
const subcircuitElements = internalStore.indexes.bySubcircuit.get(subcircuitId) || [];
|
|
3012
|
+
return subcircuitElements.filter(
|
|
3013
|
+
(e) => e.type === component_type
|
|
3014
|
+
);
|
|
3015
|
+
}
|
|
3016
|
+
let elementsToFilter;
|
|
3017
|
+
if (indexConfig.byType && internalStore.indexes.byType) {
|
|
3018
|
+
elementsToFilter = internalStore.indexes.byType.get(component_type) || [];
|
|
3019
|
+
} else {
|
|
3020
|
+
elementsToFilter = soup.filter((e) => e.type === component_type);
|
|
3021
|
+
}
|
|
3022
|
+
if (keys.length > 0) {
|
|
3023
|
+
return elementsToFilter.filter(
|
|
3024
|
+
(e) => keys.every((key) => e[key] === where[key])
|
|
3025
|
+
);
|
|
3026
|
+
}
|
|
3027
|
+
return elementsToFilter;
|
|
3028
|
+
},
|
|
3029
|
+
insert: (elm) => {
|
|
3030
|
+
internalStore.counts[component_type] ??= -1;
|
|
3031
|
+
internalStore.counts[component_type]++;
|
|
3032
|
+
const index = internalStore.counts[component_type];
|
|
3033
|
+
const newElm = {
|
|
3034
|
+
type: component_type,
|
|
3035
|
+
[`${component_type}_id`]: `${component_type}_${index}`,
|
|
3036
|
+
...elm
|
|
3037
|
+
};
|
|
3038
|
+
if (options.validateInserts) {
|
|
3039
|
+
const parser = dist_exports[component_type] ?? any_soup_element;
|
|
3040
|
+
parser.parse(newElm);
|
|
3041
|
+
}
|
|
3042
|
+
soup.push(newElm);
|
|
3043
|
+
internalStore.editCount++;
|
|
3044
|
+
const indexConfig = options.indexConfig || {};
|
|
3045
|
+
if (indexConfig.byId && internalStore.indexes.byId) {
|
|
3046
|
+
const idKey = createIdKey(newElm);
|
|
3047
|
+
internalStore.indexes.byId.set(idKey, newElm);
|
|
3048
|
+
}
|
|
3049
|
+
if (indexConfig.byType && internalStore.indexes.byType) {
|
|
3050
|
+
const elementsOfType = internalStore.indexes.byType.get(component_type) || [];
|
|
3051
|
+
elementsOfType.push(newElm);
|
|
3052
|
+
internalStore.indexes.byType.set(component_type, elementsOfType);
|
|
3053
|
+
}
|
|
3054
|
+
if (indexConfig.byRelation && internalStore.indexes.byRelation) {
|
|
3055
|
+
const elementEntries = Object.entries(newElm);
|
|
3056
|
+
for (const [key, value] of elementEntries) {
|
|
3057
|
+
if (key.endsWith("_id") && key !== `${newElm.type}_id` && typeof value === "string") {
|
|
3058
|
+
const relationTypeMap = internalStore.indexes.byRelation.get(key) || /* @__PURE__ */ new Map();
|
|
3059
|
+
const relatedElements = relationTypeMap.get(value) || [];
|
|
3060
|
+
relatedElements.push(newElm);
|
|
3061
|
+
relationTypeMap.set(value, relatedElements);
|
|
3062
|
+
internalStore.indexes.byRelation.set(key, relationTypeMap);
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
3065
|
+
}
|
|
3066
|
+
if (indexConfig.bySubcircuit && internalStore.indexes.bySubcircuit && "subcircuit_id" in newElm) {
|
|
3067
|
+
const subcircuitId = newElm.subcircuit_id;
|
|
3068
|
+
if (subcircuitId && typeof subcircuitId === "string") {
|
|
3069
|
+
const subcircuitElements = internalStore.indexes.bySubcircuit.get(subcircuitId) || [];
|
|
3070
|
+
subcircuitElements.push(newElm);
|
|
3071
|
+
internalStore.indexes.bySubcircuit.set(
|
|
3072
|
+
subcircuitId,
|
|
3073
|
+
subcircuitElements
|
|
3074
|
+
);
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
if (indexConfig.byCustomField && internalStore.indexes.byCustomField) {
|
|
3078
|
+
for (const field of indexConfig.byCustomField) {
|
|
3079
|
+
if (field in newElm) {
|
|
3080
|
+
const fieldValue = newElm[field];
|
|
3081
|
+
if (fieldValue !== void 0 && (typeof fieldValue === "string" || typeof fieldValue === "number")) {
|
|
3082
|
+
const fieldValueStr = String(fieldValue);
|
|
3083
|
+
const fieldMap = internalStore.indexes.byCustomField.get(field);
|
|
3084
|
+
const elementsWithFieldValue = fieldMap.get(fieldValueStr) || [];
|
|
3085
|
+
elementsWithFieldValue.push(newElm);
|
|
3086
|
+
fieldMap.set(fieldValueStr, elementsWithFieldValue);
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3091
|
+
return newElm;
|
|
3092
|
+
},
|
|
3093
|
+
delete: (id) => {
|
|
3094
|
+
const indexConfig = options.indexConfig || {};
|
|
3095
|
+
let elm;
|
|
3096
|
+
if (indexConfig.byId && internalStore.indexes.byId) {
|
|
3097
|
+
elm = internalStore.indexes.byId.get(`${component_type}:${id}`);
|
|
3098
|
+
} else if (indexConfig.byType && internalStore.indexes.byType) {
|
|
3099
|
+
const elementsOfType = internalStore.indexes.byType.get(component_type) || [];
|
|
3100
|
+
elm = elementsOfType.find(
|
|
3101
|
+
(e) => e[`${component_type}_id`] === id
|
|
3102
|
+
);
|
|
3103
|
+
} else {
|
|
3104
|
+
elm = soup.find((e) => e[`${component_type}_id`] === id);
|
|
3105
|
+
}
|
|
2521
3106
|
if (!elm)
|
|
2522
3107
|
return;
|
|
3108
|
+
const elmIndex = soup.indexOf(elm);
|
|
3109
|
+
if (elmIndex >= 0) {
|
|
3110
|
+
soup.splice(elmIndex, 1);
|
|
3111
|
+
internalStore.editCount++;
|
|
3112
|
+
}
|
|
3113
|
+
if (indexConfig.byId && internalStore.indexes.byId) {
|
|
3114
|
+
const idKey = createIdKey(elm);
|
|
3115
|
+
internalStore.indexes.byId.delete(idKey);
|
|
3116
|
+
}
|
|
3117
|
+
if (indexConfig.byType && internalStore.indexes.byType) {
|
|
3118
|
+
const elementsOfType = internalStore.indexes.byType.get(component_type) || [];
|
|
3119
|
+
const filteredElements = elementsOfType.filter(
|
|
3120
|
+
(e) => e[`${component_type}_id`] !== id
|
|
3121
|
+
);
|
|
3122
|
+
internalStore.indexes.byType.set(component_type, filteredElements);
|
|
3123
|
+
}
|
|
3124
|
+
if (indexConfig.byRelation && internalStore.indexes.byRelation) {
|
|
3125
|
+
for (const [
|
|
3126
|
+
relationKey,
|
|
3127
|
+
relationMap
|
|
3128
|
+
] of internalStore.indexes.byRelation.entries()) {
|
|
3129
|
+
for (const [relationValue, elements] of relationMap.entries()) {
|
|
3130
|
+
const updatedElements = elements.filter((e) => e !== elm);
|
|
3131
|
+
if (updatedElements.length === 0) {
|
|
3132
|
+
relationMap.delete(relationValue);
|
|
3133
|
+
} else {
|
|
3134
|
+
relationMap.set(relationValue, updatedElements);
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
if (indexConfig.bySubcircuit && internalStore.indexes.bySubcircuit && "subcircuit_id" in elm) {
|
|
3140
|
+
const subcircuitId = elm.subcircuit_id;
|
|
3141
|
+
if (subcircuitId) {
|
|
3142
|
+
const subcircuitElements = internalStore.indexes.bySubcircuit.get(subcircuitId) || [];
|
|
3143
|
+
const updatedElements = subcircuitElements.filter(
|
|
3144
|
+
(e) => e !== elm
|
|
3145
|
+
);
|
|
3146
|
+
if (updatedElements.length === 0) {
|
|
3147
|
+
internalStore.indexes.bySubcircuit.delete(subcircuitId);
|
|
3148
|
+
} else {
|
|
3149
|
+
internalStore.indexes.bySubcircuit.set(
|
|
3150
|
+
subcircuitId,
|
|
3151
|
+
updatedElements
|
|
3152
|
+
);
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
if (indexConfig.byCustomField && internalStore.indexes.byCustomField) {
|
|
3157
|
+
for (const fieldMap of internalStore.indexes.byCustomField.values()) {
|
|
3158
|
+
for (const [fieldValue, elements] of fieldMap.entries()) {
|
|
3159
|
+
const updatedElements = elements.filter((e) => e !== elm);
|
|
3160
|
+
if (updatedElements.length === 0) {
|
|
3161
|
+
fieldMap.delete(fieldValue);
|
|
3162
|
+
} else {
|
|
3163
|
+
fieldMap.set(fieldValue, updatedElements);
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
},
|
|
3169
|
+
update: (id, newProps) => {
|
|
3170
|
+
const indexConfig = options.indexConfig || {};
|
|
3171
|
+
let elm;
|
|
3172
|
+
if (indexConfig.byId && internalStore.indexes.byId) {
|
|
3173
|
+
elm = internalStore.indexes.byId.get(`${component_type}:${id}`);
|
|
3174
|
+
} else if (indexConfig.byType && internalStore.indexes.byType) {
|
|
3175
|
+
const elementsOfType = internalStore.indexes.byType.get(component_type) || [];
|
|
3176
|
+
elm = elementsOfType.find(
|
|
3177
|
+
(e) => e[`${component_type}_id`] === id
|
|
3178
|
+
);
|
|
3179
|
+
} else {
|
|
3180
|
+
elm = soup.find(
|
|
3181
|
+
(e) => e.type === component_type && e[`${component_type}_id`] === id
|
|
3182
|
+
);
|
|
3183
|
+
}
|
|
3184
|
+
if (!elm)
|
|
3185
|
+
return null;
|
|
3186
|
+
if (indexConfig.byRelation && internalStore.indexes.byRelation) {
|
|
3187
|
+
const elementEntries = Object.entries(elm);
|
|
3188
|
+
for (const [key, value] of elementEntries) {
|
|
3189
|
+
if (key.endsWith("_id") && key !== `${elm.type}_id` && typeof value === "string") {
|
|
3190
|
+
if (key in newProps && newProps[key] !== value) {
|
|
3191
|
+
const relationTypeMap = internalStore.indexes.byRelation.get(key);
|
|
3192
|
+
if (relationTypeMap) {
|
|
3193
|
+
const relatedElements = relationTypeMap.get(value) || [];
|
|
3194
|
+
const updatedElements = relatedElements.filter(
|
|
3195
|
+
(e) => e !== elm
|
|
3196
|
+
);
|
|
3197
|
+
if (updatedElements.length === 0) {
|
|
3198
|
+
relationTypeMap.delete(value);
|
|
3199
|
+
} else {
|
|
3200
|
+
relationTypeMap.set(value, updatedElements);
|
|
3201
|
+
}
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
if (indexConfig.bySubcircuit && internalStore.indexes.bySubcircuit && "subcircuit_id" in elm && "subcircuit_id" in newProps) {
|
|
3208
|
+
const oldSubcircuitId = elm.subcircuit_id;
|
|
3209
|
+
const newSubcircuitId = newProps.subcircuit_id;
|
|
3210
|
+
if (oldSubcircuitId !== newSubcircuitId) {
|
|
3211
|
+
const subcircuitElements = internalStore.indexes.bySubcircuit.get(oldSubcircuitId) || [];
|
|
3212
|
+
const updatedElements = subcircuitElements.filter(
|
|
3213
|
+
(e) => e !== elm
|
|
3214
|
+
);
|
|
3215
|
+
if (updatedElements.length === 0) {
|
|
3216
|
+
internalStore.indexes.bySubcircuit.delete(oldSubcircuitId);
|
|
3217
|
+
} else {
|
|
3218
|
+
internalStore.indexes.bySubcircuit.set(
|
|
3219
|
+
oldSubcircuitId,
|
|
3220
|
+
updatedElements
|
|
3221
|
+
);
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
if (indexConfig.byCustomField && internalStore.indexes.byCustomField) {
|
|
3226
|
+
for (const field of indexConfig.byCustomField) {
|
|
3227
|
+
if (field in elm && field in newProps && elm[field] !== newProps[field]) {
|
|
3228
|
+
const fieldMap = internalStore.indexes.byCustomField.get(field);
|
|
3229
|
+
if (fieldMap) {
|
|
3230
|
+
const oldValue = String(elm[field]);
|
|
3231
|
+
const elements = fieldMap.get(oldValue) || [];
|
|
3232
|
+
const updatedElements = elements.filter((e) => e !== elm);
|
|
3233
|
+
if (updatedElements.length === 0) {
|
|
3234
|
+
fieldMap.delete(oldValue);
|
|
3235
|
+
} else {
|
|
3236
|
+
fieldMap.set(oldValue, updatedElements);
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
}
|
|
2523
3242
|
Object.assign(elm, newProps);
|
|
3243
|
+
internalStore.editCount++;
|
|
3244
|
+
if (indexConfig.byRelation && internalStore.indexes.byRelation) {
|
|
3245
|
+
const elementEntries = Object.entries(elm);
|
|
3246
|
+
for (const [key, value] of elementEntries) {
|
|
3247
|
+
if (key.endsWith("_id") && key !== `${elm.type}_id` && typeof value === "string") {
|
|
3248
|
+
if (key in newProps) {
|
|
3249
|
+
const relationTypeMap = internalStore.indexes.byRelation.get(key) || /* @__PURE__ */ new Map();
|
|
3250
|
+
const relatedElements = relationTypeMap.get(value) || [];
|
|
3251
|
+
if (!relatedElements.includes(elm)) {
|
|
3252
|
+
relatedElements.push(elm);
|
|
3253
|
+
relationTypeMap.set(value, relatedElements);
|
|
3254
|
+
internalStore.indexes.byRelation.set(key, relationTypeMap);
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
}
|
|
3259
|
+
}
|
|
3260
|
+
if (indexConfig.bySubcircuit && internalStore.indexes.bySubcircuit && "subcircuit_id" in elm && "subcircuit_id" in newProps) {
|
|
3261
|
+
const subcircuitId = elm.subcircuit_id;
|
|
3262
|
+
if (subcircuitId && typeof subcircuitId === "string") {
|
|
3263
|
+
const subcircuitElements = internalStore.indexes.bySubcircuit.get(subcircuitId) || [];
|
|
3264
|
+
if (!subcircuitElements.includes(elm)) {
|
|
3265
|
+
subcircuitElements.push(elm);
|
|
3266
|
+
internalStore.indexes.bySubcircuit.set(
|
|
3267
|
+
subcircuitId,
|
|
3268
|
+
subcircuitElements
|
|
3269
|
+
);
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
if (indexConfig.byCustomField && internalStore.indexes.byCustomField) {
|
|
3274
|
+
for (const field of indexConfig.byCustomField) {
|
|
3275
|
+
if (field in elm && field in newProps) {
|
|
3276
|
+
const fieldValue = elm[field];
|
|
3277
|
+
if (fieldValue !== void 0 && (typeof fieldValue === "string" || typeof fieldValue === "number")) {
|
|
3278
|
+
const fieldValueStr = String(fieldValue);
|
|
3279
|
+
const fieldMap = internalStore.indexes.byCustomField.get(field);
|
|
3280
|
+
const elementsWithFieldValue = fieldMap.get(fieldValueStr) || [];
|
|
3281
|
+
if (!elementsWithFieldValue.includes(elm)) {
|
|
3282
|
+
elementsWithFieldValue.push(elm);
|
|
3283
|
+
fieldMap.set(fieldValueStr, elementsWithFieldValue);
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
2524
3289
|
return elm;
|
|
2525
3290
|
},
|
|
2526
3291
|
select: (selector) => {
|
|
2527
3292
|
if (component_type === "source_component") {
|
|
2528
3293
|
return soup.find(
|
|
2529
3294
|
(e) => e.type === "source_component" && e.name === selector.replace(/\./g, "")
|
|
2530
|
-
);
|
|
3295
|
+
) || null;
|
|
2531
3296
|
} else if (component_type === "pcb_port" || component_type === "source_port" || component_type === "schematic_port") {
|
|
2532
3297
|
const [component_name, port_selector] = selector.replace(/\./g, "").split(/[\s\>]+/);
|
|
2533
3298
|
const source_component = soup.find(
|
|
@@ -2545,25 +3310,28 @@ var su = (soup, options = {}) => {
|
|
|
2545
3310
|
if (component_type === "pcb_port") {
|
|
2546
3311
|
return soup.find(
|
|
2547
3312
|
(e) => e.type === "pcb_port" && e.source_port_id === source_port2.source_port_id
|
|
2548
|
-
);
|
|
3313
|
+
) || null;
|
|
2549
3314
|
} else if (component_type === "schematic_port") {
|
|
2550
3315
|
return soup.find(
|
|
2551
3316
|
(e) => e.type === "schematic_port" && e.source_port_id === source_port2.source_port_id
|
|
2552
|
-
);
|
|
3317
|
+
) || null;
|
|
2553
3318
|
}
|
|
2554
3319
|
}
|
|
3320
|
+
return null;
|
|
2555
3321
|
}
|
|
2556
3322
|
};
|
|
2557
3323
|
}
|
|
2558
3324
|
}
|
|
2559
3325
|
);
|
|
2560
|
-
return
|
|
3326
|
+
return suIndexed;
|
|
2561
3327
|
};
|
|
2562
|
-
|
|
2563
|
-
var su_default = su;
|
|
3328
|
+
cjuIndexed.unparsed = cjuIndexed;
|
|
2564
3329
|
var transformPCBElement = (elm, matrix) => {
|
|
2565
3330
|
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
|
|
2566
|
-
const { x, y } = applyToPoint(matrix, {
|
|
3331
|
+
const { x, y } = applyToPoint(matrix, {
|
|
3332
|
+
x: Number(elm.x),
|
|
3333
|
+
y: Number(elm.y)
|
|
3334
|
+
});
|
|
2567
3335
|
elm.x = x;
|
|
2568
3336
|
elm.y = y;
|
|
2569
3337
|
} else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
|
|
@@ -2794,12 +3562,12 @@ var findBoundsAndCenter = (elements) => {
|
|
|
2794
3562
|
// lib/websafe/generate-footprint-tsx.ts
|
|
2795
3563
|
import { mmStr } from "@tscircuit/mm";
|
|
2796
3564
|
var generateFootprintTsx = (circuitJson) => {
|
|
2797
|
-
const holes =
|
|
2798
|
-
const platedHoles =
|
|
2799
|
-
const smtPads =
|
|
2800
|
-
const vias =
|
|
2801
|
-
const silkscreenPaths =
|
|
2802
|
-
const silkscreenTexts =
|
|
3565
|
+
const holes = su(circuitJson).pcb_hole.list();
|
|
3566
|
+
const platedHoles = su(circuitJson).pcb_plated_hole.list();
|
|
3567
|
+
const smtPads = su(circuitJson).pcb_smtpad.list();
|
|
3568
|
+
const vias = su(circuitJson).pcb_via.list();
|
|
3569
|
+
const silkscreenPaths = su(circuitJson).pcb_silkscreen_path.list();
|
|
3570
|
+
const silkscreenTexts = su(circuitJson).pcb_silkscreen_text.list();
|
|
2803
3571
|
const elementStrings = [];
|
|
2804
3572
|
for (const hole of holes) {
|
|
2805
3573
|
if (hole.hole_shape === "circle") {
|
|
@@ -2948,17 +3716,12 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
2948
3716
|
|
|
2949
3717
|
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
2950
3718
|
import { compose, scale, translate, applyToPoint as applyToPoint2 } from "transformation-matrix";
|
|
2951
|
-
|
|
2952
|
-
// lib/compute-center-offset.ts
|
|
2953
|
-
import { mm as mm2 } from "@tscircuit/mm";
|
|
2954
|
-
|
|
2955
|
-
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
2956
|
-
import { mm as mm3 } from "@tscircuit/mm";
|
|
3719
|
+
import { mm } from "@tscircuit/mm";
|
|
2957
3720
|
import { normalizePinLabels } from "@tscircuit/core";
|
|
2958
3721
|
var mil2mm = (mil) => {
|
|
2959
|
-
if (typeof mil === "number") return
|
|
2960
|
-
if (mil.match(/^\d+$/)) return
|
|
2961
|
-
return
|
|
3722
|
+
if (typeof mil === "number") return mm(`${mil}mil`);
|
|
3723
|
+
if (mil.match(/^\d+$/)) return mm(`${mil}mil`);
|
|
3724
|
+
return mm(mil);
|
|
2962
3725
|
};
|
|
2963
3726
|
var milx10 = (mil10) => {
|
|
2964
3727
|
if (typeof mil10 === "number") return mil2mm(mil10) * 10;
|
|
@@ -3049,14 +3812,14 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
3049
3812
|
type: "source_component",
|
|
3050
3813
|
source_component_id: "source_component_1",
|
|
3051
3814
|
name: "U1",
|
|
3052
|
-
ftype: "
|
|
3815
|
+
ftype: "simple_chip"
|
|
3053
3816
|
});
|
|
3054
3817
|
const pcb_component2 = pcb_component.parse({
|
|
3055
3818
|
type: "pcb_component",
|
|
3056
3819
|
pcb_component_id: "pcb_component_1",
|
|
3057
3820
|
source_component_id: "source_component_1",
|
|
3058
3821
|
name: "U1",
|
|
3059
|
-
ftype: "
|
|
3822
|
+
ftype: "simple_chip",
|
|
3060
3823
|
width: 0,
|
|
3061
3824
|
// we update this at the end
|
|
3062
3825
|
height: 0,
|
|
@@ -3282,7 +4045,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
3282
4045
|
});
|
|
3283
4046
|
const rawPn = betterEasy.dataStr.head.c_para["Manufacturer Part"];
|
|
3284
4047
|
const pn = rawPn ? normalizeManufacturerPartNumber(rawPn) : "unknown";
|
|
3285
|
-
const sourcePorts =
|
|
4048
|
+
const sourcePorts = su(circuitJson).source_port.list();
|
|
3286
4049
|
const pinLabels = {};
|
|
3287
4050
|
const sortedPorts = sourcePorts.sort((a, b) => {
|
|
3288
4051
|
const aNum = Number.parseInt(a.name.replace("pin", ""));
|
|
@@ -3295,7 +4058,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
3295
4058
|
...sourcePort.port_hints ?? []
|
|
3296
4059
|
];
|
|
3297
4060
|
}
|
|
3298
|
-
const [cadComponent] =
|
|
4061
|
+
const [cadComponent] = su(circuitJson).cad_component.list();
|
|
3299
4062
|
let modelObjUrl;
|
|
3300
4063
|
if (cadComponent?.model_obj_url) {
|
|
3301
4064
|
const isValidUrl = await checkModelObjUrlValidity(
|