@modular-circuit/transpiler 0.0.80 → 0.0.81
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;
|
|
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,qCA0CA,CAAA"}
|
|
@@ -45,65 +45,72 @@ var __values = (this && this.__values) || function(o) {
|
|
|
45
45
|
};
|
|
46
46
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
// @ts-expect-error
|
|
49
|
+
import { loadYoga } from 'yoga-layout/load';
|
|
49
50
|
import { DEFAULT_PAPER_SIZE } from '../../utils';
|
|
50
51
|
import { GRID_SIZE } from './layout';
|
|
51
52
|
export var calc_boxes_pos = function (boxes) { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
-
var children_map, node, child_count, idList, idList_1, idList_1_1, id, box, child, width, height, result, idList_2, idList_2_1, id, child;
|
|
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;
|
|
53
54
|
var e_1, _a, e_2, _b;
|
|
54
55
|
return __generator(this, function (_c) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
result
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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.setAlignContent(Yoga.ALIGN_CENTER);
|
|
64
|
+
node.setWidth(DEFAULT_PAPER_SIZE.width / GRID_SIZE);
|
|
65
|
+
node.setHeight(DEFAULT_PAPER_SIZE.height / GRID_SIZE);
|
|
66
|
+
node.setJustifyContent(Yoga.JUSTIFY_SPACE_EVENLY);
|
|
67
|
+
node.setPadding(Yoga.EDGE_ALL, 1);
|
|
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.insertChild(child, child_count);
|
|
81
|
+
children_map[id] = child;
|
|
82
|
+
child_count++;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
86
|
+
finally {
|
|
87
|
+
try {
|
|
88
|
+
if (idList_1_1 && !idList_1_1.done && (_a = idList_1.return)) _a.call(idList_1);
|
|
89
|
+
}
|
|
90
|
+
finally { if (e_1) throw e_1.error; }
|
|
91
|
+
}
|
|
92
|
+
node.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR);
|
|
93
|
+
result = {};
|
|
94
|
+
try {
|
|
95
|
+
for (idList_2 = __values(idList), idList_2_1 = idList_2.next(); !idList_2_1.done; idList_2_1 = idList_2.next()) {
|
|
96
|
+
id = idList_2_1.value;
|
|
97
|
+
child = children_map[id];
|
|
98
|
+
result[id] = {
|
|
99
|
+
x: child.getComputedLeft() * GRID_SIZE,
|
|
100
|
+
y: child.getComputedTop() * GRID_SIZE,
|
|
101
|
+
};
|
|
102
|
+
child.free();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
106
|
+
finally {
|
|
107
|
+
try {
|
|
108
|
+
if (idList_2_1 && !idList_2_1.done && (_b = idList_2.return)) _b.call(idList_2);
|
|
109
|
+
}
|
|
110
|
+
finally { if (e_2) throw e_2.error; }
|
|
111
|
+
}
|
|
112
|
+
node.free();
|
|
113
|
+
return [2 /*return*/, result];
|
|
105
114
|
}
|
|
106
|
-
node.free();
|
|
107
|
-
return [2 /*return*/, result];
|
|
108
115
|
});
|
|
109
116
|
}); };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/transpiler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.81",
|
|
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/perc": "0.0.61",
|
|
31
30
|
"@modular-circuit/electronics-model": "0.0.54",
|
|
31
|
+
"@modular-circuit/utils": "0.0.40",
|
|
32
32
|
"@modular-circuit/ir": "0.0.61",
|
|
33
|
-
"@modular-circuit/
|
|
33
|
+
"@modular-circuit/perc": "0.0.61"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"clean": "rimraf build",
|