kicadts 0.0.13 → 0.0.14

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
@@ -1648,6 +1648,7 @@ declare class FootprintAttr extends SxClass {
1648
1648
  private _boardOnly;
1649
1649
  private _excludeFromPosFiles;
1650
1650
  private _excludeFromBom;
1651
+ private _allowSoldermaskBridges;
1651
1652
  static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): FootprintAttr;
1652
1653
  private applyFlag;
1653
1654
  get type(): string | undefined;
@@ -1658,6 +1659,8 @@ declare class FootprintAttr extends SxClass {
1658
1659
  set excludeFromPosFiles(value: boolean);
1659
1660
  get excludeFromBom(): boolean;
1660
1661
  set excludeFromBom(value: boolean);
1662
+ get allowSoldermaskBridges(): boolean;
1663
+ set allowSoldermaskBridges(value: boolean);
1661
1664
  getChildren(): SxClass[];
1662
1665
  getString(): string;
1663
1666
  }
@@ -2137,12 +2140,16 @@ declare class PadPrimitiveGrCircleEnd extends PadPrimitiveGrCirclePoint {
2137
2140
  constructor(x: number, y: number);
2138
2141
  static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): PadPrimitiveGrCircleEnd;
2139
2142
  }
2140
- declare class PadPrimitiveGrCircleFill extends SxPrimitiveBoolean {
2143
+ declare class PadPrimitiveGrCircleFill extends SxClass {
2141
2144
  static token: string;
2142
2145
  static parentToken: string;
2143
2146
  token: string;
2144
- constructor(value?: boolean);
2147
+ value: string;
2148
+ constructor(value?: boolean | string);
2145
2149
  static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): PadPrimitiveGrCircleFill;
2150
+ get filled(): boolean;
2151
+ set filled(value: boolean);
2152
+ getString(): string;
2146
2153
  }
2147
2154
 
2148
2155
  type PadPrimitiveGraphic = PadPrimitiveGrPoly | PadPrimitiveGrLine | PadPrimitiveGrArc | PadPrimitiveGrCircle;
@@ -2870,11 +2877,12 @@ declare class FpArcEnd extends SxClass {
2870
2877
  getString(): string;
2871
2878
  }
2872
2879
 
2873
- declare class FpPolyFill extends SxPrimitiveBoolean {
2880
+ declare class FpPolyFill extends SxClass {
2874
2881
  static token: string;
2875
2882
  static parentToken: string;
2876
2883
  token: string;
2877
- constructor(filled: boolean);
2884
+ value: string;
2885
+ constructor(value: string | boolean);
2878
2886
  static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): FpPolyFill;
2879
2887
  get filled(): boolean;
2880
2888
  set filled(filled: boolean);
@@ -3047,6 +3055,7 @@ declare class FootprintModel extends SxClass {
3047
3055
  private _offset?;
3048
3056
  private _scale?;
3049
3057
  private _rotate?;
3058
+ private _hide;
3050
3059
  constructor(path: string);
3051
3060
  static fromSexprPrimitives(primitiveSexprs: PrimitiveSExpr[]): FootprintModel;
3052
3061
  get path(): string;
@@ -3057,6 +3066,8 @@ declare class FootprintModel extends SxClass {
3057
3066
  set scale(value: ModelVector | undefined);
3058
3067
  get rotate(): ModelVector | undefined;
3059
3068
  set rotate(value: ModelVector | undefined);
3069
+ get hide(): boolean;
3070
+ set hide(value: boolean);
3060
3071
  getChildren(): SxClass[];
3061
3072
  getString(): string;
3062
3073
  }
@@ -3523,6 +3534,7 @@ interface GrTextConstructorParams {
3523
3534
  text?: string;
3524
3535
  position?: AtInput | Xy | GrTextPosition;
3525
3536
  layer?: Layer | string | Array<string | number>;
3537
+ tstamp?: Tstamp | string;
3526
3538
  uuid?: Uuid | string;
3527
3539
  effects?: TextEffects;
3528
3540
  }
@@ -3532,6 +3544,7 @@ declare class GrText extends SxClass {
3532
3544
  private _text;
3533
3545
  private _sxPosition?;
3534
3546
  private _sxLayer?;
3547
+ private _sxTstamp?;
3535
3548
  private _sxUuid?;
3536
3549
  private _sxEffects?;
3537
3550
  constructor(params?: GrTextConstructorParams | string);
@@ -3542,6 +3555,8 @@ declare class GrText extends SxClass {
3542
3555
  set position(value: AtInput | Xy | GrTextPosition | undefined);
3543
3556
  get layer(): Layer | undefined;
3544
3557
  set layer(value: Layer | string | Array<string | number> | undefined);
3558
+ get tstamp(): Tstamp | undefined;
3559
+ set tstamp(value: Tstamp | string | undefined);
3545
3560
  get uuid(): Uuid | undefined;
3546
3561
  set uuid(value: Uuid | string | undefined);
3547
3562
  get effects(): TextEffects | undefined;
package/dist/index.js CHANGED
@@ -578,6 +578,18 @@ var At = class _At extends SxClass {
578
578
  };
579
579
  SxClass.register(At);
580
580
 
581
+ // lib/sexpr/utils/quoteSExprString.ts
582
+ var needsQuoting = (value) => {
583
+ if (value.length === 0) return true;
584
+ return /[\s()"\\]/.test(value);
585
+ };
586
+ var quoteSExprString = (value) => {
587
+ return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t")}"`;
588
+ };
589
+ var quoteIfNeeded = (value) => {
590
+ return needsQuoting(value) ? quoteSExprString(value) : value;
591
+ };
592
+
581
593
  // lib/sexpr/base-classes/SxPrimitiveString.ts
582
594
  var SxPrimitiveString = class extends SxClass {
583
595
  value;
@@ -592,15 +604,10 @@ var SxPrimitiveString = class extends SxClass {
592
604
  return new this(primitiveSexprs[0]);
593
605
  }
594
606
  getString() {
595
- return `(${this.token} ${this.value})`;
607
+ return `(${this.token} ${quoteIfNeeded(this.value)})`;
596
608
  }
597
609
  };
598
610
 
599
- // lib/sexpr/utils/quoteSExprString.ts
600
- var quoteSExprString = (value) => {
601
- return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t")}"`;
602
- };
603
-
604
611
  // lib/sexpr/utils/toStringValue.ts
605
612
  var toStringValue = (value) => {
606
613
  if (value === void 0) return void 0;
@@ -5336,7 +5343,8 @@ SxClass.register(KicadSch);
5336
5343
  var FLAG_TOKENS = /* @__PURE__ */ new Set([
5337
5344
  "board_only",
5338
5345
  "exclude_from_pos_files",
5339
- "exclude_from_bom"
5346
+ "exclude_from_bom",
5347
+ "allow_soldermask_bridges"
5340
5348
  ]);
5341
5349
  var FootprintAttr = class _FootprintAttr extends SxClass {
5342
5350
  static token = "attr";
@@ -5346,6 +5354,7 @@ var FootprintAttr = class _FootprintAttr extends SxClass {
5346
5354
  _boardOnly = false;
5347
5355
  _excludeFromPosFiles = false;
5348
5356
  _excludeFromBom = false;
5357
+ _allowSoldermaskBridges = false;
5349
5358
  static fromSexprPrimitives(primitiveSexprs) {
5350
5359
  const attr = new _FootprintAttr();
5351
5360
  for (const primitive of primitiveSexprs) {
@@ -5379,6 +5388,9 @@ var FootprintAttr = class _FootprintAttr extends SxClass {
5379
5388
  case "exclude_from_bom":
5380
5389
  this._excludeFromBom = true;
5381
5390
  break;
5391
+ case "allow_soldermask_bridges":
5392
+ this._allowSoldermaskBridges = true;
5393
+ break;
5382
5394
  }
5383
5395
  }
5384
5396
  get type() {
@@ -5405,6 +5417,12 @@ var FootprintAttr = class _FootprintAttr extends SxClass {
5405
5417
  set excludeFromBom(value) {
5406
5418
  this._excludeFromBom = value;
5407
5419
  }
5420
+ get allowSoldermaskBridges() {
5421
+ return this._allowSoldermaskBridges;
5422
+ }
5423
+ set allowSoldermaskBridges(value) {
5424
+ this._allowSoldermaskBridges = value;
5425
+ }
5408
5426
  getChildren() {
5409
5427
  return [];
5410
5428
  }
@@ -5414,6 +5432,7 @@ var FootprintAttr = class _FootprintAttr extends SxClass {
5414
5432
  if (this._boardOnly) tokens.push("board_only");
5415
5433
  if (this._excludeFromPosFiles) tokens.push("exclude_from_pos_files");
5416
5434
  if (this._excludeFromBom) tokens.push("exclude_from_bom");
5435
+ if (this._allowSoldermaskBridges) tokens.push("allow_soldermask_bridges");
5417
5436
  return `(${tokens.join(" ")})`;
5418
5437
  }
5419
5438
  };
@@ -6604,7 +6623,7 @@ var PadPrimitiveGrCircle = class _PadPrimitiveGrCircle extends SxClass {
6604
6623
  return this._sxWidth;
6605
6624
  }
6606
6625
  get fill() {
6607
- return this._sxFill?.value;
6626
+ return this._sxFill?.filled;
6608
6627
  }
6609
6628
  set fill(value) {
6610
6629
  if (value === void 0) {
@@ -6711,34 +6730,50 @@ var PadPrimitiveGrCircleEnd = class _PadPrimitiveGrCircleEnd extends PadPrimitiv
6711
6730
  }
6712
6731
  };
6713
6732
  SxClass.register(PadPrimitiveGrCircleEnd);
6714
- var PadPrimitiveGrCircleFill = class _PadPrimitiveGrCircleFill extends SxPrimitiveBoolean {
6733
+ var truthyFillStrings = /* @__PURE__ */ new Set(["yes", "true"]);
6734
+ var falsyFillStrings = /* @__PURE__ */ new Set(["no", "false", "none"]);
6735
+ var PadPrimitiveGrCircleFill = class _PadPrimitiveGrCircleFill extends SxClass {
6715
6736
  static token = "fill";
6716
6737
  static parentToken = "gr_circle";
6717
6738
  token = "fill";
6739
+ value;
6718
6740
  constructor(value) {
6719
- super(value ?? false);
6741
+ super();
6742
+ if (value === void 0 || value === false) {
6743
+ this.value = "no";
6744
+ } else if (value === true) {
6745
+ this.value = "yes";
6746
+ } else {
6747
+ this.value = value;
6748
+ }
6720
6749
  }
6721
6750
  static fromSexprPrimitives(primitiveSexprs) {
6722
6751
  const [raw] = primitiveSexprs;
6723
6752
  if (raw === void 0) {
6724
- return new _PadPrimitiveGrCircleFill(false);
6753
+ return new _PadPrimitiveGrCircleFill("no");
6725
6754
  }
6726
6755
  if (typeof raw === "boolean") {
6727
6756
  return new _PadPrimitiveGrCircleFill(raw);
6728
6757
  }
6729
6758
  if (typeof raw === "string") {
6730
6759
  const normalized = raw.toLowerCase();
6731
- if (normalized === "yes" || normalized === "true") {
6732
- return new _PadPrimitiveGrCircleFill(true);
6733
- }
6734
- if (normalized === "no" || normalized === "false" || normalized === "none") {
6735
- return new _PadPrimitiveGrCircleFill(false);
6760
+ if (truthyFillStrings.has(normalized) || falsyFillStrings.has(normalized)) {
6761
+ return new _PadPrimitiveGrCircleFill(raw);
6736
6762
  }
6737
6763
  }
6738
6764
  throw new Error(
6739
6765
  `pad primitive gr_circle fill expects yes/no/none or boolean, received ${JSON.stringify(raw)}`
6740
6766
  );
6741
6767
  }
6768
+ get filled() {
6769
+ return truthyFillStrings.has(this.value.toLowerCase());
6770
+ }
6771
+ set filled(value) {
6772
+ this.value = value ? "yes" : "no";
6773
+ }
6774
+ getString() {
6775
+ return `(fill ${this.value})`;
6776
+ }
6742
6777
  };
6743
6778
  SxClass.register(PadPrimitiveGrCircleFill);
6744
6779
 
@@ -9316,35 +9351,41 @@ var FpArcEnd = class _FpArcEnd extends SxClass {
9316
9351
  SxClass.register(FpArcEnd);
9317
9352
 
9318
9353
  // lib/sexpr/classes/FpPolyFill.ts
9319
- var truthyStrings = /* @__PURE__ */ new Set(["yes", "true", "1"]);
9320
- var FpPolyFill = class _FpPolyFill extends SxPrimitiveBoolean {
9354
+ var truthyStrings = /* @__PURE__ */ new Set(["yes", "true", "1", "solid"]);
9355
+ var FpPolyFill = class _FpPolyFill extends SxClass {
9321
9356
  static token = "fill";
9322
9357
  static parentToken = "fp_poly";
9323
9358
  token = "fill";
9324
- constructor(filled) {
9325
- super(filled);
9359
+ value;
9360
+ constructor(value) {
9361
+ super();
9362
+ if (typeof value === "boolean") {
9363
+ this.value = value ? "yes" : "no";
9364
+ } else {
9365
+ this.value = value;
9366
+ }
9326
9367
  }
9327
9368
  static fromSexprPrimitives(primitiveSexprs) {
9328
9369
  const [rawValue] = primitiveSexprs;
9329
9370
  if (rawValue === void 0) {
9330
- return new _FpPolyFill(false);
9371
+ return new _FpPolyFill("no");
9331
9372
  }
9332
9373
  if (typeof rawValue === "boolean") {
9333
9374
  return new _FpPolyFill(rawValue);
9334
9375
  }
9335
9376
  if (typeof rawValue === "string") {
9336
- return new _FpPolyFill(truthyStrings.has(rawValue.toLowerCase()));
9377
+ return new _FpPolyFill(rawValue);
9337
9378
  }
9338
- return new _FpPolyFill(false);
9379
+ return new _FpPolyFill("no");
9339
9380
  }
9340
9381
  get filled() {
9341
- return this.value;
9382
+ return truthyStrings.has(this.value.toLowerCase());
9342
9383
  }
9343
9384
  set filled(filled) {
9344
- this.value = filled;
9385
+ this.value = filled ? "yes" : "no";
9345
9386
  }
9346
9387
  getString() {
9347
- return `(fill ${this.value ? "yes" : "no"})`;
9388
+ return `(fill ${this.value})`;
9348
9389
  }
9349
9390
  };
9350
9391
  SxClass.register(FpPolyFill);
@@ -9938,6 +9979,7 @@ var FootprintModel = class _FootprintModel extends SxClass {
9938
9979
  _offset;
9939
9980
  _scale;
9940
9981
  _rotate;
9982
+ _hide = false;
9941
9983
  constructor(path) {
9942
9984
  super();
9943
9985
  this._path = path;
@@ -9953,6 +9995,13 @@ var FootprintModel = class _FootprintModel extends SxClass {
9953
9995
  }
9954
9996
  const model = new _FootprintModel(path);
9955
9997
  for (const primitive of rest) {
9998
+ if (typeof primitive === "string") {
9999
+ if (primitive === "hide") {
10000
+ model._hide = true;
10001
+ continue;
10002
+ }
10003
+ throw new Error(`model encountered unsupported flag "${primitive}"`);
10004
+ }
9956
10005
  if (!Array.isArray(primitive) || primitive.length === 0) {
9957
10006
  throw new Error(
9958
10007
  `model encountered invalid child expression: ${JSON.stringify(primitive)}`
@@ -9999,11 +10048,20 @@ var FootprintModel = class _FootprintModel extends SxClass {
9999
10048
  set rotate(value) {
10000
10049
  this._rotate = value ? { ...value } : void 0;
10001
10050
  }
10051
+ get hide() {
10052
+ return this._hide;
10053
+ }
10054
+ set hide(value) {
10055
+ this._hide = value;
10056
+ }
10002
10057
  getChildren() {
10003
10058
  return [];
10004
10059
  }
10005
10060
  getString() {
10006
10061
  const lines = [`(model ${quoteSExprString(this._path)}`];
10062
+ if (this._hide) {
10063
+ lines.push(" hide");
10064
+ }
10007
10065
  if (this._offset) {
10008
10066
  lines.push(renderVectorBlock("offset", this._offset));
10009
10067
  }
@@ -11725,6 +11783,7 @@ var SUPPORTED_SINGLE_TOKENS8 = /* @__PURE__ */ new Set([
11725
11783
  "at",
11726
11784
  "xy",
11727
11785
  "layer",
11786
+ "tstamp",
11728
11787
  "uuid",
11729
11788
  "effects"
11730
11789
  ]);
@@ -11734,6 +11793,7 @@ var GrText = class _GrText extends SxClass {
11734
11793
  _text = "";
11735
11794
  _sxPosition;
11736
11795
  _sxLayer;
11796
+ _sxTstamp;
11737
11797
  _sxUuid;
11738
11798
  _sxEffects;
11739
11799
  constructor(params = {}) {
@@ -11744,6 +11804,7 @@ var GrText = class _GrText extends SxClass {
11744
11804
  if (params.text !== void 0) this.text = params.text;
11745
11805
  if (params.position !== void 0) this.position = params.position;
11746
11806
  if (params.layer !== void 0) this.layer = params.layer;
11807
+ if (params.tstamp !== void 0) this.tstamp = params.tstamp;
11747
11808
  if (params.uuid !== void 0) this.uuid = params.uuid;
11748
11809
  if (params.effects !== void 0) this.effects = params.effects;
11749
11810
  }
@@ -11794,6 +11855,7 @@ var GrText = class _GrText extends SxClass {
11794
11855
  }
11795
11856
  grText._sxPosition = atInstance ?? xyInstance;
11796
11857
  grText._sxLayer = propertyMap.layer;
11858
+ grText._sxTstamp = propertyMap.tstamp;
11797
11859
  grText._sxUuid = propertyMap.uuid;
11798
11860
  grText._sxEffects = propertyMap.effects;
11799
11861
  if (!grText._sxPosition) {
@@ -11802,8 +11864,8 @@ var GrText = class _GrText extends SxClass {
11802
11864
  if (!grText._sxLayer) {
11803
11865
  throw new Error("gr_text requires a layer child token");
11804
11866
  }
11805
- if (!grText._sxUuid) {
11806
- throw new Error("gr_text requires a uuid child token");
11867
+ if (!grText._sxUuid && !grText._sxTstamp) {
11868
+ throw new Error("gr_text requires a uuid or tstamp child token");
11807
11869
  }
11808
11870
  if (!grText._sxEffects) {
11809
11871
  throw new Error("gr_text requires an effects child token");
@@ -11854,6 +11916,16 @@ var GrText = class _GrText extends SxClass {
11854
11916
  const names = Array.isArray(value) ? value : [value];
11855
11917
  this._sxLayer = new Layer(names);
11856
11918
  }
11919
+ get tstamp() {
11920
+ return this._sxTstamp;
11921
+ }
11922
+ set tstamp(value) {
11923
+ if (value === void 0) {
11924
+ this._sxTstamp = void 0;
11925
+ return;
11926
+ }
11927
+ this._sxTstamp = value instanceof Tstamp ? value : new Tstamp(value);
11928
+ }
11857
11929
  get uuid() {
11858
11930
  return this._sxUuid;
11859
11931
  }
@@ -11874,6 +11946,7 @@ var GrText = class _GrText extends SxClass {
11874
11946
  const children = [];
11875
11947
  if (this._sxPosition) children.push(this._sxPosition);
11876
11948
  if (this._sxLayer) children.push(this._sxLayer);
11949
+ if (this._sxTstamp) children.push(this._sxTstamp);
11877
11950
  if (this._sxUuid) children.push(this._sxUuid);
11878
11951
  if (this._sxEffects) children.push(this._sxEffects);
11879
11952
  return children;
@@ -14777,10 +14850,10 @@ var Via = class _Via extends SxClass {
14777
14850
  if (this._type !== void 0) {
14778
14851
  lines.push(` (type ${this._type})`);
14779
14852
  }
14780
- if (this._locked) lines.push(" locked");
14781
- if (this._free) lines.push(" free");
14782
- if (this._removeUnusedLayers) lines.push(" remove_unused_layers");
14783
- if (this._keepEndLayers) lines.push(" keep_end_layers");
14853
+ if (this._locked) lines.push(" (locked)");
14854
+ if (this._free) lines.push(" (free)");
14855
+ if (this._removeUnusedLayers) lines.push(" (remove_unused_layers)");
14856
+ if (this._keepEndLayers) lines.push(" (keep_end_layers)");
14784
14857
  if (this._sxAt) lines.push(this._sxAt.getStringIndented());
14785
14858
  if (this._size !== void 0) lines.push(` (size ${this._size})`);
14786
14859
  if (this._drill !== void 0) lines.push(` (drill ${this._drill})`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kicadts",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.13",
4
+ "version": "0.0.14",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",