@tscircuit/cli 0.1.2441 → 0.1.2443

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/cli/main.js CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/cli/main.js
3
- size: 47717514 bytes
4
- sha256: 215e4b67c4a6ddd484ea719ac4d1999164b1ea44d3696541c69da0d831f2ff8d
3
+ size: 47724766 bytes
4
+ sha256: 6592109aa0623eaf46089d3e131b9c06ec549d49400a92e05012909458981def
package/dist/lib/index.js CHANGED
@@ -74364,15 +74364,8 @@ import {
74364
74364
  import { applyToPoint as applyToPoint6 } from "transformation-matrix";
74365
74365
  import { symbols as symbols4 } from "schematic-symbols";
74366
74366
  import { NoConnect } from "kicadts";
74367
- import { formatSiUnit } from "format-si-unit";
74368
74367
  import {
74369
74368
  EmbeddedFonts as EmbeddedFonts2,
74370
- SchematicSymbol as SchematicSymbol6,
74371
- SymbolInstancePath as SymbolInstancePath2,
74372
- SymbolInstances as SymbolInstances2,
74373
- SymbolInstancesProject as SymbolInstancesProject2,
74374
- SymbolLibId as SymbolLibId2,
74375
- SymbolPin as SymbolPin3,
74376
74369
  SymbolPinNames as SymbolPinNames2,
74377
74370
  SymbolPinNumbers as SymbolPinNumbers2,
74378
74371
  SymbolProperty as SymbolProperty3,
@@ -74380,6 +74373,22 @@ import {
74380
74373
  TextEffectsFont as TextEffectsFont7,
74381
74374
  TextEffectsJustify as TextEffectsJustify5
74382
74375
  } from "kicadts";
74376
+ import { formatSiUnit } from "format-si-unit";
74377
+ import {
74378
+ EmbeddedFonts as EmbeddedFonts3,
74379
+ SchematicSymbol as SchematicSymbol6,
74380
+ SymbolInstancePath as SymbolInstancePath2,
74381
+ SymbolInstances as SymbolInstances2,
74382
+ SymbolInstancesProject as SymbolInstancesProject2,
74383
+ SymbolLibId as SymbolLibId2,
74384
+ SymbolPin as SymbolPin3,
74385
+ SymbolPinNames as SymbolPinNames3,
74386
+ SymbolPinNumbers as SymbolPinNumbers3,
74387
+ SymbolProperty as SymbolProperty4,
74388
+ TextEffects as TextEffects8,
74389
+ TextEffectsFont as TextEffectsFont8,
74390
+ TextEffectsJustify as TextEffectsJustify6
74391
+ } from "kicadts";
74383
74392
  import { applyToPoint as applyToPoint7 } from "transformation-matrix";
74384
74393
  import { Wire, Pts as Pts3, Xy as Xy3, Stroke as Stroke4, Junction } from "kicadts";
74385
74394
  import { applyToPoint as applyToPoint8 } from "transformation-matrix";
@@ -74387,7 +74396,7 @@ import {
74387
74396
  SheetInstances,
74388
74397
  SheetInstancesRootPath,
74389
74398
  SheetInstancesRootPage,
74390
- EmbeddedFonts as EmbeddedFonts3
74399
+ EmbeddedFonts as EmbeddedFonts4
74391
74400
  } from "kicadts";
74392
74401
  import { Paper, Uuid as Uuid4 } from "kicadts";
74393
74402
  import { KicadPcb as KicadPcb2 } from "kicadts";
@@ -74412,9 +74421,9 @@ import {
74412
74421
  } from "transformation-matrix";
74413
74422
  import { PadPrimitiveGrPoly, PadPrimitives, Pts as Pts4, Xy as Xy4 } from "kicadts";
74414
74423
  import { applyToPoint as applyToPoint9, compose as compose3, scale as scale2, translate as translate3 } from "transformation-matrix";
74424
+ var import_polygon_clipping = __toESM3(require_polygon_clipping_cjs(), 1);
74415
74425
  import { Pts as Pts6, Xy as Xy6, Zone as Zone2, ZoneKeepout, ZonePolygon as ZonePolygon2 } from "kicadts";
74416
74426
  import { applyToPoint as applyToPoint11 } from "transformation-matrix";
74417
- var import_polygon_clipping = __toESM3(require_polygon_clipping_cjs(), 1);
74418
74427
  import {
74419
74428
  Paper as Paper2,
74420
74429
  PcbLayers,
@@ -74426,23 +74435,24 @@ import { createBoardOwnerMap, getElementId } from "@tscircuit/circuit-json-util"
74426
74435
  import { getFullConnectivityMapFromCircuitJson } from "circuit-json-to-connectivity-map";
74427
74436
  import { PcbNet } from "kicadts";
74428
74437
  import { Footprint as Footprint4, FootprintModel as FootprintModel4, FootprintAttr as FootprintAttr3 } from "kicadts";
74438
+ import { Property, TextEffects as TextEffects9, TextEffectsFont as TextEffectsFont9 } from "kicadts";
74429
74439
  import {
74430
74440
  parseKicadSexpr,
74431
74441
  KicadPcb,
74432
74442
  FootprintModel,
74433
74443
  At as At2,
74434
- EmbeddedFonts as EmbeddedFonts4,
74435
- Property,
74436
- TextEffects as TextEffects8,
74437
- TextEffectsFont as TextEffectsFont8
74444
+ EmbeddedFonts as EmbeddedFonts5,
74445
+ Property as Property2,
74446
+ TextEffects as TextEffects10,
74447
+ TextEffectsFont as TextEffectsFont10
74438
74448
  } from "kicadts";
74439
74449
  import { FootprintAttr } from "kicadts";
74440
74450
  import { applyToPoint as applyToPoint26 } from "transformation-matrix";
74441
74451
  import {
74442
- Property as Property2,
74443
- TextEffects as TextEffects9,
74444
- TextEffectsFont as TextEffectsFont9,
74445
- EmbeddedFonts as EmbeddedFonts5,
74452
+ Property as Property3,
74453
+ TextEffects as TextEffects11,
74454
+ TextEffectsFont as TextEffectsFont11,
74455
+ EmbeddedFonts as EmbeddedFonts6,
74446
74456
  FootprintModel as FootprintModel2,
74447
74457
  FootprintAttr as FootprintAttr2
74448
74458
  } from "kicadts";
@@ -74472,9 +74482,9 @@ import {
74472
74482
  translate as translate8
74473
74483
  } from "transformation-matrix";
74474
74484
  import"kicadts";
74475
- import { FpText, TextEffects as TextEffects10, TextEffectsFont as TextEffectsFont10 } from "kicadts";
74485
+ import { FpText, TextEffects as TextEffects12, TextEffectsFont as TextEffectsFont12 } from "kicadts";
74476
74486
  import { applyToPoint as applyToPoint17, rotate as rotate5, identity as identity2 } from "transformation-matrix";
74477
- import { TextEffectsJustify as TextEffectsJustify6 } from "kicadts";
74487
+ import { TextEffectsJustify as TextEffectsJustify7 } from "kicadts";
74478
74488
  import { FpLine, Stroke as Stroke10 } from "kicadts";
74479
74489
  import { applyToPoint as applyToPoint18, identity as identity3, rotate as rotate6 } from "transformation-matrix";
74480
74490
  import { FpPoly as FpPoly6, Stroke as Stroke11 } from "kicadts";
@@ -74485,7 +74495,7 @@ import {
74485
74495
  scale as scale6,
74486
74496
  translate as translate9
74487
74497
  } from "transformation-matrix";
74488
- import { FpText as FpText3, TextEffects as TextEffects11, TextEffectsFont as TextEffectsFont11 } from "kicadts";
74498
+ import { FpText as FpText3, TextEffects as TextEffects13, TextEffectsFont as TextEffectsFont13 } from "kicadts";
74489
74499
  import { applyToPoint as applyToPoint20, rotate as rotate8, identity as identity4 } from "transformation-matrix";
74490
74500
  import { FootprintModel as FootprintModel3 } from "kicadts";
74491
74501
  import { FootprintPad, PadNet, PadOptions } from "kicadts";
@@ -74519,13 +74529,13 @@ import { GrLine } from "kicadts";
74519
74529
  import {
74520
74530
  At as At3,
74521
74531
  GrText,
74522
- TextEffects as TextEffects12,
74523
- TextEffectsFont as TextEffectsFont12,
74524
- TextEffectsJustify as TextEffectsJustify7
74532
+ TextEffects as TextEffects14,
74533
+ TextEffectsFont as TextEffectsFont14,
74534
+ TextEffectsJustify as TextEffectsJustify8
74525
74535
  } from "kicadts";
74526
74536
  import { applyToPoint as applyToPoint30 } from "transformation-matrix";
74527
74537
  import { applyToPoint as applyToPoint32, rotate as rotate13 } from "transformation-matrix";
74528
- import { GrText as GrText2, TextEffects as TextEffects13, TextEffectsFont as TextEffectsFont13, At as At4 } from "kicadts";
74538
+ import { GrText as GrText2, TextEffects as TextEffects15, TextEffectsFont as TextEffectsFont15, At as At4 } from "kicadts";
74529
74539
  import { applyToPoint as applyToPoint31 } from "transformation-matrix";
74530
74540
  import { cju as cju3, createBoardOwnerMap as createBoardOwnerMap3 } from "@tscircuit/circuit-json-util";
74531
74541
  import { cju as cju4 } from "@tscircuit/circuit-json-util";
@@ -74535,20 +74545,11 @@ import { parseKicadMod } from "kicadts";
74535
74545
  import {
74536
74546
  parseKicadSexpr as parseKicadSexpr3,
74537
74547
  Footprint as Footprint6,
74538
- Property as Property3,
74539
- TextEffects as TextEffects14,
74540
- TextEffectsFont as TextEffectsFont14
74548
+ Property as Property4,
74549
+ TextEffects as TextEffects16,
74550
+ TextEffectsFont as TextEffectsFont16
74541
74551
  } from "kicadts";
74542
74552
  import { parseKicadMod as parseKicadMod2 } from "kicadts";
74543
- import {
74544
- EmbeddedFonts as EmbeddedFonts6,
74545
- SymbolPinNames as SymbolPinNames3,
74546
- SymbolPinNumbers as SymbolPinNumbers3,
74547
- SymbolProperty as SymbolProperty4,
74548
- TextEffects as TextEffects15,
74549
- TextEffectsFont as TextEffectsFont15,
74550
- TextEffectsJustify as TextEffectsJustify8
74551
- } from "kicadts";
74552
74553
  import { KicadSymbolLib as KicadSymbolLib2 } from "kicadts";
74553
74554
  var BOX_WIDTH = 40;
74554
74555
  var BOX_HEIGHT = 25;
@@ -76678,6 +76679,144 @@ var AddSchematicNoConnectsStage = class extends ConverterStage {
76678
76679
  return this.ctx.kicadSch;
76679
76680
  }
76680
76681
  };
76682
+ var DEFAULT_TEXT_SIZE = 1.27;
76683
+ var DEFAULT_TEXT_THICKNESS = 0.15;
76684
+ var toNumber = (value, fallback) => {
76685
+ if (value === undefined)
76686
+ return fallback;
76687
+ const parsed = typeof value === "number" ? value : Number.parseFloat(value);
76688
+ if (Number.isNaN(parsed))
76689
+ return fallback;
76690
+ return parsed;
76691
+ };
76692
+ var createTextEffects2 = (effectsMeta, fallback) => {
76693
+ if (!effectsMeta)
76694
+ return fallback;
76695
+ const effects = new TextEffects7({
76696
+ font: fallback?.font,
76697
+ justify: fallback?.justify,
76698
+ hiddenText: fallback?.hiddenText ?? false
76699
+ });
76700
+ if (!effects.font) {
76701
+ const defaultFont = new TextEffectsFont7;
76702
+ defaultFont.size = { width: DEFAULT_TEXT_SIZE, height: DEFAULT_TEXT_SIZE };
76703
+ effects.font = defaultFont;
76704
+ }
76705
+ if (effectsMeta.font?.size) {
76706
+ effects.font.size = {
76707
+ width: toNumber(effectsMeta.font.size.x, DEFAULT_TEXT_SIZE),
76708
+ height: toNumber(effectsMeta.font.size.y, DEFAULT_TEXT_SIZE)
76709
+ };
76710
+ }
76711
+ if (effectsMeta.font?.thickness !== undefined) {
76712
+ effects.font.thickness = toNumber(effectsMeta.font.thickness, DEFAULT_TEXT_THICKNESS);
76713
+ }
76714
+ if (!effects.font.size) {
76715
+ effects.font.size = { width: DEFAULT_TEXT_SIZE, height: DEFAULT_TEXT_SIZE };
76716
+ }
76717
+ if (!effects.font.thickness && effectsMeta.font?.thickness !== undefined) {
76718
+ effects.font.thickness = DEFAULT_TEXT_THICKNESS;
76719
+ }
76720
+ const justify = createJustify(effectsMeta.justify);
76721
+ if (justify) {
76722
+ effects.justify = justify;
76723
+ }
76724
+ if (effectsMeta.hide !== undefined) {
76725
+ effects.hiddenText = effectsMeta.hide;
76726
+ }
76727
+ return effects;
76728
+ };
76729
+ var createJustify = (justifyInput) => {
76730
+ if (!justifyInput)
76731
+ return;
76732
+ const values = Array.isArray(justifyInput) ? justifyInput : [justifyInput];
76733
+ const options = {};
76734
+ for (const value of values) {
76735
+ if (value === "left" || value === "right") {
76736
+ options.horizontal = value;
76737
+ } else if (value === "top" || value === "bottom") {
76738
+ options.vertical = value;
76739
+ } else if (value === "mirror") {
76740
+ options.mirror = true;
76741
+ }
76742
+ }
76743
+ if (!options.horizontal && !options.vertical && !options.mirror) {
76744
+ return;
76745
+ }
76746
+ return new TextEffectsJustify5(options);
76747
+ };
76748
+ var applySymbolProperty = ({
76749
+ symbol,
76750
+ key,
76751
+ propertyMeta
76752
+ }) => {
76753
+ const existingProperty = symbol.properties.find((prop) => prop.key === key);
76754
+ const nextId = propertyMeta.id !== undefined ? toNumber(propertyMeta.id) : existingProperty?.id;
76755
+ const nextAt = propertyMeta.at ? [
76756
+ toNumber(propertyMeta.at.x, 0),
76757
+ toNumber(propertyMeta.at.y, 0),
76758
+ toNumber(propertyMeta.at.rotation, 0)
76759
+ ] : existingProperty?.at;
76760
+ const nextEffects = createTextEffects2(propertyMeta.effects, existingProperty?.effects);
76761
+ if (existingProperty) {
76762
+ existingProperty.value = propertyMeta.value;
76763
+ if (nextId !== undefined) {
76764
+ existingProperty.id = nextId;
76765
+ }
76766
+ if (nextAt) {
76767
+ existingProperty.at = nextAt;
76768
+ }
76769
+ if (nextEffects) {
76770
+ existingProperty.effects = nextEffects;
76771
+ }
76772
+ return;
76773
+ }
76774
+ symbol.properties.push(new SymbolProperty3({
76775
+ key,
76776
+ value: propertyMeta.value,
76777
+ id: nextId,
76778
+ at: nextAt,
76779
+ effects: nextEffects
76780
+ }));
76781
+ };
76782
+ function applyKicadSymbolMetadata(kicadSymbol, metadata) {
76783
+ const { symbol } = kicadSymbol;
76784
+ if (metadata.excludeFromSim !== undefined) {
76785
+ symbol.excludeFromSim = metadata.excludeFromSim;
76786
+ }
76787
+ if (metadata.inBom !== undefined) {
76788
+ symbol.inBom = metadata.inBom;
76789
+ }
76790
+ if (metadata.onBoard !== undefined) {
76791
+ symbol.onBoard = metadata.onBoard;
76792
+ }
76793
+ if (metadata.embeddedFonts !== undefined) {
76794
+ symbol._sxEmbeddedFonts = new EmbeddedFonts2(metadata.embeddedFonts);
76795
+ }
76796
+ if (metadata.pinNumbers?.hide !== undefined) {
76797
+ const pinNumbers = symbol.pinNumbers ?? new SymbolPinNumbers2;
76798
+ pinNumbers.hide = metadata.pinNumbers.hide;
76799
+ symbol.pinNumbers = pinNumbers;
76800
+ }
76801
+ if (metadata.pinNames) {
76802
+ const pinNames = symbol.pinNames ?? new SymbolPinNames2;
76803
+ if (metadata.pinNames.offset !== undefined) {
76804
+ pinNames.offset = toNumber(metadata.pinNames.offset, pinNames.offset);
76805
+ }
76806
+ if (metadata.pinNames.hide !== undefined) {
76807
+ pinNames.hide = metadata.pinNames.hide;
76808
+ }
76809
+ symbol.pinNames = pinNames;
76810
+ }
76811
+ if (metadata.properties) {
76812
+ for (const [key, propertyMeta] of Object.entries(metadata.properties)) {
76813
+ if (!propertyMeta)
76814
+ continue;
76815
+ applySymbolProperty({ symbol, key, propertyMeta });
76816
+ }
76817
+ }
76818
+ return kicadSymbol;
76819
+ }
76681
76820
  var DEFAULT_PROPERTY_FONT_SIZE = 1.27;
76682
76821
  var AddSchematicSymbolsStage = class extends ConverterStage {
76683
76822
  _step() {
@@ -76746,7 +76885,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
76746
76885
  }
76747
76886
  const refMeta = symbolMetadata?.properties?.Reference;
76748
76887
  const hideGeneratedCustomReference = Boolean(schematicSymbolId) || usesComponentLevelSymbolPrimitives;
76749
- const referenceProperty = new SymbolProperty3({
76888
+ const referenceProperty = new SymbolProperty4({
76750
76889
  key: "Reference",
76751
76890
  value: refMeta?.value ?? reference,
76752
76891
  id: 0,
@@ -76762,7 +76901,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
76762
76901
  });
76763
76902
  const hideValue = Boolean(schematicSymbolId) || usesComponentLevelSymbolPrimitives || sourceComponent.ftype === "simple_chip" && !hasManufacturerValueForValuePlacement || sourceComponent.ftype === "simple_diode" && !schematicComponent.symbol_display_value || sourceComponent.ftype === "simple_pin_header" || sourceComponent.ftype === "simple_test_point";
76764
76903
  const valMeta = symbolMetadata?.properties?.Value;
76765
- const valueProperty = new SymbolProperty3({
76904
+ const valueProperty = new SymbolProperty4({
76766
76905
  key: "Value",
76767
76906
  value: valMeta?.value ?? value,
76768
76907
  id: 1,
@@ -76770,7 +76909,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
76770
76909
  effects: this.createTextEffects(Number(valMeta?.effects?.font?.size?.x ?? DEFAULT_PROPERTY_FONT_SIZE), { hide: valMeta?.effects?.hide ?? hideValue, justify: valJustify })
76771
76910
  });
76772
76911
  const fpMeta = symbolMetadata?.properties?.Footprint;
76773
- const footprintProperty = new SymbolProperty3({
76912
+ const footprintProperty = new SymbolProperty4({
76774
76913
  key: "Footprint",
76775
76914
  value: fpMeta?.value ?? "",
76776
76915
  id: 2,
@@ -76780,7 +76919,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
76780
76919
  })
76781
76920
  });
76782
76921
  const dsMeta = symbolMetadata?.properties?.Datasheet;
76783
- const datasheetProperty = new SymbolProperty3({
76922
+ const datasheetProperty = new SymbolProperty4({
76784
76923
  key: "Datasheet",
76785
76924
  value: dsMeta?.value ?? "~",
76786
76925
  id: 3,
@@ -76790,7 +76929,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
76790
76929
  })
76791
76930
  });
76792
76931
  const descMeta = symbolMetadata?.properties?.Description;
76793
- const descriptionProperty = new SymbolProperty3({
76932
+ const descriptionProperty = new SymbolProperty4({
76794
76933
  key: "Description",
76795
76934
  value: descMeta?.value ?? description,
76796
76935
  id: 4,
@@ -76802,7 +76941,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
76802
76941
  symbol.properties.push(referenceProperty, valueProperty, footprintProperty, datasheetProperty, descriptionProperty);
76803
76942
  const kwMeta = symbolMetadata?.properties?.ki_keywords;
76804
76943
  if (kwMeta?.value) {
76805
- const keywordsProperty = new SymbolProperty3({
76944
+ const keywordsProperty = new SymbolProperty4({
76806
76945
  key: "ki_keywords",
76807
76946
  value: kwMeta.value,
76808
76947
  id: 5,
@@ -76815,7 +76954,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
76815
76954
  }
76816
76955
  const fpFilterMeta = symbolMetadata?.properties?.ki_fp_filters;
76817
76956
  if (fpFilterMeta?.value) {
76818
- const fpFiltersProperty = new SymbolProperty3({
76957
+ const fpFiltersProperty = new SymbolProperty4({
76819
76958
  key: "ki_fp_filters",
76820
76959
  value: fpFilterMeta.value,
76821
76960
  id: 6,
@@ -76826,6 +76965,36 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
76826
76965
  });
76827
76966
  symbol.properties.push(fpFiltersProperty);
76828
76967
  }
76968
+ const builtInPropertyNames = /* @__PURE__ */ new Set([
76969
+ "Reference",
76970
+ "Value",
76971
+ "Footprint",
76972
+ "Datasheet",
76973
+ "Description",
76974
+ "ki_keywords",
76975
+ "ki_fp_filters"
76976
+ ]);
76977
+ let nextPropertyId = 7;
76978
+ for (const propertyMeta of Object.values(symbolMetadata?.properties ?? {})) {
76979
+ const propertyId = Number(propertyMeta?.id);
76980
+ if (Number.isFinite(propertyId)) {
76981
+ nextPropertyId = Math.max(nextPropertyId, propertyId + 1);
76982
+ }
76983
+ }
76984
+ for (const [key, propertyMeta] of Object.entries(symbolMetadata?.properties ?? {})) {
76985
+ if (!propertyMeta || builtInPropertyNames.has(key))
76986
+ continue;
76987
+ applySymbolProperty({
76988
+ symbol,
76989
+ key,
76990
+ propertyMeta: {
76991
+ ...propertyMeta,
76992
+ id: propertyMeta.id ?? nextPropertyId++,
76993
+ at: propertyMeta.at ?? { x, y, rotation: 0 },
76994
+ effects: { hide: true, ...propertyMeta.effects }
76995
+ }
76996
+ });
76997
+ }
76829
76998
  if (symbolMetadata) {
76830
76999
  if (symbolMetadata.inBom !== undefined) {
76831
77000
  symbol.inBom = symbolMetadata.inBom;
@@ -76837,7 +77006,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
76837
77006
  symbol.excludeFromSim = symbolMetadata.excludeFromSim;
76838
77007
  }
76839
77008
  if (symbolMetadata.pinNames) {
76840
- const pinNames = new SymbolPinNames2;
77009
+ const pinNames = new SymbolPinNames3;
76841
77010
  if (symbolMetadata.pinNames.offset !== undefined) {
76842
77011
  pinNames.offset = Number(symbolMetadata.pinNames.offset);
76843
77012
  }
@@ -76847,14 +77016,14 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
76847
77016
  symbol.pinNames = pinNames;
76848
77017
  }
76849
77018
  if (symbolMetadata.pinNumbers) {
76850
- const pinNumbers = new SymbolPinNumbers2;
77019
+ const pinNumbers = new SymbolPinNumbers3;
76851
77020
  if (symbolMetadata.pinNumbers.hide !== undefined) {
76852
77021
  pinNumbers.hide = symbolMetadata.pinNumbers.hide;
76853
77022
  }
76854
77023
  symbol.pinNumbers = pinNumbers;
76855
77024
  }
76856
77025
  if (symbolMetadata.embeddedFonts !== undefined) {
76857
- symbol._sxEmbeddedFonts = new EmbeddedFonts2(symbolMetadata.embeddedFonts);
77026
+ symbol._sxEmbeddedFonts = new EmbeddedFonts3(symbolMetadata.embeddedFonts);
76858
77027
  }
76859
77028
  }
76860
77029
  let schematicPorts = db.schematic_port.list().filter((p) => p.schematic_component_id === schematicComponent.schematic_component_id);
@@ -77093,10 +77262,10 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
77093
77262
  hide = false,
77094
77263
  justify
77095
77264
  } = {}) {
77096
- const font = new TextEffectsFont7;
77265
+ const font = new TextEffectsFont8;
77097
77266
  font.size = { height: size, width: size };
77098
- const justifyObj = justify ? new TextEffectsJustify5(justify) : undefined;
77099
- const effects = new TextEffects7({
77267
+ const justifyObj = justify ? new TextEffectsJustify6(justify) : undefined;
77268
+ const effects = new TextEffects8({
77100
77269
  font,
77101
77270
  hiddenText: hide,
77102
77271
  justify: justifyObj
@@ -77196,7 +77365,7 @@ var AddSheetInstancesStage = class extends ConverterStage {
77196
77365
  path.pages = [page];
77197
77366
  sheetInstances.paths = [path];
77198
77367
  kicadSch.sheetInstances = sheetInstances;
77199
- kicadSch.embeddedFonts = new EmbeddedFonts3(false);
77368
+ kicadSch.embeddedFonts = new EmbeddedFonts4(false);
77200
77369
  this.finished = true;
77201
77370
  }
77202
77371
  getOutput() {
@@ -78027,6 +78196,47 @@ var AddNetsStage = class extends ConverterStage {
78027
78196
  return this.ctx.kicadPcb;
78028
78197
  }
78029
78198
  };
78199
+ var BUILT_IN_FOOTPRINT_PROPERTY_NAMES = /* @__PURE__ */ new Set([
78200
+ "Reference",
78201
+ "Value",
78202
+ "Datasheet",
78203
+ "Description"
78204
+ ]);
78205
+ function applyCustomFootprintProperties({
78206
+ properties,
78207
+ metadata,
78208
+ footprintName
78209
+ }) {
78210
+ for (const [key, propertyMeta] of Object.entries(metadata?.properties ?? {})) {
78211
+ if (!propertyMeta || BUILT_IN_FOOTPRINT_PROPERTY_NAMES.has(key))
78212
+ continue;
78213
+ const font = new TextEffectsFont9;
78214
+ font.size = {
78215
+ width: Number(propertyMeta.effects?.font?.size?.x ?? 1.27),
78216
+ height: Number(propertyMeta.effects?.font?.size?.y ?? 1.27)
78217
+ };
78218
+ font.thickness = Number(propertyMeta.effects?.font?.thickness ?? 0.15);
78219
+ const property = new Property({
78220
+ key,
78221
+ value: propertyMeta.value,
78222
+ position: [
78223
+ Number(propertyMeta.at?.x ?? 0),
78224
+ Number(propertyMeta.at?.y ?? 0),
78225
+ Number(propertyMeta.at?.rotation ?? 0)
78226
+ ],
78227
+ layer: propertyMeta.layer ?? "F.Fab",
78228
+ hidden: propertyMeta.hide ?? true,
78229
+ uuid: propertyMeta.uuid ?? generateDeterministicUuid(`${footprintName}-property-${key}`),
78230
+ effects: new TextEffects9({ font })
78231
+ });
78232
+ const existingIndex = properties.findIndex((existing) => existing.key === key);
78233
+ if (existingIndex === -1) {
78234
+ properties.push(property);
78235
+ } else {
78236
+ properties[existingIndex] = property;
78237
+ }
78238
+ }
78239
+ }
78030
78240
  function applyInferredFootprintType(footprint) {
78031
78241
  if (footprint.attr?.type)
78032
78242
  return;
@@ -78131,17 +78341,17 @@ var ExtractFootprintsStage = class extends ConverterStage {
78131
78341
  footprint.tags = "";
78132
78342
  }
78133
78343
  if (!footprint.embeddedFonts) {
78134
- footprint.embeddedFonts = new EmbeddedFonts4(false);
78344
+ footprint.embeddedFonts = new EmbeddedFonts5(false);
78135
78345
  }
78136
78346
  applyInferredFootprintType(footprint);
78137
78347
  footprint.uuid = undefined;
78138
78348
  footprint.path = undefined;
78139
78349
  footprint.sheetfile = undefined;
78140
78350
  footprint.sheetname = undefined;
78141
- const defaultFont = new TextEffectsFont8;
78351
+ const defaultFont = new TextEffectsFont10;
78142
78352
  defaultFont.size = { width: 1.27, height: 1.27 };
78143
78353
  defaultFont.thickness = 0.15;
78144
- const defaultEffects = new TextEffects8({ font: defaultFont });
78354
+ const defaultEffects = new TextEffects10({ font: defaultFont });
78145
78355
  const fpPads = footprint.fpPads ?? [];
78146
78356
  let minY = 0;
78147
78357
  let maxY = 0;
@@ -78159,8 +78369,13 @@ var ExtractFootprintsStage = class extends ConverterStage {
78159
78369
  }
78160
78370
  const refY = minY - 0.5;
78161
78371
  const valY = maxY + 0.5;
78372
+ const referenceUuid = footprint.properties.find((property) => property.key === "Reference")?.uuid?.value;
78373
+ const pcbComponent = this.ctx.db.pcb_component.list().find((pcbComponent2) => {
78374
+ const sourceComponent = this.ctx.db.source_component.get(pcbComponent2.source_component_id);
78375
+ return sourceComponent && referenceUuid === generateDeterministicUuid(`${getReferenceDesignator(sourceComponent)}-property-Reference`);
78376
+ });
78162
78377
  footprint.properties = [
78163
- new Property({
78378
+ new Property2({
78164
78379
  key: "Reference",
78165
78380
  value: "REF**",
78166
78381
  position: [0, refY, 0],
@@ -78168,7 +78383,7 @@ var ExtractFootprintsStage = class extends ConverterStage {
78168
78383
  uuid: generateDeterministicUuid(`${footprintName}-property-Reference`),
78169
78384
  effects: defaultEffects
78170
78385
  }),
78171
- new Property({
78386
+ new Property2({
78172
78387
  key: "Value",
78173
78388
  value: "Val**",
78174
78389
  position: [0, valY, 0],
@@ -78176,7 +78391,7 @@ var ExtractFootprintsStage = class extends ConverterStage {
78176
78391
  uuid: generateDeterministicUuid(`${footprintName}-property-Value`),
78177
78392
  effects: defaultEffects
78178
78393
  }),
78179
- new Property({
78394
+ new Property2({
78180
78395
  key: "Datasheet",
78181
78396
  value: "",
78182
78397
  position: [0, 0, 0],
@@ -78185,7 +78400,7 @@ var ExtractFootprintsStage = class extends ConverterStage {
78185
78400
  uuid: generateDeterministicUuid(`${footprintName}-property-Datasheet`),
78186
78401
  effects: defaultEffects
78187
78402
  }),
78188
- new Property({
78403
+ new Property2({
78189
78404
  key: "Description",
78190
78405
  value: "",
78191
78406
  position: [0, 0, 0],
@@ -78195,6 +78410,13 @@ var ExtractFootprintsStage = class extends ConverterStage {
78195
78410
  effects: defaultEffects
78196
78411
  })
78197
78412
  ];
78413
+ const properties = footprint.properties;
78414
+ applyCustomFootprintProperties({
78415
+ properties,
78416
+ metadata: pcbComponent?.metadata?.kicad_footprint,
78417
+ footprintName
78418
+ });
78419
+ footprint.properties = properties;
78198
78420
  const texts = footprint.fpTexts ?? [];
78199
78421
  for (const text of texts) {
78200
78422
  text.uuid = undefined;
@@ -78257,8 +78479,8 @@ var ExtractFootprintsStage = class extends ConverterStage {
78257
78479
  return this.ctx.libraryOutput;
78258
78480
  }
78259
78481
  };
78260
- function createTextEffects2(metadataEffects) {
78261
- const font = new TextEffectsFont9;
78482
+ function createTextEffects3(metadataEffects) {
78483
+ const font = new TextEffectsFont11;
78262
78484
  if (metadataEffects?.font?.size) {
78263
78485
  font.size = {
78264
78486
  width: Number(metadataEffects.font.size.x),
@@ -78272,7 +78494,7 @@ function createTextEffects2(metadataEffects) {
78272
78494
  } else {
78273
78495
  font.thickness = 0.15;
78274
78496
  }
78275
- return new TextEffects9({ font });
78497
+ return new TextEffects11({ font });
78276
78498
  }
78277
78499
  function applyMetadataToFootprint({
78278
78500
  footprint,
@@ -78281,7 +78503,7 @@ function applyMetadataToFootprint({
78281
78503
  }) {
78282
78504
  let newProperties = [];
78283
78505
  const refMeta = metadata?.properties?.Reference;
78284
- newProperties.push(new Property2({
78506
+ newProperties.push(new Property3({
78285
78507
  key: "Reference",
78286
78508
  value: refMeta?.value ?? componentProperty.reference,
78287
78509
  position: refMeta?.at ? [
@@ -78291,12 +78513,12 @@ function applyMetadataToFootprint({
78291
78513
  ] : [0, -3, 0],
78292
78514
  layer: refMeta?.layer ?? "F.SilkS",
78293
78515
  uuid: generateDeterministicUuid(`${componentProperty.reference}-property-Reference`),
78294
- effects: createTextEffects2(refMeta?.effects),
78516
+ effects: createTextEffects3(refMeta?.effects),
78295
78517
  hidden: refMeta?.hide ?? true
78296
78518
  }));
78297
78519
  const valMeta = metadata?.properties?.Value;
78298
78520
  const valueText = valMeta?.value ?? componentProperty.kicadComponentValue ?? "";
78299
- newProperties.push(new Property2({
78521
+ newProperties.push(new Property3({
78300
78522
  key: "Value",
78301
78523
  value: valueText,
78302
78524
  position: valMeta?.at ? [
@@ -78306,11 +78528,11 @@ function applyMetadataToFootprint({
78306
78528
  ] : [0, 3, 0],
78307
78529
  layer: valMeta?.layer ?? "F.Fab",
78308
78530
  uuid: generateDeterministicUuid(`${componentProperty.reference}-property-Value`),
78309
- effects: createTextEffects2(valMeta?.effects),
78531
+ effects: createTextEffects3(valMeta?.effects),
78310
78532
  hidden: valMeta?.hide ?? true
78311
78533
  }));
78312
78534
  const dsMeta = metadata?.properties?.Datasheet;
78313
- newProperties.push(new Property2({
78535
+ newProperties.push(new Property3({
78314
78536
  key: "Datasheet",
78315
78537
  value: dsMeta?.value ?? "",
78316
78538
  position: dsMeta?.at ? [
@@ -78320,11 +78542,11 @@ function applyMetadataToFootprint({
78320
78542
  ] : [0, 0, 0],
78321
78543
  layer: dsMeta?.layer ?? "F.Fab",
78322
78544
  uuid: generateDeterministicUuid(`${componentProperty.reference}-property-Datasheet`),
78323
- effects: createTextEffects2(dsMeta?.effects),
78545
+ effects: createTextEffects3(dsMeta?.effects),
78324
78546
  hidden: dsMeta?.hide ?? true
78325
78547
  }));
78326
78548
  const descMeta = metadata?.properties?.Description;
78327
- newProperties.push(new Property2({
78549
+ newProperties.push(new Property3({
78328
78550
  key: "Description",
78329
78551
  value: descMeta?.value ?? "",
78330
78552
  position: descMeta?.at ? [
@@ -78334,29 +78556,34 @@ function applyMetadataToFootprint({
78334
78556
  ] : [0, 0, 0],
78335
78557
  layer: descMeta?.layer ?? "F.Fab",
78336
78558
  uuid: generateDeterministicUuid(`${componentProperty.reference}-property-Description`),
78337
- effects: createTextEffects2(descMeta?.effects),
78559
+ effects: createTextEffects3(descMeta?.effects),
78338
78560
  hidden: descMeta?.hide ?? true
78339
78561
  }));
78340
- newProperties.push(new Property2({
78562
+ newProperties.push(new Property3({
78341
78563
  key: "Supplier Part Number",
78342
78564
  value: componentProperty.supplierPartNumber,
78343
78565
  position: [0, 0, 0],
78344
78566
  layer: "F.Fab",
78345
78567
  uuid: generateDeterministicUuid(`${componentProperty.reference}-property-SupplierPartNumber`),
78346
- effects: createTextEffects2(),
78568
+ effects: createTextEffects3(),
78347
78569
  hidden: true
78348
78570
  }));
78349
78571
  if (componentProperty.manufacturerPartNumber) {
78350
- newProperties.push(new Property2({
78572
+ newProperties.push(new Property3({
78351
78573
  key: "MPN",
78352
78574
  value: componentProperty.manufacturerPartNumber,
78353
78575
  position: [0, 0, 0],
78354
78576
  layer: "F.Fab",
78355
78577
  uuid: generateDeterministicUuid(`${componentProperty.reference}-property-MPN`),
78356
- effects: createTextEffects2(),
78578
+ effects: createTextEffects3(),
78357
78579
  hidden: true
78358
78580
  }));
78359
78581
  }
78582
+ applyCustomFootprintProperties({
78583
+ properties: newProperties,
78584
+ metadata,
78585
+ footprintName: componentProperty.reference
78586
+ });
78360
78587
  footprint.properties = newProperties;
78361
78588
  if (metadata?.attributes) {
78362
78589
  if (!footprint.attr) {
@@ -78381,7 +78608,7 @@ function applyMetadataToFootprint({
78381
78608
  footprint.layer = metadata.layer;
78382
78609
  }
78383
78610
  if (metadata?.embeddedFonts !== undefined) {
78384
- footprint.embeddedFonts = new EmbeddedFonts5(metadata.embeddedFonts);
78611
+ footprint.embeddedFonts = new EmbeddedFonts6(metadata.embeddedFonts);
78385
78612
  }
78386
78613
  if (metadata?.model) {
78387
78614
  const model = new FootprintModel2(metadata.model.path);
@@ -78738,7 +78965,7 @@ function createPcbTextJustify({
78738
78965
  kicadLayer,
78739
78966
  isMirrored
78740
78967
  }) {
78741
- const justify = new TextEffectsJustify6;
78968
+ const justify = new TextEffectsJustify7;
78742
78969
  switch (anchorAlignment) {
78743
78970
  case "top_center":
78744
78971
  justify.vertical = "top";
@@ -78805,13 +79032,13 @@ function createFpTextFromCircuitJson({
78805
79032
  };
78806
79033
  const kicadLayer = layerMap[textElement.layer] || textElement.layer || "F.SilkS";
78807
79034
  const kicadLayerNames = textElement.is_knockout ? [kicadLayer, "knockout"] : kicadLayer;
78808
- const font = new TextEffectsFont10;
79035
+ const font = new TextEffectsFont12;
78809
79036
  font.size = {
78810
79037
  width: textElement.font_size || 1,
78811
79038
  height: textElement.font_size || 1
78812
79039
  };
78813
79040
  font.thickness = 0.15;
78814
- const textEffects = new TextEffects10({ font });
79041
+ const textEffects = new TextEffects12({ font });
78815
79042
  const justify = createPcbTextJustify({
78816
79043
  anchorAlignment: textElement.anchor_alignment,
78817
79044
  kicadLayer,
@@ -78958,9 +79185,9 @@ function convertNoteTexts(params2) {
78958
79185
  const rotationMatrix = componentRotation !== 0 ? rotate8(componentRotation * Math.PI / 180) : identity4();
78959
79186
  const rotatedPos = applyToPoint20(rotationMatrix, { x: relX, y: relY });
78960
79187
  const fontSize = textElement.font_size || 1;
78961
- const font = new TextEffectsFont11;
79188
+ const font = new TextEffectsFont13;
78962
79189
  font.size = { width: fontSize, height: fontSize };
78963
- const textEffects = new TextEffects11({ font });
79190
+ const textEffects = new TextEffects13({ font });
78964
79191
  const fpText = new FpText3({
78965
79192
  type: "user",
78966
79193
  text: textElement.text,
@@ -80357,7 +80584,7 @@ function createFabricationNoteTextFromCircuitJson({
80357
80584
  bottom: "B.Fab"
80358
80585
  };
80359
80586
  const kicadLayer = layerMap[textElement.layer] || textElement.layer || "F.Fab";
80360
- const justify = new TextEffectsJustify7;
80587
+ const justify = new TextEffectsJustify8;
80361
80588
  const anchorAlignment = textElement.anchor_alignment || "center";
80362
80589
  switch (anchorAlignment) {
80363
80590
  case "top_left":
@@ -80379,13 +80606,13 @@ function createFabricationNoteTextFromCircuitJson({
80379
80606
  case "center":
80380
80607
  break;
80381
80608
  }
80382
- const font = new TextEffectsFont12;
80609
+ const font = new TextEffectsFont14;
80383
80610
  font.size = {
80384
80611
  width: textElement.font_size || 1,
80385
80612
  height: textElement.font_size || 1
80386
80613
  };
80387
80614
  font.thickness = 0.15;
80388
- const textEffects = new TextEffects12({ font });
80615
+ const textEffects = new TextEffects14({ font });
80389
80616
  if (anchorAlignment !== "center") {
80390
80617
  textEffects.justify = justify;
80391
80618
  }
@@ -80417,14 +80644,14 @@ function createGrTextFromCircuitJson({
80417
80644
  };
80418
80645
  const kicadLayer = layerMap[textElement.layer] || textElement.layer || "F.SilkS";
80419
80646
  const kicadLayerNames = textElement.is_knockout ? [kicadLayer, "knockout"] : kicadLayer;
80420
- const font = new TextEffectsFont13;
80647
+ const font = new TextEffectsFont15;
80421
80648
  const fontSize = textElement.font_size || 1;
80422
80649
  font.size = {
80423
80650
  width: fontSize,
80424
80651
  height: fontSize
80425
80652
  };
80426
80653
  font.thickness = fontSize > 1 ? Math.min(0.3, fontSize * 0.2) : 0.15;
80427
- const textEffects = new TextEffects13({ font });
80654
+ const textEffects = new TextEffects15({ font });
80428
80655
  const justify = createPcbTextJustify({
80429
80656
  anchorAlignment: textElement.anchor_alignment,
80430
80657
  kicadLayer,
@@ -81255,8 +81482,8 @@ function renameKicadFootprint(params2) {
81255
81482
  model3dSourcePaths: kicadFootprint.model3dSourcePaths
81256
81483
  };
81257
81484
  }
81258
- function createTextEffects3(metadataEffects) {
81259
- const font = new TextEffectsFont14;
81485
+ function createTextEffects4(metadataEffects) {
81486
+ const font = new TextEffectsFont16;
81260
81487
  if (metadataEffects?.font?.size) {
81261
81488
  font.size = {
81262
81489
  width: Number(metadataEffects.font.size.x),
@@ -81270,7 +81497,7 @@ function createTextEffects3(metadataEffects) {
81270
81497
  } else {
81271
81498
  font.thickness = 0.15;
81272
81499
  }
81273
- return new TextEffects14({ font });
81500
+ return new TextEffects16({ font });
81274
81501
  }
81275
81502
  function applyKicadFootprintMetadata(kicadModString, metadata, footprintName) {
81276
81503
  try {
@@ -81292,7 +81519,7 @@ function applyKicadFootprintMetadata(kicadModString, metadata, footprintName) {
81292
81519
  if (metadata.properties) {
81293
81520
  const newProperties = [];
81294
81521
  const refMeta = metadata.properties.Reference;
81295
- newProperties.push(new Property3({
81522
+ newProperties.push(new Property4({
81296
81523
  key: "Reference",
81297
81524
  value: refMeta?.value ?? "REF**",
81298
81525
  position: refMeta?.at ? [
@@ -81302,11 +81529,11 @@ function applyKicadFootprintMetadata(kicadModString, metadata, footprintName) {
81302
81529
  ] : [0, 0, 0],
81303
81530
  layer: refMeta?.layer ?? "F.SilkS",
81304
81531
  uuid: refMeta?.uuid ?? generateDeterministicUuid(`${footprintName}-property-Reference`),
81305
- effects: createTextEffects3(refMeta?.effects),
81532
+ effects: createTextEffects4(refMeta?.effects),
81306
81533
  hidden: refMeta?.hide
81307
81534
  }));
81308
81535
  const valMeta = metadata.properties.Value;
81309
- newProperties.push(new Property3({
81536
+ newProperties.push(new Property4({
81310
81537
  key: "Value",
81311
81538
  value: valMeta?.value ?? footprintName,
81312
81539
  position: valMeta?.at ? [
@@ -81316,11 +81543,11 @@ function applyKicadFootprintMetadata(kicadModString, metadata, footprintName) {
81316
81543
  ] : [0, 0, 0],
81317
81544
  layer: valMeta?.layer ?? "F.Fab",
81318
81545
  uuid: valMeta?.uuid ?? generateDeterministicUuid(`${footprintName}-property-Value`),
81319
- effects: createTextEffects3(valMeta?.effects),
81546
+ effects: createTextEffects4(valMeta?.effects),
81320
81547
  hidden: valMeta?.hide
81321
81548
  }));
81322
81549
  const dsMeta = metadata.properties.Datasheet;
81323
- newProperties.push(new Property3({
81550
+ newProperties.push(new Property4({
81324
81551
  key: "Datasheet",
81325
81552
  value: dsMeta?.value ?? "",
81326
81553
  position: dsMeta?.at ? [
@@ -81330,11 +81557,11 @@ function applyKicadFootprintMetadata(kicadModString, metadata, footprintName) {
81330
81557
  ] : [0, 0, 0],
81331
81558
  layer: dsMeta?.layer ?? "F.Fab",
81332
81559
  uuid: dsMeta?.uuid ?? generateDeterministicUuid(`${footprintName}-property-Datasheet`),
81333
- effects: createTextEffects3(dsMeta?.effects),
81560
+ effects: createTextEffects4(dsMeta?.effects),
81334
81561
  hidden: dsMeta?.hide ?? true
81335
81562
  }));
81336
81563
  const descMeta = metadata.properties.Description;
81337
- newProperties.push(new Property3({
81564
+ newProperties.push(new Property4({
81338
81565
  key: "Description",
81339
81566
  value: descMeta?.value ?? "",
81340
81567
  position: descMeta?.at ? [
@@ -81344,9 +81571,14 @@ function applyKicadFootprintMetadata(kicadModString, metadata, footprintName) {
81344
81571
  ] : [0, 0, 0],
81345
81572
  layer: descMeta?.layer ?? "F.Fab",
81346
81573
  uuid: descMeta?.uuid ?? generateDeterministicUuid(`${footprintName}-property-Description`),
81347
- effects: createTextEffects3(descMeta?.effects),
81574
+ effects: createTextEffects4(descMeta?.effects),
81348
81575
  hidden: descMeta?.hide ?? true
81349
81576
  }));
81577
+ applyCustomFootprintProperties({
81578
+ properties: newProperties,
81579
+ metadata,
81580
+ footprintName
81581
+ });
81350
81582
  footprint.properties = newProperties;
81351
81583
  }
81352
81584
  if (metadata.attributes && footprint.attr) {
@@ -81499,140 +81731,6 @@ function updateBuiltinKicadSymbolFootprint(kicadSymbol, options) {
81499
81731
  }
81500
81732
  return { symbolName: kicadSymbol.symbolName, symbol };
81501
81733
  }
81502
- var DEFAULT_TEXT_SIZE = 1.27;
81503
- var DEFAULT_TEXT_THICKNESS = 0.15;
81504
- var toNumber = (value, fallback) => {
81505
- if (value === undefined)
81506
- return fallback;
81507
- const parsed = typeof value === "number" ? value : Number.parseFloat(value);
81508
- if (Number.isNaN(parsed))
81509
- return fallback;
81510
- return parsed;
81511
- };
81512
- var createTextEffects4 = (effectsMeta, fallback) => {
81513
- if (!effectsMeta)
81514
- return fallback;
81515
- const effects = new TextEffects15({
81516
- font: fallback?.font,
81517
- justify: fallback?.justify,
81518
- hiddenText: fallback?.hiddenText ?? false
81519
- });
81520
- if (!effects.font) {
81521
- const defaultFont = new TextEffectsFont15;
81522
- defaultFont.size = { width: DEFAULT_TEXT_SIZE, height: DEFAULT_TEXT_SIZE };
81523
- effects.font = defaultFont;
81524
- }
81525
- if (effectsMeta.font?.size) {
81526
- effects.font.size = {
81527
- width: toNumber(effectsMeta.font.size.x, DEFAULT_TEXT_SIZE),
81528
- height: toNumber(effectsMeta.font.size.y, DEFAULT_TEXT_SIZE)
81529
- };
81530
- }
81531
- if (effectsMeta.font?.thickness !== undefined) {
81532
- effects.font.thickness = toNumber(effectsMeta.font.thickness, DEFAULT_TEXT_THICKNESS);
81533
- }
81534
- if (!effects.font.size) {
81535
- effects.font.size = { width: DEFAULT_TEXT_SIZE, height: DEFAULT_TEXT_SIZE };
81536
- }
81537
- if (!effects.font.thickness && effectsMeta.font?.thickness !== undefined) {
81538
- effects.font.thickness = DEFAULT_TEXT_THICKNESS;
81539
- }
81540
- const justify = createJustify(effectsMeta.justify);
81541
- if (justify) {
81542
- effects.justify = justify;
81543
- }
81544
- if (effectsMeta.hide !== undefined) {
81545
- effects.hiddenText = effectsMeta.hide;
81546
- }
81547
- return effects;
81548
- };
81549
- var createJustify = (justifyInput) => {
81550
- if (!justifyInput)
81551
- return;
81552
- const values = Array.isArray(justifyInput) ? justifyInput : [justifyInput];
81553
- const options = {};
81554
- for (const value of values) {
81555
- if (value === "left" || value === "right") {
81556
- options.horizontal = value;
81557
- } else if (value === "top" || value === "bottom") {
81558
- options.vertical = value;
81559
- } else if (value === "mirror") {
81560
- options.mirror = true;
81561
- }
81562
- }
81563
- if (!options.horizontal && !options.vertical && !options.mirror) {
81564
- return;
81565
- }
81566
- return new TextEffectsJustify8(options);
81567
- };
81568
- var applySymbolProperty = (symbol, key, propertyMeta) => {
81569
- const existingProperty = symbol.properties.find((prop) => prop.key === key);
81570
- const nextId = propertyMeta.id !== undefined ? toNumber(propertyMeta.id) : existingProperty?.id;
81571
- const nextAt = propertyMeta.at ? [
81572
- toNumber(propertyMeta.at.x, 0),
81573
- toNumber(propertyMeta.at.y, 0),
81574
- toNumber(propertyMeta.at.rotation, 0)
81575
- ] : existingProperty?.at;
81576
- const nextEffects = createTextEffects4(propertyMeta.effects, existingProperty?.effects);
81577
- if (existingProperty) {
81578
- existingProperty.value = propertyMeta.value;
81579
- if (nextId !== undefined) {
81580
- existingProperty.id = nextId;
81581
- }
81582
- if (nextAt) {
81583
- existingProperty.at = nextAt;
81584
- }
81585
- if (nextEffects) {
81586
- existingProperty.effects = nextEffects;
81587
- }
81588
- return;
81589
- }
81590
- symbol.properties.push(new SymbolProperty4({
81591
- key,
81592
- value: propertyMeta.value,
81593
- id: nextId,
81594
- at: nextAt,
81595
- effects: nextEffects
81596
- }));
81597
- };
81598
- function applyKicadSymbolMetadata(kicadSymbol, metadata) {
81599
- const { symbol } = kicadSymbol;
81600
- if (metadata.excludeFromSim !== undefined) {
81601
- symbol.excludeFromSim = metadata.excludeFromSim;
81602
- }
81603
- if (metadata.inBom !== undefined) {
81604
- symbol.inBom = metadata.inBom;
81605
- }
81606
- if (metadata.onBoard !== undefined) {
81607
- symbol.onBoard = metadata.onBoard;
81608
- }
81609
- if (metadata.embeddedFonts !== undefined) {
81610
- symbol._sxEmbeddedFonts = new EmbeddedFonts6(metadata.embeddedFonts);
81611
- }
81612
- if (metadata.pinNumbers?.hide !== undefined) {
81613
- const pinNumbers = symbol.pinNumbers ?? new SymbolPinNumbers3;
81614
- pinNumbers.hide = metadata.pinNumbers.hide;
81615
- symbol.pinNumbers = pinNumbers;
81616
- }
81617
- if (metadata.pinNames) {
81618
- const pinNames = symbol.pinNames ?? new SymbolPinNames3;
81619
- if (metadata.pinNames.offset !== undefined) {
81620
- pinNames.offset = toNumber(metadata.pinNames.offset, pinNames.offset);
81621
- }
81622
- if (metadata.pinNames.hide !== undefined) {
81623
- pinNames.hide = metadata.pinNames.hide;
81624
- }
81625
- symbol.pinNames = pinNames;
81626
- }
81627
- if (metadata.properties) {
81628
- for (const [key, propertyMeta] of Object.entries(metadata.properties)) {
81629
- if (!propertyMeta)
81630
- continue;
81631
- applySymbolProperty(symbol, key, propertyMeta);
81632
- }
81633
- }
81634
- return kicadSymbol;
81635
- }
81636
81734
  var addedSymbolNames = /* @__PURE__ */ new Set;
81637
81735
  function classifyKicadSymbols(ctx) {
81638
81736
  addedSymbolNames.clear();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.2441",
3
+ "version": "0.1.2443",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tscircuit/cli"
@@ -25,7 +25,7 @@
25
25
  "@tscircuit/fake-snippets": "^0.0.226",
26
26
  "@tscircuit/file-server": "^0.0.32",
27
27
  "@tscircuit/footprinter": "^0.0.450",
28
- "@tscircuit/pcb-spice-pipeline": "https://github.com/tscircuit/pcb-spice-pipeline/releases/download/v0.1.6/tscircuit-pcb-spice-pipeline-0.1.6.tgz",
28
+ "@tscircuit/pcb-spice-pipeline": "https://github.com/tscircuit/pcb-spice-pipeline/releases/download/v0.1.8/tscircuit-pcb-spice-pipeline-0.1.8.tgz",
29
29
  "@tscircuit/schematic-trace-solver": "^0.0.204",
30
30
  "@types/bun": "^1.2.2",
31
31
  "@types/configstore": "^6.0.2",
@@ -44,7 +44,7 @@
44
44
  "circuit-json-to-fdm-component-box": "^0.0.2",
45
45
  "circuit-json-to-footprinter": "^0.0.59",
46
46
  "circuit-json-to-gerber": "^0.0.120",
47
- "circuit-json-to-kicad": "0.0.267",
47
+ "circuit-json-to-kicad": "0.0.269",
48
48
  "circuit-json-to-readable-netlist": "^0.0.15",
49
49
  "circuit-json-to-step": "^0.0.63",
50
50
  "circuit-json-to-tscircuit": "^0.0.50",