@modular-circuit/transpiler 0.0.76 → 0.0.77
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.
- package/build/builder/graph_to_kicad/do_convert_graph_to_kicad_project.js +19 -108
- package/build/builder/graph_to_kicad/index.js +4 -59
- package/build/converter/graph_to_netlist/graph_converter.js +51 -171
- package/build/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.js +1 -1
- package/build/converter/kicad_sexpr/eeschema/printer.js +245 -290
- package/build/converter/link_to_netlist/converter.js +77 -135
- package/build/converter/link_to_netlist/links/converter_base.js +38 -131
- package/build/converter/link_to_netlist/links/converters.js +316 -554
- package/build/converter/netlist_to_kicad/calc_boxes_pos.d.ts +1 -1
- package/build/converter/netlist_to_kicad/calc_boxes_pos.d.ts.map +1 -1
- package/build/converter/netlist_to_kicad/calc_boxes_pos.js +36 -101
- package/build/converter/netlist_to_kicad/layout.js +28 -32
- package/build/converter/netlist_to_kicad/netlist_converter.d.ts +1 -1
- package/build/converter/netlist_to_kicad/netlist_converter.d.ts.map +1 -1
- package/build/converter/netlist_to_kicad/netlist_converter.js +128 -300
- package/build/kicad/constraints/index.js +1 -1
- package/build/kicad/label/net_label.js +2 -2
- package/build/kicad/label/sheet_pin.js +11 -19
- package/build/kicad/project/kicad_prl.js +3 -3
- package/build/kicad/project/kicad_pro.js +4 -4
- package/build/kicad/project/kicad_project_achieve.js +31 -45
- package/build/kicad/project/wildcards_and_files_ext.js +61 -61
- package/build/kicad/sheet/sheet.js +3 -3
- package/build/kicad/symbols/lib_symbol/gnd.js +6 -6
- package/build/kicad/symbols/lib_symbol/vcc.js +7 -7
- package/build/kicad/symbols/sch_symbol/gnd.js +9 -9
- package/build/kicad/symbols/sch_symbol/vcc.js +9 -9
- package/build/kicad/symbols/symbol_utils.js +1 -1
- package/build/kicad/wire/gen_wire.js +4 -4
- package/build/utils/collect_sub_sheets.js +37 -151
- package/build/utils/constraints.js +6 -6
- package/build/utils/filter_null_undefined.js +2 -31
- package/build/utils/string_formatter.js +23 -29
- package/package.json +5 -5
|
@@ -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;AAKjE,eAAO,MAAM,cAAc,GAAI,OAAO;IACpC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;CACtB,4BAqCA,CAAA"}
|
|
@@ -1,103 +1,38 @@
|
|
|
1
|
-
|
|
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';
|
|
1
|
+
import Yoga from 'yoga-layout';
|
|
50
2
|
import { DEFAULT_PAPER_SIZE } from '../../utils';
|
|
51
3
|
import { GRID_SIZE } from './layout';
|
|
52
|
-
export
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
node.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR);
|
|
89
|
-
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();
|
|
98
|
-
}
|
|
99
|
-
node.free();
|
|
100
|
-
return [2 /*return*/, result];
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}); };
|
|
4
|
+
export const calc_boxes_pos = (boxes) => {
|
|
5
|
+
const node = Yoga.Node.create();
|
|
6
|
+
node.setAlignContent(Yoga.ALIGN_CENTER);
|
|
7
|
+
node.setWidth(DEFAULT_PAPER_SIZE.width / GRID_SIZE);
|
|
8
|
+
node.setHeight(DEFAULT_PAPER_SIZE.height / GRID_SIZE);
|
|
9
|
+
node.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
|
10
|
+
node.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
|
11
|
+
node.setPadding(Yoga.EDGE_ALL, 1);
|
|
12
|
+
const idList = Object.keys(boxes);
|
|
13
|
+
for (const id of idList) {
|
|
14
|
+
const box = boxes[id];
|
|
15
|
+
const child = Yoga.Node.create();
|
|
16
|
+
// Use box.x and box.y as width and height (assuming VECTOR2 is { x, y })
|
|
17
|
+
const width = box.x / GRID_SIZE;
|
|
18
|
+
const height = box.y / GRID_SIZE;
|
|
19
|
+
child.setWidth(width);
|
|
20
|
+
child.setHeight(height);
|
|
21
|
+
child.setMargin(Yoga.EDGE_ALL, 2);
|
|
22
|
+
node.insertChild(child, node.getChildCount());
|
|
23
|
+
}
|
|
24
|
+
node.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR);
|
|
25
|
+
// Map layout result by id
|
|
26
|
+
const result = {};
|
|
27
|
+
for (let i = 0; i < idList.length; i++) {
|
|
28
|
+
const id = idList[i];
|
|
29
|
+
const child = node.getChild(i);
|
|
30
|
+
result[id] = {
|
|
31
|
+
x: child.getComputedLeft() * GRID_SIZE,
|
|
32
|
+
y: child.getComputedTop() * GRID_SIZE,
|
|
33
|
+
};
|
|
34
|
+
child.free();
|
|
35
|
+
}
|
|
36
|
+
node.free();
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
import { PAPER_SIZE } from '../../utils/constraints';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
const MIL_TO_MM = 0.0254;
|
|
3
|
+
export const GRID_SIZE = 50 * MIL_TO_MM;
|
|
4
|
+
export const FONT_SIZE = GRID_SIZE;
|
|
5
|
+
const POWER_START_Y = 30 * GRID_SIZE;
|
|
6
|
+
const POWER_START_X = (PAPER_SIZE.A4.height - 30) * GRID_SIZE;
|
|
7
|
+
const POWER_Y_STEP = 16 * GRID_SIZE;
|
|
8
8
|
export function get_power_pos(pwr_number) {
|
|
9
9
|
return { x: POWER_START_X, y: POWER_START_Y + POWER_Y_STEP * pwr_number };
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var block_width = Math.max(MIN_BLOCK_WIDTH, factor.internal.l_side + factor.internal.r_side + INTERNAL_LABEL_MARGIN);
|
|
29
|
-
var block_bounding_width = Math.max(block_width, factor.internal.l_side +
|
|
11
|
+
const BLOCK_START_Y = 36 * GRID_SIZE;
|
|
12
|
+
const BLOCK_START_X = BLOCK_START_Y;
|
|
13
|
+
export const BLOCK_PIN_GAP = 3 * GRID_SIZE;
|
|
14
|
+
const BLOCK_MARGIN_TOP = 8 * GRID_SIZE;
|
|
15
|
+
const MIN_BLOCK_WIDTH = 8 * GRID_SIZE;
|
|
16
|
+
const BLOCK_MARGIN_LEFT = 16 * GRID_SIZE;
|
|
17
|
+
const BLOCK_MARGIN_RIGHT = BLOCK_MARGIN_LEFT;
|
|
18
|
+
const INTERNAL_LABEL_MARGIN = 8 * FONT_SIZE;
|
|
19
|
+
export const WIRE_PADDING = GRID_SIZE;
|
|
20
|
+
export class Layout {
|
|
21
|
+
width = BLOCK_START_X;
|
|
22
|
+
height = BLOCK_START_Y;
|
|
23
|
+
max_height = 0;
|
|
24
|
+
get_block_geometry(factor) {
|
|
25
|
+
const block_height = (BLOCK_PIN_GAP * factor.total_pin_num) / 2 + BLOCK_PIN_GAP * 2;
|
|
26
|
+
const block_width = Math.max(MIN_BLOCK_WIDTH, factor.internal.l_side + factor.internal.r_side + INTERNAL_LABEL_MARGIN);
|
|
27
|
+
const block_bounding_width = Math.max(block_width, factor.internal.l_side +
|
|
30
28
|
factor.internal.r_side +
|
|
31
29
|
factor.outer.l_side +
|
|
32
30
|
factor.outer.r_side +
|
|
33
31
|
// | txt | | txt |
|
|
34
32
|
WIRE_PADDING * 4);
|
|
35
|
-
|
|
33
|
+
const box = {
|
|
36
34
|
pos: {
|
|
37
35
|
x: this.width,
|
|
38
36
|
y: this.height,
|
|
@@ -42,7 +40,7 @@ var Layout = /** @class */ (function () {
|
|
|
42
40
|
y: block_height,
|
|
43
41
|
},
|
|
44
42
|
};
|
|
45
|
-
|
|
43
|
+
const bounding_box = {
|
|
46
44
|
pos: {
|
|
47
45
|
x: this.width,
|
|
48
46
|
y: this.height,
|
|
@@ -59,8 +57,6 @@ var Layout = /** @class */ (function () {
|
|
|
59
57
|
this.height += this.max_height + BLOCK_MARGIN_TOP;
|
|
60
58
|
this.max_height = 0;
|
|
61
59
|
}
|
|
62
|
-
return { box
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
}());
|
|
66
|
-
export { Layout };
|
|
60
|
+
return { box, bounding_box };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -9,7 +9,7 @@ export declare class NetListConverter {
|
|
|
9
9
|
constructor(ctx: NetlistToKicadContext);
|
|
10
10
|
pin_is_connected(id: string): boolean;
|
|
11
11
|
get_pin_net_name(id: string): string;
|
|
12
|
-
convert_to_kicad():
|
|
12
|
+
convert_to_kicad(): Record<string, SCHEMATIC>;
|
|
13
13
|
/**
|
|
14
14
|
* Convert a schematic to a kicad schematic
|
|
15
15
|
* @param name The name of the graph ,also the file name of the converted schematic
|
|
@@ -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;
|
|
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;IAIpB,gBAAgB;IAavB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAqFnB,OAAO,CAAC,0BAA0B;IAalC,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,2BAA2B;IA8CnC,OAAO,CAAC,oBAAoB;IAqC5B,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,iBAAiB;CAQ1B"}
|