@modular-circuit/transpiler 0.0.76 → 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.
@@ -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;AAMjE,eAAO,MAAM,cAAc,GAAU,OAAO;IAC1C,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;CACtB,qCAsCA,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;AAQjE,eAAO,MAAM,cAAc,GAAU,OAAO;IAC1C,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;CACtB,qCA2CA,CAAA"}
@@ -50,13 +50,15 @@ import { loadYoga } from 'yoga-layout/load';
50
50
  import { DEFAULT_PAPER_SIZE } from '../../utils';
51
51
  import { GRID_SIZE } from './layout';
52
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;
54
- var e_1, _a;
55
- return __generator(this, function (_b) {
56
- switch (_b.label) {
57
- case 0: return [4 /*yield*/, loadYoga()];
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()];
58
60
  case 1:
59
- Yoga = _b.sent();
61
+ Yoga = _c.sent();
60
62
  node = Yoga.Node.create();
61
63
  node.setAlignContent(Yoga.ALIGN_CENTER);
62
64
  node.setWidth(DEFAULT_PAPER_SIZE.width / GRID_SIZE);
@@ -64,6 +66,7 @@ export var calc_boxes_pos = function (boxes) { return __awaiter(void 0, void 0,
64
66
  node.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
65
67
  node.setJustifyContent(Yoga.JUSTIFY_CENTER);
66
68
  node.setPadding(Yoga.EDGE_ALL, 1);
69
+ child_count = 0;
67
70
  idList = Object.keys(boxes);
68
71
  try {
69
72
  for (idList_1 = __values(idList), idList_1_1 = idList_1.next(); !idList_1_1.done; idList_1_1 = idList_1.next()) {
@@ -75,7 +78,9 @@ export var calc_boxes_pos = function (boxes) { return __awaiter(void 0, void 0,
75
78
  child.setWidth(width);
76
79
  child.setHeight(height);
77
80
  child.setMargin(Yoga.EDGE_ALL, 2);
78
- node.insertChild(child, node.getChildCount());
81
+ node.insertChild(child, child_count);
82
+ children_map[id] = child;
83
+ child_count++;
79
84
  }
80
85
  }
81
86
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -87,14 +92,23 @@ export var calc_boxes_pos = function (boxes) { return __awaiter(void 0, void 0,
87
92
  }
88
93
  node.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR);
89
94
  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();
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; }
98
112
  }
99
113
  node.free();
100
114
  return [2 /*return*/, result];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-circuit/transpiler",
3
- "version": "0.0.76",
3
+ "version": "0.0.79",
4
4
  "description": "Intermediate representation of the modular circuit",
5
5
  "main": "./build/index.js",
6
6
  "files": [
@@ -27,10 +27,10 @@
27
27
  "js-base64": "^3.7.7",
28
28
  "jszip": "^3.10.1",
29
29
  "yoga-layout": "^3.2.1",
30
- "@modular-circuit/electronics-model": "0.0.51",
31
- "@modular-circuit/perc": "0.0.58",
32
- "@modular-circuit/utils": "0.0.37",
33
- "@modular-circuit/ir": "0.0.58"
30
+ "@modular-circuit/electronics-model": "0.0.54",
31
+ "@modular-circuit/ir": "0.0.61",
32
+ "@modular-circuit/utils": "0.0.40",
33
+ "@modular-circuit/perc": "0.0.61"
34
34
  },
35
35
  "scripts": {
36
36
  "clean": "rimraf build",