@tobisk/pcbs 1.0.0

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 (168) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +186 -0
  3. package/dist/src/cli/cli.d.ts +6 -0
  4. package/dist/src/cli/cli.js +87 -0
  5. package/dist/src/cli/cli.js.map +1 -0
  6. package/dist/src/cli/codegen.d.ts +25 -0
  7. package/dist/src/cli/codegen.js +170 -0
  8. package/dist/src/cli/codegen.js.map +1 -0
  9. package/dist/src/cli/commands/export.d.ts +13 -0
  10. package/dist/src/cli/commands/export.js +301 -0
  11. package/dist/src/cli/commands/export.js.map +1 -0
  12. package/dist/src/cli/commands/lib.d.ts +10 -0
  13. package/dist/src/cli/commands/lib.js +158 -0
  14. package/dist/src/cli/commands/lib.js.map +1 -0
  15. package/dist/src/cli/commands/parts.d.ts +4 -0
  16. package/dist/src/cli/commands/parts.js +104 -0
  17. package/dist/src/cli/commands/parts.js.map +1 -0
  18. package/dist/src/cli/commands/setup.d.ts +4 -0
  19. package/dist/src/cli/commands/setup.js +86 -0
  20. package/dist/src/cli/commands/setup.js.map +1 -0
  21. package/dist/src/cli/commands/synth.d.ts +4 -0
  22. package/dist/src/cli/commands/synth.js +75 -0
  23. package/dist/src/cli/commands/synth.js.map +1 -0
  24. package/dist/src/cli/commands/types.d.ts +1 -0
  25. package/dist/src/cli/commands/types.js +140 -0
  26. package/dist/src/cli/commands/types.js.map +1 -0
  27. package/dist/src/cli/commands/validate.d.ts +5 -0
  28. package/dist/src/cli/commands/validate.js +105 -0
  29. package/dist/src/cli/commands/validate.js.map +1 -0
  30. package/dist/src/cli/config.d.ts +9 -0
  31. package/dist/src/cli/config.js +80 -0
  32. package/dist/src/cli/config.js.map +1 -0
  33. package/dist/src/cli/env.d.ts +4 -0
  34. package/dist/src/cli/env.js +166 -0
  35. package/dist/src/cli/env.js.map +1 -0
  36. package/dist/src/cli/search-jlc.d.ts +0 -0
  37. package/dist/src/cli/search-jlc.js +23 -0
  38. package/dist/src/cli/search-jlc.js.map +1 -0
  39. package/dist/src/cli/synthesis.d.ts +11 -0
  40. package/dist/src/cli/synthesis.js +120 -0
  41. package/dist/src/cli/synthesis.js.map +1 -0
  42. package/dist/src/cli/utils/bom.d.ts +19 -0
  43. package/dist/src/cli/utils/bom.js +130 -0
  44. package/dist/src/cli/utils/bom.js.map +1 -0
  45. package/dist/src/cli/utils/cpl.d.ts +18 -0
  46. package/dist/src/cli/utils/cpl.js +101 -0
  47. package/dist/src/cli/utils/cpl.js.map +1 -0
  48. package/dist/src/cli/utils.d.ts +11 -0
  49. package/dist/src/cli/utils.js +136 -0
  50. package/dist/src/cli/utils.js.map +1 -0
  51. package/dist/src/generate-kicad-types.d.ts +1 -0
  52. package/dist/src/generate-kicad-types.js +137 -0
  53. package/dist/src/generate-kicad-types.js.map +1 -0
  54. package/dist/src/synth/3d/Kicad3DModel.d.ts +81 -0
  55. package/dist/src/synth/3d/Kicad3DModel.js +250 -0
  56. package/dist/src/synth/3d/Kicad3DModel.js.map +1 -0
  57. package/dist/src/synth/3d/booleans.d.ts +10 -0
  58. package/dist/src/synth/3d/booleans.js +30 -0
  59. package/dist/src/synth/3d/booleans.js.map +1 -0
  60. package/dist/src/synth/3d/fillet.d.ts +14 -0
  61. package/dist/src/synth/3d/fillet.js +47 -0
  62. package/dist/src/synth/3d/fillet.js.map +1 -0
  63. package/dist/src/synth/3d/index.d.ts +7 -0
  64. package/dist/src/synth/3d/index.js +14 -0
  65. package/dist/src/synth/3d/index.js.map +1 -0
  66. package/dist/src/synth/3d/occ-loader.d.ts +5 -0
  67. package/dist/src/synth/3d/occ-loader.js +77 -0
  68. package/dist/src/synth/3d/occ-loader.js.map +1 -0
  69. package/dist/src/synth/3d/occ.d.ts +3 -0
  70. package/dist/src/synth/3d/occ.js +31 -0
  71. package/dist/src/synth/3d/occ.js.map +1 -0
  72. package/dist/src/synth/3d/primitives.d.ts +38 -0
  73. package/dist/src/synth/3d/primitives.js +58 -0
  74. package/dist/src/synth/3d/primitives.js.map +1 -0
  75. package/dist/src/synth/3d/stepWriter.d.ts +7 -0
  76. package/dist/src/synth/3d/stepWriter.js +72 -0
  77. package/dist/src/synth/3d/stepWriter.js.map +1 -0
  78. package/dist/src/synth/3d/transforms.d.ts +18 -0
  79. package/dist/src/synth/3d/transforms.js +74 -0
  80. package/dist/src/synth/3d/transforms.js.map +1 -0
  81. package/dist/src/synth/3d/types.d.ts +54 -0
  82. package/dist/src/synth/3d/types.js +21 -0
  83. package/dist/src/synth/3d/types.js.map +1 -0
  84. package/dist/src/synth/3d/vrmlWriter.d.ts +5 -0
  85. package/dist/src/synth/3d/vrmlWriter.js +171 -0
  86. package/dist/src/synth/3d/vrmlWriter.js.map +1 -0
  87. package/dist/src/synth/Component.d.ts +67 -0
  88. package/dist/src/synth/Component.js +185 -0
  89. package/dist/src/synth/Component.js.map +1 -0
  90. package/dist/src/synth/Composable.d.ts +73 -0
  91. package/dist/src/synth/Composable.js +128 -0
  92. package/dist/src/synth/Composable.js.map +1 -0
  93. package/dist/src/synth/KicadFootprint.d.ts +97 -0
  94. package/dist/src/synth/KicadFootprint.js +312 -0
  95. package/dist/src/synth/KicadFootprint.js.map +1 -0
  96. package/dist/src/synth/KicadLibrary.d.ts +66 -0
  97. package/dist/src/synth/KicadLibrary.js +162 -0
  98. package/dist/src/synth/KicadLibrary.js.map +1 -0
  99. package/dist/src/synth/KicadSymbol.d.ts +71 -0
  100. package/dist/src/synth/KicadSymbol.js +190 -0
  101. package/dist/src/synth/KicadSymbol.js.map +1 -0
  102. package/dist/src/synth/Layout.d.ts +37 -0
  103. package/dist/src/synth/Layout.js +58 -0
  104. package/dist/src/synth/Layout.js.map +1 -0
  105. package/dist/src/synth/Markers.d.ts +35 -0
  106. package/dist/src/synth/Markers.js +48 -0
  107. package/dist/src/synth/Markers.js.map +1 -0
  108. package/dist/src/synth/Module.d.ts +56 -0
  109. package/dist/src/synth/Module.js +65 -0
  110. package/dist/src/synth/Module.js.map +1 -0
  111. package/dist/src/synth/Net.d.ts +23 -0
  112. package/dist/src/synth/Net.js +95 -0
  113. package/dist/src/synth/Net.js.map +1 -0
  114. package/dist/src/synth/Registry.d.ts +36 -0
  115. package/dist/src/synth/Registry.js +75 -0
  116. package/dist/src/synth/Registry.js.map +1 -0
  117. package/dist/src/synth/Schematic.d.ts +36 -0
  118. package/dist/src/synth/Schematic.js +51 -0
  119. package/dist/src/synth/Schematic.js.map +1 -0
  120. package/dist/src/synth/index.d.ts +21 -0
  121. package/dist/src/synth/index.js +46 -0
  122. package/dist/src/synth/index.js.map +1 -0
  123. package/dist/src/synth/kicad-types-placeholder.d.ts +6 -0
  124. package/dist/src/synth/kicad-types-placeholder.js +7 -0
  125. package/dist/src/synth/kicad-types-placeholder.js.map +1 -0
  126. package/dist/src/synth/types.d.ts +111 -0
  127. package/dist/src/synth/types.js +23 -0
  128. package/dist/src/synth/types.js.map +1 -0
  129. package/dist/src/tests/3d-model.test.d.ts +1 -0
  130. package/dist/src/tests/3d-model.test.js +282 -0
  131. package/dist/src/tests/3d-model.test.js.map +1 -0
  132. package/dist/src/tests/codegen.test.d.ts +1 -0
  133. package/dist/src/tests/codegen.test.js +80 -0
  134. package/dist/src/tests/codegen.test.js.map +1 -0
  135. package/dist/src/tests/dmx_node.test.d.ts +1 -0
  136. package/dist/src/tests/dmx_node.test.js +42 -0
  137. package/dist/src/tests/dmx_node.test.js.map +1 -0
  138. package/dist/src/tests/dnc.test.d.ts +1 -0
  139. package/dist/src/tests/dnc.test.js +100 -0
  140. package/dist/src/tests/dnc.test.js.map +1 -0
  141. package/dist/src/tests/kicad-lib.test.d.ts +1 -0
  142. package/dist/src/tests/kicad-lib.test.js +465 -0
  143. package/dist/src/tests/kicad-lib.test.js.map +1 -0
  144. package/dist/src/tests/layout.test.d.ts +1 -0
  145. package/dist/src/tests/layout.test.js +92 -0
  146. package/dist/src/tests/layout.test.js.map +1 -0
  147. package/dist/src/tests/migration.test.d.ts +1 -0
  148. package/dist/src/tests/migration.test.js +58 -0
  149. package/dist/src/tests/migration.test.js.map +1 -0
  150. package/dist/src/tests/net_merging.test.d.ts +1 -0
  151. package/dist/src/tests/net_merging.test.js +97 -0
  152. package/dist/src/tests/net_merging.test.js.map +1 -0
  153. package/dist/src/tests/occ-minimal.test.d.ts +1 -0
  154. package/dist/src/tests/occ-minimal.test.js +14 -0
  155. package/dist/src/tests/occ-minimal.test.js.map +1 -0
  156. package/dist/src/tests/placement.test.d.ts +1 -0
  157. package/dist/src/tests/placement.test.js +130 -0
  158. package/dist/src/tests/placement.test.js.map +1 -0
  159. package/dist/src/tests/synthesis.test.d.ts +1 -0
  160. package/dist/src/tests/synthesis.test.js +88 -0
  161. package/dist/src/tests/synthesis.test.js.map +1 -0
  162. package/dist/src/types/kicad-library.d.ts +6 -0
  163. package/dist/src/types/kicad-library.js +7 -0
  164. package/dist/src/types/kicad-library.js.map +1 -0
  165. package/dist/src/types/kicad-library.ts +61770 -0
  166. package/package.json +57 -0
  167. package/scripts/patch-opencascade.ts +18 -0
  168. package/scripts/wasm-stub.js +1 -0
@@ -0,0 +1,71 @@
1
+ import { FootprintName } from "./types";
2
+ export type SymbolPinType = "input" | "output" | "power_in" | "power_out" | "bidirectional" | "passive" | "unconnected";
3
+ export type SymbolPinSide = "left" | "right" | "top" | "bottom";
4
+ export type SymbolPinStyle = "line" | "inverted" | "clock" | "inverted_clock";
5
+ export interface SymbolPinOptions {
6
+ name: string;
7
+ number: string;
8
+ x: number;
9
+ y: number;
10
+ side: SymbolPinSide;
11
+ type: SymbolPinType;
12
+ style?: SymbolPinStyle;
13
+ length?: number;
14
+ }
15
+ export interface SymbolRectOptions {
16
+ x1: number;
17
+ y1: number;
18
+ x2: number;
19
+ y2: number;
20
+ fill?: "none" | "background";
21
+ strokeWidth?: number;
22
+ }
23
+ export interface SymbolTextOptions {
24
+ text: string;
25
+ x: number;
26
+ y: number;
27
+ fontSize?: number;
28
+ }
29
+ /**
30
+ * Programmatically builds a KiCad symbol for use in `.kicad_sym` files.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const sym = new KicadSymbol({ name: "MyChip", reference: "U", footprint: "Project_Footprints:MyChip" });
35
+ * sym.addRect({ x1: -5, y1: 5, x2: 5, y2: -5 });
36
+ * sym.addPin({ name: "VCC", number: "1", x: -7.62, y: 2.54, side: "left", type: "power_in" });
37
+ * // sym.serialize() returns the (symbol "MyChip" ...) block
38
+ * ```
39
+ */
40
+ export declare class KicadSymbol {
41
+ readonly name: string;
42
+ readonly reference: string;
43
+ readonly footprint: FootprintName;
44
+ readonly description: string;
45
+ readonly value: string;
46
+ private _pins;
47
+ private _rects;
48
+ private _texts;
49
+ constructor(options: {
50
+ name: string;
51
+ reference?: string;
52
+ footprint?: FootprintName;
53
+ description?: string;
54
+ value?: string;
55
+ });
56
+ addPin(options: SymbolPinOptions): this;
57
+ addRect(options: SymbolRectOptions): this;
58
+ addText(options: SymbolTextOptions): this;
59
+ /**
60
+ * Serialize this symbol to a KiCad S-expression string.
61
+ * Returns the complete `(symbol "Name" ...)` block including
62
+ * properties, graphical sub-symbol, and pin sub-symbol.
63
+ */
64
+ serialize(): string;
65
+ private _estimateHeight;
66
+ private _serializeProperty;
67
+ private _serializePropertyHidden;
68
+ private _serializeRect;
69
+ private _serializeText;
70
+ private _serializePin;
71
+ }
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KicadSymbol = void 0;
4
+ // ─── Pin side → rotation angle ───────────────────────────────────────
5
+ function sideToAngle(side) {
6
+ switch (side) {
7
+ case "left": return 0;
8
+ case "right": return 180;
9
+ case "top": return 90;
10
+ case "bottom": return 270;
11
+ }
12
+ }
13
+ // ─── Class ───────────────────────────────────────────────────────────
14
+ /**
15
+ * Programmatically builds a KiCad symbol for use in `.kicad_sym` files.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const sym = new KicadSymbol({ name: "MyChip", reference: "U", footprint: "Project_Footprints:MyChip" });
20
+ * sym.addRect({ x1: -5, y1: 5, x2: 5, y2: -5 });
21
+ * sym.addPin({ name: "VCC", number: "1", x: -7.62, y: 2.54, side: "left", type: "power_in" });
22
+ * // sym.serialize() returns the (symbol "MyChip" ...) block
23
+ * ```
24
+ */
25
+ class KicadSymbol {
26
+ constructor(options) {
27
+ this._pins = [];
28
+ this._rects = [];
29
+ this._texts = [];
30
+ this.name = options.name;
31
+ this.reference = options.reference ?? "U";
32
+ this.footprint = options.footprint ?? "DNC";
33
+ this.description = options.description ?? "";
34
+ this.value = options.value ?? options.name;
35
+ }
36
+ // ── Builder methods ────────────────────────────────────────────────
37
+ addPin(options) {
38
+ this._pins.push({
39
+ name: options.name,
40
+ number: options.number,
41
+ x: options.x,
42
+ y: options.y,
43
+ rotation: sideToAngle(options.side),
44
+ type: options.type,
45
+ style: options.style ?? "line",
46
+ length: options.length ?? 2.54,
47
+ });
48
+ return this;
49
+ }
50
+ addRect(options) {
51
+ this._rects.push({
52
+ x1: options.x1,
53
+ y1: options.y1,
54
+ x2: options.x2,
55
+ y2: options.y2,
56
+ fill: options.fill ?? "none",
57
+ strokeWidth: options.strokeWidth ?? 0,
58
+ });
59
+ return this;
60
+ }
61
+ addText(options) {
62
+ this._texts.push({
63
+ text: options.text,
64
+ x: options.x,
65
+ y: options.y,
66
+ fontSize: options.fontSize ?? 1.27,
67
+ });
68
+ return this;
69
+ }
70
+ // ── Serialization ──────────────────────────────────────────────────
71
+ /**
72
+ * Serialize this symbol to a KiCad S-expression string.
73
+ * Returns the complete `(symbol "Name" ...)` block including
74
+ * properties, graphical sub-symbol, and pin sub-symbol.
75
+ */
76
+ serialize() {
77
+ const parts = [];
78
+ parts.push(`\t(symbol "${this.name}"`);
79
+ parts.push(`\t\t(exclude_from_sim no)`);
80
+ parts.push(`\t\t(in_bom yes)`);
81
+ parts.push(`\t\t(on_board yes)`);
82
+ // Properties
83
+ parts.push(this._serializeProperty("Reference", this.reference, 0, -this._estimateHeight() - 2));
84
+ parts.push(this._serializeProperty("Value", this.value, 0, -this._estimateHeight()));
85
+ if (this.footprint) {
86
+ parts.push(this._serializePropertyHidden("Footprint", `Project_Footprints:${this.name}`));
87
+ }
88
+ parts.push(this._serializePropertyHidden("Datasheet", ""));
89
+ parts.push(this._serializePropertyHidden("Description", this.description));
90
+ // Graphical sub-symbol: <Name>_0_1 — contains rectangles
91
+ if (this._rects.length > 0) {
92
+ parts.push(`\t\t(symbol "${this.name}_0_1"`);
93
+ for (const rect of this._rects) {
94
+ parts.push(this._serializeRect(rect));
95
+ }
96
+ parts.push(`\t\t)`);
97
+ }
98
+ // Pin sub-symbol: <Name>_1_1 — contains text and pins
99
+ parts.push(`\t\t(symbol "${this.name}_1_1"`);
100
+ for (const text of this._texts) {
101
+ parts.push(this._serializeText(text));
102
+ }
103
+ for (const pin of this._pins) {
104
+ parts.push(this._serializePin(pin));
105
+ }
106
+ parts.push(`\t\t)`);
107
+ parts.push(`\t\t(embedded_fonts no)`);
108
+ parts.push(`\t)`);
109
+ return parts.join("\n");
110
+ }
111
+ // ── Private helpers ────────────────────────────────────────────────
112
+ _estimateHeight() {
113
+ // Rough estimate for property positioning
114
+ if (this._rects.length > 0) {
115
+ return Math.max(...this._rects.map(r => Math.abs(r.y2 - r.y1)));
116
+ }
117
+ return this._pins.length * 2.54;
118
+ }
119
+ _serializeProperty(key, value, x, y) {
120
+ let s = `\t\t(property "${key}" "${value}"\n`;
121
+ s += `\t\t\t(at ${x} ${y} 0)\n`;
122
+ s += `\t\t\t(effects\n`;
123
+ s += `\t\t\t\t(font\n`;
124
+ s += `\t\t\t\t\t(size 1.27 1.27)\n`;
125
+ s += `\t\t\t\t)\n`;
126
+ s += `\t\t\t)\n`;
127
+ s += `\t\t)`;
128
+ return s;
129
+ }
130
+ _serializePropertyHidden(key, value) {
131
+ let s = `\t\t(property "${key}" "${value}"\n`;
132
+ s += `\t\t\t(at 0 0 0)\n`;
133
+ s += `\t\t\t(effects\n`;
134
+ s += `\t\t\t\t(font\n`;
135
+ s += `\t\t\t\t\t(size 1.27 1.27)\n`;
136
+ s += `\t\t\t\t)\n`;
137
+ s += `\t\t\t\t(hide yes)\n`;
138
+ s += `\t\t\t)\n`;
139
+ s += `\t\t)`;
140
+ return s;
141
+ }
142
+ _serializeRect(rect) {
143
+ let s = `\t\t\t(rectangle\n`;
144
+ s += `\t\t\t\t(start ${rect.x1} ${rect.y1})\n`;
145
+ s += `\t\t\t\t(end ${rect.x2} ${rect.y2})\n`;
146
+ s += `\t\t\t\t(stroke\n`;
147
+ s += `\t\t\t\t\t(width ${rect.strokeWidth})\n`;
148
+ s += `\t\t\t\t\t(type default)\n`;
149
+ s += `\t\t\t\t)\n`;
150
+ s += `\t\t\t\t(fill\n`;
151
+ s += `\t\t\t\t\t(type ${rect.fill})\n`;
152
+ s += `\t\t\t\t)\n`;
153
+ s += `\t\t\t)`;
154
+ return s;
155
+ }
156
+ _serializeText(text) {
157
+ let s = `\t\t\t(text "${text.text}"\n`;
158
+ s += `\t\t\t\t(at ${text.x} ${text.y} 0)\n`;
159
+ s += `\t\t\t\t(effects\n`;
160
+ s += `\t\t\t\t\t(font\n`;
161
+ s += `\t\t\t\t\t\t(size ${text.fontSize} ${text.fontSize})\n`;
162
+ s += `\t\t\t\t\t)\n`;
163
+ s += `\t\t\t\t)\n`;
164
+ s += `\t\t\t)`;
165
+ return s;
166
+ }
167
+ _serializePin(pin) {
168
+ let s = `\t\t\t(pin ${pin.type} ${pin.style}\n`;
169
+ s += `\t\t\t\t(at ${pin.x} ${pin.y} ${pin.rotation})\n`;
170
+ s += `\t\t\t\t(length ${pin.length})\n`;
171
+ s += `\t\t\t\t(name "${pin.name}"\n`;
172
+ s += `\t\t\t\t\t(effects\n`;
173
+ s += `\t\t\t\t\t\t(font\n`;
174
+ s += `\t\t\t\t\t\t\t(size 1.27 1.27)\n`;
175
+ s += `\t\t\t\t\t\t)\n`;
176
+ s += `\t\t\t\t\t)\n`;
177
+ s += `\t\t\t\t)\n`;
178
+ s += `\t\t\t\t(number "${pin.number}"\n`;
179
+ s += `\t\t\t\t\t(effects\n`;
180
+ s += `\t\t\t\t\t\t(font\n`;
181
+ s += `\t\t\t\t\t\t\t(size 1.27 1.27)\n`;
182
+ s += `\t\t\t\t\t\t)\n`;
183
+ s += `\t\t\t\t\t)\n`;
184
+ s += `\t\t\t\t)\n`;
185
+ s += `\t\t\t)`;
186
+ return s;
187
+ }
188
+ }
189
+ exports.KicadSymbol = KicadSymbol;
190
+ //# sourceMappingURL=KicadSymbol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KicadSymbol.js","sourceRoot":"","sources":["../../../src/synth/KicadSymbol.ts"],"names":[],"mappings":";;;AA+DA,wEAAwE;AAExE,SAAS,WAAW,CAAC,IAAmB;IACpC,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;QACtB,KAAK,OAAO,CAAC,CAAC,OAAO,GAAG,CAAC;QACzB,KAAK,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;QACtB,KAAK,QAAQ,CAAC,CAAC,OAAO,GAAG,CAAC;IAC9B,CAAC;AACL,CAAC;AAED,wEAAwE;AAExE;;;;;;;;;;GAUG;AACH,MAAa,WAAW;IAWpB,YAAY,OAMX;QAVO,UAAK,GAAa,EAAE,CAAC;QACrB,WAAM,GAAc,EAAE,CAAC;QACvB,WAAM,GAAc,EAAE,CAAC;QAS3B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,GAAG,CAAC;QAC1C,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;QAC5C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;QAC7C,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC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@@
1
+ import { ILayout, LayoutItem } from "./types";
2
+ /**
3
+ * Base class for all layouts.
4
+ *
5
+ * Layouts are used to programmatically arrange components and composables.
6
+ */
7
+ export declare abstract class Layout implements ILayout {
8
+ /**
9
+ * Apply the layout to a list of items.
10
+ * This method directly modifies the `schematicPosition` of each item.
11
+ */
12
+ abstract apply(items: LayoutItem[]): void;
13
+ }
14
+ /**
15
+ * Arranges items horizontally.
16
+ */
17
+ export declare class HBoxLayout extends Layout {
18
+ private options;
19
+ constructor(options?: {
20
+ spacing?: number;
21
+ x?: number;
22
+ y?: number;
23
+ });
24
+ apply(items: LayoutItem[]): void;
25
+ }
26
+ /**
27
+ * Arranges items vertically.
28
+ */
29
+ export declare class VBoxLayout extends Layout {
30
+ private options;
31
+ constructor(options?: {
32
+ spacing?: number;
33
+ x?: number;
34
+ y?: number;
35
+ });
36
+ apply(items: LayoutItem[]): void;
37
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VBoxLayout = exports.HBoxLayout = exports.Layout = void 0;
4
+ /**
5
+ * Base class for all layouts.
6
+ *
7
+ * Layouts are used to programmatically arrange components and composables.
8
+ */
9
+ class Layout {
10
+ }
11
+ exports.Layout = Layout;
12
+ /**
13
+ * Arranges items horizontally.
14
+ */
15
+ class HBoxLayout extends Layout {
16
+ constructor(options = {}) {
17
+ super();
18
+ this.options = options;
19
+ }
20
+ apply(items) {
21
+ const spacing = this.options.spacing ?? 50; // Default spacing in mils/units
22
+ let currentX = this.options.x ?? 0;
23
+ const currentY = this.options.y ?? 0;
24
+ for (const item of items) {
25
+ item.schematicPosition = {
26
+ x: currentX,
27
+ y: currentY,
28
+ rotation: item.schematicPosition?.rotation ?? 0
29
+ };
30
+ currentX += spacing;
31
+ }
32
+ }
33
+ }
34
+ exports.HBoxLayout = HBoxLayout;
35
+ /**
36
+ * Arranges items vertically.
37
+ */
38
+ class VBoxLayout extends Layout {
39
+ constructor(options = {}) {
40
+ super();
41
+ this.options = options;
42
+ }
43
+ apply(items) {
44
+ const spacing = this.options.spacing ?? 50;
45
+ const currentX = this.options.x ?? 0;
46
+ let currentY = this.options.y ?? 0;
47
+ for (const item of items) {
48
+ item.schematicPosition = {
49
+ x: currentX,
50
+ y: currentY,
51
+ rotation: item.schematicPosition?.rotation ?? 0
52
+ };
53
+ currentY += spacing;
54
+ }
55
+ }
56
+ }
57
+ exports.VBoxLayout = VBoxLayout;
58
+ //# sourceMappingURL=Layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Layout.js","sourceRoot":"","sources":["../../../src/synth/Layout.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,MAAsB,MAAM;CAM3B;AAND,wBAMC;AAED;;GAEG;AACH,MAAa,UAAW,SAAQ,MAAM;IAClC,YAAoB,UAAwD,EAAE;QAC1E,KAAK,EAAE,CAAC;QADQ,YAAO,GAAP,OAAO,CAAmD;IAE9E,CAAC;IAED,KAAK,CAAC,KAAmB;QACrB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,gCAAgC;QAC5E,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;QAErC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACtB,IAAY,CAAC,iBAAiB,GAAG;gBAC9B,CAAC,EAAE,QAAQ;gBACX,CAAC,EAAE,QAAQ;gBACX,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,IAAI,CAAC;aAClD,CAAC;YACF,QAAQ,IAAI,OAAO,CAAC;QACxB,CAAC;IACL,CAAC;CACJ;AAnBD,gCAmBC;AAED;;GAEG;AACH,MAAa,UAAW,SAAQ,MAAM;IAClC,YAAoB,UAAwD,EAAE;QAC1E,KAAK,EAAE,CAAC;QADQ,YAAO,GAAP,OAAO,CAAmD;IAE9E,CAAC;IAED,KAAK,CAAC,KAAmB;QACrB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;QAEnC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACtB,IAAY,CAAC,iBAAiB,GAAG;gBAC9B,CAAC,EAAE,QAAQ;gBACX,CAAC,EAAE,QAAQ;gBACX,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,IAAI,CAAC;aAClD,CAAC;YACF,QAAQ,IAAI,OAAO,CAAC;QACxB,CAAC;IACL,CAAC;CACJ;AAnBD,gCAmBC"}
@@ -0,0 +1,35 @@
1
+ import { Component } from "./Component";
2
+ import { FootprintName } from "./types";
3
+ /**
4
+ * A special component used to mark a pin as "Do Not Connect".
5
+ *
6
+ * Usage:
7
+ * esp.pins.GPIO = new DNC(); // explicit
8
+ * esp.pins.GPIO = null; // shorthand (equivalent)
9
+ *
10
+ * If a pin is connected to DNC AND to another functional pin, an error is thrown.
11
+ */
12
+ export declare class DNC extends Component {
13
+ constructor(options?: {
14
+ ref?: string;
15
+ });
16
+ }
17
+ /**
18
+ * A TestPoint component that can be assigned directly to a pin.
19
+ *
20
+ * When assigned to a pin, it automatically connects the TestPoint's single pin
21
+ * to the target pin via an implicit net.
22
+ *
23
+ * Usage:
24
+ * esp.pins.TX2 = new TP({ ref: "TP1" });
25
+ * // Equivalent to:
26
+ * // const tp = new Component({ symbol: "Connector:TestPoint", ... });
27
+ * // esp.pins.TX2 = tp.pins[1];
28
+ */
29
+ export declare class TP extends Component {
30
+ constructor(options: {
31
+ ref: string;
32
+ footprint?: FootprintName;
33
+ description?: string;
34
+ });
35
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TP = exports.DNC = void 0;
4
+ const Component_1 = require("./Component");
5
+ /**
6
+ * A special component used to mark a pin as "Do Not Connect".
7
+ *
8
+ * Usage:
9
+ * esp.pins.GPIO = new DNC(); // explicit
10
+ * esp.pins.GPIO = null; // shorthand (equivalent)
11
+ *
12
+ * If a pin is connected to DNC AND to another functional pin, an error is thrown.
13
+ */
14
+ class DNC extends Component_1.Component {
15
+ constructor(options) {
16
+ super({
17
+ symbol: "Device:DNC",
18
+ ref: options?.ref ?? "DNC",
19
+ footprint: "DNC",
20
+ description: "Do Not Connect marker",
21
+ });
22
+ }
23
+ }
24
+ exports.DNC = DNC;
25
+ /**
26
+ * A TestPoint component that can be assigned directly to a pin.
27
+ *
28
+ * When assigned to a pin, it automatically connects the TestPoint's single pin
29
+ * to the target pin via an implicit net.
30
+ *
31
+ * Usage:
32
+ * esp.pins.TX2 = new TP({ ref: "TP1" });
33
+ * // Equivalent to:
34
+ * // const tp = new Component({ symbol: "Connector:TestPoint", ... });
35
+ * // esp.pins.TX2 = tp.pins[1];
36
+ */
37
+ class TP extends Component_1.Component {
38
+ constructor(options) {
39
+ super({
40
+ symbol: "Connector:TestPoint",
41
+ ref: options.ref,
42
+ footprint: options.footprint ?? "TestPoint:TestPoint_Pad_D2.5mm",
43
+ description: options.description,
44
+ });
45
+ }
46
+ }
47
+ exports.TP = TP;
48
+ //# sourceMappingURL=Markers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Markers.js","sourceRoot":"","sources":["../../../src/synth/Markers.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAIxC;;;;;;;;GAQG;AACH,MAAa,GAAI,SAAQ,qBAAS;IAChC,YAAY,OAA0B;QACpC,KAAK,CAAC;YACJ,MAAM,EAAE,YAAY;YACpB,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,KAAK;YAC1B,SAAS,EAAE,KAAK;YAChB,WAAW,EAAE,uBAAuB;SACrC,CAAC,CAAC;IACL,CAAC;CACF;AATD,kBASC;AAED;;;;;;;;;;;GAWG;AACH,MAAa,EAAG,SAAQ,qBAAS;IAC/B,YAAY,OAIX;QACC,KAAK,CAAC;YACJ,MAAM,EAAE,qBAAqB;YAC7B,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,gCAAgC;YAChE,WAAW,EAAE,OAAO,CAAC,WAAW;SACjC,CAAC,CAAC;IACL,CAAC;CACF;AAbD,gBAaC"}
@@ -0,0 +1,56 @@
1
+ import { ModuleOptions, PinMapFn } from "./types";
2
+ import { Component } from "./Component";
3
+ import { KicadSymbol } from "./KicadSymbol";
4
+ import { KicadFootprint } from "./KicadFootprint";
5
+ import type { Kicad3DModel } from "./3d";
6
+ /**
7
+ * A Module is a Component that represents a finished PCB module
8
+ * (e.g., an ESP32 dev board, a sensor breakout) that can be soldered
9
+ * onto the main PCB.
10
+ *
11
+ * Modules have their own symbols and footprints, which can be
12
+ * generated via the static `makeSymbol()` and `makeFootprint()` methods.
13
+ *
14
+ * Modules live in `src/module/`.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * class ESP32_ETH01 extends Module<"VCC" | "GND" | "TX" | "RX"> {
19
+ * constructor() {
20
+ * super({
21
+ * symbol: "Project_Symbols:ESP32_ETH01",
22
+ * ref: "U",
23
+ * footprint: "Project_Footprints:ESP32_ETH01",
24
+ * description: "ESP32-ETH01 WiFi+Ethernet module",
25
+ * pins: (pin) => ({
26
+ * VCC: pin(1), GND: pin(2), TX: pin(14), RX: pin(15),
27
+ * }),
28
+ * });
29
+ * }
30
+ *
31
+ * static makeSymbol(): void { ... }
32
+ * static makeFootprint(): void { ... }
33
+ * }
34
+ * ```
35
+ */
36
+ export declare class Module<PinNames extends string | number = number> extends Component<PinNames> {
37
+ constructor(options: ModuleOptions & {
38
+ pins?: PinMapFn<PinNames & string>;
39
+ });
40
+ /**
41
+ * Generate the KiCad symbol (.kicad_sym) for this module.
42
+ * Override in subclasses to define the symbol geometry and pins.
43
+ */
44
+ static makeSymbol(): KicadSymbol;
45
+ /**
46
+ * Generate the KiCad footprint (.kicad_mod) for this module.
47
+ * Override in subclasses to define the footprint pads and geometry.
48
+ */
49
+ static makeFootprint(): KicadFootprint;
50
+ /**
51
+ * Generate a 3D model for this module (optional).
52
+ * Override in subclasses to define the parametric 3D geometry.
53
+ * Return undefined to skip 3D model generation.
54
+ */
55
+ static make3DModel(): Kicad3DModel | Promise<Kicad3DModel> | undefined;
56
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Module = void 0;
4
+ const Component_1 = require("./Component");
5
+ /**
6
+ * A Module is a Component that represents a finished PCB module
7
+ * (e.g., an ESP32 dev board, a sensor breakout) that can be soldered
8
+ * onto the main PCB.
9
+ *
10
+ * Modules have their own symbols and footprints, which can be
11
+ * generated via the static `makeSymbol()` and `makeFootprint()` methods.
12
+ *
13
+ * Modules live in `src/module/`.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * class ESP32_ETH01 extends Module<"VCC" | "GND" | "TX" | "RX"> {
18
+ * constructor() {
19
+ * super({
20
+ * symbol: "Project_Symbols:ESP32_ETH01",
21
+ * ref: "U",
22
+ * footprint: "Project_Footprints:ESP32_ETH01",
23
+ * description: "ESP32-ETH01 WiFi+Ethernet module",
24
+ * pins: (pin) => ({
25
+ * VCC: pin(1), GND: pin(2), TX: pin(14), RX: pin(15),
26
+ * }),
27
+ * });
28
+ * }
29
+ *
30
+ * static makeSymbol(): void { ... }
31
+ * static makeFootprint(): void { ... }
32
+ * }
33
+ * ```
34
+ */
35
+ class Module extends Component_1.Component {
36
+ constructor(options) {
37
+ super(options);
38
+ }
39
+ /**
40
+ * Generate the KiCad symbol (.kicad_sym) for this module.
41
+ * Override in subclasses to define the symbol geometry and pins.
42
+ */
43
+ static makeSymbol() {
44
+ throw new Error(`${this.name}.makeSymbol() is not implemented. ` +
45
+ `Override this static method to generate the KiCad symbol.`);
46
+ }
47
+ /**
48
+ * Generate the KiCad footprint (.kicad_mod) for this module.
49
+ * Override in subclasses to define the footprint pads and geometry.
50
+ */
51
+ static makeFootprint() {
52
+ throw new Error(`${this.name}.makeFootprint() is not implemented. ` +
53
+ `Override this static method to generate the KiCad footprint.`);
54
+ }
55
+ /**
56
+ * Generate a 3D model for this module (optional).
57
+ * Override in subclasses to define the parametric 3D geometry.
58
+ * Return undefined to skip 3D model generation.
59
+ */
60
+ static make3DModel() {
61
+ return undefined;
62
+ }
63
+ }
64
+ exports.Module = Module;
65
+ //# sourceMappingURL=Module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Module.js","sourceRoot":"","sources":["../../../src/synth/Module.ts"],"names":[],"mappings":";;;AACA,sDAAmD;AAKnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAa,MAAkD,SAAQ,qBAAmB;IACxF,YAAY,OAA+D;QACzE,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,UAAU;QACf,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,CAAC,IAAI,oCAAoC;YAChD,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,aAAa;QAClB,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,CAAC,IAAI,uCAAuC;YACnD,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,WAAW;QAChB,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAnCD,wBAmCC"}
@@ -0,0 +1,23 @@
1
+ import { Pin, NetOptions, NetClass, PinAssignable } from "./types";
2
+ /**
3
+ * Represents an electrical net (connection) in a circuit.
4
+ *
5
+ * Nets connect component pins together. Use `tie()` to connect a pin to this net.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const vcc = new Net({ name: "VCC_3V3", class: "Power" });
10
+ * vcc.tie(component.pins.VCC);
11
+ * ```
12
+ */
13
+ export declare class Net {
14
+ readonly name: string;
15
+ readonly class: NetClass;
16
+ /** All pins connected to this net */
17
+ private _pins;
18
+ constructor(options: NetOptions);
19
+ /** Connect a pin (or another net's pin reference) to this net */
20
+ tie(pinOrNet: PinAssignable): void;
21
+ /** Get all pins connected to this net (read-only) */
22
+ get pins(): ReadonlyArray<Pin>;
23
+ }