kicadts 0.0.15 → 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;
@@ -1591,6 +1615,8 @@ interface KicadSchConstructorParams {
1591
1615
  globalLabels?: GlobalLabel[];
1592
1616
  wires?: Wire[];
1593
1617
  junctions?: Junction[];
1618
+ noConnects?: NoConnect[];
1619
+ polylines?: Polyline[];
1594
1620
  }
1595
1621
  declare class KicadSch extends SxClass {
1596
1622
  static token: string;
@@ -1613,6 +1639,8 @@ declare class KicadSch extends SxClass {
1613
1639
  private _globalLabels;
1614
1640
  private _wires;
1615
1641
  private _junctions;
1642
+ private _noConnects;
1643
+ private _polylines;
1616
1644
  constructor(params?: KicadSchConstructorParams);
1617
1645
  static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): KicadSch;
1618
1646
  get version(): number | undefined;
@@ -1651,6 +1679,10 @@ declare class KicadSch extends SxClass {
1651
1679
  set junctions(value: Junction[]);
1652
1680
  get wires(): Wire[];
1653
1681
  set wires(value: Wire[]);
1682
+ get noConnects(): NoConnect[];
1683
+ set noConnects(value: NoConnect[]);
1684
+ get polylines(): Polyline[];
1685
+ set polylines(value: Polyline[]);
1654
1686
  getChildren(): SxClass[];
1655
1687
  }
1656
1688
 
@@ -4796,4 +4828,4 @@ declare const parseKicadSch: (sexpr: string) => KicadSch;
4796
4828
  declare const parseKicadPcb: (sexpr: string) => KicadPcb;
4797
4829
  declare const parseKicadMod: (sexpr: string) => Footprint;
4798
4830
 
4799
- 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";
@@ -3530,11 +3587,15 @@ var NoConnect = class _NoConnect extends SxClass {
3530
3587
  static fromSexprPrimitives(primitiveSexprs) {
3531
3588
  const noConnect = new _NoConnect();
3532
3589
  const { propertyMap, arrayPropertyMap } = SxClass.parsePrimitivesToClassProperties(primitiveSexprs, this.token);
3533
- if (Object.keys(arrayPropertyMap).length > 0) {
3534
- const tokens = Object.keys(arrayPropertyMap).join(", ");
3535
- throw new Error(
3536
- `no_connect does not support repeated child tokens: ${tokens}`
3537
- );
3590
+ for (const token of Object.keys(arrayPropertyMap)) {
3591
+ if (!SUPPORTED_TOKENS3.has(token)) {
3592
+ continue;
3593
+ }
3594
+ if (arrayPropertyMap[token].length > 1) {
3595
+ throw new Error(
3596
+ `no_connect does not support repeated child tokens: ${token}`
3597
+ );
3598
+ }
3538
3599
  }
3539
3600
  const unsupportedTokens = Object.keys(propertyMap).filter(
3540
3601
  (token) => !SUPPORTED_TOKENS3.has(token)
@@ -5082,7 +5143,9 @@ var MULTI_CHILD_TOKENS = /* @__PURE__ */ new Set([
5082
5143
  "global_label",
5083
5144
  "junction",
5084
5145
  "wire",
5085
- "sheet_instances"
5146
+ "no_connect",
5147
+ "sheet_instances",
5148
+ "polyline"
5086
5149
  ]);
5087
5150
  var SUPPORTED_CHILD_TOKENS2 = /* @__PURE__ */ new Set([
5088
5151
  ...SINGLE_CHILD_TOKENS,
@@ -5109,6 +5172,8 @@ var KicadSch = class _KicadSch extends SxClass {
5109
5172
  _globalLabels = [];
5110
5173
  _wires = [];
5111
5174
  _junctions = [];
5175
+ _noConnects = [];
5176
+ _polylines = [];
5112
5177
  constructor(params = {}) {
5113
5178
  super();
5114
5179
  if (params.version instanceof KicadSchVersion) {
@@ -5171,6 +5236,12 @@ var KicadSch = class _KicadSch extends SxClass {
5171
5236
  if (params.junctions !== void 0) {
5172
5237
  this.junctions = params.junctions;
5173
5238
  }
5239
+ if (params.noConnects !== void 0) {
5240
+ this.noConnects = params.noConnects;
5241
+ }
5242
+ if (params.polylines !== void 0) {
5243
+ this.polylines = params.polylines;
5244
+ }
5174
5245
  }
5175
5246
  static fromSexprPrimitives(primitiveSexprs) {
5176
5247
  for (const primitive of primitiveSexprs) {
@@ -5223,7 +5294,9 @@ var KicadSch = class _KicadSch extends SxClass {
5223
5294
  labels: arrayPropertyMap.label ?? [],
5224
5295
  globalLabels: arrayPropertyMap.global_label ?? [],
5225
5296
  junctions: arrayPropertyMap.junction ?? [],
5226
- wires: arrayPropertyMap.wire ?? []
5297
+ wires: arrayPropertyMap.wire ?? [],
5298
+ noConnects: arrayPropertyMap.no_connect ?? [],
5299
+ polylines: arrayPropertyMap.polyline ?? []
5227
5300
  });
5228
5301
  }
5229
5302
  get version() {
@@ -5342,6 +5415,18 @@ var KicadSch = class _KicadSch extends SxClass {
5342
5415
  set wires(value) {
5343
5416
  this._wires = [...value];
5344
5417
  }
5418
+ get noConnects() {
5419
+ return [...this._noConnects];
5420
+ }
5421
+ set noConnects(value) {
5422
+ this._noConnects = [...value];
5423
+ }
5424
+ get polylines() {
5425
+ return [...this._polylines];
5426
+ }
5427
+ set polylines(value) {
5428
+ this._polylines = [...value];
5429
+ }
5345
5430
  getChildren() {
5346
5431
  const children = [];
5347
5432
  if (this._sxVersion) children.push(this._sxVersion);
@@ -5362,6 +5447,8 @@ var KicadSch = class _KicadSch extends SxClass {
5362
5447
  children.push(...this._globalLabels);
5363
5448
  children.push(...this._junctions);
5364
5449
  children.push(...this._wires);
5450
+ children.push(...this._noConnects);
5451
+ children.push(...this._polylines);
5365
5452
  return children;
5366
5453
  }
5367
5454
  };
@@ -15376,11 +15463,13 @@ export {
15376
15463
  PlotParamUseGerberAttributes,
15377
15464
  PlotParamUseGerberExtensions,
15378
15465
  PlotParamViaOnMask,
15466
+ Polyline,
15379
15467
  Property,
15380
15468
  PropertyHide,
15381
15469
  PropertyUnlocked,
15382
15470
  Pts,
15383
15471
  RenderCache,
15472
+ SchematicPolyline,
15384
15473
  SchematicSymbol,
15385
15474
  SchematicText,
15386
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.15",
4
+ "version": "0.0.17",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",