@modular-circuit/transpiler 0.0.63 → 0.0.65

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.
Files changed (52) hide show
  1. package/build/builder/graph_to_kicad/do_convert_graph_to_kicad_project.js +109 -25
  2. package/build/builder/graph_to_kicad/index.js +61 -9
  3. package/build/builder/index.js +1 -5
  4. package/build/converter/graph_to_netlist/context.js +0 -2
  5. package/build/converter/graph_to_netlist/graph_converter.js +173 -57
  6. package/build/converter/graph_to_netlist/index.js +2 -18
  7. package/build/converter/index.js +3 -19
  8. package/build/converter/kicad_sexpr/eeschema/drawing_sheet/index.js +4 -7
  9. package/build/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.js +1 -4
  10. package/build/converter/kicad_sexpr/eeschema/index.js +2 -18
  11. package/build/converter/kicad_sexpr/eeschema/printer.js +281 -220
  12. package/build/converter/kicad_sexpr/index.js +2 -18
  13. package/build/converter/kicad_sexpr/pcb/index.js +1 -2
  14. package/build/converter/link_to_netlist/context.js +0 -2
  15. package/build/converter/link_to_netlist/converter.js +138 -84
  16. package/build/converter/link_to_netlist/index.js +2 -18
  17. package/build/converter/link_to_netlist/links/converter_base.d.ts.map +1 -1
  18. package/build/converter/link_to_netlist/links/converter_base.js +133 -44
  19. package/build/converter/link_to_netlist/links/converters.js +556 -333
  20. package/build/converter/link_to_netlist/links/index.js +2 -18
  21. package/build/converter/netlist_to_kicad/context.js +0 -2
  22. package/build/converter/netlist_to_kicad/index.js +3 -19
  23. package/build/converter/netlist_to_kicad/layout.js +25 -26
  24. package/build/converter/netlist_to_kicad/netlist_converter.js +182 -93
  25. package/build/index.js +5 -21
  26. package/build/kicad/constraints/index.js +1 -4
  27. package/build/kicad/label/index.js +2 -18
  28. package/build/kicad/label/net_label.js +6 -10
  29. package/build/kicad/label/sheet_pin.js +23 -19
  30. package/build/kicad/project/index.js +2 -18
  31. package/build/kicad/project/kicad_prl.js +3 -7
  32. package/build/kicad/project/kicad_pro.js +5 -9
  33. package/build/kicad/project/kicad_project_achieve.js +50 -40
  34. package/build/kicad/project/wildcards_and_files_ext.js +61 -65
  35. package/build/kicad/sheet/index.js +1 -17
  36. package/build/kicad/sheet/sheet.js +8 -12
  37. package/build/kicad/symbols/index.js +2 -18
  38. package/build/kicad/symbols/lib_symbol/gnd.js +20 -24
  39. package/build/kicad/symbols/lib_symbol/index.js +2 -18
  40. package/build/kicad/symbols/lib_symbol/vcc.js +21 -25
  41. package/build/kicad/symbols/sch_symbol/gnd.js +19 -23
  42. package/build/kicad/symbols/sch_symbol/index.js +2 -18
  43. package/build/kicad/symbols/sch_symbol/vcc.js +19 -23
  44. package/build/kicad/symbols/symbol_utils.js +1 -5
  45. package/build/utils/collect_sub_sheets.js +146 -35
  46. package/build/utils/constraints.js +6 -9
  47. package/build/utils/filter_null_undefined.d.ts +1 -1
  48. package/build/utils/filter_null_undefined.d.ts.map +1 -1
  49. package/build/utils/filter_null_undefined.js +39 -2
  50. package/build/utils/index.js +4 -20
  51. package/build/utils/string_formatter.js +29 -27
  52. package/package.json +5 -5
@@ -1,226 +1,287 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SCHEMATIC_PRINTER = void 0;
4
- const electronics_model_1 = require("@modular-circuit/electronics-model");
5
- const ir_1 = require("@modular-circuit/ir");
6
- const utils_1 = require("@modular-circuit/utils");
7
- const utils_2 = require("../../../utils");
8
- const SCOPE_START = '\n\t';
9
- const SPACE = ' ';
10
- const SCOPE_END = '\n';
11
- const IGNORE_BOOLEANS = new Set(['power']);
12
- class SCHEMATIC_PRINTER {
13
- schematic(sch) {
14
- const lib_symbols = (() => {
15
- if (!sch.lib_symbols?.symbols.length)
16
- return '';
17
- return `${SCOPE_START}(lib_symbols ${sch.lib_symbols?.symbols.map((it) => this.lib_symbol(it)).join(`${SCOPE_END}`)}\t)`;
18
- })();
19
- const labels = (() => {
20
- if (!sch.labels?.length)
21
- return '';
22
- return `${SCOPE_START}${sch.labels.map((it) => this.label(it)).join(`${SCOPE_END}`)}`;
23
- })();
24
- const sch_sheets = (() => {
25
- if (!sch.sheets?.length)
26
- return '';
27
- return `${SCOPE_START}${sch.sheets.map((it) => this.sch_sheet(it)).join(`${SCOPE_END}`)}\t`;
28
- })();
29
- const sch_symbols = (() => {
30
- if (!sch.symbols?.length)
31
- return '';
32
- return `${SCOPE_START}${sch.symbols.map((it) => this.sch_symbol(it)).join(`${SCOPE_END}`)}\t`;
33
- })();
34
- return `
35
- (kicad_sch
36
- (version ${utils_2.SCH_VERSION})
37
- (generator "${utils_2.GENERATOR_NAME}")
38
- (generator_version "${utils_2.GENERATOR_VERSION}")
39
- (uuid "${(0, utils_1.gen_uuid)()}")
40
- (paper "${utils_2.PAPER}")${lib_symbols}${labels}${sch_symbols}${sch_sheets}
41
- )
42
- `;
1
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
2
+ var useValue = arguments.length > 2;
3
+ for (var i = 0; i < initializers.length; i++) {
4
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
43
5
  }
44
- power(power) {
45
- return power ? '(power)' : '';
46
- }
47
- pin_display_opt(opt) {
48
- if (!opt)
49
- return;
50
- const offset = (off) => (off ? `(offset ${off})` : '');
51
- const hide = (h) => (h ? 'hide' : '');
52
- const pin_numbers = `${opt.pin_numbers ? `(pin_numbers ${offset(opt.pin_numbers.offset)} ${hide(opt.pin_numbers.hide)})` : ''}`;
53
- const pin_names = `${opt.pin_names ? `(pin_names ${offset(opt.pin_names.offset)} ${hide(opt.pin_names.hide)})` : ''}`;
54
- return `${pin_numbers}
55
- ${pin_names}
56
- `;
57
- }
58
- lib_symbol(lib_symbol) {
59
- return `
60
- (symbol "${lib_symbol.name}" ${this.power(lib_symbol.power)}
61
- ${this.pin_display_opt(lib_symbol)}
62
- ${this.booleans(lib_symbol)}
63
- ${this.fields(lib_symbol.properties)}
64
- ${this.pin_defs(lib_symbol.pins)}
65
- ${this.drawings(lib_symbol.drawings)}
66
- ${this.lib_children(lib_symbol.children)}
67
- )
68
- `;
69
- }
70
- lib_children(libs) {
71
- if (!libs)
72
- return '';
73
- return libs.map((i) => this.lib_symbol(i)).join(SCOPE_END);
74
- }
75
- pts(points) {
76
- return `(pts ${points.map((i) => `(xy ${i.x} ${i.y} )`).join(SPACE)})`;
77
- }
78
- drawings(draws) {
79
- if (!draws)
80
- return;
81
- return draws.map((i) => this.drawing(i)).join(SCOPE_END);
82
- }
83
- drawing(draw) {
84
- if (!('shape' in draw))
85
- throw new Error(`Unhandled drawing ${draw}`);
86
- switch (draw.shape) {
87
- case ir_1.SHAPE_T.POLY:
88
- return `(polyline
89
- ${this.pts(draw.pts)}
90
- ${this.stroke(draw.stroke)}
91
- ${this.fill(draw.fill)}
92
- )`;
6
+ return useValue ? value : void 0;
7
+ };
8
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
9
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
10
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
11
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
12
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
13
+ var _, done = false;
14
+ for (var i = decorators.length - 1; i >= 0; i--) {
15
+ var context = {};
16
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
17
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
18
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
19
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
20
+ if (kind === "accessor") {
21
+ if (result === void 0) continue;
22
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
23
+ if (_ = accept(result.get)) descriptor.get = _;
24
+ if (_ = accept(result.set)) descriptor.set = _;
25
+ if (_ = accept(result.init)) initializers.unshift(_);
93
26
  }
94
- throw new Error(`Unhandled drawing ${draw}`);
95
- }
96
- pin_defs(defs) {
97
- if (!defs)
98
- return;
99
- return defs.map((it) => this.pin_def(it)).join(SCOPE_END);
100
- }
101
- pin_def(def) {
102
- return `(pin ${electronics_model_1.READABLE_ELECTRICAL_PINTYPE[def.type]} ${def.shape}
103
- ${this.at(def.at)}
104
- (length ${def.length})
105
- (name "${def.name.text}"
106
- ${this.effects(def.name.effects)}
107
- )
108
- (number "${def.number.text}"
109
- ${this.effects(def.number.effects)}
110
- )
111
- )`;
112
- }
113
- label(label) {
114
- return ` (${label.label_type} "${label.text}"
115
- ${this.at(label.at)}
116
- ${this.fields_autoplaced()}
117
- ${this.effects(label.effects)}
118
- ${this.uuid(label.uuid)}
119
- )`;
120
- }
121
- unit(c) {
122
- return `(unit ${c})`;
123
- }
124
- sch_symbol(sch_symbol) {
125
- return `(symbol
126
- ${this.lib_id(sch_symbol.lib_id)}
127
- ${this.at(sch_symbol.at)}
128
- ${this.unit(sch_symbol.unit)}
129
- ${this.booleans(sch_symbol)}
130
- ${this.fields(sch_symbol.properties)}
131
- ${sch_symbol.pins.map((pin) => this.sch_symbol_pin(pin)).join(SCOPE_START)}
132
- )`;
133
- }
134
- lib_id(id) {
135
- if (!id)
136
- return;
137
- return `(lib_id "${id}")`;
138
- }
139
- sch_symbol_pin(pin) {
140
- return `(pin "${pin.number}" ${this.uuid(pin.uuid)})`;
141
- }
142
- sch_sheet(sheet) {
143
- return `(sheet
144
- ${this.at(sheet.at)}
145
- ${this.size(sheet.size)}
146
- ${this.fields_autoplaced()}
147
- ${this.stroke(sheet.stroke)}
148
- ${this.fill(sheet.fill)}
149
- ${this.uuid(sheet.uuid)}
150
- ${this.fields(sheet.fields)}
151
- ${sheet.pins.map((sheet_pin) => this.sch_sheet_pin(sheet_pin)).join(SCOPE_START)}
152
- )`;
153
- }
154
- sch_sheet_pin(sheet_pin) {
155
- return `(pin "${sheet_pin.text}" ${sheet_pin.shape}
156
- ${this.at(sheet_pin.at)}
157
- ${this.effects(sheet_pin.effects)}
158
- ${this.uuid(sheet_pin.uuid)}
159
- )`;
160
- }
161
- at(pos) {
162
- return `(at ${pos.position.x} ${pos.position.y} ${pos.rotation === undefined ? '' : pos.rotation})`;
163
- }
164
- uuid(id) {
165
- return `(uuid "${id}")`;
166
- }
167
- effects(e) {
168
- return `(effects
169
- (font
170
- (size ${e.font.size.x} ${e.font.size.y})
171
- )${this.justify(e.justify)}${e.hide ? '(hide yes)' : ''}
172
- )`;
173
- }
174
- justify(justify) {
175
- if (!justify)
176
- return;
177
- return `(justify ${justify.horizontal} ${justify.vertical})`;
178
- }
179
- booleans(it) {
180
- if (typeof it !== 'object' || !it)
181
- return;
182
- const res = [];
183
- for (const [k, v] of Object.entries(it)) {
184
- if (typeof v === 'boolean' && !IGNORE_BOOLEANS.has(k))
185
- res.push(`( ${k} ${v ? 'yes' : 'no'} )`);
27
+ else if (_ = accept(result)) {
28
+ if (kind === "field") initializers.unshift(_);
29
+ else descriptor[key] = _;
186
30
  }
187
- return res.join(SCOPE_START);
188
- }
189
- fields(fields) {
190
- if (!fields)
191
- return;
192
- return fields.map((f) => this.field(f)).join(SCOPE_START);
193
31
  }
194
- field(field) {
195
- return `(property "${field.name}" "${field.text}"
196
- ${this.at(field.at)}
197
- ${this.effects(field.effects)}
198
- )`;
199
- }
200
- fill(f) {
201
- if (!f)
202
- return;
203
- return `(fill${f.type ? ` (type ${f.type})` : ''} ${this.color(f.color)})`;
204
- }
205
- size(s) {
206
- return `(size ${s.x} ${s.y})`;
207
- }
208
- fields_autoplaced() {
209
- return '(fields_autoplaced yes)';
210
- }
211
- stroke(s) {
212
- if (!s)
213
- return;
214
- return `(stroke
215
- (width ${s.width})
216
- (type ${s.type})
217
- ${this.color(s.color)}
218
- )`;
32
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
33
+ done = true;
34
+ };
35
+ var __values = (this && this.__values) || function(o) {
36
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
37
+ if (m) return m.call(o);
38
+ if (o && typeof o.length === "number") return {
39
+ next: function () {
40
+ if (o && i >= o.length) o = void 0;
41
+ return { value: o && o[i++], done: !o };
42
+ }
43
+ };
44
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
45
+ };
46
+ var __read = (this && this.__read) || function (o, n) {
47
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
48
+ if (!m) return o;
49
+ var i = m.call(o), r, ar = [], e;
50
+ try {
51
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
219
52
  }
220
- color(c) {
221
- if (!c)
222
- return;
223
- return `(color ${c.r} ${c.g} ${c.b} ${c.a})`;
53
+ catch (error) { e = { error: error }; }
54
+ finally {
55
+ try {
56
+ if (r && !r.done && (m = i["return"])) m.call(i);
57
+ }
58
+ finally { if (e) throw e.error; }
224
59
  }
225
- }
226
- exports.SCHEMATIC_PRINTER = SCHEMATIC_PRINTER;
60
+ return ar;
61
+ };
62
+ import { READABLE_ELECTRICAL_PINTYPE } from '@modular-circuit/electronics-model';
63
+ import { SHAPE_T, } from '@modular-circuit/ir';
64
+ import { gen_uuid } from '@modular-circuit/utils';
65
+ import { GENERATOR_NAME, GENERATOR_VERSION, PAPER, SCH_VERSION, filterNullOrUndefined } from '../../../utils';
66
+ var SCOPE_START = '\n\t';
67
+ var SPACE = ' ';
68
+ var SCOPE_END = '\n';
69
+ var IGNORE_BOOLEANS = new Set(['power']);
70
+ var SCHEMATIC_PRINTER = function () {
71
+ var _a;
72
+ var _instanceExtraInitializers = [];
73
+ var _power_decorators;
74
+ var _pin_display_opt_decorators;
75
+ var _lib_children_decorators;
76
+ var _drawings_decorators;
77
+ var _pin_defs_decorators;
78
+ var _unit_decorators;
79
+ var _lib_id_decorators;
80
+ var _justify_decorators;
81
+ var _fields_decorators;
82
+ var _fill_decorators;
83
+ var _stroke_decorators;
84
+ var _color_decorators;
85
+ return _a = /** @class */ (function () {
86
+ function SCHEMATIC_PRINTER() {
87
+ __runInitializers(this, _instanceExtraInitializers);
88
+ }
89
+ SCHEMATIC_PRINTER.prototype.schematic = function (sch) {
90
+ var _this = this;
91
+ var lib_symbols = (function () {
92
+ var _b, _c;
93
+ if (!((_b = sch.lib_symbols) === null || _b === void 0 ? void 0 : _b.symbols.length))
94
+ return '';
95
+ return "".concat(SCOPE_START, "(lib_symbols ").concat((_c = sch.lib_symbols) === null || _c === void 0 ? void 0 : _c.symbols.map(function (it) { return _this.lib_symbol(it); }).join("".concat(SCOPE_END)), "\t)");
96
+ })();
97
+ var labels = (function () {
98
+ var _b;
99
+ if (!((_b = sch.labels) === null || _b === void 0 ? void 0 : _b.length))
100
+ return '';
101
+ return "".concat(SCOPE_START).concat(sch.labels.map(function (it) { return _this.label(it); }).join("".concat(SCOPE_END)));
102
+ })();
103
+ var sch_sheets = (function () {
104
+ var _b;
105
+ if (!((_b = sch.sheets) === null || _b === void 0 ? void 0 : _b.length))
106
+ return '';
107
+ return "".concat(SCOPE_START).concat(sch.sheets.map(function (it) { return _this.sch_sheet(it); }).join("".concat(SCOPE_END)), "\t");
108
+ })();
109
+ var sch_symbols = (function () {
110
+ var _b;
111
+ if (!((_b = sch.symbols) === null || _b === void 0 ? void 0 : _b.length))
112
+ return '';
113
+ return "".concat(SCOPE_START).concat(sch.symbols.map(function (it) { return _this.sch_symbol(it); }).join("".concat(SCOPE_END)), "\t");
114
+ })();
115
+ return "\n(kicad_sch\n (version ".concat(SCH_VERSION, ")\n (generator \"").concat(GENERATOR_NAME, "\")\n (generator_version \"").concat(GENERATOR_VERSION, "\")\n (uuid \"").concat(gen_uuid(), "\")\n (paper \"").concat(PAPER, "\")").concat(lib_symbols).concat(labels).concat(sch_symbols).concat(sch_sheets, "\n)\n ");
116
+ };
117
+ SCHEMATIC_PRINTER.prototype.power = function (power) {
118
+ return power ? '(power)' : '';
119
+ };
120
+ SCHEMATIC_PRINTER.prototype.pin_display_opt = function (opt) {
121
+ if (!opt)
122
+ return;
123
+ var offset = function (off) { return (off ? "(offset ".concat(off, ")") : ''); };
124
+ var hide = function (h) { return (h ? 'hide' : ''); };
125
+ var pin_numbers = "".concat(opt.pin_numbers ? "(pin_numbers ".concat(offset(opt.pin_numbers.offset), " ").concat(hide(opt.pin_numbers.hide), ")") : '');
126
+ var pin_names = "".concat(opt.pin_names ? "(pin_names ".concat(offset(opt.pin_names.offset), " ").concat(hide(opt.pin_names.hide), ")") : '');
127
+ return "".concat(pin_numbers, "\n ").concat(pin_names, "\n ");
128
+ };
129
+ SCHEMATIC_PRINTER.prototype.lib_symbol = function (lib_symbol) {
130
+ return "\n (symbol \"".concat(lib_symbol.name, "\" ").concat(this.power(lib_symbol.power), "\n ").concat(this.pin_display_opt(lib_symbol), "\n ").concat(this.booleans(lib_symbol), "\n ").concat(this.fields(lib_symbol.properties), "\n ").concat(this.pin_defs(lib_symbol.pins), "\n ").concat(this.drawings(lib_symbol.drawings), "\n ").concat(this.lib_children(lib_symbol.children), "\n)\n ");
131
+ };
132
+ SCHEMATIC_PRINTER.prototype.lib_children = function (libs) {
133
+ var _this = this;
134
+ if (!libs)
135
+ return '';
136
+ return libs.map(function (i) { return _this.lib_symbol(i); }).join(SCOPE_END);
137
+ };
138
+ SCHEMATIC_PRINTER.prototype.pts = function (points) {
139
+ return "(pts ".concat(points.map(function (i) { return "(xy ".concat(i.x, " ").concat(i.y, " )"); }).join(SPACE), ")");
140
+ };
141
+ SCHEMATIC_PRINTER.prototype.drawings = function (draws) {
142
+ var _this = this;
143
+ if (!draws)
144
+ return;
145
+ return draws.map(function (i) { return _this.drawing(i); }).join(SCOPE_END);
146
+ };
147
+ SCHEMATIC_PRINTER.prototype.drawing = function (draw) {
148
+ if (!('shape' in draw))
149
+ throw new Error("Unhandled drawing ".concat(draw));
150
+ switch (draw.shape) {
151
+ case SHAPE_T.POLY:
152
+ return "(polyline\n ".concat(this.pts(draw.pts), "\n ").concat(this.stroke(draw.stroke), "\n ").concat(this.fill(draw.fill), "\n\t\t\t\t)");
153
+ }
154
+ throw new Error("Unhandled drawing ".concat(draw));
155
+ };
156
+ SCHEMATIC_PRINTER.prototype.pin_defs = function (defs) {
157
+ var _this = this;
158
+ if (!defs)
159
+ return;
160
+ return defs.map(function (it) { return _this.pin_def(it); }).join(SCOPE_END);
161
+ };
162
+ SCHEMATIC_PRINTER.prototype.pin_def = function (def) {
163
+ return "(pin ".concat(READABLE_ELECTRICAL_PINTYPE[def.type], " ").concat(def.shape, "\n\t\t\t\t\t").concat(this.at(def.at), "\n\t\t\t\t\t(length ").concat(def.length, ")\n\t\t\t\t\t(name \"").concat(def.name.text, "\"\n ").concat(this.effects(def.name.effects), "\n\t\t\t\t\t)\n\t\t\t\t\t(number \"").concat(def.number.text, "\"\n ").concat(this.effects(def.number.effects), "\n\t\t\t\t\t)\n\t\t\t\t)");
164
+ };
165
+ SCHEMATIC_PRINTER.prototype.label = function (label) {
166
+ return "\t(".concat(label.label_type, " \"").concat(label.text, "\"\n\t\t").concat(this.at(label.at), "\n ").concat(this.fields_autoplaced(), "\n ").concat(this.effects(label.effects), "\n\t\t").concat(this.uuid(label.uuid), "\n\t)");
167
+ };
168
+ SCHEMATIC_PRINTER.prototype.unit = function (c) {
169
+ return "(unit ".concat(c, ")");
170
+ };
171
+ SCHEMATIC_PRINTER.prototype.sch_symbol = function (sch_symbol) {
172
+ var _this = this;
173
+ return "(symbol\n\t\t".concat(this.lib_id(sch_symbol.lib_id), "\n\t\t").concat(this.at(sch_symbol.at), "\n\t\t").concat(this.unit(sch_symbol.unit), "\n ").concat(this.booleans(sch_symbol), "\n\t\t").concat(this.fields(sch_symbol.properties), "\n ").concat(sch_symbol.pins.map(function (pin) { return _this.sch_symbol_pin(pin); }).join(SCOPE_START), "\n\t)");
174
+ };
175
+ SCHEMATIC_PRINTER.prototype.lib_id = function (id) {
176
+ if (!id)
177
+ return;
178
+ return "(lib_id \"".concat(id, "\")");
179
+ };
180
+ SCHEMATIC_PRINTER.prototype.sch_symbol_pin = function (pin) {
181
+ return "(pin \"".concat(pin.number, "\" ").concat(this.uuid(pin.uuid), ")");
182
+ };
183
+ SCHEMATIC_PRINTER.prototype.sch_sheet = function (sheet) {
184
+ var _this = this;
185
+ return "(sheet \n ".concat(this.at(sheet.at), "\n ").concat(this.size(sheet.size), "\n ").concat(this.fields_autoplaced(), "\n ").concat(this.stroke(sheet.stroke), "\n ").concat(this.fill(sheet.fill), "\n ").concat(this.uuid(sheet.uuid), "\n ").concat(this.fields(sheet.fields), "\n ").concat(sheet.pins.map(function (sheet_pin) { return _this.sch_sheet_pin(sheet_pin); }).join(SCOPE_START), "\n )");
186
+ };
187
+ SCHEMATIC_PRINTER.prototype.sch_sheet_pin = function (sheet_pin) {
188
+ return "(pin \"".concat(sheet_pin.text, "\" ").concat(sheet_pin.shape, "\n\t\t\t").concat(this.at(sheet_pin.at), "\n ").concat(this.effects(sheet_pin.effects), "\n\t\t\t").concat(this.uuid(sheet_pin.uuid), "\n\t\t)");
189
+ };
190
+ SCHEMATIC_PRINTER.prototype.at = function (pos) {
191
+ return "(at ".concat(pos.position.x, " ").concat(pos.position.y, " ").concat(pos.rotation === undefined ? '' : pos.rotation, ")");
192
+ };
193
+ SCHEMATIC_PRINTER.prototype.uuid = function (id) {
194
+ return "(uuid \"".concat(id, "\")");
195
+ };
196
+ SCHEMATIC_PRINTER.prototype.effects = function (e) {
197
+ return "(effects\n (font\n (size ".concat(e.font.size.x, " ").concat(e.font.size.y, ")\n )").concat(this.justify(e.justify)).concat(e.hide ? '(hide yes)' : '', "\n )");
198
+ };
199
+ SCHEMATIC_PRINTER.prototype.justify = function (justify) {
200
+ if (!justify)
201
+ return;
202
+ return "(justify ".concat(justify.horizontal, " ").concat(justify.vertical, ")");
203
+ };
204
+ SCHEMATIC_PRINTER.prototype.booleans = function (it) {
205
+ var e_1, _b;
206
+ if (typeof it !== 'object' || !it)
207
+ return;
208
+ var res = [];
209
+ try {
210
+ for (var _c = __values(Object.entries(it)), _d = _c.next(); !_d.done; _d = _c.next()) {
211
+ var _e = __read(_d.value, 2), k = _e[0], v = _e[1];
212
+ if (typeof v === 'boolean' && !IGNORE_BOOLEANS.has(k))
213
+ res.push("( ".concat(k, " ").concat(v ? 'yes' : 'no', " )"));
214
+ }
215
+ }
216
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
217
+ finally {
218
+ try {
219
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
220
+ }
221
+ finally { if (e_1) throw e_1.error; }
222
+ }
223
+ return res.join(SCOPE_START);
224
+ };
225
+ SCHEMATIC_PRINTER.prototype.fields = function (fields) {
226
+ var _this = this;
227
+ if (!fields)
228
+ return;
229
+ return fields.map(function (f) { return _this.field(f); }).join(SCOPE_START);
230
+ };
231
+ SCHEMATIC_PRINTER.prototype.field = function (field) {
232
+ return "(property \"".concat(field.name, "\" \"").concat(field.text, "\"\n\t\t\t").concat(this.at(field.at), "\n ").concat(this.effects(field.effects), "\n\t\t)");
233
+ };
234
+ SCHEMATIC_PRINTER.prototype.fill = function (f) {
235
+ if (!f)
236
+ return;
237
+ return "(fill".concat(f.type ? " (type ".concat(f.type, ")") : '', " ").concat(this.color(f.color), ")");
238
+ };
239
+ SCHEMATIC_PRINTER.prototype.size = function (s) {
240
+ return "(size ".concat(s.x, " ").concat(s.y, ")");
241
+ };
242
+ SCHEMATIC_PRINTER.prototype.fields_autoplaced = function () {
243
+ return '(fields_autoplaced yes)';
244
+ };
245
+ SCHEMATIC_PRINTER.prototype.stroke = function (s) {
246
+ if (!s)
247
+ return;
248
+ return "(stroke\n\t\t\t(width ".concat(s.width, ")\n\t\t\t(type ").concat(s.type, ")\n ").concat(this.color(s.color), "\n\t\t)");
249
+ };
250
+ SCHEMATIC_PRINTER.prototype.color = function (c) {
251
+ if (!c)
252
+ return;
253
+ return "(color ".concat(c.r, " ").concat(c.g, " ").concat(c.b, " ").concat(c.a, ")");
254
+ };
255
+ return SCHEMATIC_PRINTER;
256
+ }()),
257
+ (function () {
258
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
259
+ _power_decorators = [filterNullOrUndefined];
260
+ _pin_display_opt_decorators = [filterNullOrUndefined];
261
+ _lib_children_decorators = [filterNullOrUndefined];
262
+ _drawings_decorators = [filterNullOrUndefined];
263
+ _pin_defs_decorators = [filterNullOrUndefined];
264
+ _unit_decorators = [filterNullOrUndefined];
265
+ _lib_id_decorators = [filterNullOrUndefined];
266
+ _justify_decorators = [filterNullOrUndefined];
267
+ _fields_decorators = [filterNullOrUndefined];
268
+ _fill_decorators = [filterNullOrUndefined];
269
+ _stroke_decorators = [filterNullOrUndefined];
270
+ _color_decorators = [filterNullOrUndefined];
271
+ __esDecorate(_a, null, _power_decorators, { kind: "method", name: "power", static: false, private: false, access: { has: function (obj) { return "power" in obj; }, get: function (obj) { return obj.power; } }, metadata: _metadata }, null, _instanceExtraInitializers);
272
+ __esDecorate(_a, null, _pin_display_opt_decorators, { kind: "method", name: "pin_display_opt", static: false, private: false, access: { has: function (obj) { return "pin_display_opt" in obj; }, get: function (obj) { return obj.pin_display_opt; } }, metadata: _metadata }, null, _instanceExtraInitializers);
273
+ __esDecorate(_a, null, _lib_children_decorators, { kind: "method", name: "lib_children", static: false, private: false, access: { has: function (obj) { return "lib_children" in obj; }, get: function (obj) { return obj.lib_children; } }, metadata: _metadata }, null, _instanceExtraInitializers);
274
+ __esDecorate(_a, null, _drawings_decorators, { kind: "method", name: "drawings", static: false, private: false, access: { has: function (obj) { return "drawings" in obj; }, get: function (obj) { return obj.drawings; } }, metadata: _metadata }, null, _instanceExtraInitializers);
275
+ __esDecorate(_a, null, _pin_defs_decorators, { kind: "method", name: "pin_defs", static: false, private: false, access: { has: function (obj) { return "pin_defs" in obj; }, get: function (obj) { return obj.pin_defs; } }, metadata: _metadata }, null, _instanceExtraInitializers);
276
+ __esDecorate(_a, null, _unit_decorators, { kind: "method", name: "unit", static: false, private: false, access: { has: function (obj) { return "unit" in obj; }, get: function (obj) { return obj.unit; } }, metadata: _metadata }, null, _instanceExtraInitializers);
277
+ __esDecorate(_a, null, _lib_id_decorators, { kind: "method", name: "lib_id", static: false, private: false, access: { has: function (obj) { return "lib_id" in obj; }, get: function (obj) { return obj.lib_id; } }, metadata: _metadata }, null, _instanceExtraInitializers);
278
+ __esDecorate(_a, null, _justify_decorators, { kind: "method", name: "justify", static: false, private: false, access: { has: function (obj) { return "justify" in obj; }, get: function (obj) { return obj.justify; } }, metadata: _metadata }, null, _instanceExtraInitializers);
279
+ __esDecorate(_a, null, _fields_decorators, { kind: "method", name: "fields", static: false, private: false, access: { has: function (obj) { return "fields" in obj; }, get: function (obj) { return obj.fields; } }, metadata: _metadata }, null, _instanceExtraInitializers);
280
+ __esDecorate(_a, null, _fill_decorators, { kind: "method", name: "fill", static: false, private: false, access: { has: function (obj) { return "fill" in obj; }, get: function (obj) { return obj.fill; } }, metadata: _metadata }, null, _instanceExtraInitializers);
281
+ __esDecorate(_a, null, _stroke_decorators, { kind: "method", name: "stroke", static: false, private: false, access: { has: function (obj) { return "stroke" in obj; }, get: function (obj) { return obj.stroke; } }, metadata: _metadata }, null, _instanceExtraInitializers);
282
+ __esDecorate(_a, null, _color_decorators, { kind: "method", name: "color", static: false, private: false, access: { has: function (obj) { return "color" in obj; }, get: function (obj) { return obj.color; } }, metadata: _metadata }, null, _instanceExtraInitializers);
283
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
284
+ })(),
285
+ _a;
286
+ }();
287
+ export { SCHEMATIC_PRINTER };
@@ -1,18 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./eeschema"), exports);
18
- __exportStar(require("./pcb"), exports);
1
+ export * from './eeschema';
2
+ export * from './pcb';
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });