@modular-circuit/transpiler 0.0.82 → 0.0.85

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.
@@ -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;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
+ {"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;IA6FzB,OAAO,CAAC,0BAA0B;IAalC,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,2BAA2B;IA8CnC,OAAO,CAAC,oBAAoB;IAqC5B,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,iBAAiB;CAQ1B"}
@@ -67,10 +67,10 @@ import { replaceAll } from '@modular-circuit/utils';
67
67
  import { gen_hierarchical_label, gen_net_label, gen_sheet_pin } from '../../kicad/label';
68
68
  import { gen_sch_sheet } from '../../kicad/sheet';
69
69
  import { gen_lib_gnd, gen_lib_vcc, gen_sch_gnd, gen_sch_vcc } from '../../kicad/symbols';
70
- import { GENERATOR_NAME, GENERATOR_VERSION, SCH_VERSION } from '../../utils/constraints';
71
- import { BLOCK_PIN_GAP, FONT_SIZE, Layout, WIRE_PADDING, get_power_pos } from './layout';
70
+ import { DEFAULT_PAPER_SIZE, GENERATOR_NAME, GENERATOR_VERSION, SCH_VERSION } from '../../utils/constraints';
71
+ import { BLOCK_PIN_GAP, FONT_SIZE, GRID_SIZE, Layout, WIRE_PADDING, get_power_pos } from './layout';
72
72
  import { gen_wire } from '../../kicad/wire/gen_wire';
73
- import { calc_boxes_pos } from './calc_boxes_pos';
73
+ import { place_blocks } from './place_blocks';
74
74
  var NetListConverter = /** @class */ (function () {
75
75
  function NetListConverter(ctx) {
76
76
  var e_1, _a, e_2, _b;
@@ -163,119 +163,121 @@ var NetListConverter = /** @class */ (function () {
163
163
  */
164
164
  NetListConverter.prototype.convert_sch = function (name, schematic) {
165
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;
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, scaled_pos, _c, _d, it_5;
167
167
  var e_4, _e, e_5, _f, e_6, _g, e_7, _h;
168
168
  var _j, _k;
169
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);
170
+ powers = new Set();
171
+ sch = {
172
+ version: SCH_VERSION,
173
+ generator: GENERATOR_NAME,
174
+ generator_version: GENERATOR_VERSION,
175
+ paper: {
176
+ size: 'A4',
177
+ },
178
+ title_block: {
179
+ title: name.replace(".".concat(MODULAR_CIRCUIT_SCH_EXT), ''),
180
+ date: replaceAll(new Date().toISOString().slice(0, 10), '-', '/'),
181
+ rev: '1.0',
182
+ comment: {
183
+ 1: 'https://www.eda.cn',
184
+ 2: this.ctx.project.author,
185
+ 3: this.ctx.project.name,
186
+ },
187
+ },
188
+ lib_symbols: {
189
+ symbols: [],
190
+ },
191
+ uuid: schematic.uuid,
192
+ symbols: [],
193
+ labels: [],
194
+ sheets: [],
195
+ };
196
+ try {
197
+ for (_a = __values(schematic.powers), _b = _a.next(); !_b.done; _b = _a.next()) {
198
+ it_2 = _b.value;
199
+ if (!powers.has(it_2.value)) {
200
+ switch (it_2.shape) {
201
+ case PowerShape.VCC:
202
+ (_j = sch.lib_symbols) === null || _j === void 0 ? void 0 : _j.symbols.push(gen_lib_vcc(it_2.value));
203
+ break;
204
+ case PowerShape.GND:
205
+ (_k = sch.lib_symbols) === null || _k === void 0 ? void 0 : _k.symbols.push(gen_lib_gnd(it_2.value));
206
+ break;
273
207
  }
274
- finally { if (e_7) throw e_7.error; }
208
+ powers.add(it_2.value);
209
+ this.convert_pwr_symbol(it_2, get_power_pos(this.sheet_pwr_count++), sch);
275
210
  }
276
- sch.wires = this.wires;
277
- return [2 /*return*/, sch];
211
+ }
212
+ }
213
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
214
+ finally {
215
+ try {
216
+ if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
217
+ }
218
+ finally { if (e_4) throw e_4.error; }
219
+ }
220
+ sheet_names_count = new Map();
221
+ ordered_sheets = schematic.sheet_symbols.sort(function (a, b) {
222
+ return b.pins.length - a.pins.length;
223
+ });
224
+ sheet_bounding_boxes = {};
225
+ sheet_size = {};
226
+ try {
227
+ 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()) {
228
+ it_3 = ordered_sheets_1_1.value;
229
+ sheet_padding = this.get_sheet_symbol_lb_padding(it_3);
230
+ block_geo = this.block_calc.get_block_geometry(sheet_padding);
231
+ sheet_bounding_boxes[it_3.uuid] = {
232
+ x: block_geo.box.size.x / GRID_SIZE,
233
+ y: block_geo.box.size.y / GRID_SIZE,
234
+ };
235
+ sheet_size[it_3.uuid] = block_geo.box.size;
236
+ }
237
+ }
238
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
239
+ finally {
240
+ try {
241
+ if (ordered_sheets_1_1 && !ordered_sheets_1_1.done && (_f = ordered_sheets_1.return)) _f.call(ordered_sheets_1);
242
+ }
243
+ finally { if (e_5) throw e_5.error; }
244
+ }
245
+ sheet_pos = place_blocks(sheet_bounding_boxes, 1, DEFAULT_PAPER_SIZE.width / GRID_SIZE);
246
+ try {
247
+ 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()) {
248
+ it_4 = ordered_sheets_2_1.value;
249
+ scaled_pos = sheet_pos[it_4.uuid];
250
+ this.convert_sheet_symbol(it_4, {
251
+ pos: {
252
+ x: scaled_pos.x * GRID_SIZE,
253
+ y: scaled_pos.y * GRID_SIZE,
254
+ },
255
+ size: sheet_size[it_4.uuid],
256
+ }, sch, sheet_names_count);
257
+ }
258
+ }
259
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
260
+ finally {
261
+ try {
262
+ if (ordered_sheets_2_1 && !ordered_sheets_2_1.done && (_g = ordered_sheets_2.return)) _g.call(ordered_sheets_2);
263
+ }
264
+ finally { if (e_6) throw e_6.error; }
265
+ }
266
+ try {
267
+ for (_c = __values(schematic.hiera_labels), _d = _c.next(); !_d.done; _d = _c.next()) {
268
+ it_5 = _d.value;
269
+ this.convert_hierarchical_label(it_5, sch);
270
+ }
271
+ }
272
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
273
+ finally {
274
+ try {
275
+ if (_d && !_d.done && (_h = _c.return)) _h.call(_c);
276
+ }
277
+ finally { if (e_7) throw e_7.error; }
278
278
  }
279
+ sch.wires = this.wires;
280
+ return [2 /*return*/, sch];
279
281
  });
280
282
  });
281
283
  };
@@ -0,0 +1,6 @@
1
+ export type VECTOR2 = {
2
+ x: number;
3
+ y: number;
4
+ };
5
+ export declare const place_blocks: (boxes: Record<string, VECTOR2>, margin: number, maxRowWidth: number) => Record<string, VECTOR2>;
6
+ //# sourceMappingURL=place_blocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"place_blocks.d.ts","sourceRoot":"","sources":["../../../src/converter/netlist_to_kicad/place_blocks.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE9C,eAAO,MAAM,YAAY,GACvB,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,QAAQ,MAAM,EACd,aAAa,MAAM,KAClB,MAAM,CAAC,MAAM,EAAE,OAAO,CAyBxB,CAAA"}
@@ -0,0 +1,59 @@
1
+ var __values = (this && this.__values) || function(o) {
2
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
+ if (m) return m.call(o);
4
+ if (o && typeof o.length === "number") return {
5
+ next: function () {
6
+ if (o && i >= o.length) o = void 0;
7
+ return { value: o && o[i++], done: !o };
8
+ }
9
+ };
10
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
+ };
12
+ var __read = (this && this.__read) || function (o, n) {
13
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
14
+ if (!m) return o;
15
+ var i = m.call(o), r, ar = [], e;
16
+ try {
17
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
18
+ }
19
+ catch (error) { e = { error: error }; }
20
+ finally {
21
+ try {
22
+ if (r && !r.done && (m = i["return"])) m.call(i);
23
+ }
24
+ finally { if (e) throw e.error; }
25
+ }
26
+ return ar;
27
+ };
28
+ export var place_blocks = function (boxes, margin, maxRowWidth // constraint on row width
29
+ ) {
30
+ var e_1, _a;
31
+ var placed = {};
32
+ var cursorX = margin;
33
+ var cursorY = margin;
34
+ var rowHeight = 0;
35
+ try {
36
+ for (var _b = __values(Object.entries(boxes)), _c = _b.next(); !_c.done; _c = _b.next()) {
37
+ var _d = __read(_c.value, 2), id = _d[0], size = _d[1];
38
+ var w = size.x;
39
+ var h = size.y;
40
+ // wrap if exceeding row width
41
+ if (cursorX + w + margin > maxRowWidth) {
42
+ cursorX = margin;
43
+ cursorY += rowHeight + margin;
44
+ rowHeight = 0;
45
+ }
46
+ placed[id] = { x: cursorX, y: cursorY };
47
+ cursorX += w + margin;
48
+ rowHeight = Math.max(rowHeight, h);
49
+ }
50
+ }
51
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
52
+ finally {
53
+ try {
54
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
55
+ }
56
+ finally { if (e_1) throw e_1.error; }
57
+ }
58
+ return placed;
59
+ };
@@ -1 +1 @@
1
- {"root":["../src/index.ts","../src/builder/index.ts","../src/builder/graph_to_kicad/do_convert_graph_to_kicad_project.ts","../src/builder/graph_to_kicad/index.ts","../src/converter/index.ts","../src/converter/graph_to_netlist/context.ts","../src/converter/graph_to_netlist/graph_converter.ts","../src/converter/graph_to_netlist/index.ts","../src/converter/kicad_sexpr/index.ts","../src/converter/kicad_sexpr/eeschema/index.ts","../src/converter/kicad_sexpr/eeschema/printer.ts","../src/converter/kicad_sexpr/eeschema/drawing_sheet/index.ts","../src/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.ts","../src/converter/kicad_sexpr/pcb/index.ts","../src/converter/link_to_netlist/context.ts","../src/converter/link_to_netlist/converter.ts","../src/converter/link_to_netlist/index.ts","../src/converter/link_to_netlist/links/converter_base.ts","../src/converter/link_to_netlist/links/converters.ts","../src/converter/link_to_netlist/links/index.ts","../src/converter/netlist_to_kicad/calc_boxes_pos.ts","../src/converter/netlist_to_kicad/context.ts","../src/converter/netlist_to_kicad/index.ts","../src/converter/netlist_to_kicad/layout.ts","../src/converter/netlist_to_kicad/netlist_converter.ts","../src/kicad/index.ts","../src/kicad/constraints/index.ts","../src/kicad/label/index.ts","../src/kicad/label/net_label.ts","../src/kicad/label/sheet_pin.ts","../src/kicad/project/index.ts","../src/kicad/project/kicad_prl.ts","../src/kicad/project/kicad_pro.ts","../src/kicad/project/kicad_project_achieve.ts","../src/kicad/project/wildcards_and_files_ext.ts","../src/kicad/sheet/index.ts","../src/kicad/sheet/sheet.ts","../src/kicad/symbols/index.ts","../src/kicad/symbols/symbol_utils.ts","../src/kicad/symbols/lib_symbol/gnd.ts","../src/kicad/symbols/lib_symbol/index.ts","../src/kicad/symbols/lib_symbol/vcc.ts","../src/kicad/symbols/sch_symbol/gnd.ts","../src/kicad/symbols/sch_symbol/index.ts","../src/kicad/symbols/sch_symbol/vcc.ts","../src/kicad/wire/gen_wire.ts","../src/utils/collect_sub_sheets.ts","../src/utils/constraints.ts","../src/utils/filter_null_undefined.ts","../src/utils/index.ts","../src/utils/string_formatter.ts"],"version":"5.8.3"}
1
+ {"root":["../src/index.ts","../src/builder/index.ts","../src/builder/graph_to_kicad/do_convert_graph_to_kicad_project.ts","../src/builder/graph_to_kicad/index.ts","../src/converter/index.ts","../src/converter/graph_to_netlist/context.ts","../src/converter/graph_to_netlist/graph_converter.ts","../src/converter/graph_to_netlist/index.ts","../src/converter/kicad_sexpr/index.ts","../src/converter/kicad_sexpr/eeschema/index.ts","../src/converter/kicad_sexpr/eeschema/printer.ts","../src/converter/kicad_sexpr/eeschema/drawing_sheet/index.ts","../src/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.ts","../src/converter/kicad_sexpr/pcb/index.ts","../src/converter/link_to_netlist/context.ts","../src/converter/link_to_netlist/converter.ts","../src/converter/link_to_netlist/index.ts","../src/converter/link_to_netlist/links/converter_base.ts","../src/converter/link_to_netlist/links/converters.ts","../src/converter/link_to_netlist/links/index.ts","../src/converter/netlist_to_kicad/context.ts","../src/converter/netlist_to_kicad/index.ts","../src/converter/netlist_to_kicad/layout.ts","../src/converter/netlist_to_kicad/netlist_converter.ts","../src/converter/netlist_to_kicad/place_blocks.ts","../src/kicad/index.ts","../src/kicad/constraints/index.ts","../src/kicad/label/index.ts","../src/kicad/label/net_label.ts","../src/kicad/label/sheet_pin.ts","../src/kicad/project/index.ts","../src/kicad/project/kicad_prl.ts","../src/kicad/project/kicad_pro.ts","../src/kicad/project/kicad_project_achieve.ts","../src/kicad/project/wildcards_and_files_ext.ts","../src/kicad/sheet/index.ts","../src/kicad/sheet/sheet.ts","../src/kicad/symbols/index.ts","../src/kicad/symbols/symbol_utils.ts","../src/kicad/symbols/lib_symbol/gnd.ts","../src/kicad/symbols/lib_symbol/index.ts","../src/kicad/symbols/lib_symbol/vcc.ts","../src/kicad/symbols/sch_symbol/gnd.ts","../src/kicad/symbols/sch_symbol/index.ts","../src/kicad/symbols/sch_symbol/vcc.ts","../src/kicad/wire/gen_wire.ts","../src/utils/collect_sub_sheets.ts","../src/utils/constraints.ts","../src/utils/filter_null_undefined.ts","../src/utils/index.ts","../src/utils/string_formatter.ts"],"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-circuit/transpiler",
3
- "version": "0.0.82",
3
+ "version": "0.0.85",
4
4
  "description": "Intermediate representation of the modular circuit",
5
5
  "main": "./build/index.js",
6
6
  "files": [
@@ -26,10 +26,9 @@
26
26
  "dependencies": {
27
27
  "js-base64": "^3.7.7",
28
28
  "jszip": "^3.10.1",
29
- "yoga-layout": "^3.2.1",
30
29
  "@modular-circuit/electronics-model": "0.0.54",
31
- "@modular-circuit/perc": "0.0.61",
32
30
  "@modular-circuit/ir": "0.0.61",
31
+ "@modular-circuit/perc": "0.0.61",
33
32
  "@modular-circuit/utils": "0.0.40"
34
33
  },
35
34
  "scripts": {
@@ -1,5 +0,0 @@
1
- import type { VECTOR2 } from '@modular-circuit/electronics-model';
2
- export declare const calc_boxes_pos: (boxes: {
3
- [id: string]: VECTOR2;
4
- }) => Promise<Record<string, VECTOR2>>;
5
- //# sourceMappingURL=calc_boxes_pos.d.ts.map
@@ -1 +0,0 @@
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;AASjE,eAAO,MAAM,cAAc,GAAU,OAAO;IAC1C,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;CACtB,qCA2CA,CAAA"}
@@ -1,117 +0,0 @@
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
- // @ts-expect-error
49
- import { loadYoga } from 'yoga-layout/load';
50
- import { DEFAULT_PAPER_SIZE } from '../../utils';
51
- import { GRID_SIZE } from './layout';
52
- export var calc_boxes_pos = function (boxes) { return __awaiter(void 0, void 0, void 0, function () {
53
- var children_map, Yoga, node, child_count, idList, idList_1, idList_1_1, id, box, child, width, height, result, idList_2, idList_2_1, id, child;
54
- var e_1, _a, e_2, _b;
55
- return __generator(this, function (_c) {
56
- switch (_c.label) {
57
- case 0:
58
- children_map = {};
59
- return [4 /*yield*/, loadYoga()];
60
- case 1:
61
- Yoga = _c.sent();
62
- node = Yoga.Node.create();
63
- node.setAlignItems(Yoga.ALIGN_FLEX_START);
64
- node.setAlignContent(Yoga.ALIGN_CENTER);
65
- node.setWidth(DEFAULT_PAPER_SIZE.width / GRID_SIZE);
66
- node.setHeight(DEFAULT_PAPER_SIZE.height / GRID_SIZE);
67
- node.setJustifyContent(Yoga.JUSTIFY_SPACE_EVENLY);
68
- child_count = 0;
69
- idList = Object.keys(boxes);
70
- try {
71
- for (idList_1 = __values(idList), idList_1_1 = idList_1.next(); !idList_1_1.done; idList_1_1 = idList_1.next()) {
72
- id = idList_1_1.value;
73
- box = boxes[id];
74
- child = Yoga.Node.create();
75
- width = box.x / GRID_SIZE;
76
- height = box.y / GRID_SIZE;
77
- child.setWidth(width);
78
- child.setHeight(height);
79
- child.setMargin(Yoga.EDGE_ALL, 2);
80
- node.setAlignSelf(Yoga.ALIGN_CENTER);
81
- node.insertChild(child, child_count);
82
- children_map[id] = child;
83
- child_count++;
84
- }
85
- }
86
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
87
- finally {
88
- try {
89
- if (idList_1_1 && !idList_1_1.done && (_a = idList_1.return)) _a.call(idList_1);
90
- }
91
- finally { if (e_1) throw e_1.error; }
92
- }
93
- node.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR);
94
- result = {};
95
- try {
96
- for (idList_2 = __values(idList), idList_2_1 = idList_2.next(); !idList_2_1.done; idList_2_1 = idList_2.next()) {
97
- id = idList_2_1.value;
98
- child = children_map[id];
99
- result[id] = {
100
- x: child.getComputedLeft() * GRID_SIZE,
101
- y: child.getComputedTop() * GRID_SIZE,
102
- };
103
- child.free();
104
- }
105
- }
106
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
107
- finally {
108
- try {
109
- if (idList_2_1 && !idList_2_1.done && (_b = idList_2.return)) _b.call(idList_2);
110
- }
111
- finally { if (e_2) throw e_2.error; }
112
- }
113
- node.free();
114
- return [2 /*return*/, result];
115
- }
116
- });
117
- }); };