kicadts 0.0.16 → 0.0.17

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
@@ -558,6 +558,46 @@ declare class FieldsAutoplaced extends SxPrimitiveBoolean {
558
558
  token: string;
559
559
  }
560
560
 
561
+ interface SymbolPolylineFillLike extends SxClass {
562
+ type?: string;
563
+ }
564
+ interface PolylineConstructorParams {
565
+ points?: Pts;
566
+ stroke?: Stroke;
567
+ uuid?: string | Uuid;
568
+ fill?: SymbolPolylineFillLike;
569
+ }
570
+ /**
571
+ * Base Polyline class that can be used in both kicad_sch and symbol contexts.
572
+ * - When parent is "kicad_sch": supports pts, stroke, uuid
573
+ * - When parent is "symbol": supports pts, stroke, fill
574
+ */
575
+ declare class Polyline extends SxClass {
576
+ static token: string;
577
+ token: string;
578
+ private _sxPts?;
579
+ private _sxStroke?;
580
+ private _sxUuid?;
581
+ private _sxFill?;
582
+ constructor(params?: PolylineConstructorParams);
583
+ static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): Polyline;
584
+ get points(): Pts | undefined;
585
+ set points(value: Pts | undefined);
586
+ get stroke(): Stroke | undefined;
587
+ set stroke(value: Stroke | undefined);
588
+ get uuid(): Uuid | undefined;
589
+ set uuid(value: Uuid | string | undefined);
590
+ get fill(): SymbolPolylineFillLike | undefined;
591
+ set fill(value: SymbolPolylineFillLike | undefined);
592
+ getChildren(): SxClass[];
593
+ }
594
+ declare class SchematicPolyline extends Polyline {
595
+ static parentToken: string;
596
+ }
597
+ declare class SymbolPolyline extends Polyline {
598
+ static parentToken: string;
599
+ }
600
+
561
601
  declare class SymbolUnit extends SxPrimitiveNumber {
562
602
  static token: string;
563
603
  static parentToken: string;
@@ -715,22 +755,6 @@ declare class SymbolFillType extends SxClass {
715
755
  getChildren(): SxClass[];
716
756
  getString(): string;
717
757
  }
718
- declare class SymbolPolyline extends SxClass {
719
- static token: string;
720
- static parentToken: string;
721
- token: string;
722
- private _sxPts?;
723
- private _sxStroke?;
724
- private _sxFill?;
725
- static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): SymbolPolyline;
726
- get points(): Pts | undefined;
727
- set points(value: Pts | undefined);
728
- get stroke(): Stroke | undefined;
729
- set stroke(value: Stroke | undefined);
730
- get fill(): SymbolPolylineFill | undefined;
731
- set fill(value: SymbolPolylineFill | undefined);
732
- getChildren(): SxClass[];
733
- }
734
758
  declare class SymbolRectangle extends SxClass {
735
759
  static token: string;
736
760
  static parentToken: string;
@@ -1592,6 +1616,7 @@ interface KicadSchConstructorParams {
1592
1616
  wires?: Wire[];
1593
1617
  junctions?: Junction[];
1594
1618
  noConnects?: NoConnect[];
1619
+ polylines?: Polyline[];
1595
1620
  }
1596
1621
  declare class KicadSch extends SxClass {
1597
1622
  static token: string;
@@ -1615,6 +1640,7 @@ declare class KicadSch extends SxClass {
1615
1640
  private _wires;
1616
1641
  private _junctions;
1617
1642
  private _noConnects;
1643
+ private _polylines;
1618
1644
  constructor(params?: KicadSchConstructorParams);
1619
1645
  static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): KicadSch;
1620
1646
  get version(): number | undefined;
@@ -1655,6 +1681,8 @@ declare class KicadSch extends SxClass {
1655
1681
  set wires(value: Wire[]);
1656
1682
  get noConnects(): NoConnect[];
1657
1683
  set noConnects(value: NoConnect[]);
1684
+ get polylines(): Polyline[];
1685
+ set polylines(value: Polyline[]);
1658
1686
  getChildren(): SxClass[];
1659
1687
  }
1660
1688
 
@@ -4800,4 +4828,4 @@ declare const parseKicadSch: (sexpr: string) => KicadSch;
4800
4828
  declare const parseKicadPcb: (sexpr: string) => KicadPcb;
4801
4829
  declare const parseKicadMod: (sexpr: string) => Footprint;
4802
4830
 
4803
- 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, type GrCirclePoint, GrCurve, type GrCurveConstructorParams, GrLine, GrLineAngle, type GrLineConstructorParams, GrLineEnd, GrLineLocked, type GrLinePoint, GrLineStart, GrText, type GrTextConstructorParams, type GrTextPosition, 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, 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, Property, type PropertyConstructorParams, PropertyHide, PropertyUnlocked, Pts, type RGBAColor, RenderCache, 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, 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 };
4831
+ 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, type GrCirclePoint, GrCurve, type GrCurveConstructorParams, GrLine, GrLineAngle, type GrLineConstructorParams, GrLineEnd, GrLineLocked, type GrLinePoint, GrLineStart, GrText, type GrTextConstructorParams, type GrTextPosition, 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, 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, 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
@@ -1918,6 +1918,108 @@ var FieldsAutoplaced = class extends SxPrimitiveBoolean {
1918
1918
  };
1919
1919
  SxClass.register(FieldsAutoplaced);
1920
1920
 
1921
+ // lib/sexpr/classes/Polyline.ts
1922
+ var SUPPORTED_TOKENS_KICAD_SCH = /* @__PURE__ */ new Set(["pts", "stroke", "uuid"]);
1923
+ var SUPPORTED_TOKENS_SYMBOL = /* @__PURE__ */ new Set(["pts", "stroke", "fill"]);
1924
+ var Polyline = class _Polyline extends SxClass {
1925
+ static token = "polyline";
1926
+ token = "polyline";
1927
+ _sxPts;
1928
+ _sxStroke;
1929
+ _sxUuid;
1930
+ _sxFill;
1931
+ constructor(params = {}) {
1932
+ super();
1933
+ if (params.points !== void 0) {
1934
+ this.points = params.points;
1935
+ }
1936
+ if (params.stroke !== void 0) {
1937
+ this.stroke = params.stroke;
1938
+ }
1939
+ if (params.uuid !== void 0) {
1940
+ this.uuid = params.uuid;
1941
+ }
1942
+ if (params.fill !== void 0) {
1943
+ this.fill = params.fill;
1944
+ }
1945
+ }
1946
+ static fromSexprPrimitives(primitiveSexprs) {
1947
+ const polyline = new _Polyline();
1948
+ const { propertyMap, arrayPropertyMap } = SxClass.parsePrimitivesToClassProperties(primitiveSexprs, this.token);
1949
+ const supportedTokens = this.parentToken === "symbol" ? SUPPORTED_TOKENS_SYMBOL : SUPPORTED_TOKENS_KICAD_SCH;
1950
+ for (const [token, entries] of Object.entries(arrayPropertyMap)) {
1951
+ if (!supportedTokens.has(token)) {
1952
+ throw new Error(
1953
+ `Unsupported child tokens inside polyline expression: ${token}`
1954
+ );
1955
+ }
1956
+ if (entries.length > 1) {
1957
+ throw new Error(
1958
+ `polyline does not support repeated child tokens: ${token}`
1959
+ );
1960
+ }
1961
+ }
1962
+ const unsupportedTokens = Object.keys(propertyMap).filter(
1963
+ (token) => !supportedTokens.has(token)
1964
+ );
1965
+ if (unsupportedTokens.length > 0) {
1966
+ throw new Error(
1967
+ `Unsupported child tokens inside polyline expression: ${unsupportedTokens.join(", ")}`
1968
+ );
1969
+ }
1970
+ polyline._sxPts = arrayPropertyMap.pts?.[0] ?? propertyMap.pts;
1971
+ polyline._sxStroke = propertyMap.stroke;
1972
+ polyline._sxUuid = propertyMap.uuid;
1973
+ polyline._sxFill = propertyMap.fill;
1974
+ return polyline;
1975
+ }
1976
+ get points() {
1977
+ return this._sxPts;
1978
+ }
1979
+ set points(value) {
1980
+ this._sxPts = value;
1981
+ }
1982
+ get stroke() {
1983
+ return this._sxStroke;
1984
+ }
1985
+ set stroke(value) {
1986
+ this._sxStroke = value;
1987
+ }
1988
+ get uuid() {
1989
+ return this._sxUuid;
1990
+ }
1991
+ set uuid(value) {
1992
+ if (value === void 0) {
1993
+ this._sxUuid = void 0;
1994
+ return;
1995
+ }
1996
+ this._sxUuid = value instanceof Uuid ? value : new Uuid(value);
1997
+ }
1998
+ get fill() {
1999
+ return this._sxFill;
2000
+ }
2001
+ set fill(value) {
2002
+ this._sxFill = value;
2003
+ }
2004
+ getChildren() {
2005
+ const children = [];
2006
+ if (this._sxPts) children.push(this._sxPts);
2007
+ if (this._sxStroke) children.push(this._sxStroke);
2008
+ if (this._sxFill) children.push(this._sxFill);
2009
+ if (this._sxUuid) children.push(this._sxUuid);
2010
+ return children;
2011
+ }
2012
+ };
2013
+ SxClass.register(Polyline);
2014
+ var SchematicPolyline = class extends Polyline {
2015
+ static parentToken = "kicad_sch";
2016
+ };
2017
+ SxClass.register(SchematicPolyline);
2018
+ var SymbolPolyline = class extends Polyline {
2019
+ static parentToken = "symbol";
2020
+ };
2021
+ SxClass.register(SymbolPolyline);
2022
+
1921
2023
  // lib/sexpr/classes/Symbol.ts
1922
2024
  var SymbolUnit = class _SymbolUnit extends SxPrimitiveNumber {
1923
2025
  static token = "unit";
@@ -2249,51 +2351,6 @@ var SymbolFillType = class _SymbolFillType extends SxClass {
2249
2351
  }
2250
2352
  };
2251
2353
  SxClass.register(SymbolFillType);
2252
- var SymbolPolyline = class _SymbolPolyline extends SxClass {
2253
- static token = "polyline";
2254
- static parentToken = "symbol";
2255
- token = "polyline";
2256
- _sxPts;
2257
- _sxStroke;
2258
- _sxFill;
2259
- static fromSexprPrimitives(primitiveSexprs) {
2260
- const polyline = new _SymbolPolyline();
2261
- const { propertyMap } = SxClass.parsePrimitivesToClassProperties(
2262
- primitiveSexprs,
2263
- this.token
2264
- );
2265
- polyline._sxPts = propertyMap.pts;
2266
- polyline._sxStroke = propertyMap.stroke;
2267
- polyline._sxFill = propertyMap.fill;
2268
- return polyline;
2269
- }
2270
- get points() {
2271
- return this._sxPts;
2272
- }
2273
- set points(value) {
2274
- this._sxPts = value;
2275
- }
2276
- get stroke() {
2277
- return this._sxStroke;
2278
- }
2279
- set stroke(value) {
2280
- this._sxStroke = value;
2281
- }
2282
- get fill() {
2283
- return this._sxFill;
2284
- }
2285
- set fill(value) {
2286
- this._sxFill = value;
2287
- }
2288
- getChildren() {
2289
- const children = [];
2290
- if (this._sxPts) children.push(this._sxPts);
2291
- if (this._sxStroke) children.push(this._sxStroke);
2292
- if (this._sxFill) children.push(this._sxFill);
2293
- return children;
2294
- }
2295
- };
2296
- SxClass.register(SymbolPolyline);
2297
2354
  var SymbolRectangle = class _SymbolRectangle extends SxClass {
2298
2355
  static token = "rectangle";
2299
2356
  static parentToken = "symbol";
@@ -5087,7 +5144,8 @@ var MULTI_CHILD_TOKENS = /* @__PURE__ */ new Set([
5087
5144
  "junction",
5088
5145
  "wire",
5089
5146
  "no_connect",
5090
- "sheet_instances"
5147
+ "sheet_instances",
5148
+ "polyline"
5091
5149
  ]);
5092
5150
  var SUPPORTED_CHILD_TOKENS2 = /* @__PURE__ */ new Set([
5093
5151
  ...SINGLE_CHILD_TOKENS,
@@ -5115,6 +5173,7 @@ var KicadSch = class _KicadSch extends SxClass {
5115
5173
  _wires = [];
5116
5174
  _junctions = [];
5117
5175
  _noConnects = [];
5176
+ _polylines = [];
5118
5177
  constructor(params = {}) {
5119
5178
  super();
5120
5179
  if (params.version instanceof KicadSchVersion) {
@@ -5180,6 +5239,9 @@ var KicadSch = class _KicadSch extends SxClass {
5180
5239
  if (params.noConnects !== void 0) {
5181
5240
  this.noConnects = params.noConnects;
5182
5241
  }
5242
+ if (params.polylines !== void 0) {
5243
+ this.polylines = params.polylines;
5244
+ }
5183
5245
  }
5184
5246
  static fromSexprPrimitives(primitiveSexprs) {
5185
5247
  for (const primitive of primitiveSexprs) {
@@ -5233,7 +5295,8 @@ var KicadSch = class _KicadSch extends SxClass {
5233
5295
  globalLabels: arrayPropertyMap.global_label ?? [],
5234
5296
  junctions: arrayPropertyMap.junction ?? [],
5235
5297
  wires: arrayPropertyMap.wire ?? [],
5236
- noConnects: arrayPropertyMap.no_connect ?? []
5298
+ noConnects: arrayPropertyMap.no_connect ?? [],
5299
+ polylines: arrayPropertyMap.polyline ?? []
5237
5300
  });
5238
5301
  }
5239
5302
  get version() {
@@ -5358,6 +5421,12 @@ var KicadSch = class _KicadSch extends SxClass {
5358
5421
  set noConnects(value) {
5359
5422
  this._noConnects = [...value];
5360
5423
  }
5424
+ get polylines() {
5425
+ return [...this._polylines];
5426
+ }
5427
+ set polylines(value) {
5428
+ this._polylines = [...value];
5429
+ }
5361
5430
  getChildren() {
5362
5431
  const children = [];
5363
5432
  if (this._sxVersion) children.push(this._sxVersion);
@@ -5379,6 +5448,7 @@ var KicadSch = class _KicadSch extends SxClass {
5379
5448
  children.push(...this._junctions);
5380
5449
  children.push(...this._wires);
5381
5450
  children.push(...this._noConnects);
5451
+ children.push(...this._polylines);
5382
5452
  return children;
5383
5453
  }
5384
5454
  };
@@ -15393,11 +15463,13 @@ export {
15393
15463
  PlotParamUseGerberAttributes,
15394
15464
  PlotParamUseGerberExtensions,
15395
15465
  PlotParamViaOnMask,
15466
+ Polyline,
15396
15467
  Property,
15397
15468
  PropertyHide,
15398
15469
  PropertyUnlocked,
15399
15470
  Pts,
15400
15471
  RenderCache,
15472
+ SchematicPolyline,
15401
15473
  SchematicSymbol,
15402
15474
  SchematicText,
15403
15475
  Segment,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kicadts",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.16",
4
+ "version": "0.0.17",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",