@modular-circuit/transpiler 0.0.77 → 0.0.79

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.
Files changed (34) hide show
  1. package/build/builder/graph_to_kicad/do_convert_graph_to_kicad_project.js +108 -19
  2. package/build/builder/graph_to_kicad/index.js +59 -4
  3. package/build/converter/graph_to_netlist/graph_converter.js +171 -51
  4. package/build/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.js +1 -1
  5. package/build/converter/kicad_sexpr/eeschema/printer.js +290 -245
  6. package/build/converter/link_to_netlist/converter.js +135 -77
  7. package/build/converter/link_to_netlist/links/converter_base.js +131 -38
  8. package/build/converter/link_to_netlist/links/converters.js +554 -316
  9. package/build/converter/netlist_to_kicad/calc_boxes_pos.d.ts +1 -1
  10. package/build/converter/netlist_to_kicad/calc_boxes_pos.d.ts.map +1 -1
  11. package/build/converter/netlist_to_kicad/calc_boxes_pos.js +115 -36
  12. package/build/converter/netlist_to_kicad/layout.js +32 -28
  13. package/build/converter/netlist_to_kicad/netlist_converter.d.ts +1 -1
  14. package/build/converter/netlist_to_kicad/netlist_converter.d.ts.map +1 -1
  15. package/build/converter/netlist_to_kicad/netlist_converter.js +300 -128
  16. package/build/kicad/constraints/index.js +1 -1
  17. package/build/kicad/label/net_label.js +2 -2
  18. package/build/kicad/label/sheet_pin.js +19 -11
  19. package/build/kicad/project/kicad_prl.js +3 -3
  20. package/build/kicad/project/kicad_pro.js +4 -4
  21. package/build/kicad/project/kicad_project_achieve.js +45 -31
  22. package/build/kicad/project/wildcards_and_files_ext.js +61 -61
  23. package/build/kicad/sheet/sheet.js +3 -3
  24. package/build/kicad/symbols/lib_symbol/gnd.js +6 -6
  25. package/build/kicad/symbols/lib_symbol/vcc.js +7 -7
  26. package/build/kicad/symbols/sch_symbol/gnd.js +9 -9
  27. package/build/kicad/symbols/sch_symbol/vcc.js +9 -9
  28. package/build/kicad/symbols/symbol_utils.js +1 -1
  29. package/build/kicad/wire/gen_wire.js +4 -4
  30. package/build/utils/collect_sub_sheets.js +151 -37
  31. package/build/utils/constraints.js +6 -6
  32. package/build/utils/filter_null_undefined.js +31 -2
  33. package/build/utils/string_formatter.js +29 -23
  34. package/package.json +5 -5
@@ -1,3 +1,66 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ var __values = (this && this.__values) || function(o) {
38
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
39
+ if (m) return m.call(o);
40
+ if (o && typeof o.length === "number") return {
41
+ next: function () {
42
+ if (o && i >= o.length) o = void 0;
43
+ return { value: o && o[i++], done: !o };
44
+ }
45
+ };
46
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
47
+ };
48
+ var __read = (this && this.__read) || function (o, n) {
49
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
50
+ if (!m) return o;
51
+ var i = m.call(o), r, ar = [], e;
52
+ try {
53
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
54
+ }
55
+ catch (error) { e = { error: error }; }
56
+ finally {
57
+ try {
58
+ if (r && !r.done && (m = i["return"])) m.call(i);
59
+ }
60
+ finally { if (e) throw e.error; }
61
+ }
62
+ return ar;
63
+ };
1
64
  import { PowerShape } from '@modular-circuit/electronics-model';
2
65
  import { MODULAR_CIRCUIT_SCH_EXT, } from '@modular-circuit/ir';
3
66
  import { replaceAll } from '@modular-circuit/utils';
@@ -8,36 +71,89 @@ import { GENERATOR_NAME, GENERATOR_VERSION, SCH_VERSION } from '../../utils/cons
8
71
  import { BLOCK_PIN_GAP, FONT_SIZE, Layout, WIRE_PADDING, get_power_pos } from './layout';
9
72
  import { gen_wire } from '../../kicad/wire/gen_wire';
10
73
  import { calc_boxes_pos } from './calc_boxes_pos';
11
- export class NetListConverter {
12
- ctx;
13
- block_calc;
14
- sheet_pwr_count = 0;
15
- net_name = {};
16
- wires = [];
17
- constructor(ctx) {
74
+ var NetListConverter = /** @class */ (function () {
75
+ function NetListConverter(ctx) {
76
+ var e_1, _a, e_2, _b;
18
77
  this.ctx = ctx;
19
- for (const net of this.ctx.netlist.nets) {
20
- for (const it of net.pins) {
21
- this.net_name[it] = net.name;
78
+ this.sheet_pwr_count = 0;
79
+ this.net_name = {};
80
+ this.wires = [];
81
+ try {
82
+ for (var _c = __values(this.ctx.netlist.nets), _d = _c.next(); !_d.done; _d = _c.next()) {
83
+ var net = _d.value;
84
+ try {
85
+ for (var _e = (e_2 = void 0, __values(net.pins)), _f = _e.next(); !_f.done; _f = _e.next()) {
86
+ var it_1 = _f.value;
87
+ this.net_name[it_1] = net.name;
88
+ }
89
+ }
90
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
91
+ finally {
92
+ try {
93
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
94
+ }
95
+ finally { if (e_2) throw e_2.error; }
96
+ }
22
97
  }
23
98
  }
99
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
100
+ finally {
101
+ try {
102
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
103
+ }
104
+ finally { if (e_1) throw e_1.error; }
105
+ }
24
106
  }
25
- pin_is_connected(id) {
107
+ NetListConverter.prototype.pin_is_connected = function (id) {
26
108
  return this.net_name[id] !== undefined;
27
- }
28
- get_pin_net_name(id) {
109
+ };
110
+ NetListConverter.prototype.get_pin_net_name = function (id) {
29
111
  return this.net_name[id];
30
- }
31
- convert_to_kicad() {
32
- const all_sch = {};
33
- for (const [k, v] of Object.entries(this.ctx.netlist.schematics)) {
34
- this.sheet_pwr_count = 0;
35
- this.block_calc = new Layout();
36
- this.wires = [];
37
- all_sch[k] = this.convert_sch(k, v);
38
- }
39
- return all_sch;
40
- }
112
+ };
113
+ NetListConverter.prototype.convert_to_kicad = function () {
114
+ return __awaiter(this, void 0, void 0, function () {
115
+ var all_sch, _a, _b, _c, k, v, _d, _e, e_3_1;
116
+ var e_3, _f;
117
+ return __generator(this, function (_g) {
118
+ switch (_g.label) {
119
+ case 0:
120
+ all_sch = {};
121
+ _g.label = 1;
122
+ case 1:
123
+ _g.trys.push([1, 6, 7, 8]);
124
+ _a = __values(Object.entries(this.ctx.netlist.schematics)), _b = _a.next();
125
+ _g.label = 2;
126
+ case 2:
127
+ if (!!_b.done) return [3 /*break*/, 5];
128
+ _c = __read(_b.value, 2), k = _c[0], v = _c[1];
129
+ this.sheet_pwr_count = 0;
130
+ this.block_calc = new Layout();
131
+ this.wires = [];
132
+ _d = all_sch;
133
+ _e = k;
134
+ return [4 /*yield*/, this.convert_sch(k, v)];
135
+ case 3:
136
+ _d[_e] = _g.sent();
137
+ _g.label = 4;
138
+ case 4:
139
+ _b = _a.next();
140
+ return [3 /*break*/, 2];
141
+ case 5: return [3 /*break*/, 8];
142
+ case 6:
143
+ e_3_1 = _g.sent();
144
+ e_3 = { error: e_3_1 };
145
+ return [3 /*break*/, 8];
146
+ case 7:
147
+ try {
148
+ if (_b && !_b.done && (_f = _a.return)) _f.call(_a);
149
+ }
150
+ finally { if (e_3) throw e_3.error; }
151
+ return [7 /*endfinally*/];
152
+ case 8: return [2 /*return*/, all_sch];
153
+ }
154
+ });
155
+ });
156
+ };
41
157
  /**
42
158
  * Convert a schematic to a kicad schematic
43
159
  * @param name The name of the graph ,also the file name of the converted schematic
@@ -45,92 +161,145 @@ export class NetListConverter {
45
161
  * no need to handle them before the other types of label are introduced, e.g. global or hierarchical
46
162
  * @returns
47
163
  */
48
- convert_sch(name, schematic) {
49
- const powers = new Set();
50
- const sch = {
51
- version: SCH_VERSION,
52
- generator: GENERATOR_NAME,
53
- generator_version: GENERATOR_VERSION,
54
- paper: {
55
- size: 'A4',
56
- },
57
- title_block: {
58
- title: name.replace(`.${MODULAR_CIRCUIT_SCH_EXT}`, ''),
59
- date: replaceAll(new Date().toISOString().slice(0, 10), '-', '/'),
60
- rev: '1.0',
61
- comment: {
62
- 1: 'https://www.eda.cn',
63
- 2: this.ctx.project.author,
64
- 3: this.ctx.project.name,
65
- },
66
- },
67
- lib_symbols: {
68
- symbols: [],
69
- },
70
- uuid: schematic.uuid,
71
- symbols: [],
72
- labels: [],
73
- sheets: [],
74
- };
75
- for (const it of schematic.powers) {
76
- if (!powers.has(it.value)) {
77
- switch (it.shape) {
78
- case PowerShape.VCC:
79
- sch.lib_symbols?.symbols.push(gen_lib_vcc(it.value));
80
- break;
81
- case PowerShape.GND:
82
- sch.lib_symbols?.symbols.push(gen_lib_gnd(it.value));
83
- break;
164
+ NetListConverter.prototype.convert_sch = function (name, schematic) {
165
+ return __awaiter(this, void 0, void 0, function () {
166
+ var powers, sch, _a, _b, it_2, sheet_names_count, ordered_sheets, sheet_bounding_boxes, sheet_size, ordered_sheets_1, ordered_sheets_1_1, it_3, sheet_padding, block_geo, sheet_pos, ordered_sheets_2, ordered_sheets_2_1, it_4, _c, _d, it_5;
167
+ var e_4, _e, e_5, _f, e_6, _g, e_7, _h;
168
+ var _j, _k;
169
+ return __generator(this, function (_l) {
170
+ switch (_l.label) {
171
+ case 0:
172
+ powers = new Set();
173
+ sch = {
174
+ version: SCH_VERSION,
175
+ generator: GENERATOR_NAME,
176
+ generator_version: GENERATOR_VERSION,
177
+ paper: {
178
+ size: 'A4',
179
+ },
180
+ title_block: {
181
+ title: name.replace(".".concat(MODULAR_CIRCUIT_SCH_EXT), ''),
182
+ date: replaceAll(new Date().toISOString().slice(0, 10), '-', '/'),
183
+ rev: '1.0',
184
+ comment: {
185
+ 1: 'https://www.eda.cn',
186
+ 2: this.ctx.project.author,
187
+ 3: this.ctx.project.name,
188
+ },
189
+ },
190
+ lib_symbols: {
191
+ symbols: [],
192
+ },
193
+ uuid: schematic.uuid,
194
+ symbols: [],
195
+ labels: [],
196
+ sheets: [],
197
+ };
198
+ try {
199
+ for (_a = __values(schematic.powers), _b = _a.next(); !_b.done; _b = _a.next()) {
200
+ it_2 = _b.value;
201
+ if (!powers.has(it_2.value)) {
202
+ switch (it_2.shape) {
203
+ case PowerShape.VCC:
204
+ (_j = sch.lib_symbols) === null || _j === void 0 ? void 0 : _j.symbols.push(gen_lib_vcc(it_2.value));
205
+ break;
206
+ case PowerShape.GND:
207
+ (_k = sch.lib_symbols) === null || _k === void 0 ? void 0 : _k.symbols.push(gen_lib_gnd(it_2.value));
208
+ break;
209
+ }
210
+ powers.add(it_2.value);
211
+ this.convert_pwr_symbol(it_2, get_power_pos(this.sheet_pwr_count++), sch);
212
+ }
213
+ }
214
+ }
215
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
216
+ finally {
217
+ try {
218
+ if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
219
+ }
220
+ finally { if (e_4) throw e_4.error; }
221
+ }
222
+ sheet_names_count = new Map();
223
+ ordered_sheets = schematic.sheet_symbols.sort(function (a, b) {
224
+ return b.pins.length - a.pins.length;
225
+ });
226
+ sheet_bounding_boxes = {};
227
+ sheet_size = {};
228
+ try {
229
+ for (ordered_sheets_1 = __values(ordered_sheets), ordered_sheets_1_1 = ordered_sheets_1.next(); !ordered_sheets_1_1.done; ordered_sheets_1_1 = ordered_sheets_1.next()) {
230
+ it_3 = ordered_sheets_1_1.value;
231
+ sheet_padding = this.get_sheet_symbol_lb_padding(it_3);
232
+ block_geo = this.block_calc.get_block_geometry(sheet_padding);
233
+ sheet_bounding_boxes[it_3.uuid] = block_geo.bounding_box.size;
234
+ sheet_size[it_3.uuid] = block_geo.box.size;
235
+ }
236
+ }
237
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
238
+ finally {
239
+ try {
240
+ if (ordered_sheets_1_1 && !ordered_sheets_1_1.done && (_f = ordered_sheets_1.return)) _f.call(ordered_sheets_1);
241
+ }
242
+ finally { if (e_5) throw e_5.error; }
243
+ }
244
+ return [4 /*yield*/, calc_boxes_pos(sheet_bounding_boxes)];
245
+ case 1:
246
+ sheet_pos = _l.sent();
247
+ try {
248
+ for (ordered_sheets_2 = __values(ordered_sheets), ordered_sheets_2_1 = ordered_sheets_2.next(); !ordered_sheets_2_1.done; ordered_sheets_2_1 = ordered_sheets_2.next()) {
249
+ it_4 = ordered_sheets_2_1.value;
250
+ this.convert_sheet_symbol(it_4, {
251
+ pos: sheet_pos[it_4.uuid],
252
+ size: sheet_size[it_4.uuid],
253
+ }, sch, sheet_names_count);
254
+ }
255
+ }
256
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
257
+ finally {
258
+ try {
259
+ if (ordered_sheets_2_1 && !ordered_sheets_2_1.done && (_g = ordered_sheets_2.return)) _g.call(ordered_sheets_2);
260
+ }
261
+ finally { if (e_6) throw e_6.error; }
262
+ }
263
+ try {
264
+ for (_c = __values(schematic.hiera_labels), _d = _c.next(); !_d.done; _d = _c.next()) {
265
+ it_5 = _d.value;
266
+ this.convert_hierarchical_label(it_5, sch);
267
+ }
268
+ }
269
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
270
+ finally {
271
+ try {
272
+ if (_d && !_d.done && (_h = _c.return)) _h.call(_c);
273
+ }
274
+ finally { if (e_7) throw e_7.error; }
275
+ }
276
+ sch.wires = this.wires;
277
+ return [2 /*return*/, sch];
84
278
  }
85
- powers.add(it.value);
86
- this.convert_pwr_symbol(it, get_power_pos(this.sheet_pwr_count++), sch);
87
- }
88
- }
89
- const sheet_names_count = new Map();
90
- const ordered_sheets = schematic.sheet_symbols.sort((a, b) => {
91
- return b.pins.length - a.pins.length;
279
+ });
92
280
  });
93
- const sheet_bounding_boxes = {};
94
- const sheet_size = {};
95
- for (const it of ordered_sheets) {
96
- const sheet_padding = this.get_sheet_symbol_lb_padding(it);
97
- const block_geo = this.block_calc.get_block_geometry(sheet_padding);
98
- sheet_bounding_boxes[it.uuid] = block_geo.bounding_box.size;
99
- sheet_size[it.uuid] = block_geo.box.size;
100
- }
101
- const sheet_pos = calc_boxes_pos(sheet_bounding_boxes);
102
- for (const it of ordered_sheets) {
103
- this.convert_sheet_symbol(it, {
104
- pos: sheet_pos[it.uuid],
105
- size: sheet_size[it.uuid],
106
- }, sch, sheet_names_count);
107
- }
108
- for (const it of schematic.hiera_labels) {
109
- this.convert_hierarchical_label(it, sch);
110
- }
111
- sch.wires = this.wires;
112
- return sch;
113
- }
114
- convert_hierarchical_label(pin, sch) {
281
+ };
282
+ NetListConverter.prototype.convert_hierarchical_label = function (pin, sch) {
283
+ var _a;
115
284
  // FIXME: layout them in the Yoga layout
116
- const pin_pos = this.block_calc.get_block_geometry({
285
+ var pin_pos = this.block_calc.get_block_geometry({
117
286
  internal: { l_side: 0, r_side: 0 },
118
287
  outer: { l_side: 0, r_side: 0 },
119
288
  total_pin_num: 1,
120
289
  }).box.pos;
121
- sch.labels?.push(gen_hierarchical_label(pin.name, pin_pos, { horizontal: 'left', vertical: 'bottom' }, 0, pin.shape));
122
- }
123
- convert_pwr_symbol(pwr, at, sch) {
290
+ (_a = sch.labels) === null || _a === void 0 ? void 0 : _a.push(gen_hierarchical_label(pin.name, pin_pos, { horizontal: 'left', vertical: 'bottom' }, 0, pin.shape));
291
+ };
292
+ NetListConverter.prototype.convert_pwr_symbol = function (pwr, at, sch) {
124
293
  // NOTE : The power uuid is used as the uuid of its pin ,cause all power symbols have only one pin
125
- const pin_id = pwr.uuid;
126
- const sch_pwr_symbol = pwr.shape === PowerShape.VCC
294
+ var pin_id = pwr.uuid;
295
+ var sch_pwr_symbol = pwr.shape === PowerShape.VCC
127
296
  ? gen_sch_vcc(pwr.value, this.sheet_pwr_count, pin_id, at)
128
297
  : gen_sch_gnd(pwr.value, this.sheet_pwr_count, pin_id, at);
129
298
  sch.symbols.push(sch_pwr_symbol);
130
299
  this.convert_net_label(pwr.value, at, sch);
131
- }
132
- get_sheet_symbol_lb_padding(sheet_sym) {
133
- const factor = {
300
+ };
301
+ NetListConverter.prototype.get_sheet_symbol_lb_padding = function (sheet_sym) {
302
+ var factor = {
134
303
  internal: {
135
304
  l_side: 0,
136
305
  r_side: 0,
@@ -141,10 +310,10 @@ export class NetListConverter {
141
310
  },
142
311
  total_pin_num: sheet_sym.pins.length,
143
312
  };
144
- const port_count = sheet_sym.pins.length;
145
- for (let i = 0; i < port_count; i++) {
146
- const is_left = i < port_count / 2;
147
- const cur_pin = sheet_sym.pins[i];
313
+ var port_count = sheet_sym.pins.length;
314
+ for (var i = 0; i < port_count; i++) {
315
+ var is_left = i < port_count / 2;
316
+ var cur_pin = sheet_sym.pins[i];
148
317
  if (is_left) {
149
318
  factor.internal.l_side = Math.max(factor.internal.l_side, cur_pin.name.length);
150
319
  }
@@ -152,7 +321,7 @@ export class NetListConverter {
152
321
  factor.internal.r_side = Math.max(factor.internal.r_side, cur_pin.name.length);
153
322
  }
154
323
  if (this.pin_is_connected(cur_pin.uuid)) {
155
- const net_name = this.get_pin_net_name(cur_pin.uuid);
324
+ var net_name = this.get_pin_net_name(cur_pin.uuid);
156
325
  if (is_left) {
157
326
  factor.outer.l_side = Math.max(factor.outer.l_side, net_name.length);
158
327
  }
@@ -172,22 +341,22 @@ export class NetListConverter {
172
341
  },
173
342
  total_pin_num: sheet_sym.pins.length,
174
343
  };
175
- }
176
- convert_sheet_symbol(sheet_sym, rect, sch, sheet_names_count) {
177
- const port_count = sheet_sym.pins.length;
178
- const pins = [];
179
- for (let i = 0; i < port_count; i++) {
180
- const is_left = i < port_count / 2;
181
- const x = is_left ? rect.pos.x : rect.pos.x + rect.size.x;
182
- const y = rect.pos.y + BLOCK_PIN_GAP * ((i < port_count / 2 ? i : i - port_count / 2) + 1);
183
- const justify = is_left ? 'left' : 'right';
184
- const rotation = is_left ? 180 : 0;
185
- pins.push(this.convert_sheet_pin(sheet_sym.pins[i], { x, y }, sch, justify, rotation, is_left));
344
+ };
345
+ NetListConverter.prototype.convert_sheet_symbol = function (sheet_sym, rect, sch, sheet_names_count) {
346
+ var port_count = sheet_sym.pins.length;
347
+ var pins = [];
348
+ for (var i = 0; i < port_count; i++) {
349
+ var is_left = i < port_count / 2;
350
+ var x = is_left ? rect.pos.x : rect.pos.x + rect.size.x;
351
+ var y = rect.pos.y + BLOCK_PIN_GAP * ((i < port_count / 2 ? i : i - port_count / 2) + 1);
352
+ var justify = is_left ? 'left' : 'right';
353
+ var rotation = is_left ? 180 : 0;
354
+ pins.push(this.convert_sheet_pin(sheet_sym.pins[i], { x: x, y: y }, sch, justify, rotation, is_left));
186
355
  }
187
- let sheet_name = sheet_sym.sheet_name;
356
+ var sheet_name = sheet_sym.sheet_name;
188
357
  if (sheet_names_count.has(sheet_name)) {
189
- const count = sheet_names_count.get(sheet_name);
190
- sheet_name += `_${count}`;
358
+ var count = sheet_names_count.get(sheet_name);
359
+ sheet_name += "_".concat(count);
191
360
  sheet_names_count.set(sheet_name, count + 1);
192
361
  }
193
362
  else {
@@ -197,24 +366,27 @@ export class NetListConverter {
197
366
  Sheetfile: sheet_sym.sheet_file_name,
198
367
  Sheetname: sheet_name,
199
368
  }));
200
- }
201
- convert_sheet_pin(pin, pin_pos, sch, horizontal, rotation, is_left) {
369
+ };
370
+ NetListConverter.prototype.convert_sheet_pin = function (pin, pin_pos, sch, horizontal, rotation, is_left) {
202
371
  if (this.pin_is_connected(pin.uuid)) {
203
- const nt_name = this.get_pin_net_name(pin.uuid);
372
+ var nt_name = this.get_pin_net_name(pin.uuid);
204
373
  this.convert_net_label(nt_name, {
205
374
  x: pin_pos.x + (is_left ? -WIRE_PADDING : WIRE_PADDING),
206
375
  y: pin_pos.y,
207
376
  }, sch, horizontal === 'left' ? 'right' : 'left');
208
- const lb_txt_len = nt_name.length * FONT_SIZE;
209
- const wire_padding = lb_txt_len + 2 * WIRE_PADDING;
377
+ var lb_txt_len = nt_name.length * FONT_SIZE;
378
+ var wire_padding = lb_txt_len + 2 * WIRE_PADDING;
210
379
  this.wires.push(gen_wire(pin_pos, {
211
380
  x: pin_pos.x + (is_left ? -wire_padding : wire_padding),
212
381
  y: pin_pos.y,
213
382
  }));
214
383
  }
215
- return gen_sheet_pin(pin.name, pin_pos, { horizontal, vertical: 'bottom' }, rotation, pin.shape);
216
- }
217
- convert_net_label(net_name, pin_pos, sch, horizontal = 'right') {
218
- sch.labels.push(gen_net_label(net_name, pin_pos, { horizontal, vertical: 'bottom' }));
219
- }
220
- }
384
+ return gen_sheet_pin(pin.name, pin_pos, { horizontal: horizontal, vertical: 'bottom' }, rotation, pin.shape);
385
+ };
386
+ NetListConverter.prototype.convert_net_label = function (net_name, pin_pos, sch, horizontal) {
387
+ if (horizontal === void 0) { horizontal = 'right'; }
388
+ sch.labels.push(gen_net_label(net_name, pin_pos, { horizontal: horizontal, vertical: 'bottom' }));
389
+ };
390
+ return NetListConverter;
391
+ }());
392
+ export { NetListConverter };
@@ -1,4 +1,4 @@
1
- export const DEFAULT_FONT_SIZE = {
1
+ export var DEFAULT_FONT_SIZE = {
2
2
  x: 1.27,
3
3
  y: 1.27,
4
4
  };
@@ -1,6 +1,6 @@
1
1
  import { gen_uuid } from '@modular-circuit/utils';
2
2
  import { DEFAULT_FONT_SIZE } from '../constraints';
3
- export const gen_net_label = (name, at, justify) => ({
3
+ export var gen_net_label = function (name, at, justify) { return ({
4
4
  label_type: 'label',
5
5
  text: name,
6
6
  fields: [],
@@ -11,4 +11,4 @@ export const gen_net_label = (name, at, justify) => ({
11
11
  justify: justify,
12
12
  },
13
13
  uuid: gen_uuid(),
14
- });
14
+ }); };
@@ -1,17 +1,25 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import { gen_uuid } from '@modular-circuit/utils';
2
13
  import { DEFAULT_FONT_SIZE } from '../constraints';
3
- const gen_base_hierarchical_label = (text, at, justify, rotation, shape) => ({
4
- shape,
14
+ var gen_base_hierarchical_label = function (text, at, justify, rotation, shape) { return ({
15
+ shape: shape,
5
16
  effects: {
6
17
  font: { size: DEFAULT_FONT_SIZE },
7
- justify,
18
+ justify: justify,
8
19
  },
9
- text,
10
- at: { position: at, rotation },
20
+ text: text,
21
+ at: { position: at, rotation: rotation },
11
22
  uuid: gen_uuid(),
12
- });
13
- export const gen_sheet_pin = (text, at, justify, rotation, shape) => ({
14
- label_type: 'hierarchical_label',
15
- ...gen_base_hierarchical_label(text, at, justify, rotation, shape),
16
- });
17
- export const gen_hierarchical_label = gen_sheet_pin;
23
+ }); };
24
+ export var gen_sheet_pin = function (text, at, justify, rotation, shape) { return (__assign({ label_type: 'hierarchical_label' }, gen_base_hierarchical_label(text, at, justify, rotation, shape))); };
25
+ export var gen_hierarchical_label = gen_sheet_pin;
@@ -1,4 +1,4 @@
1
- export const kicad_prl = (prj_name) => ({
1
+ export var kicad_prl = function (prj_name) { return ({
2
2
  board: {
3
3
  active_layer: 0,
4
4
  active_layer_preset: '',
@@ -41,10 +41,10 @@ export const kicad_prl = (prj_name) => ({
41
41
  ssh_key: '',
42
42
  },
43
43
  meta: {
44
- filename: `${prj_name}.kicad_prl`,
44
+ filename: "".concat(prj_name, ".kicad_prl"),
45
45
  version: 3,
46
46
  },
47
47
  project: {
48
48
  files: [],
49
49
  },
50
- });
50
+ }); };
@@ -1,5 +1,5 @@
1
1
  import { DrawingSheetFileExtension } from './wildcards_and_files_ext';
2
- export const kicad_pro = (project_name) => ({
2
+ export var kicad_pro = function (project_name) { return ({
3
3
  board: {
4
4
  '3dviewports': [],
5
5
  ipc2581: {
@@ -76,7 +76,7 @@ export const kicad_pro = (project_name) => ({
76
76
  pinned_symbol_libs: [],
77
77
  },
78
78
  meta: {
79
- filename: `${project_name}.kicad_pro`,
79
+ filename: "".concat(project_name, ".kicad_pro"),
80
80
  version: 1,
81
81
  },
82
82
  net_settings: {
@@ -208,7 +208,7 @@ export const kicad_pro = (project_name) => ({
208
208
  version: 1,
209
209
  },
210
210
  net_format_name: '',
211
- page_layout_descr_file: `${project_name}.${DrawingSheetFileExtension}`,
211
+ page_layout_descr_file: "".concat(project_name, ".").concat(DrawingSheetFileExtension),
212
212
  plot_directory: '',
213
213
  spice_current_sheet_as_root: false,
214
214
  spice_external_command: 'spice "%I"',
@@ -221,4 +221,4 @@ export const kicad_pro = (project_name) => ({
221
221
  },
222
222
  sheets: [],
223
223
  text_variables: {},
224
- });
224
+ }); };