kicadts 0.0.19 → 0.0.20
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 +166 -3
- package/dist/index.js +513 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -128,12 +128,82 @@ declare class Xy extends SxClass {
|
|
|
128
128
|
declare class Pts extends SxClass {
|
|
129
129
|
static token: string;
|
|
130
130
|
token: string;
|
|
131
|
-
points: Array<Xy>;
|
|
132
|
-
constructor(points?: Array<Xy>);
|
|
131
|
+
points: Array<Xy | PtsArc>;
|
|
132
|
+
constructor(points?: Array<Xy | PtsArc>);
|
|
133
133
|
static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): Pts;
|
|
134
134
|
getChildren(): SxClass[];
|
|
135
135
|
getString(): string;
|
|
136
136
|
}
|
|
137
|
+
declare class PtsArc extends SxClass {
|
|
138
|
+
static token: string;
|
|
139
|
+
static parentToken: string;
|
|
140
|
+
token: string;
|
|
141
|
+
private _sxStart?;
|
|
142
|
+
private _sxMid?;
|
|
143
|
+
private _sxEnd?;
|
|
144
|
+
constructor(params?: {
|
|
145
|
+
start?: PtsArcStart | {
|
|
146
|
+
x: number;
|
|
147
|
+
y: number;
|
|
148
|
+
};
|
|
149
|
+
mid?: PtsArcMid | {
|
|
150
|
+
x: number;
|
|
151
|
+
y: number;
|
|
152
|
+
};
|
|
153
|
+
end?: PtsArcEnd | {
|
|
154
|
+
x: number;
|
|
155
|
+
y: number;
|
|
156
|
+
};
|
|
157
|
+
});
|
|
158
|
+
static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): PtsArc;
|
|
159
|
+
get start(): PtsArcStart | undefined;
|
|
160
|
+
set start(value: PtsArcStart | {
|
|
161
|
+
x: number;
|
|
162
|
+
y: number;
|
|
163
|
+
} | undefined);
|
|
164
|
+
get mid(): PtsArcMid | undefined;
|
|
165
|
+
set mid(value: PtsArcMid | {
|
|
166
|
+
x: number;
|
|
167
|
+
y: number;
|
|
168
|
+
} | undefined);
|
|
169
|
+
get end(): PtsArcEnd | undefined;
|
|
170
|
+
set end(value: PtsArcEnd | {
|
|
171
|
+
x: number;
|
|
172
|
+
y: number;
|
|
173
|
+
} | undefined);
|
|
174
|
+
getChildren(): SxClass[];
|
|
175
|
+
getString(): string;
|
|
176
|
+
}
|
|
177
|
+
declare class PtsArcStart extends SxClass {
|
|
178
|
+
x: number;
|
|
179
|
+
y: number;
|
|
180
|
+
static token: string;
|
|
181
|
+
static parentToken: string;
|
|
182
|
+
token: string;
|
|
183
|
+
constructor(x: number, y: number);
|
|
184
|
+
static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): PtsArcStart;
|
|
185
|
+
getString(): string;
|
|
186
|
+
}
|
|
187
|
+
declare class PtsArcMid extends SxClass {
|
|
188
|
+
x: number;
|
|
189
|
+
y: number;
|
|
190
|
+
static token: string;
|
|
191
|
+
static parentToken: string;
|
|
192
|
+
token: string;
|
|
193
|
+
constructor(x: number, y: number);
|
|
194
|
+
static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): PtsArcMid;
|
|
195
|
+
getString(): string;
|
|
196
|
+
}
|
|
197
|
+
declare class PtsArcEnd extends SxClass {
|
|
198
|
+
x: number;
|
|
199
|
+
y: number;
|
|
200
|
+
static token: string;
|
|
201
|
+
static parentToken: string;
|
|
202
|
+
token: string;
|
|
203
|
+
constructor(x: number, y: number);
|
|
204
|
+
static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): PtsArcEnd;
|
|
205
|
+
getString(): string;
|
|
206
|
+
}
|
|
137
207
|
|
|
138
208
|
type AtInput = At | [x: number, y: number, angle?: number] | {
|
|
139
209
|
x: number;
|
|
@@ -3733,6 +3803,7 @@ interface GrTextConstructorParams {
|
|
|
3733
3803
|
tstamp?: Tstamp | string;
|
|
3734
3804
|
uuid?: Uuid | string;
|
|
3735
3805
|
effects?: TextEffects;
|
|
3806
|
+
renderCaches?: GrTextRenderCache[];
|
|
3736
3807
|
}
|
|
3737
3808
|
declare class GrText extends SxClass {
|
|
3738
3809
|
static token: string;
|
|
@@ -3743,6 +3814,7 @@ declare class GrText extends SxClass {
|
|
|
3743
3814
|
private _sxTstamp?;
|
|
3744
3815
|
private _sxUuid?;
|
|
3745
3816
|
private _sxEffects?;
|
|
3817
|
+
private _renderCaches;
|
|
3746
3818
|
constructor(params?: GrTextConstructorParams | string);
|
|
3747
3819
|
static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): GrText;
|
|
3748
3820
|
get text(): string;
|
|
@@ -3757,9 +3829,100 @@ declare class GrText extends SxClass {
|
|
|
3757
3829
|
set uuid(value: Uuid | string | undefined);
|
|
3758
3830
|
get effects(): TextEffects | undefined;
|
|
3759
3831
|
set effects(value: TextEffects | undefined);
|
|
3832
|
+
get renderCaches(): GrTextRenderCache[];
|
|
3833
|
+
set renderCaches(value: GrTextRenderCache[]);
|
|
3760
3834
|
getChildren(): SxClass[];
|
|
3761
3835
|
getString(): string;
|
|
3762
3836
|
}
|
|
3837
|
+
declare class GrTextRenderCache extends SxClass {
|
|
3838
|
+
static token: string;
|
|
3839
|
+
static parentToken: string;
|
|
3840
|
+
token: string;
|
|
3841
|
+
private _text;
|
|
3842
|
+
private _angle;
|
|
3843
|
+
private _polygons;
|
|
3844
|
+
constructor(params?: {
|
|
3845
|
+
text?: string;
|
|
3846
|
+
angle?: number;
|
|
3847
|
+
polygons?: GrTextRenderCachePolygon[];
|
|
3848
|
+
});
|
|
3849
|
+
static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): GrTextRenderCache;
|
|
3850
|
+
get text(): string;
|
|
3851
|
+
set text(value: string);
|
|
3852
|
+
get angle(): number;
|
|
3853
|
+
set angle(value: number);
|
|
3854
|
+
get polygons(): GrTextRenderCachePolygon[];
|
|
3855
|
+
set polygons(value: GrTextRenderCachePolygon[]);
|
|
3856
|
+
getChildren(): SxClass[];
|
|
3857
|
+
getString(): string;
|
|
3858
|
+
}
|
|
3859
|
+
declare class GrTextRenderCachePolygon extends SxClass {
|
|
3860
|
+
static token: string;
|
|
3861
|
+
static parentToken: string;
|
|
3862
|
+
token: string;
|
|
3863
|
+
private _pts?;
|
|
3864
|
+
constructor(params?: {
|
|
3865
|
+
pts?: Pts;
|
|
3866
|
+
});
|
|
3867
|
+
static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): GrTextRenderCachePolygon;
|
|
3868
|
+
get pts(): Pts | undefined;
|
|
3869
|
+
set pts(value: Pts | undefined);
|
|
3870
|
+
getChildren(): SxClass[];
|
|
3871
|
+
getString(): string;
|
|
3872
|
+
}
|
|
3873
|
+
|
|
3874
|
+
declare class GrPolyFill extends SxClass {
|
|
3875
|
+
static token: string;
|
|
3876
|
+
static parentToken: string;
|
|
3877
|
+
token: string;
|
|
3878
|
+
filled: boolean;
|
|
3879
|
+
constructor(filled: boolean);
|
|
3880
|
+
static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): GrPolyFill;
|
|
3881
|
+
getString(): string;
|
|
3882
|
+
}
|
|
3883
|
+
interface GrPolyConstructorParams {
|
|
3884
|
+
points?: Pts | Xy[] | Array<{
|
|
3885
|
+
x: number;
|
|
3886
|
+
y: number;
|
|
3887
|
+
}>;
|
|
3888
|
+
layer?: Layer | string | Array<string | number>;
|
|
3889
|
+
width?: Width | number;
|
|
3890
|
+
stroke?: Stroke;
|
|
3891
|
+
fill?: GrPolyFill | boolean;
|
|
3892
|
+
uuid?: Uuid | string;
|
|
3893
|
+
}
|
|
3894
|
+
declare class GrPoly extends SxClass {
|
|
3895
|
+
static token: string;
|
|
3896
|
+
token: string;
|
|
3897
|
+
private _sxPts?;
|
|
3898
|
+
private _sxLayer?;
|
|
3899
|
+
private _sxWidth?;
|
|
3900
|
+
private _sxStroke?;
|
|
3901
|
+
private _sxFill?;
|
|
3902
|
+
private _sxUuid?;
|
|
3903
|
+
constructor(params?: GrPolyConstructorParams);
|
|
3904
|
+
static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): GrPoly;
|
|
3905
|
+
get points(): Pts | undefined;
|
|
3906
|
+
set points(value: Pts | Xy[] | Array<{
|
|
3907
|
+
x: number;
|
|
3908
|
+
y: number;
|
|
3909
|
+
}> | undefined);
|
|
3910
|
+
get layer(): Layer | undefined;
|
|
3911
|
+
set layer(value: Layer | string | Array<string | number> | undefined);
|
|
3912
|
+
get width(): number | undefined;
|
|
3913
|
+
set width(value: Width | number | undefined);
|
|
3914
|
+
get widthClass(): Width | undefined;
|
|
3915
|
+
set widthClass(value: Width | undefined);
|
|
3916
|
+
get stroke(): Stroke | undefined;
|
|
3917
|
+
set stroke(value: Stroke | undefined);
|
|
3918
|
+
get fill(): boolean | undefined;
|
|
3919
|
+
set fill(value: GrPolyFill | boolean | undefined);
|
|
3920
|
+
get fillClass(): GrPolyFill | undefined;
|
|
3921
|
+
get uuid(): string | undefined;
|
|
3922
|
+
set uuid(value: Uuid | string | undefined);
|
|
3923
|
+
get uuidClass(): Uuid | undefined;
|
|
3924
|
+
getChildren(): SxClass[];
|
|
3925
|
+
}
|
|
3763
3926
|
|
|
3764
3927
|
interface GroupConstructorParams {
|
|
3765
3928
|
name?: string;
|
|
@@ -5025,4 +5188,4 @@ declare const parseKicadSch: (sexpr: string) => KicadSch;
|
|
|
5025
5188
|
declare const parseKicadPcb: (sexpr: string) => KicadPcb;
|
|
5026
5189
|
declare const parseKicadMod: (sexpr: string) => Footprint;
|
|
5027
5190
|
|
|
5028
|
-
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, GrRect, type GrRectConstructorParams, GrRectEnd, GrRectFill, GrRectLocked, GrRectStart, GrText, type GrTextConstructorParams, type GrTextPosition, 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, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -510,6 +510,10 @@ var Pts = class _Pts extends SxClass {
|
|
|
510
510
|
points.push(parsed);
|
|
511
511
|
continue;
|
|
512
512
|
}
|
|
513
|
+
if (parsed instanceof PtsArc) {
|
|
514
|
+
points.push(parsed);
|
|
515
|
+
continue;
|
|
516
|
+
}
|
|
513
517
|
if (parsed instanceof SxClass) {
|
|
514
518
|
throw new Error(
|
|
515
519
|
`Unsupported child "${parsed.token}" inside pts expression`
|
|
@@ -538,6 +542,146 @@ var Pts = class _Pts extends SxClass {
|
|
|
538
542
|
}
|
|
539
543
|
};
|
|
540
544
|
SxClass.register(Pts);
|
|
545
|
+
var PtsArc = class _PtsArc extends SxClass {
|
|
546
|
+
static token = "arc";
|
|
547
|
+
static parentToken = "pts";
|
|
548
|
+
token = "arc";
|
|
549
|
+
_sxStart;
|
|
550
|
+
_sxMid;
|
|
551
|
+
_sxEnd;
|
|
552
|
+
constructor(params = {}) {
|
|
553
|
+
super();
|
|
554
|
+
if (params.start !== void 0) this.start = params.start;
|
|
555
|
+
if (params.mid !== void 0) this.mid = params.mid;
|
|
556
|
+
if (params.end !== void 0) this.end = params.end;
|
|
557
|
+
}
|
|
558
|
+
static fromSexprPrimitives(primitiveSexprs) {
|
|
559
|
+
const arc = new _PtsArc();
|
|
560
|
+
const { propertyMap } = SxClass.parsePrimitivesToClassProperties(
|
|
561
|
+
primitiveSexprs,
|
|
562
|
+
this.token
|
|
563
|
+
);
|
|
564
|
+
arc._sxStart = propertyMap.start;
|
|
565
|
+
arc._sxMid = propertyMap.mid;
|
|
566
|
+
arc._sxEnd = propertyMap.end;
|
|
567
|
+
return arc;
|
|
568
|
+
}
|
|
569
|
+
get start() {
|
|
570
|
+
return this._sxStart;
|
|
571
|
+
}
|
|
572
|
+
set start(value) {
|
|
573
|
+
if (value === void 0) {
|
|
574
|
+
this._sxStart = void 0;
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
if (value instanceof PtsArcStart) {
|
|
578
|
+
this._sxStart = value;
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
this._sxStart = new PtsArcStart(value.x, value.y);
|
|
582
|
+
}
|
|
583
|
+
get mid() {
|
|
584
|
+
return this._sxMid;
|
|
585
|
+
}
|
|
586
|
+
set mid(value) {
|
|
587
|
+
if (value === void 0) {
|
|
588
|
+
this._sxMid = void 0;
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
if (value instanceof PtsArcMid) {
|
|
592
|
+
this._sxMid = value;
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
this._sxMid = new PtsArcMid(value.x, value.y);
|
|
596
|
+
}
|
|
597
|
+
get end() {
|
|
598
|
+
return this._sxEnd;
|
|
599
|
+
}
|
|
600
|
+
set end(value) {
|
|
601
|
+
if (value === void 0) {
|
|
602
|
+
this._sxEnd = void 0;
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
if (value instanceof PtsArcEnd) {
|
|
606
|
+
this._sxEnd = value;
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
this._sxEnd = new PtsArcEnd(value.x, value.y);
|
|
610
|
+
}
|
|
611
|
+
getChildren() {
|
|
612
|
+
const children = [];
|
|
613
|
+
if (this._sxStart) children.push(this._sxStart);
|
|
614
|
+
if (this._sxMid) children.push(this._sxMid);
|
|
615
|
+
if (this._sxEnd) children.push(this._sxEnd);
|
|
616
|
+
return children;
|
|
617
|
+
}
|
|
618
|
+
getString() {
|
|
619
|
+
const lines = ["(arc"];
|
|
620
|
+
if (this._sxStart) lines.push(this._sxStart.getStringIndented());
|
|
621
|
+
if (this._sxMid) lines.push(this._sxMid.getStringIndented());
|
|
622
|
+
if (this._sxEnd) lines.push(this._sxEnd.getStringIndented());
|
|
623
|
+
lines.push(")");
|
|
624
|
+
return lines.join("\n");
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
SxClass.register(PtsArc);
|
|
628
|
+
var PtsArcStart = class _PtsArcStart extends SxClass {
|
|
629
|
+
constructor(x, y) {
|
|
630
|
+
super();
|
|
631
|
+
this.x = x;
|
|
632
|
+
this.y = y;
|
|
633
|
+
}
|
|
634
|
+
static token = "start";
|
|
635
|
+
static parentToken = "arc";
|
|
636
|
+
token = "start";
|
|
637
|
+
static fromSexprPrimitives(primitiveSexprs) {
|
|
638
|
+
const x = toNumberValue(primitiveSexprs[0]) ?? 0;
|
|
639
|
+
const y = toNumberValue(primitiveSexprs[1]) ?? 0;
|
|
640
|
+
return new _PtsArcStart(x, y);
|
|
641
|
+
}
|
|
642
|
+
getString() {
|
|
643
|
+
return `(start ${this.x} ${this.y})`;
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
SxClass.register(PtsArcStart);
|
|
647
|
+
var PtsArcMid = class _PtsArcMid extends SxClass {
|
|
648
|
+
constructor(x, y) {
|
|
649
|
+
super();
|
|
650
|
+
this.x = x;
|
|
651
|
+
this.y = y;
|
|
652
|
+
}
|
|
653
|
+
static token = "mid";
|
|
654
|
+
static parentToken = "arc";
|
|
655
|
+
token = "mid";
|
|
656
|
+
static fromSexprPrimitives(primitiveSexprs) {
|
|
657
|
+
const x = toNumberValue(primitiveSexprs[0]) ?? 0;
|
|
658
|
+
const y = toNumberValue(primitiveSexprs[1]) ?? 0;
|
|
659
|
+
return new _PtsArcMid(x, y);
|
|
660
|
+
}
|
|
661
|
+
getString() {
|
|
662
|
+
return `(mid ${this.x} ${this.y})`;
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
SxClass.register(PtsArcMid);
|
|
666
|
+
var PtsArcEnd = class _PtsArcEnd extends SxClass {
|
|
667
|
+
constructor(x, y) {
|
|
668
|
+
super();
|
|
669
|
+
this.x = x;
|
|
670
|
+
this.y = y;
|
|
671
|
+
}
|
|
672
|
+
static token = "end";
|
|
673
|
+
static parentToken = "arc";
|
|
674
|
+
token = "end";
|
|
675
|
+
static fromSexprPrimitives(primitiveSexprs) {
|
|
676
|
+
const x = toNumberValue(primitiveSexprs[0]) ?? 0;
|
|
677
|
+
const y = toNumberValue(primitiveSexprs[1]) ?? 0;
|
|
678
|
+
return new _PtsArcEnd(x, y);
|
|
679
|
+
}
|
|
680
|
+
getString() {
|
|
681
|
+
return `(end ${this.x} ${this.y})`;
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
SxClass.register(PtsArcEnd);
|
|
541
685
|
|
|
542
686
|
// lib/sexpr/classes/At.ts
|
|
543
687
|
var At = class _At extends SxClass {
|
|
@@ -12314,7 +12458,17 @@ var SUPPORTED_SINGLE_TOKENS9 = /* @__PURE__ */ new Set([
|
|
|
12314
12458
|
"layer",
|
|
12315
12459
|
"tstamp",
|
|
12316
12460
|
"uuid",
|
|
12317
|
-
"effects"
|
|
12461
|
+
"effects",
|
|
12462
|
+
"render_cache"
|
|
12463
|
+
]);
|
|
12464
|
+
var SUPPORTED_ARRAY_TOKENS3 = /* @__PURE__ */ new Set([
|
|
12465
|
+
"at",
|
|
12466
|
+
"xy",
|
|
12467
|
+
"layer",
|
|
12468
|
+
"tstamp",
|
|
12469
|
+
"uuid",
|
|
12470
|
+
"effects",
|
|
12471
|
+
"render_cache"
|
|
12318
12472
|
]);
|
|
12319
12473
|
var GrText = class _GrText extends SxClass {
|
|
12320
12474
|
static token = "gr_text";
|
|
@@ -12325,6 +12479,7 @@ var GrText = class _GrText extends SxClass {
|
|
|
12325
12479
|
_sxTstamp;
|
|
12326
12480
|
_sxUuid;
|
|
12327
12481
|
_sxEffects;
|
|
12482
|
+
_renderCaches = [];
|
|
12328
12483
|
constructor(params = {}) {
|
|
12329
12484
|
super();
|
|
12330
12485
|
if (typeof params === "string") {
|
|
@@ -12336,6 +12491,8 @@ var GrText = class _GrText extends SxClass {
|
|
|
12336
12491
|
if (params.tstamp !== void 0) this.tstamp = params.tstamp;
|
|
12337
12492
|
if (params.uuid !== void 0) this.uuid = params.uuid;
|
|
12338
12493
|
if (params.effects !== void 0) this.effects = params.effects;
|
|
12494
|
+
if (params.renderCaches !== void 0)
|
|
12495
|
+
this.renderCaches = params.renderCaches;
|
|
12339
12496
|
}
|
|
12340
12497
|
}
|
|
12341
12498
|
static fromSexprPrimitives(primitiveSexprs) {
|
|
@@ -12356,11 +12513,11 @@ var GrText = class _GrText extends SxClass {
|
|
|
12356
12513
|
}
|
|
12357
12514
|
}
|
|
12358
12515
|
for (const token of Object.keys(arrayPropertyMap)) {
|
|
12359
|
-
if (!
|
|
12516
|
+
if (!SUPPORTED_ARRAY_TOKENS3.has(token)) {
|
|
12360
12517
|
unexpectedTokens.add(token);
|
|
12361
12518
|
continue;
|
|
12362
12519
|
}
|
|
12363
|
-
if (arrayPropertyMap[token].length > 1) {
|
|
12520
|
+
if (token !== "render_cache" && arrayPropertyMap[token].length > 1) {
|
|
12364
12521
|
throw new Error(
|
|
12365
12522
|
`gr_text does not support repeated child tokens: ${token}`
|
|
12366
12523
|
);
|
|
@@ -12387,6 +12544,10 @@ var GrText = class _GrText extends SxClass {
|
|
|
12387
12544
|
grText._sxTstamp = propertyMap.tstamp;
|
|
12388
12545
|
grText._sxUuid = propertyMap.uuid;
|
|
12389
12546
|
grText._sxEffects = propertyMap.effects;
|
|
12547
|
+
const renderCaches = arrayPropertyMap.render_cache;
|
|
12548
|
+
if (renderCaches && renderCaches.length > 0) {
|
|
12549
|
+
grText._renderCaches = renderCaches;
|
|
12550
|
+
}
|
|
12390
12551
|
if (!grText._sxPosition) {
|
|
12391
12552
|
throw new Error("gr_text requires a position child token");
|
|
12392
12553
|
}
|
|
@@ -12471,6 +12632,12 @@ var GrText = class _GrText extends SxClass {
|
|
|
12471
12632
|
set effects(value) {
|
|
12472
12633
|
this._sxEffects = value;
|
|
12473
12634
|
}
|
|
12635
|
+
get renderCaches() {
|
|
12636
|
+
return [...this._renderCaches];
|
|
12637
|
+
}
|
|
12638
|
+
set renderCaches(value) {
|
|
12639
|
+
this._renderCaches = [...value];
|
|
12640
|
+
}
|
|
12474
12641
|
getChildren() {
|
|
12475
12642
|
const children = [];
|
|
12476
12643
|
if (this._sxPosition) children.push(this._sxPosition);
|
|
@@ -12478,6 +12645,7 @@ var GrText = class _GrText extends SxClass {
|
|
|
12478
12645
|
if (this._sxTstamp) children.push(this._sxTstamp);
|
|
12479
12646
|
if (this._sxUuid) children.push(this._sxUuid);
|
|
12480
12647
|
if (this._sxEffects) children.push(this._sxEffects);
|
|
12648
|
+
children.push(...this._renderCaches);
|
|
12481
12649
|
return children;
|
|
12482
12650
|
}
|
|
12483
12651
|
getString() {
|
|
@@ -12490,6 +12658,340 @@ var GrText = class _GrText extends SxClass {
|
|
|
12490
12658
|
}
|
|
12491
12659
|
};
|
|
12492
12660
|
SxClass.register(GrText);
|
|
12661
|
+
var GrTextRenderCache = class _GrTextRenderCache extends SxClass {
|
|
12662
|
+
static token = "render_cache";
|
|
12663
|
+
static parentToken = "gr_text";
|
|
12664
|
+
token = "render_cache";
|
|
12665
|
+
_text = "";
|
|
12666
|
+
_angle = 0;
|
|
12667
|
+
_polygons = [];
|
|
12668
|
+
constructor(params = {}) {
|
|
12669
|
+
super();
|
|
12670
|
+
if (params.text !== void 0) this._text = params.text;
|
|
12671
|
+
if (params.angle !== void 0) this._angle = params.angle;
|
|
12672
|
+
if (params.polygons !== void 0) this._polygons = params.polygons;
|
|
12673
|
+
}
|
|
12674
|
+
static fromSexprPrimitives(primitiveSexprs) {
|
|
12675
|
+
const renderCache = new _GrTextRenderCache();
|
|
12676
|
+
if (primitiveSexprs.length >= 1) {
|
|
12677
|
+
renderCache._text = toStringValue(primitiveSexprs[0]) ?? "";
|
|
12678
|
+
}
|
|
12679
|
+
if (primitiveSexprs.length >= 2) {
|
|
12680
|
+
renderCache._angle = toNumberValue(primitiveSexprs[1]) ?? 0;
|
|
12681
|
+
}
|
|
12682
|
+
for (let i = 2; i < primitiveSexprs.length; i++) {
|
|
12683
|
+
const primitive = primitiveSexprs[i];
|
|
12684
|
+
if (!Array.isArray(primitive) || primitive.length === 0) {
|
|
12685
|
+
continue;
|
|
12686
|
+
}
|
|
12687
|
+
const parsed = SxClass.parsePrimitiveSexpr(primitive, {
|
|
12688
|
+
parentToken: this.token
|
|
12689
|
+
});
|
|
12690
|
+
if (parsed instanceof GrTextRenderCachePolygon) {
|
|
12691
|
+
renderCache._polygons.push(parsed);
|
|
12692
|
+
}
|
|
12693
|
+
}
|
|
12694
|
+
return renderCache;
|
|
12695
|
+
}
|
|
12696
|
+
get text() {
|
|
12697
|
+
return this._text;
|
|
12698
|
+
}
|
|
12699
|
+
set text(value) {
|
|
12700
|
+
this._text = value;
|
|
12701
|
+
}
|
|
12702
|
+
get angle() {
|
|
12703
|
+
return this._angle;
|
|
12704
|
+
}
|
|
12705
|
+
set angle(value) {
|
|
12706
|
+
this._angle = value;
|
|
12707
|
+
}
|
|
12708
|
+
get polygons() {
|
|
12709
|
+
return [...this._polygons];
|
|
12710
|
+
}
|
|
12711
|
+
set polygons(value) {
|
|
12712
|
+
this._polygons = [...value];
|
|
12713
|
+
}
|
|
12714
|
+
getChildren() {
|
|
12715
|
+
return [...this._polygons];
|
|
12716
|
+
}
|
|
12717
|
+
getString() {
|
|
12718
|
+
const lines = [
|
|
12719
|
+
`(render_cache ${quoteSExprString(this._text)} ${this._angle}`
|
|
12720
|
+
];
|
|
12721
|
+
for (const polygon of this._polygons) {
|
|
12722
|
+
lines.push(polygon.getStringIndented());
|
|
12723
|
+
}
|
|
12724
|
+
lines.push(")");
|
|
12725
|
+
return lines.join("\n");
|
|
12726
|
+
}
|
|
12727
|
+
};
|
|
12728
|
+
SxClass.register(GrTextRenderCache);
|
|
12729
|
+
var GrTextRenderCachePolygon = class _GrTextRenderCachePolygon extends SxClass {
|
|
12730
|
+
static token = "polygon";
|
|
12731
|
+
static parentToken = "render_cache";
|
|
12732
|
+
token = "polygon";
|
|
12733
|
+
_pts;
|
|
12734
|
+
constructor(params = {}) {
|
|
12735
|
+
super();
|
|
12736
|
+
if (params.pts !== void 0) this._pts = params.pts;
|
|
12737
|
+
}
|
|
12738
|
+
static fromSexprPrimitives(primitiveSexprs) {
|
|
12739
|
+
const polygon = new _GrTextRenderCachePolygon();
|
|
12740
|
+
for (const primitive of primitiveSexprs) {
|
|
12741
|
+
if (!Array.isArray(primitive) || primitive.length === 0) {
|
|
12742
|
+
continue;
|
|
12743
|
+
}
|
|
12744
|
+
const parsed = SxClass.parsePrimitiveSexpr(primitive, {
|
|
12745
|
+
parentToken: this.token
|
|
12746
|
+
});
|
|
12747
|
+
if (parsed instanceof Pts) {
|
|
12748
|
+
polygon._pts = parsed;
|
|
12749
|
+
}
|
|
12750
|
+
}
|
|
12751
|
+
return polygon;
|
|
12752
|
+
}
|
|
12753
|
+
get pts() {
|
|
12754
|
+
return this._pts;
|
|
12755
|
+
}
|
|
12756
|
+
set pts(value) {
|
|
12757
|
+
this._pts = value;
|
|
12758
|
+
}
|
|
12759
|
+
getChildren() {
|
|
12760
|
+
return this._pts ? [this._pts] : [];
|
|
12761
|
+
}
|
|
12762
|
+
getString() {
|
|
12763
|
+
if (!this._pts) return "(polygon)";
|
|
12764
|
+
const lines = ["(polygon"];
|
|
12765
|
+
lines.push(this._pts.getStringIndented());
|
|
12766
|
+
lines.push(")");
|
|
12767
|
+
return lines.join("\n");
|
|
12768
|
+
}
|
|
12769
|
+
};
|
|
12770
|
+
SxClass.register(GrTextRenderCachePolygon);
|
|
12771
|
+
|
|
12772
|
+
// lib/sexpr/classes/GrPoly.ts
|
|
12773
|
+
var GrPolyFill = class _GrPolyFill extends SxClass {
|
|
12774
|
+
static token = "fill";
|
|
12775
|
+
static parentToken = "gr_poly";
|
|
12776
|
+
token = "fill";
|
|
12777
|
+
filled;
|
|
12778
|
+
constructor(filled) {
|
|
12779
|
+
super();
|
|
12780
|
+
this.filled = filled;
|
|
12781
|
+
}
|
|
12782
|
+
static fromSexprPrimitives(primitiveSexprs) {
|
|
12783
|
+
const state = toStringValue(primitiveSexprs[0]);
|
|
12784
|
+
return new _GrPolyFill(state === "yes");
|
|
12785
|
+
}
|
|
12786
|
+
getString() {
|
|
12787
|
+
return `(fill ${this.filled ? "yes" : "no"})`;
|
|
12788
|
+
}
|
|
12789
|
+
};
|
|
12790
|
+
SxClass.register(GrPolyFill);
|
|
12791
|
+
var SUPPORTED_TOKENS15 = /* @__PURE__ */ new Set([
|
|
12792
|
+
"pts",
|
|
12793
|
+
"xy",
|
|
12794
|
+
"layer",
|
|
12795
|
+
"width",
|
|
12796
|
+
"stroke",
|
|
12797
|
+
"fill",
|
|
12798
|
+
"uuid"
|
|
12799
|
+
]);
|
|
12800
|
+
var GrPoly = class _GrPoly extends SxClass {
|
|
12801
|
+
static token = "gr_poly";
|
|
12802
|
+
token = "gr_poly";
|
|
12803
|
+
_sxPts;
|
|
12804
|
+
_sxLayer;
|
|
12805
|
+
_sxWidth;
|
|
12806
|
+
_sxStroke;
|
|
12807
|
+
_sxFill;
|
|
12808
|
+
_sxUuid;
|
|
12809
|
+
constructor(params = {}) {
|
|
12810
|
+
super();
|
|
12811
|
+
if (params.points !== void 0) this.points = params.points;
|
|
12812
|
+
if (params.layer !== void 0) this.layer = params.layer;
|
|
12813
|
+
if (params.width !== void 0) this.width = params.width;
|
|
12814
|
+
if (params.stroke !== void 0) this.stroke = params.stroke;
|
|
12815
|
+
if (params.fill !== void 0) this.fill = params.fill;
|
|
12816
|
+
if (params.uuid !== void 0) this.uuid = params.uuid;
|
|
12817
|
+
}
|
|
12818
|
+
static fromSexprPrimitives(primitiveSexprs) {
|
|
12819
|
+
const grPoly = new _GrPoly();
|
|
12820
|
+
const { propertyMap, arrayPropertyMap } = SxClass.parsePrimitivesToClassProperties(primitiveSexprs, this.token);
|
|
12821
|
+
const unexpectedTokens = /* @__PURE__ */ new Set();
|
|
12822
|
+
for (const token of Object.keys(propertyMap)) {
|
|
12823
|
+
if (!SUPPORTED_TOKENS15.has(token)) {
|
|
12824
|
+
unexpectedTokens.add(token);
|
|
12825
|
+
}
|
|
12826
|
+
}
|
|
12827
|
+
for (const token of Object.keys(arrayPropertyMap)) {
|
|
12828
|
+
if (!SUPPORTED_TOKENS15.has(token)) {
|
|
12829
|
+
unexpectedTokens.add(token);
|
|
12830
|
+
}
|
|
12831
|
+
if (token !== "xy" && arrayPropertyMap[token].length > 1) {
|
|
12832
|
+
unexpectedTokens.add(token);
|
|
12833
|
+
}
|
|
12834
|
+
}
|
|
12835
|
+
if (unexpectedTokens.size > 0) {
|
|
12836
|
+
throw new Error(
|
|
12837
|
+
`Unsupported child tokens inside gr_poly expression: ${[...unexpectedTokens].join(", ")}`
|
|
12838
|
+
);
|
|
12839
|
+
}
|
|
12840
|
+
const ptsEntries = arrayPropertyMap.pts;
|
|
12841
|
+
if (ptsEntries && ptsEntries.length > 1) {
|
|
12842
|
+
throw new Error("gr_poly does not support repeated pts tokens");
|
|
12843
|
+
}
|
|
12844
|
+
const xyEntries = arrayPropertyMap.xy;
|
|
12845
|
+
let pts = propertyMap.pts;
|
|
12846
|
+
if (pts && xyEntries && xyEntries.length > 0) {
|
|
12847
|
+
throw new Error("gr_poly cannot mix pts and xy child tokens");
|
|
12848
|
+
}
|
|
12849
|
+
if (!pts && ptsEntries?.length) {
|
|
12850
|
+
pts = ptsEntries[0];
|
|
12851
|
+
}
|
|
12852
|
+
if (!pts && xyEntries && xyEntries.length > 0) {
|
|
12853
|
+
pts = new Pts(xyEntries);
|
|
12854
|
+
}
|
|
12855
|
+
grPoly._sxPts = pts;
|
|
12856
|
+
grPoly._sxLayer = propertyMap.layer;
|
|
12857
|
+
grPoly._sxWidth = propertyMap.width;
|
|
12858
|
+
grPoly._sxStroke = propertyMap.stroke;
|
|
12859
|
+
grPoly._sxFill = propertyMap.fill;
|
|
12860
|
+
grPoly._sxUuid = propertyMap.uuid;
|
|
12861
|
+
for (const primitive of primitiveSexprs) {
|
|
12862
|
+
if (!Array.isArray(primitive) || primitive.length === 0) {
|
|
12863
|
+
throw new Error(
|
|
12864
|
+
`gr_poly encountered unexpected primitive child: ${JSON.stringify(primitive)}`
|
|
12865
|
+
);
|
|
12866
|
+
}
|
|
12867
|
+
const [token, ...rest] = primitive;
|
|
12868
|
+
if (typeof token !== "string") {
|
|
12869
|
+
throw new Error(
|
|
12870
|
+
`gr_poly child token must be a string, received: ${JSON.stringify(token)}`
|
|
12871
|
+
);
|
|
12872
|
+
}
|
|
12873
|
+
if (!SUPPORTED_TOKENS15.has(token)) {
|
|
12874
|
+
throw new Error(
|
|
12875
|
+
`Unsupported child token inside gr_poly expression: ${token}`
|
|
12876
|
+
);
|
|
12877
|
+
}
|
|
12878
|
+
}
|
|
12879
|
+
if (!grPoly._sxPts) {
|
|
12880
|
+
throw new Error("gr_poly requires pts or xy child tokens");
|
|
12881
|
+
}
|
|
12882
|
+
if (!grPoly._sxLayer) {
|
|
12883
|
+
throw new Error("gr_poly requires a layer child token");
|
|
12884
|
+
}
|
|
12885
|
+
return grPoly;
|
|
12886
|
+
}
|
|
12887
|
+
get points() {
|
|
12888
|
+
return this._sxPts;
|
|
12889
|
+
}
|
|
12890
|
+
set points(value) {
|
|
12891
|
+
if (value === void 0) {
|
|
12892
|
+
this._sxPts = void 0;
|
|
12893
|
+
return;
|
|
12894
|
+
}
|
|
12895
|
+
if (value instanceof Pts) {
|
|
12896
|
+
this._sxPts = value;
|
|
12897
|
+
return;
|
|
12898
|
+
}
|
|
12899
|
+
if (Array.isArray(value) && value.every((point) => point instanceof Xy)) {
|
|
12900
|
+
this._sxPts = new Pts(value);
|
|
12901
|
+
return;
|
|
12902
|
+
}
|
|
12903
|
+
if (Array.isArray(value)) {
|
|
12904
|
+
this._sxPts = new Pts(value.map(({ x, y }) => new Xy(x, y)));
|
|
12905
|
+
return;
|
|
12906
|
+
}
|
|
12907
|
+
throw new Error("Unsupported points value provided to gr_poly");
|
|
12908
|
+
}
|
|
12909
|
+
get layer() {
|
|
12910
|
+
return this._sxLayer;
|
|
12911
|
+
}
|
|
12912
|
+
set layer(value) {
|
|
12913
|
+
if (value === void 0) {
|
|
12914
|
+
this._sxLayer = void 0;
|
|
12915
|
+
return;
|
|
12916
|
+
}
|
|
12917
|
+
if (value instanceof Layer) {
|
|
12918
|
+
this._sxLayer = value;
|
|
12919
|
+
return;
|
|
12920
|
+
}
|
|
12921
|
+
const names = Array.isArray(value) ? value : [value];
|
|
12922
|
+
this._sxLayer = new Layer(names);
|
|
12923
|
+
}
|
|
12924
|
+
get width() {
|
|
12925
|
+
return this._sxWidth?.value;
|
|
12926
|
+
}
|
|
12927
|
+
set width(value) {
|
|
12928
|
+
if (value === void 0) {
|
|
12929
|
+
this._sxWidth = void 0;
|
|
12930
|
+
return;
|
|
12931
|
+
}
|
|
12932
|
+
this._sxWidth = value instanceof Width ? value : new Width(value);
|
|
12933
|
+
}
|
|
12934
|
+
get widthClass() {
|
|
12935
|
+
return this._sxWidth;
|
|
12936
|
+
}
|
|
12937
|
+
set widthClass(value) {
|
|
12938
|
+
this._sxWidth = value;
|
|
12939
|
+
}
|
|
12940
|
+
get stroke() {
|
|
12941
|
+
return this._sxStroke;
|
|
12942
|
+
}
|
|
12943
|
+
set stroke(value) {
|
|
12944
|
+
this._sxStroke = value;
|
|
12945
|
+
}
|
|
12946
|
+
get fill() {
|
|
12947
|
+
if (!this._sxFill) return void 0;
|
|
12948
|
+
if ("filled" in this._sxFill) {
|
|
12949
|
+
return this._sxFill.filled;
|
|
12950
|
+
}
|
|
12951
|
+
if ("value" in this._sxFill) {
|
|
12952
|
+
return this._sxFill.value;
|
|
12953
|
+
}
|
|
12954
|
+
return void 0;
|
|
12955
|
+
}
|
|
12956
|
+
set fill(value) {
|
|
12957
|
+
if (value === void 0) {
|
|
12958
|
+
this._sxFill = void 0;
|
|
12959
|
+
return;
|
|
12960
|
+
}
|
|
12961
|
+
if (value instanceof GrPolyFill) {
|
|
12962
|
+
this._sxFill = value;
|
|
12963
|
+
return;
|
|
12964
|
+
}
|
|
12965
|
+
this._sxFill = new GrPolyFill(value);
|
|
12966
|
+
}
|
|
12967
|
+
get fillClass() {
|
|
12968
|
+
return this._sxFill;
|
|
12969
|
+
}
|
|
12970
|
+
get uuid() {
|
|
12971
|
+
return this._sxUuid?.value;
|
|
12972
|
+
}
|
|
12973
|
+
set uuid(value) {
|
|
12974
|
+
if (value === void 0) {
|
|
12975
|
+
this._sxUuid = void 0;
|
|
12976
|
+
return;
|
|
12977
|
+
}
|
|
12978
|
+
this._sxUuid = value instanceof Uuid ? value : new Uuid(value);
|
|
12979
|
+
}
|
|
12980
|
+
get uuidClass() {
|
|
12981
|
+
return this._sxUuid;
|
|
12982
|
+
}
|
|
12983
|
+
getChildren() {
|
|
12984
|
+
const children = [];
|
|
12985
|
+
if (this._sxPts) children.push(this._sxPts);
|
|
12986
|
+
if (this._sxStroke) children.push(this._sxStroke);
|
|
12987
|
+
if (this._sxWidth) children.push(this._sxWidth);
|
|
12988
|
+
if (this._sxFill) children.push(this._sxFill);
|
|
12989
|
+
if (this._sxLayer) children.push(this._sxLayer);
|
|
12990
|
+
if (this._sxUuid) children.push(this._sxUuid);
|
|
12991
|
+
return children;
|
|
12992
|
+
}
|
|
12993
|
+
};
|
|
12994
|
+
SxClass.register(GrPoly);
|
|
12493
12995
|
|
|
12494
12996
|
// lib/sexpr/classes/Group.ts
|
|
12495
12997
|
var SUPPORTED_SINGLE_TOKENS10 = /* @__PURE__ */ new Set(["uuid", "locked", "members"]);
|
|
@@ -15936,12 +16438,16 @@ export {
|
|
|
15936
16438
|
GrLineEnd,
|
|
15937
16439
|
GrLineLocked,
|
|
15938
16440
|
GrLineStart,
|
|
16441
|
+
GrPoly,
|
|
16442
|
+
GrPolyFill,
|
|
15939
16443
|
GrRect,
|
|
15940
16444
|
GrRectEnd,
|
|
15941
16445
|
GrRectFill,
|
|
15942
16446
|
GrRectLocked,
|
|
15943
16447
|
GrRectStart,
|
|
15944
16448
|
GrText,
|
|
16449
|
+
GrTextRenderCache,
|
|
16450
|
+
GrTextRenderCachePolygon,
|
|
15945
16451
|
Group,
|
|
15946
16452
|
GroupLocked,
|
|
15947
16453
|
GroupMembers,
|
|
@@ -16056,6 +16562,10 @@ export {
|
|
|
16056
16562
|
PropertyHide,
|
|
16057
16563
|
PropertyUnlocked,
|
|
16058
16564
|
Pts,
|
|
16565
|
+
PtsArc,
|
|
16566
|
+
PtsArcEnd,
|
|
16567
|
+
PtsArcMid,
|
|
16568
|
+
PtsArcStart,
|
|
16059
16569
|
RenderCache,
|
|
16060
16570
|
SchematicPolyline,
|
|
16061
16571
|
SchematicSymbol,
|