kicadts 0.0.21 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -601,6 +601,21 @@ declare class KicadSchGeneratorVersion extends SxPrimitiveString {
601
601
  getString(): string;
602
602
  }
603
603
 
604
+ declare class KicadSymbolLibGenerator extends SxPrimitiveString {
605
+ static token: string;
606
+ static parentToken: string;
607
+ token: string;
608
+ static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): KicadSymbolLibGenerator;
609
+ getString(): string;
610
+ }
611
+
612
+ declare class KicadSymbolLibVersion extends SxPrimitiveNumber {
613
+ static token: string;
614
+ static parentToken: string;
615
+ token: string;
616
+ static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): KicadSymbolLibVersion;
617
+ }
618
+
604
619
  declare class Dnp extends SxPrimitiveBoolean {
605
620
  static token: string;
606
621
  token: string;
@@ -1131,6 +1146,28 @@ declare class SymbolInstanceUnit extends SxPrimitiveNumber {
1131
1146
  token: string;
1132
1147
  }
1133
1148
 
1149
+ interface KicadSymbolLibConstructorParams {
1150
+ version?: number | KicadSymbolLibVersion;
1151
+ generator?: string | KicadSymbolLibGenerator;
1152
+ symbols?: SchematicSymbol[];
1153
+ }
1154
+ declare class KicadSymbolLib extends SxClass {
1155
+ static token: string;
1156
+ token: string;
1157
+ private _sxVersion?;
1158
+ private _sxGenerator?;
1159
+ private _symbols;
1160
+ constructor(params?: KicadSymbolLibConstructorParams);
1161
+ static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): KicadSymbolLib;
1162
+ get version(): number | undefined;
1163
+ set version(value: number | undefined);
1164
+ get generator(): string | undefined;
1165
+ set generator(value: string | undefined);
1166
+ get symbols(): SchematicSymbol[];
1167
+ set symbols(value: SchematicSymbol[]);
1168
+ getChildren(): SxClass[];
1169
+ }
1170
+
1134
1171
  declare class LibSymbols extends SxClass {
1135
1172
  static token: string;
1136
1173
  static parentToken: string;
@@ -5116,6 +5153,8 @@ interface KicadPcbConstructorParams {
5116
5153
  segments?: Segment[];
5117
5154
  graphicLines?: GrLine[];
5118
5155
  graphicTexts?: GrText[];
5156
+ graphicPolys?: GrPoly[];
5157
+ graphicRects?: GrRect[];
5119
5158
  vias?: Via[];
5120
5159
  zones?: Zone[];
5121
5160
  otherChildren?: SxClass[];
@@ -5138,6 +5177,8 @@ declare class KicadPcb extends SxClass {
5138
5177
  private _segments;
5139
5178
  private _grLines;
5140
5179
  private _grTexts;
5180
+ private _grPolys;
5181
+ private _grRects;
5141
5182
  private _vias;
5142
5183
  private _zones;
5143
5184
  private _otherChildren;
@@ -5174,6 +5215,10 @@ declare class KicadPcb extends SxClass {
5174
5215
  set graphicLines(value: GrLine[]);
5175
5216
  get graphicTexts(): GrText[];
5176
5217
  set graphicTexts(value: GrText[]);
5218
+ get graphicPolys(): GrPoly[];
5219
+ set graphicPolys(value: GrPoly[]);
5220
+ get graphicRects(): GrRect[];
5221
+ set graphicRects(value: GrRect[]);
5177
5222
  get vias(): Via[];
5178
5223
  set vias(value: Via[]);
5179
5224
  get zones(): Zone[];
@@ -5188,4 +5233,4 @@ declare const parseKicadSch: (sexpr: string) => KicadSch;
5188
5233
  declare const parseKicadPcb: (sexpr: string) => KicadPcb;
5189
5234
  declare const parseKicadMod: (sexpr: string) => Footprint;
5190
5235
 
5191
- export { At, type AtInput, Bus, type BusConstructorParams, BusEntry, type BusEntryConstructorParams, BusEntrySize, Color, Dnp, EmbeddedFonts, ExcludeFromSim, FieldsAutoplaced, Footprint, FootprintAttr, FootprintAutoplaceCost180, FootprintAutoplaceCost90, FootprintClearance, type FootprintConstructorParams, FootprintDescr, FootprintLocked, FootprintModel, FootprintNetTiePadGroups, FootprintPad, type FootprintPadConstructorParams, FootprintPath, FootprintPlaced, FootprintPrivateLayers, FootprintSheetfile, FootprintSheetname, FootprintSolderMaskMargin, FootprintSolderPasteMargin, FootprintSolderPasteRatio, FootprintTags, FootprintTedit, FootprintThermalGap, FootprintThermalWidth, FootprintZoneConnect, FpArc, type FpArcConstructorParams, FpArcEnd, FpArcMid, FpArcStart, FpCircle, FpCircleCenter, type FpCircleConstructorParams, FpCircleEnd, FpCircleFill, FpLine, type FpLineConstructorParams, FpLineEnd, FpLineStart, FpPoly, type FpPolyConstructorParams, FpPolyFill, FpPolyLocked, FpRect, type FpRectConstructorParams, FpRectEnd, FpRectFill, FpRectStart, FpText, FpTextBox, FpTextBoxAngle, type FpTextBoxConstructorParams, FpTextBoxEnd, FpTextBoxStart, type FpTextConstructorParams, type FpTextType, GlobalLabel, type GlobalLabelConstructorParams, type GlobalLabelShape, GrArc, type GrArcConstructorParams, GrArcEnd, GrArcMid, type GrArcPoint, GrArcStart, GrCircle, GrCircleCenter, type GrCircleConstructorParams, GrCircleEnd, GrCircleLocked, type GrCirclePoint, GrCurve, type GrCurveConstructorParams, GrLine, GrLineAngle, type GrLineConstructorParams, GrLineEnd, GrLineLocked, type GrLinePoint, GrLineStart, GrPoly, type GrPolyConstructorParams, GrPolyFill, GrRect, type GrRectConstructorParams, GrRectEnd, GrRectFill, GrRectLocked, GrRectStart, GrText, type GrTextConstructorParams, type GrTextPosition, GrTextRenderCache, GrTextRenderCachePolygon, Group, type GroupConstructorParams, GroupLocked, GroupMembers, Image, type ImageConstructorParams, ImageData, ImageScale, InBom, Junction, type JunctionConstructorParams, JunctionDiameter, KicadPcb, type KicadPcbConstructorParams, KicadSch, type KicadSchConstructorParams, KicadSchGenerator, KicadSchGeneratorVersion, KicadSchVersion, Label, type LabelConstructorParams, Layer, Layers, LibSymbols, Mirror, type ModelVector, NoConnect, type NoConnectConstructorParams, OnBoard, PadChamfer, PadChamferRatio, PadClearance, PadDieLength, PadDrill, PadDrillOffset, PadLayers, type PadLayersInput, PadNet, PadOptions, type PadOptionsAnchorShape, type PadOptionsClearanceType, PadPinFunction, PadPinType, PadPrimitiveGrArc, type PadPrimitiveGrArcConstructorParams, PadPrimitiveGrCircle, type PadPrimitiveGrCircleConstructorParams, PadPrimitiveGrCircleFill, PadPrimitiveGrLine, PadPrimitiveGrPoly, PadPrimitives, PadRectDelta, PadRoundrectRratio, PadSize, type PadSizeInput, PadSolderMaskMargin, PadSolderPasteMargin, PadSolderPasteMarginRatio, PadTeardrops, PadThermalBridgeAngle, PadThermalGap, PadThermalWidth, PadZoneConnect, Paper, PcbGeneral, PcbGeneralLegacyTeardrops, PcbGeneralThickness, PcbGenerator, PcbGeneratorVersion, PcbLayerDefinition, PcbLayers, PcbNet, PcbPlotParams, PcbVersion, PlotParamCreateGerberJobFile, PlotParamCrossoutDnpOnFab, PlotParamDashedLineDashRatio, PlotParamDashedLineGapRatio, PlotParamDisableApertMacros, PlotParamDrillShape, PlotParamDxfImperialUnits, PlotParamDxfPolygonMode, PlotParamDxfUsePcbnewFont, PlotParamExcludeEdgeLayer, PlotParamHideDnpOnFab, PlotParamHpglPenDiameter, PlotParamHpglPenNumber, PlotParamHpglPenOverlay, PlotParamHpglPenSpeed, PlotParamLayerSelection, PlotParamLineWidth, PlotParamMirror, PlotParamMode, PlotParamOutputDirectory, PlotParamOutputFormat, PlotParamPadOnSilk, PlotParamPdfBackFpPropertyPopups, PlotParamPdfFrontFpPropertyPopups, PlotParamPdfMetadata, PlotParamPdfSingleDocument, PlotParamPlotBlackAndWhite, PlotParamPlotFrameRef, PlotParamPlotInvisible, PlotParamPlotInvisibleText, PlotParamPlotOnAllLayers, PlotParamPlotOnAllLayersSelection, PlotParamPlotOtherText, PlotParamPlotPadNumbers, PlotParamPlotReference, PlotParamPlotValue, PlotParamProperty, PlotParamPsA4Output, PlotParamPsNegative, PlotParamScaleSelection, PlotParamSketchDnpOnFab, PlotParamSketchPadsOnFab, PlotParamSubtractMaskFromSilk, PlotParamSvgPrecision, PlotParamUseAuxOrigin, PlotParamUseGerberAdvancedAttributes, PlotParamUseGerberAttributes, PlotParamUseGerberExtensions, PlotParamViaOnMask, Polyline, type PolylineConstructorParams, Property, type PropertyConstructorParams, PropertyHide, PropertyUnlocked, Pts, PtsArc, PtsArcEnd, PtsArcMid, PtsArcStart, type RGBAColor, RenderCache, SchematicPolyline, SchematicSymbol, type SchematicSymbolConstructorParams, SchematicText, type SchematicTextConstructorParams, Segment, type SegmentConstructorParams, SegmentEnd, SegmentLocked, SegmentNet, SegmentStart, Setup, SetupAllowSoldermaskBridgesInFootprints, SetupAuxAxisOrigin, SetupEdgeWidth, SetupGridOrigin, SetupLastTraceWidth, SetupModEdgeWidth, SetupModTextSize, SetupModTextWidth, SetupPadDrill, SetupPadSize, SetupPadToMaskClearance, SetupPadToPasteClearance, SetupPadToPasteClearanceRatio, SetupPadToPasteClearanceValues, SetupPcbTextSize, SetupPcbTextWidth, type SetupProperty, type SetupPropertyValues, SetupSegmentWidth, SetupSolderMaskMinWidth, SetupTenting, SetupTraceClearance, SetupTraceMin, SetupTraceWidth, SetupUviaDrill, SetupUviaMinDrill, SetupUviaMinSize, SetupUviaSize, SetupUviasAllowed, SetupViaDrill, SetupViaMinDrill, SetupViaMinSize, SetupViaSize, SetupVisibleElements, SetupZone45Only, SetupZoneClearance, Sheet, type SheetConstructorParams, SheetFill, SheetInstancePage, SheetInstancePath, SheetInstances, SheetInstancesForSheet, SheetInstancesProject, SheetInstancesRoot, SheetInstancesRootPage, SheetInstancesRootPath, SheetPin, type SheetPinElectricalType, SheetProperty, SheetSize, Stackup, StackupCastellatedPads, StackupCopperFinish, StackupDielectricConstraints, StackupEdgeConnector, StackupEdgePlating, StackupLayer, StackupLayerColor, StackupLayerEpsilonR, StackupLayerLossTangent, StackupLayerMaterial, StackupLayerThickness, StackupLayerType, type StandardPaperSize, Stroke, type StrokeProperty, StrokeType, type StrokeTypeString, SxClass, SymbolArc, SymbolArcEnd, SymbolArcFill, SymbolArcMid, SymbolArcStart, SymbolCircle, SymbolCircleCenter, SymbolCircleFill, SymbolCircleRadius, SymbolDuplicatePinNumbersAreJumpers, SymbolFillType, SymbolInstancePath, SymbolInstanceReference, SymbolInstanceUnit, SymbolInstances, SymbolInstancesProject, SymbolLibId, SymbolPin, SymbolPinLength, SymbolPinName, SymbolPinNames, SymbolPinNamesHide, SymbolPinNamesOffset, SymbolPinNumber, SymbolPinNumbers, SymbolPinNumbersHide, SymbolPolyline, SymbolPolylineFill, type SymbolPolylineFillLike, SymbolPower, SymbolProperty, SymbolPropertyId, SymbolRectangle, SymbolRectangleEnd, SymbolRectangleFill, SymbolRectangleStart, SymbolText, SymbolUnit, TextEffects, type TextEffectsConstructorParams, TextEffectsFont, TextEffectsFontBold, TextEffectsFontFace, TextEffectsFontItalic, TextEffectsFontLineSpacing, type TextEffectsFontProperty, TextEffectsFontSize, TextEffectsFontThickness, TextEffectsJustify, type TextEffectsProperty, TitleBlock, TitleBlockComment, TitleBlockCompany, type TitleBlockConstructorParams, TitleBlockDate, TitleBlockRevision, TitleBlockTitle, Tstamp, Unit, type UnitString, Uuid, Via, type ViaConstructorParams, ViaNet, Width, Wire, type WireConstructorParams, Xy, Zone, parseKicadMod, parseKicadPcb, parseKicadSch, parseKicadSexpr };
5236
+ export { At, type AtInput, Bus, type BusConstructorParams, BusEntry, type BusEntryConstructorParams, BusEntrySize, Color, Dnp, EmbeddedFonts, ExcludeFromSim, FieldsAutoplaced, Footprint, FootprintAttr, FootprintAutoplaceCost180, FootprintAutoplaceCost90, FootprintClearance, type FootprintConstructorParams, FootprintDescr, FootprintLocked, FootprintModel, FootprintNetTiePadGroups, FootprintPad, type FootprintPadConstructorParams, FootprintPath, FootprintPlaced, FootprintPrivateLayers, FootprintSheetfile, FootprintSheetname, FootprintSolderMaskMargin, FootprintSolderPasteMargin, FootprintSolderPasteRatio, FootprintTags, FootprintTedit, FootprintThermalGap, FootprintThermalWidth, FootprintZoneConnect, FpArc, type FpArcConstructorParams, FpArcEnd, FpArcMid, FpArcStart, FpCircle, FpCircleCenter, type FpCircleConstructorParams, FpCircleEnd, FpCircleFill, FpLine, type FpLineConstructorParams, FpLineEnd, FpLineStart, FpPoly, type FpPolyConstructorParams, FpPolyFill, FpPolyLocked, FpRect, type FpRectConstructorParams, FpRectEnd, FpRectFill, FpRectStart, FpText, FpTextBox, FpTextBoxAngle, type FpTextBoxConstructorParams, FpTextBoxEnd, FpTextBoxStart, type FpTextConstructorParams, type FpTextType, GlobalLabel, type GlobalLabelConstructorParams, type GlobalLabelShape, GrArc, type GrArcConstructorParams, GrArcEnd, GrArcMid, type GrArcPoint, GrArcStart, GrCircle, GrCircleCenter, type GrCircleConstructorParams, GrCircleEnd, GrCircleLocked, type GrCirclePoint, GrCurve, type GrCurveConstructorParams, GrLine, GrLineAngle, type GrLineConstructorParams, GrLineEnd, GrLineLocked, type GrLinePoint, GrLineStart, GrPoly, type GrPolyConstructorParams, GrPolyFill, GrRect, type GrRectConstructorParams, GrRectEnd, GrRectFill, GrRectLocked, GrRectStart, GrText, type GrTextConstructorParams, type GrTextPosition, GrTextRenderCache, GrTextRenderCachePolygon, Group, type GroupConstructorParams, GroupLocked, GroupMembers, Image, type ImageConstructorParams, ImageData, ImageScale, InBom, Junction, type JunctionConstructorParams, JunctionDiameter, KicadPcb, type KicadPcbConstructorParams, KicadSch, type KicadSchConstructorParams, KicadSchGenerator, KicadSchGeneratorVersion, KicadSchVersion, KicadSymbolLib, type KicadSymbolLibConstructorParams, KicadSymbolLibGenerator, KicadSymbolLibVersion, Label, type LabelConstructorParams, Layer, Layers, LibSymbols, Mirror, type ModelVector, NoConnect, type NoConnectConstructorParams, OnBoard, PadChamfer, PadChamferRatio, PadClearance, PadDieLength, PadDrill, PadDrillOffset, PadLayers, type PadLayersInput, PadNet, PadOptions, type PadOptionsAnchorShape, type PadOptionsClearanceType, PadPinFunction, PadPinType, PadPrimitiveGrArc, type PadPrimitiveGrArcConstructorParams, PadPrimitiveGrCircle, type PadPrimitiveGrCircleConstructorParams, PadPrimitiveGrCircleFill, PadPrimitiveGrLine, PadPrimitiveGrPoly, PadPrimitives, PadRectDelta, PadRoundrectRratio, PadSize, type PadSizeInput, PadSolderMaskMargin, PadSolderPasteMargin, PadSolderPasteMarginRatio, PadTeardrops, PadThermalBridgeAngle, PadThermalGap, PadThermalWidth, PadZoneConnect, Paper, PcbGeneral, PcbGeneralLegacyTeardrops, PcbGeneralThickness, PcbGenerator, PcbGeneratorVersion, PcbLayerDefinition, PcbLayers, PcbNet, PcbPlotParams, PcbVersion, PlotParamCreateGerberJobFile, PlotParamCrossoutDnpOnFab, PlotParamDashedLineDashRatio, PlotParamDashedLineGapRatio, PlotParamDisableApertMacros, PlotParamDrillShape, PlotParamDxfImperialUnits, PlotParamDxfPolygonMode, PlotParamDxfUsePcbnewFont, PlotParamExcludeEdgeLayer, PlotParamHideDnpOnFab, PlotParamHpglPenDiameter, PlotParamHpglPenNumber, PlotParamHpglPenOverlay, PlotParamHpglPenSpeed, PlotParamLayerSelection, PlotParamLineWidth, PlotParamMirror, PlotParamMode, PlotParamOutputDirectory, PlotParamOutputFormat, PlotParamPadOnSilk, PlotParamPdfBackFpPropertyPopups, PlotParamPdfFrontFpPropertyPopups, PlotParamPdfMetadata, PlotParamPdfSingleDocument, PlotParamPlotBlackAndWhite, PlotParamPlotFrameRef, PlotParamPlotInvisible, PlotParamPlotInvisibleText, PlotParamPlotOnAllLayers, PlotParamPlotOnAllLayersSelection, PlotParamPlotOtherText, PlotParamPlotPadNumbers, PlotParamPlotReference, PlotParamPlotValue, PlotParamProperty, PlotParamPsA4Output, PlotParamPsNegative, PlotParamScaleSelection, PlotParamSketchDnpOnFab, PlotParamSketchPadsOnFab, PlotParamSubtractMaskFromSilk, PlotParamSvgPrecision, PlotParamUseAuxOrigin, PlotParamUseGerberAdvancedAttributes, PlotParamUseGerberAttributes, PlotParamUseGerberExtensions, PlotParamViaOnMask, Polyline, type PolylineConstructorParams, Property, type PropertyConstructorParams, PropertyHide, PropertyUnlocked, Pts, PtsArc, PtsArcEnd, PtsArcMid, PtsArcStart, type RGBAColor, RenderCache, SchematicPolyline, SchematicSymbol, type SchematicSymbolConstructorParams, SchematicText, type SchematicTextConstructorParams, Segment, type SegmentConstructorParams, SegmentEnd, SegmentLocked, SegmentNet, SegmentStart, Setup, SetupAllowSoldermaskBridgesInFootprints, SetupAuxAxisOrigin, SetupEdgeWidth, SetupGridOrigin, SetupLastTraceWidth, SetupModEdgeWidth, SetupModTextSize, SetupModTextWidth, SetupPadDrill, SetupPadSize, SetupPadToMaskClearance, SetupPadToPasteClearance, SetupPadToPasteClearanceRatio, SetupPadToPasteClearanceValues, SetupPcbTextSize, SetupPcbTextWidth, type SetupProperty, type SetupPropertyValues, SetupSegmentWidth, SetupSolderMaskMinWidth, SetupTenting, SetupTraceClearance, SetupTraceMin, SetupTraceWidth, SetupUviaDrill, SetupUviaMinDrill, SetupUviaMinSize, SetupUviaSize, SetupUviasAllowed, SetupViaDrill, SetupViaMinDrill, SetupViaMinSize, SetupViaSize, SetupVisibleElements, SetupZone45Only, SetupZoneClearance, Sheet, type SheetConstructorParams, SheetFill, SheetInstancePage, SheetInstancePath, SheetInstances, SheetInstancesForSheet, SheetInstancesProject, SheetInstancesRoot, SheetInstancesRootPage, SheetInstancesRootPath, SheetPin, type SheetPinElectricalType, SheetProperty, SheetSize, Stackup, StackupCastellatedPads, StackupCopperFinish, StackupDielectricConstraints, StackupEdgeConnector, StackupEdgePlating, StackupLayer, StackupLayerColor, StackupLayerEpsilonR, StackupLayerLossTangent, StackupLayerMaterial, StackupLayerThickness, StackupLayerType, type StandardPaperSize, Stroke, type StrokeProperty, StrokeType, type StrokeTypeString, SxClass, SymbolArc, SymbolArcEnd, SymbolArcFill, SymbolArcMid, SymbolArcStart, SymbolCircle, SymbolCircleCenter, SymbolCircleFill, SymbolCircleRadius, SymbolDuplicatePinNumbersAreJumpers, SymbolFillType, SymbolInstancePath, SymbolInstanceReference, SymbolInstanceUnit, SymbolInstances, SymbolInstancesProject, SymbolLibId, SymbolPin, SymbolPinLength, SymbolPinName, SymbolPinNames, SymbolPinNamesHide, SymbolPinNamesOffset, SymbolPinNumber, SymbolPinNumbers, SymbolPinNumbersHide, SymbolPolyline, SymbolPolylineFill, type SymbolPolylineFillLike, SymbolPower, SymbolProperty, SymbolPropertyId, SymbolRectangle, SymbolRectangleEnd, SymbolRectangleFill, SymbolRectangleStart, SymbolText, SymbolUnit, TextEffects, type TextEffectsConstructorParams, TextEffectsFont, TextEffectsFontBold, TextEffectsFontFace, TextEffectsFontItalic, TextEffectsFontLineSpacing, type TextEffectsFontProperty, TextEffectsFontSize, TextEffectsFontThickness, TextEffectsJustify, type TextEffectsProperty, TitleBlock, TitleBlockComment, TitleBlockCompany, type TitleBlockConstructorParams, TitleBlockDate, TitleBlockRevision, TitleBlockTitle, Tstamp, Unit, type UnitString, Uuid, Via, type ViaConstructorParams, ViaNet, Width, Wire, type WireConstructorParams, Xy, Zone, parseKicadMod, parseKicadPcb, parseKicadSch, parseKicadSexpr };
package/dist/index.js CHANGED
@@ -200,7 +200,7 @@ var SxClass = class _SxClass {
200
200
  get [Symbol.toStringTag]() {
201
201
  return this.getString();
202
202
  }
203
- [Symbol.for("nodejs.util.inspect.custom")]() {
203
+ [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
204
204
  return this.getString();
205
205
  }
206
206
  // =========================== STATIC METHODS ===========================
@@ -1984,6 +1984,42 @@ var KicadSchGeneratorVersion = class _KicadSchGeneratorVersion extends SxPrimiti
1984
1984
  };
1985
1985
  SxClass.register(KicadSchGeneratorVersion);
1986
1986
 
1987
+ // lib/sexpr/classes/KicadSymbolLibGenerator.ts
1988
+ var isSymbolToken2 = (value) => /^[A-Za-z0-9._-]+$/.test(value);
1989
+ var KicadSymbolLibGenerator = class _KicadSymbolLibGenerator extends SxPrimitiveString {
1990
+ static token = "generator";
1991
+ static parentToken = "kicad_symbol_lib";
1992
+ token = "generator";
1993
+ static fromSexprPrimitives(primitiveSexprs) {
1994
+ const [rawValue] = primitiveSexprs;
1995
+ const parsedValue = toStringValue(rawValue);
1996
+ if (parsedValue === void 0) {
1997
+ throw new Error("generator expects a string argument");
1998
+ }
1999
+ return new _KicadSymbolLibGenerator(parsedValue);
2000
+ }
2001
+ getString() {
2002
+ const serialized = isSymbolToken2(this.value) ? this.value : quoteSExprString(this.value);
2003
+ return `(generator ${serialized})`;
2004
+ }
2005
+ };
2006
+ SxClass.register(KicadSymbolLibGenerator);
2007
+
2008
+ // lib/sexpr/classes/KicadSymbolLibVersion.ts
2009
+ var KicadSymbolLibVersion = class _KicadSymbolLibVersion extends SxPrimitiveNumber {
2010
+ static token = "version";
2011
+ static parentToken = "kicad_symbol_lib";
2012
+ token = "version";
2013
+ static fromSexprPrimitives(primitiveSexprs) {
2014
+ const [value] = primitiveSexprs;
2015
+ if (typeof value !== "number") {
2016
+ throw new Error("version expects a numeric argument");
2017
+ }
2018
+ return new _KicadSymbolLibVersion(value);
2019
+ }
2020
+ };
2021
+ SxClass.register(KicadSymbolLibVersion);
2022
+
1987
2023
  // lib/sexpr/utils/indentLines.ts
1988
2024
  var indentLines = (value, indent = " ") => {
1989
2025
  return value.split("\n").map((line) => `${indent}${line}`);
@@ -3430,6 +3466,102 @@ var SymbolInstanceUnit = class extends SxPrimitiveNumber {
3430
3466
  };
3431
3467
  SxClass.register(SymbolInstanceUnit);
3432
3468
 
3469
+ // lib/sexpr/classes/KicadSymbolLib.ts
3470
+ var SINGLE_CHILD_TOKENS = /* @__PURE__ */ new Set(["version", "generator"]);
3471
+ var MULTI_CHILD_TOKENS = /* @__PURE__ */ new Set(["symbol"]);
3472
+ var SUPPORTED_CHILD_TOKENS = /* @__PURE__ */ new Set([
3473
+ ...SINGLE_CHILD_TOKENS,
3474
+ ...MULTI_CHILD_TOKENS
3475
+ ]);
3476
+ var KicadSymbolLib = class _KicadSymbolLib extends SxClass {
3477
+ static token = "kicad_symbol_lib";
3478
+ token = "kicad_symbol_lib";
3479
+ _sxVersion;
3480
+ _sxGenerator;
3481
+ _symbols = [];
3482
+ constructor(params = {}) {
3483
+ super();
3484
+ if (params.version instanceof KicadSymbolLibVersion) {
3485
+ this._sxVersion = params.version;
3486
+ } else if (params.version !== void 0) {
3487
+ this.version = params.version;
3488
+ }
3489
+ if (params.generator instanceof KicadSymbolLibGenerator) {
3490
+ this._sxGenerator = params.generator;
3491
+ } else if (params.generator !== void 0) {
3492
+ this.generator = params.generator;
3493
+ }
3494
+ if (params.symbols !== void 0) {
3495
+ this.symbols = params.symbols;
3496
+ }
3497
+ }
3498
+ static fromSexprPrimitives(primitiveSexprs) {
3499
+ for (const primitive of primitiveSexprs) {
3500
+ if (!Array.isArray(primitive)) {
3501
+ throw new Error(
3502
+ `kicad_symbol_lib encountered unexpected primitive child: ${JSON.stringify(primitive)}`
3503
+ );
3504
+ }
3505
+ if (primitive.length === 0 || typeof primitive[0] !== "string") {
3506
+ throw new Error(
3507
+ `kicad_symbol_lib encountered invalid child expression: ${JSON.stringify(primitive)}`
3508
+ );
3509
+ }
3510
+ }
3511
+ const { propertyMap, arrayPropertyMap } = SxClass.parsePrimitivesToClassProperties(primitiveSexprs, this.token);
3512
+ for (const token of Object.keys(propertyMap)) {
3513
+ if (!SUPPORTED_CHILD_TOKENS.has(token)) {
3514
+ throw new Error(
3515
+ `kicad_symbol_lib encountered unsupported child token "${token}"`
3516
+ );
3517
+ }
3518
+ }
3519
+ for (const [token, entries] of Object.entries(arrayPropertyMap)) {
3520
+ if (!SUPPORTED_CHILD_TOKENS.has(token)) {
3521
+ throw new Error(
3522
+ `kicad_symbol_lib encountered unsupported child token "${token}"`
3523
+ );
3524
+ }
3525
+ if (!MULTI_CHILD_TOKENS.has(token) && entries.length > 1) {
3526
+ throw new Error(
3527
+ `kicad_symbol_lib does not support repeated child token "${token}"`
3528
+ );
3529
+ }
3530
+ }
3531
+ return new _KicadSymbolLib({
3532
+ version: propertyMap.version,
3533
+ generator: propertyMap.generator,
3534
+ symbols: arrayPropertyMap.symbol ?? []
3535
+ });
3536
+ }
3537
+ get version() {
3538
+ return this._sxVersion?.value;
3539
+ }
3540
+ set version(value) {
3541
+ this._sxVersion = value === void 0 ? void 0 : new KicadSymbolLibVersion(value);
3542
+ }
3543
+ get generator() {
3544
+ return this._sxGenerator?.value;
3545
+ }
3546
+ set generator(value) {
3547
+ this._sxGenerator = value === void 0 ? void 0 : new KicadSymbolLibGenerator(value);
3548
+ }
3549
+ get symbols() {
3550
+ return [...this._symbols];
3551
+ }
3552
+ set symbols(value) {
3553
+ this._symbols = [...value];
3554
+ }
3555
+ getChildren() {
3556
+ const children = [];
3557
+ if (this._sxVersion) children.push(this._sxVersion);
3558
+ if (this._sxGenerator) children.push(this._sxGenerator);
3559
+ children.push(...this._symbols);
3560
+ return children;
3561
+ }
3562
+ };
3563
+ SxClass.register(KicadSymbolLib);
3564
+
3433
3565
  // lib/sexpr/classes/LibSymbols.ts
3434
3566
  var SUPPORTED_ARRAY_TOKENS = /* @__PURE__ */ new Set(["symbol"]);
3435
3567
  var LibSymbols = class _LibSymbols extends SxClass {
@@ -4713,11 +4845,11 @@ var SheetInstancesRootPage = class _SheetInstancesRootPage extends SxPrimitiveSt
4713
4845
  SxClass.register(SheetInstancesRootPage);
4714
4846
 
4715
4847
  // lib/sexpr/classes/SheetInstances.ts
4716
- var SUPPORTED_CHILD_TOKENS = /* @__PURE__ */ new Set(["project", "path"]);
4848
+ var SUPPORTED_CHILD_TOKENS2 = /* @__PURE__ */ new Set(["project", "path"]);
4717
4849
  var parseSheetInstancesChildren = (primitiveSexprs) => {
4718
4850
  const { propertyMap, arrayPropertyMap } = SxClass.parsePrimitivesToClassProperties(primitiveSexprs, "sheet_instances");
4719
4851
  const unsupportedSingularTokens = Object.keys(propertyMap).filter(
4720
- (token) => !SUPPORTED_CHILD_TOKENS.has(token)
4852
+ (token) => !SUPPORTED_CHILD_TOKENS2.has(token)
4721
4853
  );
4722
4854
  if (unsupportedSingularTokens.length > 0) {
4723
4855
  throw new Error(
@@ -4725,7 +4857,7 @@ var parseSheetInstancesChildren = (primitiveSexprs) => {
4725
4857
  );
4726
4858
  }
4727
4859
  const unsupportedArrayTokens = Object.keys(arrayPropertyMap).filter(
4728
- (token) => !SUPPORTED_CHILD_TOKENS.has(token)
4860
+ (token) => !SUPPORTED_CHILD_TOKENS2.has(token)
4729
4861
  );
4730
4862
  if (unsupportedArrayTokens.length > 0) {
4731
4863
  throw new Error(
@@ -5306,7 +5438,7 @@ var Sheet = class _Sheet extends SxClass {
5306
5438
  SxClass.register(Sheet);
5307
5439
 
5308
5440
  // lib/sexpr/classes/KicadSch.ts
5309
- var SINGLE_CHILD_TOKENS = /* @__PURE__ */ new Set([
5441
+ var SINGLE_CHILD_TOKENS2 = /* @__PURE__ */ new Set([
5310
5442
  "version",
5311
5443
  "generator",
5312
5444
  "generator_version",
@@ -5316,7 +5448,7 @@ var SINGLE_CHILD_TOKENS = /* @__PURE__ */ new Set([
5316
5448
  "lib_symbols",
5317
5449
  "embedded_fonts"
5318
5450
  ]);
5319
- var MULTI_CHILD_TOKENS = /* @__PURE__ */ new Set([
5451
+ var MULTI_CHILD_TOKENS2 = /* @__PURE__ */ new Set([
5320
5452
  "property",
5321
5453
  "image",
5322
5454
  "sheet",
@@ -5330,9 +5462,9 @@ var MULTI_CHILD_TOKENS = /* @__PURE__ */ new Set([
5330
5462
  "sheet_instances",
5331
5463
  "polyline"
5332
5464
  ]);
5333
- var SUPPORTED_CHILD_TOKENS2 = /* @__PURE__ */ new Set([
5334
- ...SINGLE_CHILD_TOKENS,
5335
- ...MULTI_CHILD_TOKENS
5465
+ var SUPPORTED_CHILD_TOKENS3 = /* @__PURE__ */ new Set([
5466
+ ...SINGLE_CHILD_TOKENS2,
5467
+ ...MULTI_CHILD_TOKENS2
5336
5468
  ]);
5337
5469
  var KicadSch = class _KicadSch extends SxClass {
5338
5470
  static token = "kicad_sch";
@@ -5441,19 +5573,19 @@ var KicadSch = class _KicadSch extends SxClass {
5441
5573
  }
5442
5574
  const { propertyMap, arrayPropertyMap } = SxClass.parsePrimitivesToClassProperties(primitiveSexprs, this.token);
5443
5575
  for (const token of Object.keys(propertyMap)) {
5444
- if (!SUPPORTED_CHILD_TOKENS2.has(token)) {
5576
+ if (!SUPPORTED_CHILD_TOKENS3.has(token)) {
5445
5577
  throw new Error(
5446
5578
  `kicad_sch encountered unsupported child token "${token}"`
5447
5579
  );
5448
5580
  }
5449
5581
  }
5450
5582
  for (const [token, entries] of Object.entries(arrayPropertyMap)) {
5451
- if (!SUPPORTED_CHILD_TOKENS2.has(token)) {
5583
+ if (!SUPPORTED_CHILD_TOKENS3.has(token)) {
5452
5584
  throw new Error(
5453
5585
  `kicad_sch encountered unsupported child token "${token}"`
5454
5586
  );
5455
5587
  }
5456
- if (!MULTI_CHILD_TOKENS.has(token) && entries.length > 1) {
5588
+ if (!MULTI_CHILD_TOKENS2.has(token) && entries.length > 1) {
5457
5589
  throw new Error(
5458
5590
  `kicad_sch does not support repeated child token "${token}"`
5459
5591
  );
@@ -16092,6 +16224,8 @@ var KicadPcb = class _KicadPcb extends SxClass {
16092
16224
  _segments = [];
16093
16225
  _grLines = [];
16094
16226
  _grTexts = [];
16227
+ _grPolys = [];
16228
+ _grRects = [];
16095
16229
  _vias = [];
16096
16230
  _zones = [];
16097
16231
  _otherChildren = [];
@@ -16115,6 +16249,10 @@ var KicadPcb = class _KicadPcb extends SxClass {
16115
16249
  this.graphicLines = params.graphicLines;
16116
16250
  if (params.graphicTexts !== void 0)
16117
16251
  this.graphicTexts = params.graphicTexts;
16252
+ if (params.graphicPolys !== void 0)
16253
+ this.graphicPolys = params.graphicPolys;
16254
+ if (params.graphicRects !== void 0)
16255
+ this.graphicRects = params.graphicRects;
16118
16256
  if (params.vias !== void 0) this.vias = params.vias;
16119
16257
  if (params.zones !== void 0) this.zones = params.zones;
16120
16258
  if (params.otherChildren !== void 0)
@@ -16201,6 +16339,14 @@ var KicadPcb = class _KicadPcb extends SxClass {
16201
16339
  this._grTexts.push(child);
16202
16340
  return;
16203
16341
  }
16342
+ if (child instanceof GrPoly) {
16343
+ this._grPolys.push(child);
16344
+ return;
16345
+ }
16346
+ if (child instanceof GrRect) {
16347
+ this._grRects.push(child);
16348
+ return;
16349
+ }
16204
16350
  if (child instanceof Via) {
16205
16351
  this._vias.push(child);
16206
16352
  return;
@@ -16301,6 +16447,18 @@ var KicadPcb = class _KicadPcb extends SxClass {
16301
16447
  set graphicTexts(value) {
16302
16448
  this._grTexts = [...value];
16303
16449
  }
16450
+ get graphicPolys() {
16451
+ return [...this._grPolys];
16452
+ }
16453
+ set graphicPolys(value) {
16454
+ this._grPolys = [...value];
16455
+ }
16456
+ get graphicRects() {
16457
+ return [...this._grRects];
16458
+ }
16459
+ set graphicRects(value) {
16460
+ this._grRects = [...value];
16461
+ }
16304
16462
  get vias() {
16305
16463
  return [...this._vias];
16306
16464
  }
@@ -16336,6 +16494,8 @@ var KicadPcb = class _KicadPcb extends SxClass {
16336
16494
  children.push(...this._segments);
16337
16495
  children.push(...this._grLines);
16338
16496
  children.push(...this._grTexts);
16497
+ children.push(...this._grPolys);
16498
+ children.push(...this._grRects);
16339
16499
  children.push(...this._vias);
16340
16500
  children.push(...this._zones);
16341
16501
  children.push(...this._otherChildren);
@@ -16470,6 +16630,9 @@ export {
16470
16630
  KicadSchGenerator,
16471
16631
  KicadSchGeneratorVersion,
16472
16632
  KicadSchVersion,
16633
+ KicadSymbolLib,
16634
+ KicadSymbolLibGenerator,
16635
+ KicadSymbolLibVersion,
16473
16636
  Label,
16474
16637
  Layer,
16475
16638
  Layers,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kicadts",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.21",
4
+ "version": "0.0.23",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",