@modular-circuit/transpiler 0.0.71 → 0.0.72

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.
@@ -7,19 +7,19 @@ export declare function get_power_pos(pwr_number: number): {
7
7
  };
8
8
  export declare const BLOCK_PIN_GAP: number;
9
9
  export declare const WIRE_PADDING: number;
10
- export interface BlockPadding {
10
+ export interface LabelPadding {
11
11
  l_side: number;
12
12
  r_side: number;
13
13
  }
14
- export interface BlockBoxPadding {
15
- internal: BlockPadding;
16
- outer: BlockPadding;
14
+ export interface BlockLabelPadding {
15
+ internal: LabelPadding;
16
+ outer: LabelPadding;
17
17
  total_pin_num: number;
18
18
  }
19
19
  export declare class Layout {
20
20
  private width;
21
21
  private height;
22
22
  private max_height;
23
- get_block_bounding_box(factor: BlockBoxPadding): BOX2;
23
+ get_block_bounding_box(factor: BlockLabelPadding): BOX2;
24
24
  }
25
25
  //# sourceMappingURL=layout.d.ts.map
@@ -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,MAAM,oCAAoC,CAAA;AAI9D,eAAO,MAAM,SAAS,QAAiB,CAAA;AAEvC,eAAO,MAAM,SAAS,QAAY,CAAA;AAQlC,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM;;;EAE/C;AAKD,eAAO,MAAM,aAAa,QAAgB,CAAA;AAO1C,eAAO,MAAM,YAAY,QAAY,CAAA;AAErC,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,YAAY,CAAA;IACtB,KAAK,EAAE,YAAY,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,KAAK,CAAgB;IAE7B,OAAO,CAAC,MAAM,CAAgB;IAE9B,OAAO,CAAC,UAAU,CAAI;IAEf,sBAAsB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;CAoC7D"}
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/converter/netlist_to_kicad/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAA;AAI9D,eAAO,MAAM,SAAS,QAAiB,CAAA;AAEvC,eAAO,MAAM,SAAS,QAAY,CAAA;AAQlC,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM;;;EAE/C;AAKD,eAAO,MAAM,aAAa,QAAgB,CAAA;AAO1C,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,qBAAa,MAAM;IACjB,OAAO,CAAC,KAAK,CAAgB;IAE7B,OAAO,CAAC,MAAM,CAAgB;IAE9B,OAAO,CAAC,UAAU,CAAI;IAEf,sBAAsB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;CAsC/D"}
@@ -24,7 +24,8 @@ var Layout = /** @class */ (function () {
24
24
  }
25
25
  Layout.prototype.get_block_bounding_box = function (factor) {
26
26
  var block_height = (BLOCK_PIN_GAP * factor.total_pin_num) / 2 + BLOCK_PIN_GAP * 2;
27
- var block_width = Math.max(MIN_BLOCK_WIDTH, factor.internal.l_side +
27
+ var block_width = Math.max(MIN_BLOCK_WIDTH, factor.internal.l_side + factor.internal.r_side + factor.outer.l_side + WIRE_PADDING * 2);
28
+ var block_bounding_width = Math.max(block_width, factor.internal.l_side +
28
29
  factor.internal.r_side +
29
30
  factor.outer.l_side +
30
31
  factor.outer.r_side +
@@ -41,8 +42,8 @@ var Layout = /** @class */ (function () {
41
42
  },
42
43
  };
43
44
  this.max_height = Math.max(this.max_height, block_height);
44
- this.width += block_width + BLOCK_MARGIN_LEFT;
45
- if (this.width + BLOCK_MARGIN_RIGHT + block_width + BLOCK_MARGIN_LEFT > POWER_START_X) {
45
+ this.width += block_bounding_width + BLOCK_MARGIN_LEFT;
46
+ if (this.width + BLOCK_MARGIN_RIGHT + block_bounding_width + BLOCK_MARGIN_LEFT > POWER_START_X) {
46
47
  this.width = BLOCK_START_X;
47
48
  this.height += this.max_height + BLOCK_MARGIN_TOP;
48
49
  this.max_height = 0;
@@ -20,7 +20,7 @@ export declare class NetListConverter {
20
20
  private convert_sch;
21
21
  private convert_hierarchical_label;
22
22
  private convert_pwr_symbol;
23
- private get_sheet_symbol_paddings;
23
+ private get_sheet_symbol_lb_padding;
24
24
  private convert_sheet_symbol;
25
25
  private convert_sheet_pin;
26
26
  private convert_net_label;
@@ -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;AAatD,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;IAYvB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAqEnB,OAAO,CAAC,0BAA0B;IAYlC,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,yBAAyB;IA8CjC,OAAO,CAAC,oBAAoB;IAgD5B,OAAO,CAAC,iBAAiB;IA+BzB,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;AAatD,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;IAYvB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAoEnB,OAAO,CAAC,0BAA0B;IAYlC,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,2BAA2B;IA8CnC,OAAO,CAAC,oBAAoB;IAqC5B,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,iBAAiB;CAQ1B"}
@@ -160,8 +160,8 @@ var NetListConverter = /** @class */ (function () {
160
160
  return b.pins.length - a.pins.length;
161
161
  })), _j = _h.next(); !_j.done; _j = _h.next()) {
162
162
  var it_3 = _j.value;
163
- var sheet_padding = this.get_sheet_symbol_paddings(it_3);
164
- this.convert_sheet_symbol(it_3, this.block_calc.get_block_bounding_box(sheet_padding), sch, sheet_names_count, sheet_padding.outer);
163
+ var sheet_padding = this.get_sheet_symbol_lb_padding(it_3);
164
+ this.convert_sheet_symbol(it_3, this.block_calc.get_block_bounding_box(sheet_padding), sch, sheet_names_count);
165
165
  }
166
166
  }
167
167
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
@@ -206,7 +206,7 @@ var NetListConverter = /** @class */ (function () {
206
206
  sch.symbols.push(sch_pwr_symbol);
207
207
  this.convert_net_label(pwr.value, at, sch);
208
208
  };
209
- NetListConverter.prototype.get_sheet_symbol_paddings = function (sheet_sym) {
209
+ NetListConverter.prototype.get_sheet_symbol_lb_padding = function (sheet_sym) {
210
210
  var factor = {
211
211
  internal: {
212
212
  l_side: 0,
@@ -250,7 +250,7 @@ var NetListConverter = /** @class */ (function () {
250
250
  total_pin_num: sheet_sym.pins.length,
251
251
  };
252
252
  };
253
- NetListConverter.prototype.convert_sheet_symbol = function (sheet_sym, rect, sch, sheet_names_count, outer_padding) {
253
+ NetListConverter.prototype.convert_sheet_symbol = function (sheet_sym, rect, sch, sheet_names_count) {
254
254
  var port_count = sheet_sym.pins.length;
255
255
  var pins = [];
256
256
  for (var i = 0; i < port_count; i++) {
@@ -259,7 +259,7 @@ var NetListConverter = /** @class */ (function () {
259
259
  var y = rect.pos.y + BLOCK_PIN_GAP * ((i < port_count / 2 ? i : i - port_count / 2) + 1);
260
260
  var justify = is_left ? 'left' : 'right';
261
261
  var rotation = is_left ? 180 : 0;
262
- pins.push(this.convert_sheet_pin(sheet_sym.pins[i], { x: x, y: y }, sch, justify, rotation, is_left, is_left ? outer_padding.l_side : outer_padding.r_side));
262
+ pins.push(this.convert_sheet_pin(sheet_sym.pins[i], { x: x, y: y }, sch, justify, rotation, is_left));
263
263
  }
264
264
  var sheet_name = sheet_sym.sheet_name;
265
265
  if (sheet_names_count.has(sheet_name)) {
@@ -275,13 +275,15 @@ var NetListConverter = /** @class */ (function () {
275
275
  Sheetname: sheet_name,
276
276
  }));
277
277
  };
278
- NetListConverter.prototype.convert_sheet_pin = function (pin, pin_pos, sch, horizontal, rotation, is_left, padding) {
278
+ NetListConverter.prototype.convert_sheet_pin = function (pin, pin_pos, sch, horizontal, rotation, is_left) {
279
279
  if (this.pin_is_connected(pin.uuid)) {
280
- this.convert_net_label(this.get_pin_net_name(pin.uuid), {
280
+ var nt_name = this.get_pin_net_name(pin.uuid);
281
+ this.convert_net_label(nt_name, {
281
282
  x: pin_pos.x + (is_left ? -WIRE_PADDING : WIRE_PADDING),
282
283
  y: pin_pos.y,
283
284
  }, sch, horizontal === 'left' ? 'right' : 'left');
284
- var wire_padding = padding + 2 * WIRE_PADDING;
285
+ var lb_txt_len = nt_name.length * FONT_SIZE;
286
+ var wire_padding = lb_txt_len + 2 * WIRE_PADDING;
285
287
  this.wires.push(gen_wire(pin_pos, {
286
288
  x: pin_pos.x + (is_left ? -wire_padding : wire_padding),
287
289
  y: pin_pos.y,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-circuit/transpiler",
3
- "version": "0.0.71",
3
+ "version": "0.0.72",
4
4
  "description": "Intermediate representation of the modular circuit",
5
5
  "main": "./build/index.js",
6
6
  "files": [
@@ -27,9 +27,9 @@
27
27
  "js-base64": "^3.7.7",
28
28
  "jszip": "^3.10.1",
29
29
  "@modular-circuit/ir": "0.0.58",
30
+ "@modular-circuit/electronics-model": "0.0.51",
30
31
  "@modular-circuit/perc": "0.0.58",
31
- "@modular-circuit/utils": "0.0.37",
32
- "@modular-circuit/electronics-model": "0.0.51"
32
+ "@modular-circuit/utils": "0.0.37"
33
33
  },
34
34
  "scripts": {
35
35
  "clean": "rimraf build",