kicadts 0.0.2 → 0.0.4

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 (195) hide show
  1. package/dist/index.d.ts +4466 -0
  2. package/dist/index.js +14253 -0
  3. package/package.json +5 -2
  4. package/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc +0 -111
  5. package/.github/workflows/bun-formatcheck.yml +0 -26
  6. package/.github/workflows/bun-pver-release.yml +0 -70
  7. package/.github/workflows/bun-test.yml +0 -32
  8. package/.github/workflows/bun-typecheck.yml +0 -26
  9. package/.vscode/settings.json +0 -16
  10. package/AGENTS.md +0 -31
  11. package/TODO.md +0 -46
  12. package/biome.json +0 -93
  13. package/bunfig.toml +0 -5
  14. package/lib/index.ts +0 -1
  15. package/lib/sexpr/base-classes/SxClass.ts +0 -164
  16. package/lib/sexpr/base-classes/SxPrimitiveBoolean.ts +0 -35
  17. package/lib/sexpr/base-classes/SxPrimitiveNumber.ts +0 -26
  18. package/lib/sexpr/base-classes/SxPrimitiveString.ts +0 -26
  19. package/lib/sexpr/classes/At.ts +0 -53
  20. package/lib/sexpr/classes/Bus.ts +0 -103
  21. package/lib/sexpr/classes/BusEntry.ts +0 -169
  22. package/lib/sexpr/classes/Color.ts +0 -29
  23. package/lib/sexpr/classes/Dnp.ts +0 -8
  24. package/lib/sexpr/classes/EmbeddedFonts.ts +0 -68
  25. package/lib/sexpr/classes/ExcludeFromSim.ts +0 -8
  26. package/lib/sexpr/classes/FieldsAutoplaced.ts +0 -8
  27. package/lib/sexpr/classes/Footprint.ts +0 -849
  28. package/lib/sexpr/classes/FootprintAttr.ts +0 -104
  29. package/lib/sexpr/classes/FootprintAutoplaceCost180.ts +0 -9
  30. package/lib/sexpr/classes/FootprintAutoplaceCost90.ts +0 -9
  31. package/lib/sexpr/classes/FootprintClearance.ts +0 -9
  32. package/lib/sexpr/classes/FootprintDescr.ts +0 -44
  33. package/lib/sexpr/classes/FootprintLocked.ts +0 -32
  34. package/lib/sexpr/classes/FootprintModel.ts +0 -142
  35. package/lib/sexpr/classes/FootprintNetTiePadGroups.ts +0 -52
  36. package/lib/sexpr/classes/FootprintPad.ts +0 -857
  37. package/lib/sexpr/classes/FootprintPath.ts +0 -44
  38. package/lib/sexpr/classes/FootprintPlaced.ts +0 -32
  39. package/lib/sexpr/classes/FootprintPrivateLayers.ts +0 -56
  40. package/lib/sexpr/classes/FootprintSheetfile.ts +0 -44
  41. package/lib/sexpr/classes/FootprintSheetname.ts +0 -44
  42. package/lib/sexpr/classes/FootprintSolderMaskMargin.ts +0 -9
  43. package/lib/sexpr/classes/FootprintSolderPasteMargin.ts +0 -9
  44. package/lib/sexpr/classes/FootprintSolderPasteRatio.ts +0 -9
  45. package/lib/sexpr/classes/FootprintTags.ts +0 -44
  46. package/lib/sexpr/classes/FootprintTedit.ts +0 -21
  47. package/lib/sexpr/classes/FootprintThermalGap.ts +0 -9
  48. package/lib/sexpr/classes/FootprintThermalWidth.ts +0 -9
  49. package/lib/sexpr/classes/FootprintZoneConnect.ts +0 -9
  50. package/lib/sexpr/classes/FpArc.ts +0 -312
  51. package/lib/sexpr/classes/FpCircle.ts +0 -314
  52. package/lib/sexpr/classes/FpLine.ts +0 -316
  53. package/lib/sexpr/classes/FpPoly.ts +0 -286
  54. package/lib/sexpr/classes/FpPolyFill.ts +0 -48
  55. package/lib/sexpr/classes/FpPolyLocked.ts +0 -40
  56. package/lib/sexpr/classes/FpRect.ts +0 -314
  57. package/lib/sexpr/classes/FpText.ts +0 -375
  58. package/lib/sexpr/classes/FpTextBox.ts +0 -450
  59. package/lib/sexpr/classes/GrLine.ts +0 -264
  60. package/lib/sexpr/classes/GrLineAngle.ts +0 -32
  61. package/lib/sexpr/classes/GrLineEnd.ts +0 -61
  62. package/lib/sexpr/classes/GrLineLocked.ts +0 -40
  63. package/lib/sexpr/classes/GrLineStart.ts +0 -61
  64. package/lib/sexpr/classes/GrText.ts +0 -228
  65. package/lib/sexpr/classes/Image.ts +0 -283
  66. package/lib/sexpr/classes/InBom.ts +0 -8
  67. package/lib/sexpr/classes/Junction.ts +0 -166
  68. package/lib/sexpr/classes/KicadPcb.ts +0 -361
  69. package/lib/sexpr/classes/KicadSch.ts +0 -397
  70. package/lib/sexpr/classes/KicadSchGenerator.ts +0 -32
  71. package/lib/sexpr/classes/KicadSchGeneratorVersion.ts +0 -30
  72. package/lib/sexpr/classes/KicadSchVersion.ts +0 -22
  73. package/lib/sexpr/classes/Label.ts +0 -176
  74. package/lib/sexpr/classes/Layer.ts +0 -51
  75. package/lib/sexpr/classes/Layers.ts +0 -47
  76. package/lib/sexpr/classes/LibSymbols.ts +0 -61
  77. package/lib/sexpr/classes/NoConnect.ts +0 -90
  78. package/lib/sexpr/classes/OnBoard.ts +0 -8
  79. package/lib/sexpr/classes/PadChamfer.ts +0 -50
  80. package/lib/sexpr/classes/PadChamferRatio.ts +0 -9
  81. package/lib/sexpr/classes/PadClearance.ts +0 -9
  82. package/lib/sexpr/classes/PadDieLength.ts +0 -9
  83. package/lib/sexpr/classes/PadDrill.ts +0 -145
  84. package/lib/sexpr/classes/PadDrillOffset.ts +0 -54
  85. package/lib/sexpr/classes/PadLayers.ts +0 -71
  86. package/lib/sexpr/classes/PadNet.ts +0 -56
  87. package/lib/sexpr/classes/PadOptions.ts +0 -181
  88. package/lib/sexpr/classes/PadPinFunction.ts +0 -9
  89. package/lib/sexpr/classes/PadPinType.ts +0 -9
  90. package/lib/sexpr/classes/PadPrimitiveGrArc.ts +0 -272
  91. package/lib/sexpr/classes/PadPrimitiveGrCircle.ts +0 -298
  92. package/lib/sexpr/classes/PadPrimitiveGrLine.ts +0 -126
  93. package/lib/sexpr/classes/PadPrimitives.ts +0 -291
  94. package/lib/sexpr/classes/PadRectDelta.ts +0 -57
  95. package/lib/sexpr/classes/PadRoundrectRratio.ts +0 -9
  96. package/lib/sexpr/classes/PadSize.ts +0 -69
  97. package/lib/sexpr/classes/PadSolderMaskMargin.ts +0 -9
  98. package/lib/sexpr/classes/PadSolderPasteMargin.ts +0 -9
  99. package/lib/sexpr/classes/PadSolderPasteMarginRatio.ts +0 -9
  100. package/lib/sexpr/classes/PadTeardrops.ts +0 -210
  101. package/lib/sexpr/classes/PadThermalBridgeAngle.ts +0 -9
  102. package/lib/sexpr/classes/PadThermalGap.ts +0 -9
  103. package/lib/sexpr/classes/PadThermalWidth.ts +0 -9
  104. package/lib/sexpr/classes/PadZoneConnect.ts +0 -9
  105. package/lib/sexpr/classes/Paper.ts +0 -119
  106. package/lib/sexpr/classes/PcbGeneral.ts +0 -82
  107. package/lib/sexpr/classes/PcbGeneralLegacyTeardrops.ts +0 -44
  108. package/lib/sexpr/classes/PcbGeneralThickness.ts +0 -9
  109. package/lib/sexpr/classes/PcbGenerator.ts +0 -16
  110. package/lib/sexpr/classes/PcbGeneratorVersion.ts +0 -16
  111. package/lib/sexpr/classes/PcbLayerDefinition.ts +0 -106
  112. package/lib/sexpr/classes/PcbLayers.ts +0 -34
  113. package/lib/sexpr/classes/PcbNet.ts +0 -56
  114. package/lib/sexpr/classes/PcbVersion.ts +0 -9
  115. package/lib/sexpr/classes/Property.ts +0 -301
  116. package/lib/sexpr/classes/PropertyHide.ts +0 -9
  117. package/lib/sexpr/classes/PropertyUnlocked.ts +0 -9
  118. package/lib/sexpr/classes/Pts.ts +0 -67
  119. package/lib/sexpr/classes/RenderCache.ts +0 -221
  120. package/lib/sexpr/classes/SchematicText.ts +0 -171
  121. package/lib/sexpr/classes/Segment.ts +0 -243
  122. package/lib/sexpr/classes/SegmentEnd.ts +0 -59
  123. package/lib/sexpr/classes/SegmentLocked.ts +0 -33
  124. package/lib/sexpr/classes/SegmentNet.ts +0 -64
  125. package/lib/sexpr/classes/SegmentStart.ts +0 -59
  126. package/lib/sexpr/classes/Setup/PcbPlotParams.ts +0 -689
  127. package/lib/sexpr/classes/Setup/PcbPlotParamsBase.ts +0 -9
  128. package/lib/sexpr/classes/Setup/PcbPlotParamsNumericProperties.ts +0 -105
  129. package/lib/sexpr/classes/Setup/PcbPlotParamsStringPropertiesA.ts +0 -104
  130. package/lib/sexpr/classes/Setup/PcbPlotParamsStringPropertiesB.ts +0 -105
  131. package/lib/sexpr/classes/Setup/Setup.ts +0 -574
  132. package/lib/sexpr/classes/Setup/SetupPropertyTypes.ts +0 -119
  133. package/lib/sexpr/classes/Setup/Stackup.ts +0 -135
  134. package/lib/sexpr/classes/Setup/StackupLayer.ts +0 -233
  135. package/lib/sexpr/classes/Setup/StackupLayerProperties.ts +0 -80
  136. package/lib/sexpr/classes/Setup/StackupProperties.ts +0 -40
  137. package/lib/sexpr/classes/Setup/base.ts +0 -165
  138. package/lib/sexpr/classes/Setup/index.ts +0 -14
  139. package/lib/sexpr/classes/Setup/setupMultiValueProperties.ts +0 -53
  140. package/lib/sexpr/classes/Setup/setupNumericProperties.ts +0 -151
  141. package/lib/sexpr/classes/Setup/setupPropertyHandlers.ts +0 -90
  142. package/lib/sexpr/classes/Setup/setupStringProperties.ts +0 -75
  143. package/lib/sexpr/classes/Sheet.ts +0 -287
  144. package/lib/sexpr/classes/SheetFill.ts +0 -44
  145. package/lib/sexpr/classes/SheetInstances.ts +0 -168
  146. package/lib/sexpr/classes/SheetInstancesRoot.ts +0 -165
  147. package/lib/sexpr/classes/SheetPin.ts +0 -125
  148. package/lib/sexpr/classes/SheetProperty.ts +0 -115
  149. package/lib/sexpr/classes/SheetSize.ts +0 -44
  150. package/lib/sexpr/classes/Stroke.ts +0 -58
  151. package/lib/sexpr/classes/StrokeType.ts +0 -34
  152. package/lib/sexpr/classes/Symbol.ts +0 -1666
  153. package/lib/sexpr/classes/TextEffects.ts +0 -461
  154. package/lib/sexpr/classes/TitleBlock.ts +0 -369
  155. package/lib/sexpr/classes/Unit.ts +0 -28
  156. package/lib/sexpr/classes/Uuid.ts +0 -8
  157. package/lib/sexpr/classes/Via.ts +0 -363
  158. package/lib/sexpr/classes/ViaNet.ts +0 -60
  159. package/lib/sexpr/classes/Width.ts +0 -8
  160. package/lib/sexpr/classes/Wire.ts +0 -111
  161. package/lib/sexpr/classes/Xy.ts +0 -33
  162. package/lib/sexpr/classes/Zone.ts +0 -39
  163. package/lib/sexpr/index.ts +0 -130
  164. package/lib/sexpr/parseKicadSexpr.ts +0 -5
  165. package/lib/sexpr/parseToPrimitiveSExpr.ts +0 -245
  166. package/lib/sexpr/utils/indentLines.ts +0 -3
  167. package/lib/sexpr/utils/parseYesNo.ts +0 -12
  168. package/lib/sexpr/utils/quoteSExprString.ts +0 -8
  169. package/lib/sexpr/utils/strokeFromArgs.ts +0 -18
  170. package/lib/sexpr/utils/toNumberValue.ts +0 -13
  171. package/lib/sexpr/utils/toStringValue.ts +0 -11
  172. package/scripts/download-references.ts +0 -68
  173. package/tests/fixtures/expectEqualPrimitiveSExpr.ts +0 -199
  174. package/tests/fixtures/png-matcher.ts +0 -109
  175. package/tests/fixtures/preload.ts +0 -1
  176. package/tests/sexpr/KicadPcbDemos.test.ts +0 -48
  177. package/tests/sexpr/KicadSchDemos.test.ts +0 -49
  178. package/tests/sexpr/classes/Footprint.test.ts +0 -277
  179. package/tests/sexpr/classes/FootprintPad.test.ts +0 -78
  180. package/tests/sexpr/classes/FpArc.test.ts +0 -45
  181. package/tests/sexpr/classes/FpCircle.test.ts +0 -39
  182. package/tests/sexpr/classes/FpPoly.test.ts +0 -43
  183. package/tests/sexpr/classes/FpRect.test.ts +0 -40
  184. package/tests/sexpr/classes/FpTextBox.test.ts +0 -84
  185. package/tests/sexpr/classes/Image.test.ts +0 -58
  186. package/tests/sexpr/classes/KicadSch.test.ts +0 -95
  187. package/tests/sexpr/classes/Paper.test.ts +0 -30
  188. package/tests/sexpr/classes/Property.test.ts +0 -48
  189. package/tests/sexpr/classes/Setup.test.ts +0 -188
  190. package/tests/sexpr/classes/Sheet.test.ts +0 -107
  191. package/tests/sexpr/classes/Stroke.test.ts +0 -15
  192. package/tests/sexpr/classes/Symbol.test.ts +0 -96
  193. package/tests/sexpr/classes/TextEffects.test.ts +0 -56
  194. package/tests/sexpr/classes/TitleBlock.test.ts +0 -40
  195. package/tsconfig.json +0 -35
@@ -1,53 +0,0 @@
1
- import { SxClass } from "../../base-classes/SxClass"
2
-
3
- import { CoordinateProperty, NumericListProperty } from "./base"
4
-
5
- abstract class SetupNumericListProperty extends NumericListProperty {
6
- static override parentToken = "setup"
7
- }
8
-
9
- abstract class SetupCoordinateProperty extends CoordinateProperty {
10
- static override parentToken = "setup"
11
- }
12
-
13
- export class SetupPcbTextSize extends SetupNumericListProperty {
14
- static override token = "pcb_text_size"
15
- token = "pcb_text_size"
16
- }
17
- SxClass.register(SetupPcbTextSize)
18
-
19
- export class SetupModTextSize extends SetupNumericListProperty {
20
- static override token = "mod_text_size"
21
- token = "mod_text_size"
22
- }
23
- SxClass.register(SetupModTextSize)
24
-
25
- export class SetupPadSize extends SetupNumericListProperty {
26
- static override token = "pad_size"
27
- token = "pad_size"
28
- }
29
- SxClass.register(SetupPadSize)
30
-
31
- export class SetupPadToPasteClearanceValues extends SetupNumericListProperty {
32
- static override token = "pad_to_paste_clearance_values"
33
- token = "pad_to_paste_clearance_values"
34
- }
35
- SxClass.register(SetupPadToPasteClearanceValues)
36
-
37
- export class SetupTraceWidth extends SetupNumericListProperty {
38
- static override token = "trace_width"
39
- token = "trace_width"
40
- }
41
- SxClass.register(SetupTraceWidth)
42
-
43
- export class SetupAuxAxisOrigin extends SetupCoordinateProperty {
44
- static override token = "aux_axis_origin"
45
- token = "aux_axis_origin"
46
- }
47
- SxClass.register(SetupAuxAxisOrigin)
48
-
49
- export class SetupGridOrigin extends SetupCoordinateProperty {
50
- static override token = "grid_origin"
51
- token = "grid_origin"
52
- }
53
- SxClass.register(SetupGridOrigin)
@@ -1,151 +0,0 @@
1
- import { SxClass } from "../../base-classes/SxClass"
2
- import type { PrimitiveSExpr } from "../../parseToPrimitiveSExpr"
3
- import { toNumberValue } from "../../utils/toNumberValue"
4
-
5
- import { SingleValueProperty } from "./base"
6
-
7
- abstract class SetupNumberProperty extends SingleValueProperty<number> {
8
- static override parentToken = "setup"
9
-
10
- protected static override parsePrimitiveValue(
11
- value: PrimitiveSExpr | undefined,
12
- ): number {
13
- const parsed = toNumberValue(value)
14
- if (parsed === undefined) {
15
- throw new Error(`${this.name} expects a numeric value`)
16
- }
17
- return parsed
18
- }
19
- }
20
-
21
- export class SetupPadToMaskClearance extends SetupNumberProperty {
22
- static override token = "pad_to_mask_clearance"
23
- token = "pad_to_mask_clearance"
24
- }
25
- SxClass.register(SetupPadToMaskClearance)
26
-
27
- export class SetupSolderMaskMinWidth extends SetupNumberProperty {
28
- static override token = "solder_mask_min_width"
29
- token = "solder_mask_min_width"
30
- }
31
- SxClass.register(SetupSolderMaskMinWidth)
32
-
33
- export class SetupPadToPasteClearance extends SetupNumberProperty {
34
- static override token = "pad_to_paste_clearance"
35
- token = "pad_to_paste_clearance"
36
- }
37
- SxClass.register(SetupPadToPasteClearance)
38
-
39
- export class SetupPadToPasteClearanceRatio extends SetupNumberProperty {
40
- static override token = "pad_to_paste_clearance_ratio"
41
- token = "pad_to_paste_clearance_ratio"
42
- }
43
- SxClass.register(SetupPadToPasteClearanceRatio)
44
-
45
- export class SetupLastTraceWidth extends SetupNumberProperty {
46
- static override token = "last_trace_width"
47
- token = "last_trace_width"
48
- }
49
- SxClass.register(SetupLastTraceWidth)
50
-
51
- export class SetupTraceClearance extends SetupNumberProperty {
52
- static override token = "trace_clearance"
53
- token = "trace_clearance"
54
- }
55
- SxClass.register(SetupTraceClearance)
56
-
57
- export class SetupZoneClearance extends SetupNumberProperty {
58
- static override token = "zone_clearance"
59
- token = "zone_clearance"
60
- }
61
- SxClass.register(SetupZoneClearance)
62
-
63
- export class SetupTraceMin extends SetupNumberProperty {
64
- static override token = "trace_min"
65
- token = "trace_min"
66
- }
67
- SxClass.register(SetupTraceMin)
68
-
69
- export class SetupSegmentWidth extends SetupNumberProperty {
70
- static override token = "segment_width"
71
- token = "segment_width"
72
- }
73
- SxClass.register(SetupSegmentWidth)
74
-
75
- export class SetupEdgeWidth extends SetupNumberProperty {
76
- static override token = "edge_width"
77
- token = "edge_width"
78
- }
79
- SxClass.register(SetupEdgeWidth)
80
-
81
- export class SetupViaSize extends SetupNumberProperty {
82
- static override token = "via_size"
83
- token = "via_size"
84
- }
85
- SxClass.register(SetupViaSize)
86
-
87
- export class SetupViaDrill extends SetupNumberProperty {
88
- static override token = "via_drill"
89
- token = "via_drill"
90
- }
91
- SxClass.register(SetupViaDrill)
92
-
93
- export class SetupViaMinSize extends SetupNumberProperty {
94
- static override token = "via_min_size"
95
- token = "via_min_size"
96
- }
97
- SxClass.register(SetupViaMinSize)
98
-
99
- export class SetupViaMinDrill extends SetupNumberProperty {
100
- static override token = "via_min_drill"
101
- token = "via_min_drill"
102
- }
103
- SxClass.register(SetupViaMinDrill)
104
-
105
- export class SetupUviaSize extends SetupNumberProperty {
106
- static override token = "uvia_size"
107
- token = "uvia_size"
108
- }
109
- SxClass.register(SetupUviaSize)
110
-
111
- export class SetupUviaDrill extends SetupNumberProperty {
112
- static override token = "uvia_drill"
113
- token = "uvia_drill"
114
- }
115
- SxClass.register(SetupUviaDrill)
116
-
117
- export class SetupUviaMinSize extends SetupNumberProperty {
118
- static override token = "uvia_min_size"
119
- token = "uvia_min_size"
120
- }
121
- SxClass.register(SetupUviaMinSize)
122
-
123
- export class SetupUviaMinDrill extends SetupNumberProperty {
124
- static override token = "uvia_min_drill"
125
- token = "uvia_min_drill"
126
- }
127
- SxClass.register(SetupUviaMinDrill)
128
-
129
- export class SetupPcbTextWidth extends SetupNumberProperty {
130
- static override token = "pcb_text_width"
131
- token = "pcb_text_width"
132
- }
133
- SxClass.register(SetupPcbTextWidth)
134
-
135
- export class SetupModEdgeWidth extends SetupNumberProperty {
136
- static override token = "mod_edge_width"
137
- token = "mod_edge_width"
138
- }
139
- SxClass.register(SetupModEdgeWidth)
140
-
141
- export class SetupModTextWidth extends SetupNumberProperty {
142
- static override token = "mod_text_width"
143
- token = "mod_text_width"
144
- }
145
- SxClass.register(SetupModTextWidth)
146
-
147
- export class SetupPadDrill extends SetupNumberProperty {
148
- static override token = "pad_drill"
149
- token = "pad_drill"
150
- }
151
- SxClass.register(SetupPadDrill)
@@ -1,90 +0,0 @@
1
- import type { SetupPropertyValues } from "./SetupPropertyTypes"
2
- import { PcbPlotParams } from "./PcbPlotParams"
3
- import { Stackup } from "./Stackup"
4
- import {
5
- SetupAuxAxisOrigin,
6
- SetupGridOrigin,
7
- SetupModTextSize,
8
- SetupPadSize,
9
- SetupPadToPasteClearanceValues,
10
- SetupPcbTextSize,
11
- SetupTraceWidth,
12
- } from "./setupMultiValueProperties"
13
- import {
14
- SetupAllowSoldermaskBridgesInFootprints,
15
- SetupTenting,
16
- SetupUviasAllowed,
17
- SetupVisibleElements,
18
- SetupZone45Only,
19
- } from "./setupStringProperties"
20
- import {
21
- SetupEdgeWidth,
22
- SetupLastTraceWidth,
23
- SetupModEdgeWidth,
24
- SetupModTextWidth,
25
- SetupPadDrill,
26
- SetupPadToMaskClearance,
27
- SetupPadToPasteClearance,
28
- SetupPadToPasteClearanceRatio,
29
- SetupPcbTextWidth,
30
- SetupSegmentWidth,
31
- SetupSolderMaskMinWidth,
32
- SetupTraceClearance,
33
- SetupTraceMin,
34
- SetupUviaDrill,
35
- SetupUviaMinDrill,
36
- SetupUviaMinSize,
37
- SetupUviaSize,
38
- SetupViaDrill,
39
- SetupViaMinDrill,
40
- SetupViaMinSize,
41
- SetupViaSize,
42
- SetupZoneClearance,
43
- } from "./setupNumericProperties"
44
-
45
- type Constructor<T> = new (...args: any[]) => T
46
-
47
- export const setupPropertyDescriptors = [
48
- { Class: Stackup, key: "stackup" },
49
- { Class: PcbPlotParams, key: "pcbPlotParams" },
50
- { Class: SetupPadToMaskClearance, key: "padToMaskClearance" },
51
- { Class: SetupSolderMaskMinWidth, key: "solderMaskMinWidth" },
52
- { Class: SetupPadToPasteClearance, key: "padToPasteClearance" },
53
- { Class: SetupPadToPasteClearanceRatio, key: "padToPasteClearanceRatio" },
54
- { Class: SetupLastTraceWidth, key: "lastTraceWidth" },
55
- { Class: SetupTraceClearance, key: "traceClearance" },
56
- { Class: SetupZoneClearance, key: "zoneClearance" },
57
- { Class: SetupZone45Only, key: "zone45Only" },
58
- { Class: SetupTraceMin, key: "traceMin" },
59
- { Class: SetupSegmentWidth, key: "segmentWidth" },
60
- { Class: SetupEdgeWidth, key: "edgeWidth" },
61
- { Class: SetupViaSize, key: "viaSize" },
62
- { Class: SetupViaDrill, key: "viaDrill" },
63
- { Class: SetupViaMinSize, key: "viaMinSize" },
64
- { Class: SetupViaMinDrill, key: "viaMinDrill" },
65
- { Class: SetupUviasAllowed, key: "uviasAllowed" },
66
- { Class: SetupUviaSize, key: "uviaSize" },
67
- { Class: SetupUviaDrill, key: "uviaDrill" },
68
- { Class: SetupUviaMinSize, key: "uviaMinSize" },
69
- { Class: SetupUviaMinDrill, key: "uviaMinDrill" },
70
- { Class: SetupPcbTextWidth, key: "pcbTextWidth" },
71
- { Class: SetupPcbTextSize, key: "pcbTextSize" },
72
- { Class: SetupModEdgeWidth, key: "modEdgeWidth" },
73
- { Class: SetupModTextSize, key: "modTextSize" },
74
- { Class: SetupModTextWidth, key: "modTextWidth" },
75
- { Class: SetupPadSize, key: "padSize" },
76
- { Class: SetupPadDrill, key: "padDrill" },
77
- {
78
- Class: SetupAllowSoldermaskBridgesInFootprints,
79
- key: "allowSoldermaskBridgesInFootprints",
80
- },
81
- { Class: SetupTenting, key: "tenting" },
82
- { Class: SetupAuxAxisOrigin, key: "auxAxisOrigin" },
83
- { Class: SetupGridOrigin, key: "gridOrigin" },
84
- { Class: SetupVisibleElements, key: "visibleElements" },
85
- { Class: SetupPadToPasteClearanceValues, key: "padToPasteClearanceValues" },
86
- { Class: SetupTraceWidth, key: "traceWidth" },
87
- ] as const satisfies ReadonlyArray<{
88
- Class: Constructor<SetupPropertyValues[keyof SetupPropertyValues]>
89
- key: keyof SetupPropertyValues
90
- }>
@@ -1,75 +0,0 @@
1
- import { SxClass } from "../../base-classes/SxClass"
2
- import type { PrimitiveSExpr } from "../../parseToPrimitiveSExpr"
3
- import { toStringValue } from "../../utils/toStringValue"
4
-
5
- import { SingleValueProperty } from "./base"
6
-
7
- abstract class SetupStringProperty extends SingleValueProperty<string> {
8
- static override parentToken = "setup"
9
- }
10
-
11
- export class SetupZone45Only extends SetupStringProperty {
12
- static override token = "zone_45_only"
13
- token = "zone_45_only"
14
- }
15
- SxClass.register(SetupZone45Only)
16
-
17
- export class SetupAllowSoldermaskBridgesInFootprints extends SetupStringProperty {
18
- static override token = "allow_soldermask_bridges_in_footprints"
19
- token = "allow_soldermask_bridges_in_footprints"
20
- }
21
- SxClass.register(SetupAllowSoldermaskBridgesInFootprints)
22
-
23
- export class SetupVisibleElements extends SetupStringProperty {
24
- static override token = "visible_elements"
25
- token = "visible_elements"
26
- }
27
- SxClass.register(SetupVisibleElements)
28
-
29
- export class SetupUviasAllowed extends SetupStringProperty {
30
- static override token = "uvias_allowed"
31
- token = "uvias_allowed"
32
- }
33
- SxClass.register(SetupUviasAllowed)
34
-
35
- export class SetupTenting extends SxClass {
36
- static override token = "tenting"
37
- static override parentToken = "setup"
38
- token = "tenting"
39
-
40
- private _sides: string[] = []
41
-
42
- constructor(sides: string[] = []) {
43
- super()
44
- this.sides = sides
45
- }
46
-
47
- static override fromSexprPrimitives(
48
- primitiveSexprs: PrimitiveSExpr[],
49
- ): SetupTenting {
50
- const sides = primitiveSexprs
51
- .map((primitive) => toStringValue(primitive))
52
- .filter((value): value is string => value !== undefined)
53
- return new SetupTenting(sides)
54
- }
55
-
56
- get sides(): string[] {
57
- return [...this._sides]
58
- }
59
-
60
- set sides(sides: string[]) {
61
- this._sides = sides.map((side) => String(side))
62
- }
63
-
64
- override getChildren(): SxClass[] {
65
- return []
66
- }
67
-
68
- override getString(): string {
69
- if (this._sides.length === 0) {
70
- return "(tenting)"
71
- }
72
- return `(tenting ${this._sides.join(" ")})`
73
- }
74
- }
75
- SxClass.register(SetupTenting)
@@ -1,287 +0,0 @@
1
- import { SxClass } from "../base-classes/SxClass"
2
- import type { PrimitiveSExpr } from "../parseToPrimitiveSExpr"
3
- import { indentLines } from "../utils/indentLines"
4
- import { quoteSExprString } from "../utils/quoteSExprString"
5
- import { toNumberValue } from "../utils/toNumberValue"
6
- import { toStringValue } from "../utils/toStringValue"
7
- import { At, type AtInput } from "./At"
8
- import { Color } from "./Color"
9
- import { Dnp } from "./Dnp"
10
- import { ExcludeFromSim } from "./ExcludeFromSim"
11
- import { FieldsAutoplaced } from "./FieldsAutoplaced"
12
- import { InBom } from "./InBom"
13
- import { OnBoard } from "./OnBoard"
14
- import { SheetInstances } from "./SheetInstances"
15
- import { SheetPin } from "./SheetPin"
16
- import { Stroke } from "./Stroke"
17
- import { TextEffects } from "./TextEffects"
18
- import { Uuid } from "./Uuid"
19
- import { SymbolPropertyId as PropertyId } from "./Symbol"
20
- import { SheetFill } from "./SheetFill"
21
- import { SheetSize } from "./SheetSize"
22
- import { SheetProperty } from "./SheetProperty"
23
-
24
- export interface SheetConstructorParams {
25
- position?: AtInput
26
- size?: SheetSize | { width: number; height: number }
27
- excludeFromSim?: boolean | ExcludeFromSim
28
- inBom?: boolean | InBom
29
- onBoard?: boolean | OnBoard
30
- dnp?: boolean | Dnp
31
- fieldsAutoplaced?: boolean | FieldsAutoplaced
32
- stroke?: Stroke
33
- fill?: SheetFill
34
- uuid?: string | Uuid
35
- properties?: SheetProperty[]
36
- pins?: SheetPin[]
37
- instances?: SheetInstances
38
- }
39
-
40
- export class Sheet extends SxClass {
41
- static override token = "sheet"
42
- token = "sheet"
43
-
44
- private _sxAt?: At
45
- private _sxSize?: SheetSize
46
- private _sxExcludeFromSim?: ExcludeFromSim
47
- private _sxInBom?: InBom
48
- private _sxOnBoard?: OnBoard
49
- private _sxDnp?: Dnp
50
- private _sxFieldsAutoplaced?: FieldsAutoplaced
51
- private _sxStroke?: Stroke
52
- private _sxFill?: SheetFill
53
- private _sxUuid?: Uuid
54
- private _properties: SheetProperty[] = []
55
- private _pins: SheetPin[] = []
56
- private _sxInstances?: SheetInstances
57
-
58
- constructor(params: SheetConstructorParams = {}) {
59
- super()
60
-
61
- if (params.position !== undefined) {
62
- this.position = params.position
63
- }
64
-
65
- if (params.size !== undefined) {
66
- this.size = params.size
67
- }
68
-
69
- if (params.excludeFromSim !== undefined) {
70
- this.excludeFromSim =
71
- typeof params.excludeFromSim === "boolean"
72
- ? params.excludeFromSim
73
- : params.excludeFromSim.value
74
- }
75
-
76
- if (params.inBom !== undefined) {
77
- this.inBom =
78
- typeof params.inBom === "boolean" ? params.inBom : params.inBom.value
79
- }
80
-
81
- if (params.onBoard !== undefined) {
82
- this.onBoard =
83
- typeof params.onBoard === "boolean"
84
- ? params.onBoard
85
- : params.onBoard.value
86
- }
87
-
88
- if (params.dnp !== undefined) {
89
- this.dnp = typeof params.dnp === "boolean" ? params.dnp : params.dnp.value
90
- }
91
-
92
- if (params.fieldsAutoplaced !== undefined) {
93
- this.fieldsAutoplaced =
94
- typeof params.fieldsAutoplaced === "boolean"
95
- ? params.fieldsAutoplaced
96
- : params.fieldsAutoplaced.value
97
- }
98
-
99
- if (params.stroke !== undefined) {
100
- this.stroke = params.stroke
101
- }
102
-
103
- if (params.fill !== undefined) {
104
- this.fill = params.fill
105
- }
106
-
107
- if (params.uuid !== undefined) {
108
- this.uuid = params.uuid
109
- }
110
-
111
- if (params.properties !== undefined) {
112
- this.properties = params.properties
113
- }
114
-
115
- if (params.pins !== undefined) {
116
- this.pins = params.pins
117
- }
118
-
119
- if (params.instances !== undefined) {
120
- this.instances = params.instances
121
- }
122
- }
123
-
124
- static override fromSexprPrimitives(
125
- primitiveSexprs: PrimitiveSExpr[],
126
- ): Sheet {
127
- const sheet = new Sheet()
128
-
129
- const { propertyMap, arrayPropertyMap } =
130
- SxClass.parsePrimitivesToClassProperties(primitiveSexprs, this.token)
131
-
132
- sheet._sxAt = propertyMap.at as At | undefined
133
- sheet._sxSize = propertyMap.size as SheetSize | undefined
134
- sheet._sxExcludeFromSim = propertyMap.exclude_from_sim as
135
- | ExcludeFromSim
136
- | undefined
137
- sheet._sxInBom = propertyMap.in_bom as InBom | undefined
138
- sheet._sxOnBoard = propertyMap.on_board as OnBoard | undefined
139
- sheet._sxDnp = propertyMap.dnp as Dnp | undefined
140
- sheet._sxFieldsAutoplaced = propertyMap.fields_autoplaced as
141
- | FieldsAutoplaced
142
- | undefined
143
- sheet._sxStroke = propertyMap.stroke as Stroke | undefined
144
- sheet._sxFill = propertyMap.fill as SheetFill | undefined
145
- sheet._sxUuid = propertyMap.uuid as Uuid | undefined
146
- sheet._properties = (arrayPropertyMap.property as SheetProperty[]) ?? []
147
- sheet._pins = (arrayPropertyMap.pin as SheetPin[]) ?? []
148
- sheet._sxInstances = propertyMap.instances as SheetInstances | undefined
149
-
150
- return sheet
151
- }
152
-
153
- get position(): At | undefined {
154
- return this._sxAt
155
- }
156
-
157
- set position(value: AtInput | undefined) {
158
- this._sxAt = value !== undefined ? At.from(value) : undefined
159
- }
160
-
161
- get size(): { width: number; height: number } | undefined {
162
- return this._sxSize?.toObject()
163
- }
164
-
165
- set size(value: SheetSize | { width: number; height: number } | undefined) {
166
- if (value === undefined) {
167
- this._sxSize = undefined
168
- return
169
- }
170
- if (value instanceof SheetSize) {
171
- this._sxSize = value
172
- return
173
- }
174
- this._sxSize = new SheetSize(value.width, value.height)
175
- }
176
-
177
- get excludeFromSim(): boolean {
178
- return this._sxExcludeFromSim?.value ?? false
179
- }
180
-
181
- set excludeFromSim(value: boolean) {
182
- this._sxExcludeFromSim = new ExcludeFromSim(value)
183
- }
184
-
185
- get inBom(): boolean {
186
- return this._sxInBom?.value ?? false
187
- }
188
-
189
- set inBom(value: boolean) {
190
- this._sxInBom = new InBom(value)
191
- }
192
-
193
- get onBoard(): boolean {
194
- return this._sxOnBoard?.value ?? false
195
- }
196
-
197
- set onBoard(value: boolean) {
198
- this._sxOnBoard = new OnBoard(value)
199
- }
200
-
201
- get dnp(): boolean {
202
- return this._sxDnp?.value ?? false
203
- }
204
-
205
- set dnp(value: boolean) {
206
- this._sxDnp = new Dnp(value)
207
- }
208
-
209
- get fieldsAutoplaced(): boolean {
210
- return this._sxFieldsAutoplaced?.value ?? false
211
- }
212
-
213
- set fieldsAutoplaced(value: boolean) {
214
- this._sxFieldsAutoplaced = new FieldsAutoplaced(value)
215
- }
216
-
217
- get stroke(): Stroke | undefined {
218
- return this._sxStroke
219
- }
220
-
221
- set stroke(value: Stroke | undefined) {
222
- this._sxStroke = value
223
- }
224
-
225
- get fill(): SheetFill | undefined {
226
- return this._sxFill
227
- }
228
-
229
- set fill(value: SheetFill | undefined) {
230
- this._sxFill = value
231
- }
232
-
233
- get uuid(): Uuid | undefined {
234
- return this._sxUuid
235
- }
236
-
237
- set uuid(value: Uuid | string | undefined) {
238
- if (value === undefined) {
239
- this._sxUuid = undefined
240
- return
241
- }
242
- this._sxUuid = value instanceof Uuid ? value : new Uuid(value)
243
- }
244
-
245
- get properties(): SheetProperty[] {
246
- return this._properties
247
- }
248
-
249
- set properties(value: SheetProperty[]) {
250
- this._properties = value
251
- }
252
-
253
- get pins(): SheetPin[] {
254
- return this._pins
255
- }
256
-
257
- set pins(value: SheetPin[]) {
258
- this._pins = value
259
- }
260
-
261
- get instances(): SheetInstances | undefined {
262
- return this._sxInstances
263
- }
264
-
265
- set instances(value: SheetInstances | undefined) {
266
- this._sxInstances = value
267
- }
268
-
269
- override getChildren(): SxClass[] {
270
- const children: SxClass[] = []
271
- if (this._sxAt) children.push(this._sxAt)
272
- if (this._sxSize) children.push(this._sxSize)
273
- if (this._sxExcludeFromSim) children.push(this._sxExcludeFromSim)
274
- if (this._sxInBom) children.push(this._sxInBom)
275
- if (this._sxOnBoard) children.push(this._sxOnBoard)
276
- if (this._sxDnp) children.push(this._sxDnp)
277
- if (this._sxFieldsAutoplaced) children.push(this._sxFieldsAutoplaced)
278
- if (this._sxStroke) children.push(this._sxStroke)
279
- if (this._sxFill) children.push(this._sxFill)
280
- if (this._sxUuid) children.push(this._sxUuid)
281
- children.push(...this._properties)
282
- children.push(...this._pins)
283
- if (this._sxInstances) children.push(this._sxInstances)
284
- return children
285
- }
286
- }
287
- SxClass.register(Sheet)
@@ -1,44 +0,0 @@
1
- import { SxClass } from "../base-classes/SxClass"
2
- import type { PrimitiveSExpr } from "../parseToPrimitiveSExpr"
3
- import { indentLines } from "../utils/indentLines"
4
- import { quoteSExprString } from "../utils/quoteSExprString"
5
- import { toStringValue } from "../utils/toStringValue"
6
- import { At } from "./At"
7
- import { TextEffects } from "./TextEffects"
8
- import { SymbolPropertyId as PropertyId } from "./Symbol"
9
- import type { Color } from "./Color"
10
-
11
- export class SheetFill extends SxClass {
12
- static override token = "fill"
13
- static override parentToken = "sheet"
14
- token = "fill"
15
-
16
- private _sxColor?: Color
17
-
18
- static override fromSexprPrimitives(
19
- primitiveSexprs: PrimitiveSExpr[],
20
- ): SheetFill {
21
- const fill = new SheetFill()
22
- const { propertyMap } = SxClass.parsePrimitivesToClassProperties(
23
- primitiveSexprs,
24
- this.token,
25
- )
26
-
27
- fill._sxColor = propertyMap.color as Color | undefined
28
-
29
- return fill
30
- }
31
-
32
- get color(): Color | undefined {
33
- return this._sxColor
34
- }
35
-
36
- set color(value: Color | undefined) {
37
- this._sxColor = value
38
- }
39
-
40
- override getChildren(): SxClass[] {
41
- return this._sxColor ? [this._sxColor] : []
42
- }
43
- }
44
- SxClass.register(SheetFill)