@vessel-dsp/core 0.6.0 → 0.6.2

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 (238) hide show
  1. package/dist/editor/commands.d.ts +48 -0
  2. package/dist/editor/commands.d.ts.map +1 -0
  3. package/{src/editor/commands.ts → dist/editor/commands.js} +44 -91
  4. package/dist/editor/commands.js.map +1 -0
  5. package/dist/editor/factory.d.ts +10 -0
  6. package/dist/editor/factory.d.ts.map +1 -0
  7. package/{src/editor/factory.ts → dist/editor/factory.js} +11 -27
  8. package/dist/editor/factory.js.map +1 -0
  9. package/dist/editor/history.d.ts +29 -0
  10. package/dist/editor/history.d.ts.map +1 -0
  11. package/{src/editor/history.ts → dist/editor/history.js} +12 -42
  12. package/dist/editor/history.js.map +1 -0
  13. package/{src/editor/index.ts → dist/editor/index.d.ts} +1 -3
  14. package/dist/editor/index.d.ts.map +1 -0
  15. package/dist/editor/index.js +5 -0
  16. package/dist/editor/index.js.map +1 -0
  17. package/dist/editor/layout.d.ts +8 -0
  18. package/dist/editor/layout.d.ts.map +1 -0
  19. package/{src/editor/layout.ts → dist/editor/layout.js} +36 -90
  20. package/dist/editor/layout.js.map +1 -0
  21. package/dist/formats/circuit-json/serializer.d.ts +101 -0
  22. package/dist/formats/circuit-json/serializer.d.ts.map +1 -0
  23. package/{src/formats/circuit-json/serializer.ts → dist/formats/circuit-json/serializer.js} +352 -418
  24. package/dist/formats/circuit-json/serializer.js.map +1 -0
  25. package/dist/formats/document.d.ts +64 -0
  26. package/dist/formats/document.d.ts.map +1 -0
  27. package/{src/formats/document.ts → dist/formats/document.js} +43 -159
  28. package/dist/formats/document.js.map +1 -0
  29. package/dist/formats/interchange/parser.d.ts +3 -0
  30. package/dist/formats/interchange/parser.d.ts.map +1 -0
  31. package/{src/formats/interchange/parser.ts → dist/formats/interchange/parser.js} +157 -463
  32. package/dist/formats/interchange/parser.js.map +1 -0
  33. package/dist/formats/interchange/serializer.d.ts +9 -0
  34. package/dist/formats/interchange/serializer.d.ts.map +1 -0
  35. package/{src/formats/interchange/serializer.ts → dist/formats/interchange/serializer.js} +84 -186
  36. package/dist/formats/interchange/serializer.js.map +1 -0
  37. package/dist/formats/ltspice/catalog.d.ts +19 -0
  38. package/dist/formats/ltspice/catalog.d.ts.map +1 -0
  39. package/{src/formats/ltspice/catalog.ts → dist/formats/ltspice/catalog.js} +18 -52
  40. package/dist/formats/ltspice/catalog.js.map +1 -0
  41. package/dist/formats/ltspice/encoding.d.ts +2 -0
  42. package/dist/formats/ltspice/encoding.d.ts.map +1 -0
  43. package/{src/formats/ltspice/encoding.ts → dist/formats/ltspice/encoding.js} +17 -41
  44. package/dist/formats/ltspice/encoding.js.map +1 -0
  45. package/dist/formats/ltspice/parser.d.ts +3 -0
  46. package/dist/formats/ltspice/parser.d.ts.map +1 -0
  47. package/{src/formats/ltspice/parser.ts → dist/formats/ltspice/parser.js} +39 -141
  48. package/dist/formats/ltspice/parser.js.map +1 -0
  49. package/dist/formats/ltspice/serializer.d.ts +7 -0
  50. package/dist/formats/ltspice/serializer.d.ts.map +1 -0
  51. package/{src/formats/ltspice/serializer.ts → dist/formats/ltspice/serializer.js} +18 -45
  52. package/dist/formats/ltspice/serializer.js.map +1 -0
  53. package/dist/formats/schx/catalog.d.ts +19 -0
  54. package/dist/formats/schx/catalog.d.ts.map +1 -0
  55. package/{src/formats/schx/catalog.ts → dist/formats/schx/catalog.js} +48 -101
  56. package/dist/formats/schx/catalog.js.map +1 -0
  57. package/dist/formats/schx/parser.d.ts +3 -0
  58. package/dist/formats/schx/parser.d.ts.map +1 -0
  59. package/{src/formats/schx/parser.ts → dist/formats/schx/parser.js} +31 -86
  60. package/dist/formats/schx/parser.js.map +1 -0
  61. package/dist/formats/schx/runtime-descriptors.d.ts +3 -0
  62. package/dist/formats/schx/runtime-descriptors.d.ts.map +1 -0
  63. package/{src/formats/schx/runtime-descriptors.ts → dist/formats/schx/runtime-descriptors.js} +36 -123
  64. package/dist/formats/schx/runtime-descriptors.js.map +1 -0
  65. package/dist/formats/schx/serializer.d.ts +5 -0
  66. package/dist/formats/schx/serializer.d.ts.map +1 -0
  67. package/{src/formats/schx/serializer.ts → dist/formats/schx/serializer.js} +17 -42
  68. package/dist/formats/schx/serializer.js.map +1 -0
  69. package/dist/formats/schx/transforms.d.ts +4 -0
  70. package/dist/formats/schx/transforms.d.ts.map +1 -0
  71. package/{src/formats/schx/transforms.ts → dist/formats/schx/transforms.js} +6 -10
  72. package/dist/formats/schx/transforms.js.map +1 -0
  73. package/dist/formats/spice/parser.d.ts +3 -0
  74. package/dist/formats/spice/parser.d.ts.map +1 -0
  75. package/{src/formats/spice/parser.ts → dist/formats/spice/parser.js} +50 -96
  76. package/dist/formats/spice/parser.js.map +1 -0
  77. package/dist/formats/spice/serializer.d.ts +3 -0
  78. package/dist/formats/spice/serializer.d.ts.map +1 -0
  79. package/{src/formats/spice/serializer.ts → dist/formats/spice/serializer.js} +20 -16
  80. package/dist/formats/spice/serializer.js.map +1 -0
  81. package/dist/index.d.ts +47 -0
  82. package/dist/index.d.ts.map +1 -0
  83. package/dist/index.js +32 -0
  84. package/dist/index.js.map +1 -0
  85. package/dist/model/connectivity.d.ts +16 -0
  86. package/dist/model/connectivity.d.ts.map +1 -0
  87. package/{src/model/connectivity.ts → dist/model/connectivity.js} +28 -63
  88. package/dist/model/connectivity.js.map +1 -0
  89. package/dist/model/netlist.d.ts +24 -0
  90. package/dist/model/netlist.d.ts.map +1 -0
  91. package/{src/model/netlist.ts → dist/model/netlist.js} +42 -110
  92. package/dist/model/netlist.js.map +1 -0
  93. package/dist/model/properties.d.ts +9 -0
  94. package/dist/model/properties.d.ts.map +1 -0
  95. package/{src/model/properties.ts → dist/model/properties.js} +10 -18
  96. package/dist/model/properties.js.map +1 -0
  97. package/dist/model/quantity.d.ts +3 -0
  98. package/dist/model/quantity.d.ts.map +1 -0
  99. package/{src/model/quantity.ts → dist/model/quantity.js} +7 -30
  100. package/dist/model/quantity.js.map +1 -0
  101. package/{src/model/types.ts → dist/model/types.d.ts} +17 -196
  102. package/dist/model/types.d.ts.map +1 -0
  103. package/dist/model/types.js +10 -0
  104. package/dist/model/types.js.map +1 -0
  105. package/dist/model/validation.d.ts +32 -0
  106. package/dist/model/validation.d.ts.map +1 -0
  107. package/{src/model/validation.ts → dist/model/validation.js} +172 -653
  108. package/dist/model/validation.js.map +1 -0
  109. package/dist/model/wires.d.ts +3 -0
  110. package/dist/model/wires.d.ts.map +1 -0
  111. package/{src/model/wires.ts → dist/model/wires.js} +10 -16
  112. package/dist/model/wires.js.map +1 -0
  113. package/dist/panel/extract.d.ts +5 -0
  114. package/dist/panel/extract.d.ts.map +1 -0
  115. package/{src/panel/extract.ts → dist/panel/extract.js} +146 -235
  116. package/dist/panel/extract.js.map +1 -0
  117. package/dist/panel/index.d.ts +6 -0
  118. package/dist/panel/index.d.ts.map +1 -0
  119. package/dist/panel/index.js +5 -0
  120. package/dist/panel/index.js.map +1 -0
  121. package/dist/panel/knobs.d.ts +7 -0
  122. package/dist/panel/knobs.d.ts.map +1 -0
  123. package/{src/panel/knobs.ts → dist/panel/knobs.js} +7 -18
  124. package/dist/panel/knobs.js.map +1 -0
  125. package/dist/panel/protocol.d.ts +9 -0
  126. package/dist/panel/protocol.d.ts.map +1 -0
  127. package/{src/panel/protocol.ts → dist/panel/protocol.js} +10 -26
  128. package/dist/panel/protocol.js.map +1 -0
  129. package/{src/panel/types.ts → dist/panel/types.d.ts} +50 -89
  130. package/dist/panel/types.d.ts.map +1 -0
  131. package/dist/panel/types.js +2 -0
  132. package/dist/panel/types.js.map +1 -0
  133. package/dist/preview/bounds.d.ts +12 -0
  134. package/dist/preview/bounds.d.ts.map +1 -0
  135. package/{src/preview/bounds.ts → dist/preview/bounds.js} +15 -29
  136. package/dist/preview/bounds.js.map +1 -0
  137. package/dist/preview/box-layout.d.ts +4 -0
  138. package/dist/preview/box-layout.d.ts.map +1 -0
  139. package/{src/preview/box-layout.ts → dist/preview/box-layout.js} +2 -6
  140. package/dist/preview/box-layout.js.map +1 -0
  141. package/dist/preview/colors.d.ts +3 -0
  142. package/dist/preview/colors.d.ts.map +1 -0
  143. package/{src/preview/colors.ts → dist/preview/colors.js} +3 -5
  144. package/dist/preview/colors.js.map +1 -0
  145. package/dist/preview/hanging.d.ts +8 -0
  146. package/dist/preview/hanging.d.ts.map +1 -0
  147. package/{src/preview/hanging.ts → dist/preview/hanging.js} +9 -28
  148. package/dist/preview/hanging.js.map +1 -0
  149. package/dist/preview/junctions.d.ts +3 -0
  150. package/dist/preview/junctions.d.ts.map +1 -0
  151. package/{src/preview/junctions.ts → dist/preview/junctions.js} +9 -24
  152. package/dist/preview/junctions.js.map +1 -0
  153. package/dist/preview/label-layout.d.ts +12 -0
  154. package/dist/preview/label-layout.d.ts.map +1 -0
  155. package/{src/preview/label-layout.ts → dist/preview/label-layout.js} +15 -36
  156. package/dist/preview/label-layout.js.map +1 -0
  157. package/dist/preview/ports.d.ts +17 -0
  158. package/dist/preview/ports.d.ts.map +1 -0
  159. package/{src/preview/ports.ts → dist/preview/ports.js} +10 -37
  160. package/dist/preview/ports.js.map +1 -0
  161. package/dist/preview/renderable-wires.d.ts +3 -0
  162. package/dist/preview/renderable-wires.d.ts.map +1 -0
  163. package/{src/preview/renderable-wires.ts → dist/preview/renderable-wires.js} +12 -29
  164. package/dist/preview/renderable-wires.js.map +1 -0
  165. package/dist/preview/routing.d.ts +4 -0
  166. package/dist/preview/routing.d.ts.map +1 -0
  167. package/dist/preview/routing.js +13 -0
  168. package/dist/preview/routing.js.map +1 -0
  169. package/dist/preview/snap.d.ts +9 -0
  170. package/dist/preview/snap.d.ts.map +1 -0
  171. package/{src/preview/snap.ts → dist/preview/snap.js} +9 -31
  172. package/dist/preview/snap.js.map +1 -0
  173. package/dist/preview/symbols/svg-content.d.ts +7 -0
  174. package/dist/preview/symbols/svg-content.d.ts.map +1 -0
  175. package/{src/preview/symbols/svg-content.ts → dist/preview/symbols/svg-content.js} +3 -6
  176. package/dist/preview/symbols/svg-content.js.map +1 -0
  177. package/dist/preview/symbols.d.ts +7 -0
  178. package/dist/preview/symbols.d.ts.map +1 -0
  179. package/{src/preview/symbols.ts → dist/preview/symbols.js} +18 -43
  180. package/dist/preview/symbols.js.map +1 -0
  181. package/dist/preview/wire-chains.d.ts +4 -0
  182. package/dist/preview/wire-chains.d.ts.map +1 -0
  183. package/{src/preview/wire-chains.ts → dist/preview/wire-chains.js} +37 -37
  184. package/dist/preview/wire-chains.js.map +1 -0
  185. package/package.json +3 -3
  186. package/src/index.ts +0 -255
  187. package/src/panel/index.ts +0 -39
  188. package/src/preview/routing.ts +0 -15
  189. package/src/preview/symbols/analog-switch.svg +0 -17
  190. package/src/preview/symbols/battery.svg +0 -16
  191. package/src/preview/symbols/bbd.svg +0 -21
  192. package/src/preview/symbols/bjt-npn.svg +0 -16
  193. package/src/preview/symbols/bjt-pnp.svg +0 -17
  194. package/src/preview/symbols/capacitor-electrolytic.svg +0 -13
  195. package/src/preview/symbols/capacitor.svg +0 -12
  196. package/src/preview/symbols/current-source.svg +0 -14
  197. package/src/preview/symbols/delay-ic.svg +0 -22
  198. package/src/preview/symbols/diode-schottky.svg +0 -12
  199. package/src/preview/symbols/diode-zener.svg +0 -12
  200. package/src/preview/symbols/diode.svg +0 -13
  201. package/src/preview/symbols/flipflop.svg +0 -20
  202. package/src/preview/symbols/ground.svg +0 -12
  203. package/src/preview/symbols/ic-block.svg +0 -20
  204. package/src/preview/symbols/ic.svg +0 -19
  205. package/src/preview/symbols/inductor.svg +0 -11
  206. package/src/preview/symbols/jack-input.svg +0 -16
  207. package/src/preview/symbols/jack-output.svg +0 -16
  208. package/src/preview/symbols/jfet-junction-n.svg +0 -17
  209. package/src/preview/symbols/jfet-n.svg +0 -17
  210. package/src/preview/symbols/jfet-p.svg +0 -17
  211. package/src/preview/symbols/label.svg +0 -8
  212. package/src/preview/symbols/led.svg +0 -18
  213. package/src/preview/symbols/mosfet-n.svg +0 -21
  214. package/src/preview/symbols/mosfet-p.svg +0 -21
  215. package/src/preview/symbols/named-wire.svg +0 -11
  216. package/src/preview/symbols/opamp.svg +0 -21
  217. package/src/preview/symbols/optocoupler.svg +0 -30
  218. package/src/preview/symbols/ota.svg +0 -20
  219. package/src/preview/symbols/pentode.svg +0 -25
  220. package/src/preview/symbols/photoresistor.svg +0 -19
  221. package/src/preview/symbols/port.svg +0 -8
  222. package/src/preview/symbols/potentiometer.svg +0 -15
  223. package/src/preview/symbols/power-amp.svg +0 -20
  224. package/src/preview/symbols/rail.svg +0 -11
  225. package/src/preview/symbols/regulator.svg +0 -13
  226. package/src/preview/symbols/relay.svg +0 -20
  227. package/src/preview/symbols/resistor.svg +0 -11
  228. package/src/preview/symbols/switch-3pdt.svg +0 -32
  229. package/src/preview/symbols/switch-rotary.svg +0 -23
  230. package/src/preview/symbols/switch-spdt.svg +0 -16
  231. package/src/preview/symbols/switch-spst.svg +0 -14
  232. package/src/preview/symbols/switch-toggle.svg +0 -14
  233. package/src/preview/symbols/transformer.svg +0 -17
  234. package/src/preview/symbols/triode.svg +0 -17
  235. package/src/preview/symbols/tube-diode.svg +0 -13
  236. package/src/preview/symbols/unsupported.svg +0 -8
  237. package/src/preview/symbols/variable-resistor.svg +0 -13
  238. package/src/preview/symbols/voltage-source.svg +0 -15
@@ -0,0 +1,13 @@
1
+ export function orthogonalPath(a, b) {
2
+ if (a.x === b.x || a.y === b.y) {
3
+ return [a, b];
4
+ }
5
+ const dx = Math.abs(b.x - a.x);
6
+ const dy = Math.abs(b.y - a.y);
7
+ const corner = dx >= dy ? { x: b.x, y: a.y } : { x: a.x, y: b.y };
8
+ return [a, corner, b];
9
+ }
10
+ export function pointsToSvg(points) {
11
+ return points.map((p) => `${p.x},${p.y}`).join(' ');
12
+ }
13
+ //# sourceMappingURL=routing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routing.js","sourceRoot":"","sources":["../../src/preview/routing.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,cAAc,CAAC,CAAQ,EAAE,CAAQ;IAC7C,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7B,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAwB;IAChD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Component, Point, Wire } from '../model/types';
2
+ export declare const DEFAULT_SNAP_RADIUS = 12;
3
+ export type SnapResult = Readonly<{
4
+ origin: Point;
5
+ snappedTo: Point | null;
6
+ distance: number;
7
+ }>;
8
+ export declare function findSnap(draggedComponent: Component, candidateOrigin: Point, others: readonly Component[], radius?: number, wires?: readonly Wire[]): SnapResult;
9
+ //# sourceMappingURL=snap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snap.d.ts","sourceRoot":"","sources":["../../src/preview/snap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE7D,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAC9B,MAAM,EAAE,KAAK,CAAC;IACd,SAAS,EAAE,KAAK,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH,wBAAgB,QAAQ,CACpB,gBAAgB,EAAE,SAAS,EAC3B,eAAe,EAAE,KAAK,EACtB,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,MAAM,GAAE,MAA4B,EACpC,KAAK,GAAE,SAAS,IAAI,EAAO,GAC5B,UAAU,CA8DZ"}
@@ -1,30 +1,13 @@
1
- import type { Component, Point, Wire } from '../model/types';
2
-
3
1
  export const DEFAULT_SNAP_RADIUS = 12;
4
-
5
- export type SnapResult = Readonly<{
6
- origin: Point;
7
- snappedTo: Point | null;
8
- distance: number;
9
- }>;
10
-
11
- export function findSnap(
12
- draggedComponent: Component,
13
- candidateOrigin: Point,
14
- others: readonly Component[],
15
- radius: number = DEFAULT_SNAP_RADIUS,
16
- wires: readonly Wire[] = [],
17
- ): SnapResult {
2
+ export function findSnap(draggedComponent, candidateOrigin, others, radius = DEFAULT_SNAP_RADIUS, wires = []) {
18
3
  const dx = candidateOrigin.x - draggedComponent.origin.x;
19
4
  const dy = candidateOrigin.y - draggedComponent.origin.y;
20
5
  const draggedTerminalKeys = new Set(draggedComponent.terminals.map((t) => pointKey(t.position)));
21
-
22
- let bestDelta: Point | null = null;
6
+ let bestDelta = null;
23
7
  let bestDistance = Number.POSITIVE_INFINITY;
24
- let bestTarget: Point | null = null;
25
-
8
+ let bestTarget = null;
26
9
  for (const draggedTerminal of draggedComponent.terminals) {
27
- const projected: Point = {
10
+ const projected = {
28
11
  x: draggedTerminal.position.x + dx,
29
12
  y: draggedTerminal.position.y + dy,
30
13
  };
@@ -44,9 +27,8 @@ export function findSnap(
44
27
  }
45
28
  }
46
29
  }
47
-
48
30
  for (const draggedTerminal of draggedComponent.terminals) {
49
- const projected: Point = {
31
+ const projected = {
50
32
  x: draggedTerminal.position.x + dx,
51
33
  y: draggedTerminal.position.y + dy,
52
34
  };
@@ -66,23 +48,19 @@ export function findSnap(
66
48
  }
67
49
  }
68
50
  }
69
-
70
51
  if (bestDelta === null || bestTarget === null) {
71
52
  return { origin: candidateOrigin, snappedTo: null, distance: Number.POSITIVE_INFINITY };
72
53
  }
73
-
74
54
  return {
75
55
  origin: { x: candidateOrigin.x + bestDelta.x, y: candidateOrigin.y + bestDelta.y },
76
56
  snappedTo: bestTarget,
77
57
  distance: bestDistance,
78
58
  };
79
59
  }
80
-
81
- function wireTouchesDraggedTerminal(wire: Wire, terminalKeys: ReadonlySet<string>): boolean {
60
+ function wireTouchesDraggedTerminal(wire, terminalKeys) {
82
61
  return terminalKeys.has(pointKey(wire.endpoints[0])) || terminalKeys.has(pointKey(wire.endpoints[1]));
83
62
  }
84
-
85
- function nearestInteriorPointOnSegment(point: Point, a: Point, b: Point): Point | null {
63
+ function nearestInteriorPointOnSegment(point, a, b) {
86
64
  const dx = b.x - a.x;
87
65
  const dy = b.y - a.y;
88
66
  const lengthSq = dx * dx + dy * dy;
@@ -98,7 +76,7 @@ function nearestInteriorPointOnSegment(point: Point, a: Point, b: Point): Point
98
76
  y: a.y + dy * t,
99
77
  };
100
78
  }
101
-
102
- function pointKey(point: Point): string {
79
+ function pointKey(point) {
103
80
  return `${point.x},${point.y}`;
104
81
  }
82
+ //# sourceMappingURL=snap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snap.js","sourceRoot":"","sources":["../../src/preview/snap.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAQtC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,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC;IACnE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO;QACH,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC;QACf,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC;KAClB,CAAC;AACN,CAAC;AAED,SAAS,QAAQ,CAAC,KAAY;IAC1B,OAAO,GAAG,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC;AACnC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type SymbolContent = Readonly<{
2
+ viewBox: string;
3
+ content: string;
4
+ }>;
5
+ export declare const SYMBOL_CONTENT: Readonly<Record<string, SymbolContent>>;
6
+ export declare const SYMBOL_KEYS: readonly string[];
7
+ //# sourceMappingURL=svg-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-content.d.ts","sourceRoot":"","sources":["../../../src/preview/symbols/svg-content.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE3E,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAmDlE,CAAC;AAEF,eAAO,MAAM,WAAW,EAAkC,SAAS,MAAM,EAAE,CAAC"}
@@ -1,9 +1,6 @@
1
1
  // AUTO-GENERATED by scripts/generate-symbol-content.ts — DO NOT EDIT BY HAND.
2
2
  // Run `bun run generate:symbols` to regenerate from packages/core/src/preview/symbols/*.svg.
3
-
4
- export type SymbolContent = Readonly<{ viewBox: string; content: string }>;
5
-
6
- export const SYMBOL_CONTENT: Readonly<Record<string, SymbolContent>> = {
3
+ export const SYMBOL_CONTENT = {
7
4
  "analog-switch": { viewBox: "-25 -25 50 50", content: "<!--\n kind: analog-switch (one element of a CD4066-style bilateral switch)\n terminals: a (SVG -20,-10), b (SVG 20,-10), ctrl (SVG 0,20)\n Two contacts with a control input on the bottom — like an SPST but with electronic control.\n -->\n <g stroke-width=\"0.95\">\n <line x1=\"-20\" y1=\"-10\" x2=\"-7\" y2=\"-10\"/>\n <line x1=\"7\" y1=\"-10\" x2=\"20\" y2=\"-10\"/>\n <line x1=\"0\" y1=\"6\" x2=\"0\" y2=\"20\"/>\n </g>\n <circle cx=\"-5\" cy=\"-10\" r=\"1.5\"/>\n <circle cx=\"5\" cy=\"-10\" r=\"1.5\"/>\n <line x1=\"-5\" y1=\"-10\" x2=\"5\" y2=\"-10\" stroke-dasharray=\"2 2\"/>\n <rect x=\"-6\" y=\"0\" width=\"12\" height=\"6\" rx=\"1\"/>\n <text x=\"0\" y=\"-13\" font-size=\"3.5\" font-family=\"ui-sans-serif, system-ui, sans-serif\" fill=\"currentColor\" stroke=\"none\" text-anchor=\"middle\">SW</text>" },
8
5
  "battery": { viewBox: "-25 -25 50 50", content: "<!--\n kind: battery / DC supply\n terminals: + (SVG 0,-20), - (SVG 0,20)\n Long plate = +, short plate = -. Top lead is the + terminal.\n -->\n <g stroke-width=\"0.95\">\n <line x1=\"0\" y1=\"-20\" x2=\"0\" y2=\"-5\"/>\n <line x1=\"0\" y1=\"5\" x2=\"0\" y2=\"20\"/>\n </g>\n <line x1=\"-7\" y1=\"-5\" x2=\"7\" y2=\"-5\"/>\n <line x1=\"-3\" y1=\"-2\" x2=\"3\" y2=\"-2\"/>\n <line x1=\"-7\" y1=\"2\" x2=\"7\" y2=\"2\"/>\n <line x1=\"-3\" y1=\"5\" x2=\"3\" y2=\"5\"/>\n <text x=\"-12\" y=\"-4\" font-size=\"6\" font-family=\"ui-sans-serif, system-ui, sans-serif\" fill=\"currentColor\" stroke=\"none\">+</text>" },
9
6
  "bbd": { viewBox: "-35 -25 70 50", content: "<!--\n kind: bbd (bucket-brigade delay — MN3007 / MN3008 / MN3205 family)\n terminals: vdd (-30,-20), vgg (-30,0), vss (-30,20), cp1 (0,-20), cp2 (0,20), in (-30,10), out1 (30,-10), out2 (30,10)\n DIP-8 style rectangle, \"BBD\" label and small bucket icon on the face.\n -->\n <g stroke-width=\"0.95\">\n <line x1=\"-30\" y1=\"-20\" x2=\"-20\" y2=\"-20\"/>\n <line x1=\"-30\" y1=\"0\" x2=\"-20\" y2=\"0\"/>\n <line x1=\"-30\" y1=\"20\" x2=\"-20\" y2=\"20\"/>\n <line x1=\"-30\" y1=\"10\" x2=\"-20\" y2=\"10\"/>\n <line x1=\"0\" y1=\"-20\" x2=\"0\" y2=\"-15\"/>\n <line x1=\"0\" y1=\"15\" x2=\"0\" y2=\"20\"/>\n <line x1=\"20\" y1=\"-10\" x2=\"30\" y2=\"-10\"/>\n <line x1=\"20\" y1=\"10\" x2=\"30\" y2=\"10\"/>\n </g>\n <rect x=\"-20\" y=\"-15\" width=\"40\" height=\"30\" rx=\"2\"/>\n <circle cx=\"-17\" cy=\"-12\" r=\"1.2\" fill=\"currentColor\" stroke=\"none\"/>\n <text x=\"0\" y=\"-3\" font-size=\"6\" font-family=\"ui-sans-serif, system-ui, sans-serif\" fill=\"currentColor\" stroke=\"none\" text-anchor=\"middle\">BBD</text>\n <text x=\"0\" y=\"8\" font-size=\"3.5\" font-family=\"ui-sans-serif, system-ui, sans-serif\" fill=\"currentColor\" stroke=\"none\" text-anchor=\"middle\">MN3007</text>" },
@@ -55,5 +52,5 @@ export const SYMBOL_CONTENT: Readonly<Record<string, SymbolContent>> = {
55
52
  "variable-resistor": { viewBox: "-25 -25 50 50", content: "<!--\n kind: variable-resistor (trimpot)\n terminals: a (SVG 0,-20), b (SVG 0,20)\n -->\n <g stroke-width=\"0.95\">\n <line x1=\"0\" y1=\"-20\" x2=\"0\" y2=\"-10\"/>\n <line x1=\"0\" y1=\"10\" x2=\"0\" y2=\"20\"/>\n </g>\n <polyline points=\"0,-10 -5,-8 5,-4 -5,0 5,4 -5,8 0,10\"/>\n <line x1=\"-11\" y1=\"11\" x2=\"11\" y2=\"-11\"/>\n <path d=\"M 11 -11 L 6 -8 L 8 -6 Z\" fill=\"currentColor\" stroke=\"none\"/>" },
56
53
  "voltage-source": { viewBox: "-25 -25 50 50", content: "<!--\n kind: voltage-source\n terminals: + (SVG 0,-20), - (SVG 0,20)\n + marker at top, − marker at bottom inside the circle.\n -->\n <g stroke-width=\"0.95\">\n <line x1=\"0\" y1=\"-20\" x2=\"0\" y2=\"-9\"/>\n <line x1=\"0\" y1=\"9\" x2=\"0\" y2=\"20\"/>\n </g>\n <circle cx=\"0\" cy=\"0\" r=\"9\"/>\n <line x1=\"-2\" y1=\"-4\" x2=\"2\" y2=\"-4\"/>\n <line x1=\"0\" y1=\"-6\" x2=\"0\" y2=\"-2\"/>\n <line x1=\"-2\" y1=\"4\" x2=\"2\" y2=\"4\"/>" },
57
54
  };
58
-
59
- export const SYMBOL_KEYS = Object.keys(SYMBOL_CONTENT) as readonly string[];
55
+ export const SYMBOL_KEYS = Object.keys(SYMBOL_CONTENT);
56
+ //# sourceMappingURL=svg-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-content.js","sourceRoot":"","sources":["../../../src/preview/symbols/svg-content.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,6FAA6F;AAI7F,MAAM,CAAC,MAAM,cAAc,GAA4C;IACnE,eAAe,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,00BAA00B,EAAE;IACl4B,SAAS,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,ynBAAynB,EAAE;IAC3qB,KAAK,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,2tCAA2tC,EAAE;IACzwC,SAAS,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,ukB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Value } from '../model/types';
2
+ import { type SymbolContent } from './symbols/svg-content';
3
+ export type SymbolDef = SymbolContent;
4
+ export type SymbolProperties = Readonly<Record<string, PropertyValue>>;
5
+ export declare function symbolFor(kind: ComponentKind, sourceTypeName?: string | null, properties?: SymbolProperties): SymbolDef;
6
+ export declare const COMPONENT_KINDS: readonly ComponentKind[];
7
+ //# sourceMappingURL=symbols.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../../src/preview/symbols.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3E,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC;AACtC,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;AAavE,wBAAgB,SAAS,CACrB,IAAI,EAAE,aAAa,EACnB,cAAc,GAAE,MAAM,GAAG,IAAW,EACpC,UAAU,GAAE,gBAAmC,GAChD,SAAS,CAEX;AAkJD,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAoCnD,CAAC"}
@@ -1,30 +1,18 @@
1
- import { propertyStringValue } from '../model/properties';
2
- import type { ComponentKind, PropertyValue } from '../model/types';
3
- import { SYMBOL_CONTENT, type SymbolContent } from './symbols/svg-content';
4
-
5
- export type SymbolDef = SymbolContent;
6
- export type SymbolProperties = Readonly<Record<string, PropertyValue>>;
7
-
1
+ import { propertyStringValue } from '../model/properties.js';
2
+ import { SYMBOL_CONTENT } from './symbols/svg-content.js';
8
3
  const FALLBACK_KEY = 'unsupported';
9
- const EMPTY_PROPERTIES: SymbolProperties = {};
10
-
11
- function lookup(key: string): SymbolDef {
4
+ const EMPTY_PROPERTIES = {};
5
+ function lookup(key) {
12
6
  const def = SYMBOL_CONTENT[key];
13
7
  if (def === undefined) {
14
- return SYMBOL_CONTENT[FALLBACK_KEY] as SymbolDef;
8
+ return SYMBOL_CONTENT[FALLBACK_KEY];
15
9
  }
16
10
  return def;
17
11
  }
18
-
19
- export function symbolFor(
20
- kind: ComponentKind,
21
- sourceTypeName: string | null = null,
22
- properties: SymbolProperties = EMPTY_PROPERTIES,
23
- ): SymbolDef {
12
+ export function symbolFor(kind, sourceTypeName = null, properties = EMPTY_PROPERTIES) {
24
13
  return lookup(resolveKey(kind, sourceTypeName, properties));
25
14
  }
26
-
27
- function resolveKey(kind: ComponentKind, sourceTypeName: string | null, properties: SymbolProperties): string {
15
+ function resolveKey(kind, sourceTypeName, properties) {
28
16
  switch (kind) {
29
17
  case 'capacitor':
30
18
  return resolveCapacitor(properties);
@@ -54,11 +42,9 @@ function resolveKey(kind: ComponentKind, sourceTypeName: string | null, properti
54
42
  return kind;
55
43
  }
56
44
  }
57
-
58
45
  const NPN_SHORT_TYPES = new Set(['NpnBjt']);
59
46
  const PNP_SHORT_TYPES = new Set(['PnpBjt']);
60
-
61
- function resolveBjt(sourceTypeName: string | null): string {
47
+ function resolveBjt(sourceTypeName) {
62
48
  const short = shortName(sourceTypeName);
63
49
  if (short !== null && PNP_SHORT_TYPES.has(short)) {
64
50
  return 'bjt-pnp';
@@ -68,12 +54,10 @@ function resolveBjt(sourceTypeName: string | null): string {
68
54
  }
69
55
  return 'bjt-npn';
70
56
  }
71
-
72
57
  const N_JFET_SHORT_TYPES = new Set(['NjfJfet']);
73
58
  const P_JFET_SHORT_TYPES = new Set(['PjfJfet']);
74
59
  const LIVE_SPICE_JUNCTION_FET_TYPES = new Set(['JunctionFieldEffectTransistor']);
75
-
76
- function resolveJfet(sourceTypeName: string | null): string {
60
+ function resolveJfet(sourceTypeName) {
77
61
  const short = shortName(sourceTypeName);
78
62
  if (short !== null && LIVE_SPICE_JUNCTION_FET_TYPES.has(short)) {
79
63
  return 'jfet-junction-n';
@@ -86,16 +70,14 @@ function resolveJfet(sourceTypeName: string | null): string {
86
70
  }
87
71
  return 'jfet-n';
88
72
  }
89
-
90
- function resolveCapacitor(properties: SymbolProperties): string {
73
+ function resolveCapacitor(properties) {
91
74
  const material = propertyText(properties, 'Material') ?? propertyText(properties, 'material');
92
75
  if (material !== null && material.toLowerCase().includes('electrolytic')) {
93
76
  return 'capacitor-electrolytic';
94
77
  }
95
78
  return 'capacitor';
96
79
  }
97
-
98
- function resolveDiode(sourceTypeName: string | null, properties: SymbolProperties): string {
80
+ function resolveDiode(sourceTypeName, properties) {
99
81
  const short = shortName(sourceTypeName)?.toLowerCase() ?? null;
100
82
  const type = propertyText(properties, 'Type')?.toLowerCase() ?? null;
101
83
  if (short === 'zener' || type?.includes('zener')) {
@@ -106,11 +88,9 @@ function resolveDiode(sourceTypeName: string | null, properties: SymbolPropertie
106
88
  }
107
89
  return 'diode';
108
90
  }
109
-
110
91
  const N_MOSFET_SHORT_TYPES = new Set(['NMosfet']);
111
92
  const P_MOSFET_SHORT_TYPES = new Set(['PMosfet']);
112
-
113
- function resolveMosfet(sourceTypeName: string | null): string {
93
+ function resolveMosfet(sourceTypeName) {
114
94
  const short = shortName(sourceTypeName);
115
95
  if (short !== null && P_MOSFET_SHORT_TYPES.has(short)) {
116
96
  return 'mosfet-p';
@@ -120,18 +100,15 @@ function resolveMosfet(sourceTypeName: string | null): string {
120
100
  }
121
101
  return 'mosfet-n';
122
102
  }
123
-
124
103
  const OUTPUT_JACK_SHORT_TYPES = new Set(['Speaker', 'OutputJack']);
125
-
126
- function resolveJack(sourceTypeName: string | null): string {
104
+ function resolveJack(sourceTypeName) {
127
105
  const short = shortName(sourceTypeName);
128
106
  if (short !== null && OUTPUT_JACK_SHORT_TYPES.has(short)) {
129
107
  return 'jack-output';
130
108
  }
131
109
  return 'jack-input';
132
110
  }
133
-
134
- function resolveSwitch(sourceTypeName: string | null): string {
111
+ function resolveSwitch(sourceTypeName) {
135
112
  const short = shortName(sourceTypeName);
136
113
  if (short === null) {
137
114
  return 'switch-spst';
@@ -151,8 +128,7 @@ function resolveSwitch(sourceTypeName: string | null): string {
151
128
  return 'switch-spst';
152
129
  }
153
130
  }
154
-
155
- function shortName(fullType: string | null): string | null {
131
+ function shortName(fullType) {
156
132
  if (fullType === null) {
157
133
  return null;
158
134
  }
@@ -163,12 +139,10 @@ function shortName(fullType: string | null): string | null {
163
139
  const ltspiceMatch = fullType.match(/^ltspice:([A-Za-z0-9_]+)/);
164
140
  return ltspiceMatch?.[1] ?? fullType;
165
141
  }
166
-
167
- function propertyText(properties: SymbolProperties, name: string): string | null {
142
+ function propertyText(properties, name) {
168
143
  return propertyStringValue(properties[name]);
169
144
  }
170
-
171
- export const COMPONENT_KINDS: readonly ComponentKind[] = [
145
+ export const COMPONENT_KINDS = [
172
146
  'resistor',
173
147
  'capacitor',
174
148
  'inductor',
@@ -205,3 +179,4 @@ export const COMPONENT_KINDS: readonly ComponentKind[] = [
205
179
  'port',
206
180
  'unsupported',
207
181
  ];
182
+ //# sourceMappingURL=symbols.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbols.js","sourceRoot":"","sources":["../../src/preview/symbols.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAsB,MAAM,uBAAuB,CAAC;AAK3E,MAAM,YAAY,GAAG,aAAa,CAAC;AACnC,MAAM,gBAAgB,GAAqB,EAAE,CAAC;AAE9C,SAAS,MAAM,CAAC,GAAW;IACvB,MAAM,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACpB,OAAO,cAAc,CAAC,YAAY,CAAc,CAAC;IACrD,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC;AAED,MAAM,UAAU,SAAS,CACrB,IAAmB,EACnB,iBAAgC,IAAI,EACpC,aAA+B,gBAAgB;IAE/C,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,EAA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O;IACP,KAAK;IACL,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,aAAa;IACb,eAAe;IACf,mBAAmB;IACnB,QAAQ;IACR,aAAa;IACb,gBAAgB;IAChB,gBAAgB;IAChB,SAAS;IACT,QAAQ;IACR,MAAM;IACN,MAAM;IACN,KAAK;IACL,UAAU;IACV,WAAW;IACX,WAAW;IACX,eAAe;IACf,UAAU;IACV,IAAI;IACJ,OAAO;IACP,YAAY;IACZ,MAAM;IACN,aAAa;CAChB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { CircuitDocument, Point } from '../model/types';
2
+ export declare function findChainCorners(doc: CircuitDocument): readonly Point[];
3
+ export declare function findWireChain(rootWireId: string, doc: CircuitDocument): readonly string[];
4
+ //# sourceMappingURL=wire-chains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire-chains.d.ts","sourceRoot":"","sources":["../../src/preview/wire-chains.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAQ,MAAM,gBAAgB,CAAC;AAMnE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,eAAe,GAAG,SAAS,KAAK,EAAE,CA2CvE;AAWD,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,GAAG,SAAS,MAAM,EAAE,CAiEzF"}
@@ -1,54 +1,56 @@
1
- import type { CircuitDocument, Point, Wire } from '../model/types';
2
-
3
1
  // A "chain corner" is a wire endpoint where exactly two wires meet, with no
4
2
  // component terminal at the same point and no third wire crossing through —
5
3
  // i.e. a routing bend the user sees as a single bend point on a longer
6
4
  // connector. These are the points that split-wire / merge-wires operate on.
7
- export function findChainCorners(doc: CircuitDocument): readonly Point[] {
8
- const wireByEndpoint = new Map<string, Wire[]>();
5
+ export function findChainCorners(doc) {
6
+ const wireByEndpoint = new Map();
9
7
  for (const wire of doc.wires) {
10
8
  for (const endpoint of wire.endpoints) {
11
9
  const key = pointKey(endpoint);
12
10
  const list = wireByEndpoint.get(key);
13
11
  if (list === undefined) {
14
12
  wireByEndpoint.set(key, [wire]);
15
- } else {
13
+ }
14
+ else {
16
15
  list.push(wire);
17
16
  }
18
17
  }
19
18
  }
20
- const terminalSet = new Set<string>();
19
+ const terminalSet = new Set();
21
20
  for (const component of doc.components) {
22
21
  for (const terminal of component.terminals) {
23
22
  terminalSet.add(pointKey(terminal.position));
24
23
  }
25
24
  }
26
-
27
- const seen = new Set<string>();
28
- const corners: Point[] = [];
25
+ const seen = new Set();
26
+ const corners = [];
29
27
  for (const wire of doc.wires) {
30
28
  for (const endpoint of wire.endpoints) {
31
29
  const key = pointKey(endpoint);
32
- if (seen.has(key)) continue;
33
- if (terminalSet.has(key)) continue;
30
+ if (seen.has(key))
31
+ continue;
32
+ if (terminalSet.has(key))
33
+ continue;
34
34
  const peers = wireByEndpoint.get(key) ?? [];
35
- if (peers.length !== 2) continue;
35
+ if (peers.length !== 2)
36
+ continue;
36
37
  let crossed = false;
37
38
  for (const other of doc.wires) {
38
- if (peers.some((p) => p.id === other.id)) continue;
39
+ if (peers.some((p) => p.id === other.id))
40
+ continue;
39
41
  if (pointOnSegmentInterior(endpoint, other.endpoints[0], other.endpoints[1])) {
40
42
  crossed = true;
41
43
  break;
42
44
  }
43
45
  }
44
- if (crossed) continue;
46
+ if (crossed)
47
+ continue;
45
48
  seen.add(key);
46
49
  corners.push(endpoint);
47
50
  }
48
51
  }
49
52
  return corners;
50
53
  }
51
-
52
54
  // findWireChain expands a single wire id into the connected "chain" of wires
53
55
  // the user perceives as one connector. Two wires belong to the same chain when
54
56
  // they share an endpoint that is:
@@ -58,33 +60,31 @@ export function findChainCorners(doc: CircuitDocument): readonly Point[] {
58
60
  // The chain stops as soon as any of those conditions fails. This lets fixture
59
61
  // L-shapes authored as two adjacent segments select and delete as one unit,
60
62
  // while preserving legitimate branching / junctions.
61
- export function findWireChain(rootWireId: string, doc: CircuitDocument): readonly string[] {
63
+ export function findWireChain(rootWireId, doc) {
62
64
  const root = doc.wires.find((w) => w.id === rootWireId);
63
65
  if (root === undefined) {
64
66
  return [];
65
67
  }
66
-
67
- const wireByEndpoint = new Map<string, Wire[]>();
68
+ const wireByEndpoint = new Map();
68
69
  for (const wire of doc.wires) {
69
70
  for (const endpoint of wire.endpoints) {
70
71
  const key = pointKey(endpoint);
71
72
  const list = wireByEndpoint.get(key);
72
73
  if (list === undefined) {
73
74
  wireByEndpoint.set(key, [wire]);
74
- } else {
75
+ }
76
+ else {
75
77
  list.push(wire);
76
78
  }
77
79
  }
78
80
  }
79
-
80
- const terminalSet = new Set<string>();
81
+ const terminalSet = new Set();
81
82
  for (const component of doc.components) {
82
83
  for (const terminal of component.terminals) {
83
84
  terminalSet.add(pointKey(terminal.position));
84
85
  }
85
86
  }
86
-
87
- function isInteriorCorner(endpoint: Point, owningWire: Wire): boolean {
87
+ function isInteriorCorner(endpoint, owningWire) {
88
88
  const key = pointKey(endpoint);
89
89
  if (terminalSet.has(key)) {
90
90
  return false;
@@ -94,38 +94,38 @@ export function findWireChain(rootWireId: string, doc: CircuitDocument): readonl
94
94
  return false;
95
95
  }
96
96
  for (const candidate of doc.wires) {
97
- if (candidate.id === owningWire.id) continue;
98
- if (peers.some((peer) => peer.id === candidate.id)) continue;
97
+ if (candidate.id === owningWire.id)
98
+ continue;
99
+ if (peers.some((peer) => peer.id === candidate.id))
100
+ continue;
99
101
  if (pointOnSegmentInterior(endpoint, candidate.endpoints[0], candidate.endpoints[1])) {
100
102
  return false;
101
103
  }
102
104
  }
103
105
  return true;
104
106
  }
105
-
106
- const visited = new Set<string>([root.id]);
107
- const stack: Wire[] = [root];
108
-
107
+ const visited = new Set([root.id]);
108
+ const stack = [root];
109
109
  while (stack.length > 0) {
110
- const wire = stack.pop() as Wire;
110
+ const wire = stack.pop();
111
111
  for (const endpoint of wire.endpoints) {
112
112
  if (!isInteriorCorner(endpoint, wire)) {
113
113
  continue;
114
114
  }
115
115
  const peers = wireByEndpoint.get(pointKey(endpoint)) ?? [];
116
116
  for (const peer of peers) {
117
- if (peer.id === wire.id) continue;
118
- if (visited.has(peer.id)) continue;
117
+ if (peer.id === wire.id)
118
+ continue;
119
+ if (visited.has(peer.id))
120
+ continue;
119
121
  visited.add(peer.id);
120
122
  stack.push(peer);
121
123
  }
122
124
  }
123
125
  }
124
-
125
126
  return [...visited];
126
127
  }
127
-
128
- function pointOnSegmentInterior(p: Point, a: Point, b: Point): boolean {
128
+ function pointOnSegmentInterior(p, a, b) {
129
129
  const cross = (p.x - a.x) * (b.y - a.y) - (p.y - a.y) * (b.x - a.x);
130
130
  if (cross !== 0) {
131
131
  return false;
@@ -147,7 +147,7 @@ function pointOnSegmentInterior(p: Point, a: Point, b: Point): boolean {
147
147
  }
148
148
  return inXRange && inYRange;
149
149
  }
150
-
151
- function pointKey(p: Point): string {
150
+ function pointKey(p) {
152
151
  return `${p.x},${p.y}`;
153
152
  }
153
+ //# sourceMappingURL=wire-chains.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire-chains.js","sourceRoot":"","sources":["../../src/preview/wire-chains.ts"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,4EAA4E;AAC5E,uEAAuE;AACvE,4EAA4E;AAC5E,MAAM,UAAU,gBAAgB,CAAC,GAAoB;IACjD,MAAM,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IACjD,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;QAC3B,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAC/B,MAAM,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACrC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACrB,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;YACpC,CAAC;iBAAM,CAAC;gBACJ,IA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I,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC1C,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC1C,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAChB,OAAO,QAAQ,CAAC;IACpB,CAAC;IACD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAChB,OAAO,QAAQ,CAAC;IACpB,CAAC;IACD,OAAO,QAAQ,IAAI,QAAQ,CAAC;AAChC,CAAC;AAED,SAAS,QAAQ,CAAC,CAAQ;IACtB,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vessel-dsp/core",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Headless Vessel DSP circuit, device, format conversion, and layout model APIs.",
5
5
  "keywords": [
6
6
  "guitar-pedal",
@@ -24,7 +24,7 @@
24
24
  "exports": {
25
25
  ".": {
26
26
  "types": "./dist/index.d.ts",
27
- "bun": "./src/index.ts",
27
+ "bun": "./dist/index.js",
28
28
  "import": "./dist/index.js"
29
29
  },
30
30
  "./package.json": {
@@ -36,7 +36,6 @@
36
36
  "types": "./dist/index.d.ts",
37
37
  "files": [
38
38
  "dist",
39
- "src",
40
39
  "README.md",
41
40
  "LICENSE.md"
42
41
  ],
@@ -44,6 +43,7 @@
44
43
  "build": "tsc -p tsconfig.build.json && bun run ../../scripts/fix-dist-imports.ts dist",
45
44
  "clean": "rm -rf dist",
46
45
  "pack:dry-run": "npm pack --dry-run",
46
+ "prepack": "bun run build",
47
47
  "typecheck": "tsc --noEmit -p tsconfig.json"
48
48
  },
49
49
  "dependencies": {