@modular-circuit/transpiler 0.0.96 → 0.0.98
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":"layout.d.ts","sourceRoot":"","sources":["../../../src/converter/netlist_to_kicad/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAMvE,eAAO,MAAM,SAAS,QAAiB,CAAA;AAEvC,eAAO,MAAM,SAAS,QAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/converter/netlist_to_kicad/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAMvE,eAAO,MAAM,SAAS,QAAiB,CAAA;AAEvC,eAAO,MAAM,SAAS,QAAY,CAAA;AAYlC,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM;;;EAE/C;AAED,eAAO,MAAM,aAAa,QAAgB,CAAA;AAE1C,eAAO,MAAM,mBAAmB,QAAgB,CAAA;AAKhD,eAAO,MAAM,YAAY,QAAY,CAAA;AAErC,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,YAAY,CAAA;IACtB,KAAK,EAAE,YAAY,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,IAAI,CAAA;IACT,YAAY,EAAE,IAAI,CAAA;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAA;IACb,aAAa,EAAE,OAAO,CAAA;CACvB;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,SAAS,CAAgC;IAEjD,OAAO,CAAC,GAAG,CAAY;IAEhB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB;IAIzC,QAAQ;IA8CrB,OAAO,CAAC,eAAe;CAiCxB"}
|
|
@@ -69,24 +69,18 @@ export var FONT_SIZE = GRID_SIZE;
|
|
|
69
69
|
var POWER_START_Y = 30 * GRID_SIZE;
|
|
70
70
|
var POWER_START_X = (PAPER_SIZE.A4.height - 30) * GRID_SIZE;
|
|
71
71
|
var POWER_Y_STEP = 16 * GRID_SIZE;
|
|
72
|
+
var NODE_NODE_SPACE = 4 * GRID_SIZE;
|
|
73
|
+
var PADDING = 6 * GRID_SIZE;
|
|
72
74
|
export function get_power_pos(pwr_number) {
|
|
73
75
|
return { x: POWER_START_X, y: POWER_START_Y + POWER_Y_STEP * pwr_number };
|
|
74
76
|
}
|
|
75
|
-
var BLOCK_START_Y = 36 * GRID_SIZE;
|
|
76
|
-
var BLOCK_START_X = BLOCK_START_Y;
|
|
77
77
|
export var BLOCK_PIN_GAP = 4 * GRID_SIZE;
|
|
78
78
|
export var BLOCK_PIN_TB_MARGIN = 2 * GRID_SIZE;
|
|
79
|
-
var BLOCK_MARGIN_TOP = 8 * GRID_SIZE;
|
|
80
79
|
var MIN_BLOCK_WIDTH = 8 * GRID_SIZE;
|
|
81
|
-
var BLOCK_MARGIN_LEFT = 16 * GRID_SIZE;
|
|
82
|
-
var BLOCK_MARGIN_RIGHT = BLOCK_MARGIN_LEFT;
|
|
83
80
|
var INTERNAL_LABEL_MARGIN = 8 * FONT_SIZE;
|
|
84
81
|
export var WIRE_PADDING = GRID_SIZE;
|
|
85
82
|
var Layout = /** @class */ (function () {
|
|
86
83
|
function Layout() {
|
|
87
|
-
this.width = BLOCK_START_X;
|
|
88
|
-
this.height = BLOCK_START_Y;
|
|
89
|
-
this.max_height = 0;
|
|
90
84
|
this.block_geo = {};
|
|
91
85
|
this.elk = new ELK();
|
|
92
86
|
}
|
|
@@ -95,7 +89,7 @@ var Layout = /** @class */ (function () {
|
|
|
95
89
|
};
|
|
96
90
|
Layout.prototype.finalize = function () {
|
|
97
91
|
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
-
var bbox, graph, _a, _b, _c, id, geo, bounding_size, res, _d, _e, child, geo, pos
|
|
92
|
+
var bbox, graph, _a, _b, _c, id, geo, bounding_size, res, _d, _e, child, geo, pos;
|
|
99
93
|
var e_1, _f, e_2, _g;
|
|
100
94
|
var _h, _j;
|
|
101
95
|
return __generator(this, function (_k) {
|
|
@@ -108,8 +102,8 @@ var Layout = /** @class */ (function () {
|
|
|
108
102
|
'elk.algorithm': 'box',
|
|
109
103
|
'elk.contentAlignment': 'H_LEFT | V_TOP',
|
|
110
104
|
'elk.fixedGraphSize': 'true',
|
|
111
|
-
'elk.spacing.nodeNode': "".concat(
|
|
112
|
-
'elk.padding': "[top=".concat(
|
|
105
|
+
'elk.spacing.nodeNode': "".concat(NODE_NODE_SPACE),
|
|
106
|
+
'elk.padding': "[top=".concat(PADDING, ",left=").concat(PADDING, ",bottom=").concat(PADDING, ",right=").concat(PADDING, "]"),
|
|
113
107
|
'elk.childAreaWidth': "".concat(PAPER_SIZE.A4.width * MIL_TO_MM - GRID_SIZE * 2),
|
|
114
108
|
'elk.childAreaHeight': "".concat(PAPER_SIZE.A4.height * MIL_TO_MM - GRID_SIZE * 2),
|
|
115
109
|
},
|
|
@@ -119,7 +113,7 @@ var Layout = /** @class */ (function () {
|
|
|
119
113
|
try {
|
|
120
114
|
for (_a = __values(Object.entries(this.block_geo)), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
121
115
|
_c = __read(_b.value, 2), id = _c[0], geo = _c[1];
|
|
122
|
-
bounding_size = geo.
|
|
116
|
+
bounding_size = geo.bounding_size;
|
|
123
117
|
graph.children.push({
|
|
124
118
|
id: id,
|
|
125
119
|
width: bounding_size.x,
|
|
@@ -146,17 +140,9 @@ var Layout = /** @class */ (function () {
|
|
|
146
140
|
x: (_h = child.x) !== null && _h !== void 0 ? _h : 0,
|
|
147
141
|
y: (_j = child.y) !== null && _j !== void 0 ? _j : 0,
|
|
148
142
|
};
|
|
149
|
-
block_offset = {
|
|
150
|
-
x: geo.bounding_box.pos.x - geo.box.pos.x,
|
|
151
|
-
y: geo.bounding_box.pos.y - geo.box.pos.y,
|
|
152
|
-
};
|
|
153
|
-
final_pos = {
|
|
154
|
-
x: pos.x - block_offset.x,
|
|
155
|
-
y: pos.y - block_offset.y,
|
|
156
|
-
};
|
|
157
143
|
bbox[child.id] = {
|
|
158
|
-
pos:
|
|
159
|
-
size: geo.
|
|
144
|
+
pos: pos,
|
|
145
|
+
size: geo.size,
|
|
160
146
|
};
|
|
161
147
|
}
|
|
162
148
|
}
|
|
@@ -182,34 +168,18 @@ var Layout = /** @class */ (function () {
|
|
|
182
168
|
factor.outer.r_side +
|
|
183
169
|
// | txt | | txt |
|
|
184
170
|
WIRE_PADDING * 4);
|
|
185
|
-
var
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
y: this.height,
|
|
189
|
-
},
|
|
190
|
-
size: {
|
|
191
|
-
x: block_width,
|
|
192
|
-
y: block_height,
|
|
193
|
-
},
|
|
171
|
+
var size = {
|
|
172
|
+
x: block_width,
|
|
173
|
+
y: block_height,
|
|
194
174
|
};
|
|
195
|
-
var
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
size:
|
|
201
|
-
|
|
202
|
-
y: block_height,
|
|
203
|
-
},
|
|
175
|
+
var bounding_size = {
|
|
176
|
+
x: block_bounding_width,
|
|
177
|
+
y: block_height,
|
|
178
|
+
};
|
|
179
|
+
return {
|
|
180
|
+
size: size,
|
|
181
|
+
bounding_size: bounding_size,
|
|
204
182
|
};
|
|
205
|
-
this.max_height = Math.max(this.max_height, block_height);
|
|
206
|
-
this.width += block_bounding_width + BLOCK_MARGIN_LEFT;
|
|
207
|
-
if (this.width + BLOCK_MARGIN_RIGHT + MIN_BLOCK_WIDTH + BLOCK_MARGIN_LEFT > POWER_START_X) {
|
|
208
|
-
this.width = BLOCK_START_X;
|
|
209
|
-
this.height += this.max_height + BLOCK_MARGIN_TOP;
|
|
210
|
-
this.max_height = 0;
|
|
211
|
-
}
|
|
212
|
-
return { box: box, bounding_box: bounding_box };
|
|
213
183
|
};
|
|
214
184
|
return Layout;
|
|
215
185
|
}());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/transpiler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.98",
|
|
4
4
|
"description": "Intermediate representation of the modular circuit",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"elkjs": "^0.11.0",
|
|
28
28
|
"js-base64": "^3.7.7",
|
|
29
29
|
"jszip": "^3.10.1",
|
|
30
|
-
"@modular-circuit/electronics-model": "0.0.54",
|
|
31
30
|
"@modular-circuit/ir": "0.0.63",
|
|
32
31
|
"@modular-circuit/perc": "0.0.61",
|
|
32
|
+
"@modular-circuit/electronics-model": "0.0.54",
|
|
33
33
|
"@modular-circuit/utils": "0.0.41"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|