@modular-circuit/transpiler 0.0.75 → 0.0.76

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.
@@ -87,7 +87,9 @@ export function do_convert_graph_to_kicad_project(ctx) {
87
87
  case 1:
88
88
  sheets = (_e.sent()).sheets;
89
89
  netlist = new GraphConverter(__assign({}, ctx)).convert_to_netlist();
90
- converted_sheets = new NetListConverter(__assign(__assign({}, ctx), { netlist: netlist })).convert_to_kicad();
90
+ return [4 /*yield*/, new NetListConverter(__assign(__assign({}, ctx), { netlist: netlist })).convert_to_kicad()];
91
+ case 2:
92
+ converted_sheets = _e.sent();
91
93
  sexpr_printer = new SCHEMATIC_PRINTER();
92
94
  try {
93
95
  for (_a = __values(Object.entries(converted_sheets)), _b = _a.next(); !_b.done; _b = _a.next()) {
@@ -1,5 +1,5 @@
1
1
  import type { VECTOR2 } from '@modular-circuit/electronics-model';
2
2
  export declare const calc_boxes_pos: (boxes: {
3
3
  [id: string]: VECTOR2;
4
- }) => Record<string, VECTOR2>;
4
+ }) => Promise<Record<string, VECTOR2>>;
5
5
  //# sourceMappingURL=calc_boxes_pos.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"calc_boxes_pos.d.ts","sourceRoot":"","sources":["../../../src/converter/netlist_to_kicad/calc_boxes_pos.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAKjE,eAAO,MAAM,cAAc,GAAI,OAAO;IACpC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;CACtB,4BAqCA,CAAA"}
1
+ {"version":3,"file":"calc_boxes_pos.d.ts","sourceRoot":"","sources":["../../../src/converter/netlist_to_kicad/calc_boxes_pos.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAMjE,eAAO,MAAM,cAAc,GAAU,OAAO;IAC1C,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;CACtB,qCAsCA,CAAA"}
@@ -1,3 +1,39 @@
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
+ };
1
37
  var __values = (this && this.__values) || function(o) {
2
38
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
39
  if (m) return m.call(o);
@@ -9,52 +45,59 @@ var __values = (this && this.__values) || function(o) {
9
45
  };
10
46
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
47
  };
12
- import Yoga from 'yoga-layout';
48
+ // @ts-expect-error
49
+ import { loadYoga } from 'yoga-layout/load';
13
50
  import { DEFAULT_PAPER_SIZE } from '../../utils';
14
51
  import { GRID_SIZE } from './layout';
15
- export var calc_boxes_pos = function (boxes) {
52
+ export var calc_boxes_pos = function (boxes) { return __awaiter(void 0, void 0, void 0, function () {
53
+ var Yoga, node, idList, idList_1, idList_1_1, id, box, child, width, height, result, i, id, child;
16
54
  var e_1, _a;
17
- var node = Yoga.Node.create();
18
- node.setAlignContent(Yoga.ALIGN_CENTER);
19
- node.setWidth(DEFAULT_PAPER_SIZE.width / GRID_SIZE);
20
- node.setHeight(DEFAULT_PAPER_SIZE.height / GRID_SIZE);
21
- node.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
22
- node.setJustifyContent(Yoga.JUSTIFY_CENTER);
23
- node.setPadding(Yoga.EDGE_ALL, 1);
24
- var idList = Object.keys(boxes);
25
- try {
26
- for (var idList_1 = __values(idList), idList_1_1 = idList_1.next(); !idList_1_1.done; idList_1_1 = idList_1.next()) {
27
- var id = idList_1_1.value;
28
- var box = boxes[id];
29
- var child = Yoga.Node.create();
30
- // Use box.x and box.y as width and height (assuming VECTOR2 is { x, y })
31
- var width = box.x / GRID_SIZE;
32
- var height = box.y / GRID_SIZE;
33
- child.setWidth(width);
34
- child.setHeight(height);
35
- child.setMargin(Yoga.EDGE_ALL, 2);
36
- node.insertChild(child, node.getChildCount());
37
- }
38
- }
39
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
40
- finally {
41
- try {
42
- if (idList_1_1 && !idList_1_1.done && (_a = idList_1.return)) _a.call(idList_1);
55
+ return __generator(this, function (_b) {
56
+ switch (_b.label) {
57
+ case 0: return [4 /*yield*/, loadYoga()];
58
+ case 1:
59
+ Yoga = _b.sent();
60
+ node = Yoga.Node.create();
61
+ node.setAlignContent(Yoga.ALIGN_CENTER);
62
+ node.setWidth(DEFAULT_PAPER_SIZE.width / GRID_SIZE);
63
+ node.setHeight(DEFAULT_PAPER_SIZE.height / GRID_SIZE);
64
+ node.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
65
+ node.setJustifyContent(Yoga.JUSTIFY_CENTER);
66
+ node.setPadding(Yoga.EDGE_ALL, 1);
67
+ idList = Object.keys(boxes);
68
+ try {
69
+ for (idList_1 = __values(idList), idList_1_1 = idList_1.next(); !idList_1_1.done; idList_1_1 = idList_1.next()) {
70
+ id = idList_1_1.value;
71
+ box = boxes[id];
72
+ child = Yoga.Node.create();
73
+ width = box.x / GRID_SIZE;
74
+ height = box.y / GRID_SIZE;
75
+ child.setWidth(width);
76
+ child.setHeight(height);
77
+ child.setMargin(Yoga.EDGE_ALL, 2);
78
+ node.insertChild(child, node.getChildCount());
79
+ }
80
+ }
81
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
82
+ finally {
83
+ try {
84
+ if (idList_1_1 && !idList_1_1.done && (_a = idList_1.return)) _a.call(idList_1);
85
+ }
86
+ finally { if (e_1) throw e_1.error; }
87
+ }
88
+ node.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR);
89
+ result = {};
90
+ for (i = 0; i < idList.length; i++) {
91
+ id = idList[i];
92
+ child = node.getChild(i);
93
+ result[id] = {
94
+ x: child.getComputedLeft() * GRID_SIZE,
95
+ y: child.getComputedTop() * GRID_SIZE,
96
+ };
97
+ child.free();
98
+ }
99
+ node.free();
100
+ return [2 /*return*/, result];
43
101
  }
44
- finally { if (e_1) throw e_1.error; }
45
- }
46
- node.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR);
47
- // Map layout result by id
48
- var result = {};
49
- for (var i = 0; i < idList.length; i++) {
50
- var id = idList[i];
51
- var child = node.getChild(i);
52
- result[id] = {
53
- x: child.getComputedLeft() * GRID_SIZE,
54
- y: child.getComputedTop() * GRID_SIZE,
55
- };
56
- child.free();
57
- }
58
- node.free();
59
- return result;
60
- };
102
+ });
103
+ }); };
@@ -9,7 +9,7 @@ export declare class NetListConverter {
9
9
  constructor(ctx: NetlistToKicadContext);
10
10
  pin_is_connected(id: string): boolean;
11
11
  get_pin_net_name(id: string): string;
12
- convert_to_kicad(): Record<string, SCHEMATIC>;
12
+ convert_to_kicad(): Promise<Record<string, SCHEMATIC>>;
13
13
  /**
14
14
  * Convert a schematic to a kicad schematic
15
15
  * @param name The name of the graph ,also the file name of the converted schematic
@@ -1 +1 @@
1
- {"version":3,"file":"netlist_converter.d.ts","sourceRoot":"","sources":["../../../src/converter/netlist_to_kicad/netlist_converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,SAAS,EAGf,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AAMtD,qBAAa,gBAAgB;IASR,OAAO,CAAC,GAAG;IAR9B,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO,CAAC,eAAe,CAAI;IAE3B,OAAO,CAAC,QAAQ,CAA6B;IAE7C,OAAO,CAAC,KAAK,CAAiB;gBAEH,GAAG,EAAE,qBAAqB;IAQrD,gBAAgB,CAAC,EAAE,EAAE,MAAM;IAI3B,gBAAgB,CAAC,EAAE,EAAE,MAAM;IAIpB,gBAAgB;IAavB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAqFnB,OAAO,CAAC,0BAA0B;IAalC,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,2BAA2B;IA8CnC,OAAO,CAAC,oBAAoB;IAqC5B,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,iBAAiB;CAQ1B"}
1
+ {"version":3,"file":"netlist_converter.d.ts","sourceRoot":"","sources":["../../../src/converter/netlist_to_kicad/netlist_converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,SAAS,EAGf,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AAMtD,qBAAa,gBAAgB;IASR,OAAO,CAAC,GAAG;IAR9B,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO,CAAC,eAAe,CAAI;IAE3B,OAAO,CAAC,QAAQ,CAA6B;IAE7C,OAAO,CAAC,KAAK,CAAiB;gBAEH,GAAG,EAAE,qBAAqB;IAQrD,gBAAgB,CAAC,EAAE,EAAE,MAAM;IAI3B,gBAAgB,CAAC,EAAE,EAAE,MAAM;IAId,gBAAgB;IAa7B;;;;;;OAMG;YACW,WAAW;IAqFzB,OAAO,CAAC,0BAA0B;IAalC,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,2BAA2B;IA8CnC,OAAO,CAAC,oBAAoB;IAqC5B,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,iBAAiB;CAQ1B"}
@@ -1,3 +1,39 @@
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
+ };
1
37
  var __values = (this && this.__values) || function(o) {
2
38
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
39
  if (m) return m.call(o);
@@ -75,25 +111,48 @@ var NetListConverter = /** @class */ (function () {
75
111
  return this.net_name[id];
76
112
  };
77
113
  NetListConverter.prototype.convert_to_kicad = function () {
78
- var e_3, _a;
79
- var all_sch = {};
80
- try {
81
- for (var _b = __values(Object.entries(this.ctx.netlist.schematics)), _c = _b.next(); !_c.done; _c = _b.next()) {
82
- var _d = __read(_c.value, 2), k = _d[0], v = _d[1];
83
- this.sheet_pwr_count = 0;
84
- this.block_calc = new Layout();
85
- this.wires = [];
86
- all_sch[k] = this.convert_sch(k, v);
87
- }
88
- }
89
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
90
- finally {
91
- try {
92
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
93
- }
94
- finally { if (e_3) throw e_3.error; }
95
- }
96
- return all_sch;
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
+ });
97
156
  };
98
157
  /**
99
158
  * Convert a schematic to a kicad schematic
@@ -103,112 +162,122 @@ var NetListConverter = /** @class */ (function () {
103
162
  * @returns
104
163
  */
105
164
  NetListConverter.prototype.convert_sch = function (name, schematic) {
106
- var e_4, _a, e_5, _b, e_6, _c, e_7, _d;
107
- var _e, _f;
108
- var powers = new Set();
109
- var sch = {
110
- version: SCH_VERSION,
111
- generator: GENERATOR_NAME,
112
- generator_version: GENERATOR_VERSION,
113
- paper: {
114
- size: 'A4',
115
- },
116
- title_block: {
117
- title: name.replace(".".concat(MODULAR_CIRCUIT_SCH_EXT), ''),
118
- date: replaceAll(new Date().toISOString().slice(0, 10), '-', '/'),
119
- rev: '1.0',
120
- comment: {
121
- 1: 'https://www.eda.cn',
122
- 2: this.ctx.project.author,
123
- 3: this.ctx.project.name,
124
- },
125
- },
126
- lib_symbols: {
127
- symbols: [],
128
- },
129
- uuid: schematic.uuid,
130
- symbols: [],
131
- labels: [],
132
- sheets: [],
133
- };
134
- try {
135
- for (var _g = __values(schematic.powers), _h = _g.next(); !_h.done; _h = _g.next()) {
136
- var it_2 = _h.value;
137
- if (!powers.has(it_2.value)) {
138
- switch (it_2.shape) {
139
- case PowerShape.VCC:
140
- (_e = sch.lib_symbols) === null || _e === void 0 ? void 0 : _e.symbols.push(gen_lib_vcc(it_2.value));
141
- break;
142
- case PowerShape.GND:
143
- (_f = sch.lib_symbols) === null || _f === void 0 ? void 0 : _f.symbols.push(gen_lib_gnd(it_2.value));
144
- break;
145
- }
146
- powers.add(it_2.value);
147
- this.convert_pwr_symbol(it_2, get_power_pos(this.sheet_pwr_count++), sch);
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];
148
278
  }
149
- }
150
- }
151
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
152
- finally {
153
- try {
154
- if (_h && !_h.done && (_a = _g.return)) _a.call(_g);
155
- }
156
- finally { if (e_4) throw e_4.error; }
157
- }
158
- var sheet_names_count = new Map();
159
- var ordered_sheets = schematic.sheet_symbols.sort(function (a, b) {
160
- return b.pins.length - a.pins.length;
279
+ });
161
280
  });
162
- var sheet_bounding_boxes = {};
163
- var sheet_size = {};
164
- try {
165
- for (var 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()) {
166
- var it_3 = ordered_sheets_1_1.value;
167
- var sheet_padding = this.get_sheet_symbol_lb_padding(it_3);
168
- var block_geo = this.block_calc.get_block_geometry(sheet_padding);
169
- sheet_bounding_boxes[it_3.uuid] = block_geo.bounding_box.size;
170
- sheet_size[it_3.uuid] = block_geo.box.size;
171
- }
172
- }
173
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
174
- finally {
175
- try {
176
- if (ordered_sheets_1_1 && !ordered_sheets_1_1.done && (_b = ordered_sheets_1.return)) _b.call(ordered_sheets_1);
177
- }
178
- finally { if (e_5) throw e_5.error; }
179
- }
180
- var sheet_pos = calc_boxes_pos(sheet_bounding_boxes);
181
- try {
182
- for (var 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()) {
183
- var it_4 = ordered_sheets_2_1.value;
184
- this.convert_sheet_symbol(it_4, {
185
- pos: sheet_pos[it_4.uuid],
186
- size: sheet_size[it_4.uuid],
187
- }, sch, sheet_names_count);
188
- }
189
- }
190
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
191
- finally {
192
- try {
193
- if (ordered_sheets_2_1 && !ordered_sheets_2_1.done && (_c = ordered_sheets_2.return)) _c.call(ordered_sheets_2);
194
- }
195
- finally { if (e_6) throw e_6.error; }
196
- }
197
- try {
198
- for (var _j = __values(schematic.hiera_labels), _k = _j.next(); !_k.done; _k = _j.next()) {
199
- var it_5 = _k.value;
200
- this.convert_hierarchical_label(it_5, sch);
201
- }
202
- }
203
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
204
- finally {
205
- try {
206
- if (_k && !_k.done && (_d = _j.return)) _d.call(_j);
207
- }
208
- finally { if (e_7) throw e_7.error; }
209
- }
210
- sch.wires = this.wires;
211
- return sch;
212
281
  };
213
282
  NetListConverter.prototype.convert_hierarchical_label = function (pin, sch) {
214
283
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-circuit/transpiler",
3
- "version": "0.0.75",
3
+ "version": "0.0.76",
4
4
  "description": "Intermediate representation of the modular circuit",
5
5
  "main": "./build/index.js",
6
6
  "files": [
@@ -28,9 +28,9 @@
28
28
  "jszip": "^3.10.1",
29
29
  "yoga-layout": "^3.2.1",
30
30
  "@modular-circuit/electronics-model": "0.0.51",
31
- "@modular-circuit/ir": "0.0.58",
31
+ "@modular-circuit/perc": "0.0.58",
32
32
  "@modular-circuit/utils": "0.0.37",
33
- "@modular-circuit/perc": "0.0.58"
33
+ "@modular-circuit/ir": "0.0.58"
34
34
  },
35
35
  "scripts": {
36
36
  "clean": "rimraf build",