@tscircuit/cli 0.1.1957 → 0.1.1959

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
@@ -136044,10 +136044,14 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
136044
136044
  // lib/getVersion.ts
136045
136045
  import { createRequire as createRequire2 } from "node:module";
136046
136046
  // package.json
136047
- var version = "0.1.1956";
136047
+ var version = "0.1.1958";
136048
136048
  var package_default = {
136049
136049
  name: "@tscircuit/cli",
136050
136050
  version,
136051
+ repository: {
136052
+ type: "git",
136053
+ url: "https://github.com/tscircuit/cli"
136054
+ },
136051
136055
  main: "dist/cli/main.js",
136052
136056
  exports: {
136053
136057
  ".": "./dist/cli/main.js",
@@ -136105,7 +136109,7 @@ var package_default = {
136105
136109
  debug: "^4.4.0",
136106
136110
  delay: "^6.0.0",
136107
136111
  "dsn-converter": "^0.0.90",
136108
- easyeda: "^0.0.307",
136112
+ easyeda: "^0.0.315",
136109
136113
  "fuse.js": "^7.1.0",
136110
136114
  "get-port": "^7.1.0",
136111
136115
  globby: "^14.1.0",
@@ -327227,7 +327231,7 @@ var handleSilkscreenPath = (track, index) => {
327227
327231
  type: "pcb_silkscreen_path",
327228
327232
  pcb_silkscreen_path_id: `pcb_silkscreen_path_${index + 1}`,
327229
327233
  pcb_component_id: "pcb_component_1",
327230
- layer: "top",
327234
+ layer: getSideFromLayer(track.layer),
327231
327235
  route: track.points.map((point22) => ({
327232
327236
  x: milx10(point22.x),
327233
327237
  y: milx10(point22.y)
@@ -327237,6 +327241,18 @@ var handleSilkscreenPath = (track, index) => {
327237
327241
  };
327238
327242
  var isCourtyardLayer = (layer) => layer === 13 || layer === 14 || layer === 15;
327239
327243
  var isSilkscreenLayer = (layer) => layer === 3 || layer === 4;
327244
+ var isDocumentLayer = (layer) => layer === 12;
327245
+ var handleFabricationNotePath = (track, index) => pcb_fabrication_note_path.parse({
327246
+ type: "pcb_fabrication_note_path",
327247
+ pcb_fabrication_note_path_id: `pcb_fabrication_note_path_${index + 1}`,
327248
+ pcb_component_id: "pcb_component_1",
327249
+ layer: "top",
327250
+ route: track.points.map((point22) => ({
327251
+ x: mil10ToMm(point22.x),
327252
+ y: mil10ToMm(point22.y)
327253
+ })),
327254
+ stroke_width: mil10ToMm(track.width)
327255
+ });
327240
327256
  var getSideFromLayer = (layer) => {
327241
327257
  if (layer === 4 || layer === 14)
327242
327258
  return "bottom";
@@ -327434,7 +327450,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
327434
327450
  pcb_plated_hole_id: platedHoleId,
327435
327451
  x: mil2mm(pad2.center.x),
327436
327452
  y: mil2mm(pad2.center.y),
327437
- layers: ["top"],
327453
+ layers: ["top", "bottom"],
327438
327454
  port_hints: pcbPortHints,
327439
327455
  pcb_component_id: "pcb_component_1",
327440
327456
  pcb_port_id: `pcb_port_${index + 1}`
@@ -327559,8 +327575,10 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
327559
327575
  let hasFoundDesignator = false;
327560
327576
  easyEdaJson.packageDetail.dataStr.shape.forEach((shape, index) => {
327561
327577
  if (shape.type === "TRACK") {
327562
- if (!isCourtyardLayer(shape.layer)) {
327578
+ if (isSilkscreenLayer(shape.layer)) {
327563
327579
  circuitElements.push(handleSilkscreenPath(shape, index));
327580
+ } else if (isDocumentLayer(shape.layer)) {
327581
+ circuitElements.push(handleFabricationNotePath(shape, index));
327564
327582
  }
327565
327583
  } else if (shape.type === "CIRCLE") {
327566
327584
  if (isSilkscreenLayer(shape.layer)) {
@@ -328697,6 +328715,7 @@ var generateFootprintTsx2 = (circuitJson, options = {}) => {
328697
328715
  const vias = su17(circuitJson).pcb_via.list();
328698
328716
  const silkscreenPaths = su17(circuitJson).pcb_silkscreen_path.list();
328699
328717
  const silkscreenTexts = su17(circuitJson).pcb_silkscreen_text.list();
328718
+ const fabricationNotePaths = su17(circuitJson).pcb_fabrication_note_path.list();
328700
328719
  const courtyardOutlines = su17(circuitJson).pcb_courtyard_outline.list();
328701
328720
  const elementStrings = [];
328702
328721
  for (const hole of holes) {
@@ -328747,6 +328766,9 @@ var generateFootprintTsx2 = (circuitJson, options = {}) => {
328747
328766
  const rotationAttr = rotation23 ? ` pcbRotation="${rotation23}deg"` : "";
328748
328767
  elementStrings.push(`<silkscreentext text=${textValue} pcbX="${mmStr2(silkscreenText.anchor_position.x)}" pcbY="${mmStr2(silkscreenText.anchor_position.y)}" anchorAlignment="${silkscreenText.anchor_alignment}"${rotationAttr}${silkscreenText.font_size ? ` fontSize="${mmStr2(silkscreenText.font_size)}"` : ""} />`);
328749
328768
  }
328769
+ for (const fabricationNotePath of fabricationNotePaths) {
328770
+ elementStrings.push(`<fabricationnotepath route={${JSON.stringify(fabricationNotePath.route)}} strokeWidth="${mmStr2(fabricationNotePath.stroke_width)}" />`);
328771
+ }
328750
328772
  for (const courtyardOutline of courtyardOutlines) {
328751
328773
  elementStrings.push(`<courtyardoutline outline={${JSON.stringify(courtyardOutline.outline)}} />`);
328752
328774
  }
@@ -328757,6 +328779,40 @@ var generateFootprintTsx2 = (circuitJson, options = {}) => {
328757
328779
  </footprint>
328758
328780
  `.trim();
328759
328781
  };
328782
+ var POWER_PIN_LABEL = /^(?:VCC|VDD|VIN|VDDA)\d*$/;
328783
+ var GROUND_PIN_LABEL = /^(?:GND|VSS|PGND|AGND)\d*$/;
328784
+ var NO_CONNECT_PIN_LABEL = /^NC\d*$/;
328785
+ var getAttributeKind = (label) => {
328786
+ const normalizedLabel = label.trim().toUpperCase();
328787
+ if (POWER_PIN_LABEL.test(normalizedLabel))
328788
+ return "power";
328789
+ if (GROUND_PIN_LABEL.test(normalizedLabel))
328790
+ return "ground";
328791
+ if (NO_CONNECT_PIN_LABEL.test(normalizedLabel))
328792
+ return "no-connect";
328793
+ return;
328794
+ };
328795
+ var inferPinAttributes = (pinLabels) => {
328796
+ const pinAttributes = {};
328797
+ for (const [pinName, labels] of Object.entries(pinLabels)) {
328798
+ const labelList = typeof labels === "string" ? [labels] : labels;
328799
+ const inferredKinds = labelList.map(getAttributeKind);
328800
+ if (inferredKinds.some((kind) => kind === undefined))
328801
+ continue;
328802
+ const attributeKinds = new Set(inferredKinds);
328803
+ if (attributeKinds.size !== 1)
328804
+ continue;
328805
+ const [attributeKind] = attributeKinds;
328806
+ if (attributeKind === "power") {
328807
+ pinAttributes[pinName] = { requiresPower: true };
328808
+ } else if (attributeKind === "ground") {
328809
+ pinAttributes[pinName] = { requiresGround: true };
328810
+ } else if (attributeKind === "no-connect") {
328811
+ pinAttributes[pinName] = { doNotConnect: true };
328812
+ }
328813
+ }
328814
+ return pinAttributes;
328815
+ };
328760
328816
  var generateTypescriptComponent = ({
328761
328817
  pinLabels,
328762
328818
  componentName,
@@ -328787,6 +328843,19 @@ var generateTypescriptComponent = ({
328787
328843
  }));
328788
328844
  const pinLabelsString = Object.entries(simplifiedPinLabels).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(`,
328789
328845
  `);
328846
+ const inferredPinAttributes = componentType === "chip" ? inferPinAttributes(simplifiedPinLabels) : {};
328847
+ const pinAttributesString = Object.entries(inferredPinAttributes).map(([pin, attributes2]) => {
328848
+ const attributesString = Object.entries(attributes2).map(([attributeName, value]) => `${attributeName}: ${JSON.stringify(value)}`).join(", ");
328849
+ return ` ${pin}: {${attributesString}}`;
328850
+ }).join(`,
328851
+ `);
328852
+ const pinAttributesBlock = pinAttributesString ? `const pinAttributes = {
328853
+ ${pinAttributesString}
328854
+ } as const
328855
+
328856
+ ` : "";
328857
+ const pinAttributesProp = pinAttributesString ? ` pinAttributes={pinAttributes}
328858
+ ` : "";
328790
328859
  const polarizedPinLabelsString = Object.entries(polarizedPinLabels ?? {}).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(`,
328791
328860
  `);
328792
328861
  const polarizedPinLabelsBlock = polarizedPinLabels ? `const pinLabels = {
@@ -329042,11 +329111,11 @@ const pinLabels = {
329042
329111
  ${pinLabelsString}
329043
329112
  } as const
329044
329113
 
329045
- export const ${componentName} = (props: ChipProps<typeof pinLabels>) => {
329114
+ ${pinAttributesBlock}export const ${componentName} = (props: ChipProps<typeof pinLabels>) => {
329046
329115
  return (
329047
329116
  <chip
329048
329117
  pinLabels={pinLabels}
329049
- ${symbolProp2} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
329118
+ ${pinAttributesProp}${symbolProp2} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
329050
329119
  manufacturerPartNumber="${manufacturerPartNumber}"
329051
329120
  footprint={${footprintTsx}}
329052
329121
  ${objUrl || stepUrl ? `cadModel={{
@@ -329097,7 +329166,7 @@ var categoryValueContainsPushbutton = (value) => {
329097
329166
  if (/analog\s+switch/.test(normalized) || /multiplex/.test(normalized) || /switching\s+diodes?/.test(normalized) || /\bics?\b/.test(normalized)) {
329098
329167
  return false;
329099
329168
  }
329100
- return /push\s*buttons?/.test(normalized) || /pushbuttons?/.test(normalized) || /tact(?:ile)?\s+switch(?:es)?/.test(normalized) || /keyboard\s+(?:switch(?:es)?|shaft)/.test(normalized) || /mechanical\s+keyboard\s+shaft/.test(normalized);
329169
+ return /push\s*buttons?/.test(normalized) || /pushbuttons?/.test(normalized) || /tact(?:ile)?\s+switch(?:es)?/.test(normalized) || /keyboard\s+(?:switch(?:es)?|shaft)/.test(normalized) || /mechanical\s+keyboard\s+shaft/.test(normalized) || /\bkey[-_\s]+(?:th|smd)(?:\b|[_-])/.test(normalized);
329101
329170
  }
329102
329171
  if (Array.isArray(value)) {
329103
329172
  return value.some(categoryValueContainsPushbutton);
@@ -329111,10 +329180,14 @@ var isPushbuttonCategoryComponent = (betterEasy) => {
329111
329180
  const cPara = betterEasy.dataStr.head.c_para;
329112
329181
  return [
329113
329182
  betterEasy.tags,
329183
+ betterEasy.title,
329184
+ betterEasy.description,
329114
329185
  cPara.category,
329115
329186
  cPara.Category,
329116
329187
  cPara["LCSC Category"],
329117
329188
  cPara["JLCPCB Category"],
329189
+ cPara.package,
329190
+ cPara.pre,
329118
329191
  betterEasy.category
329119
329192
  ].some(categoryValueContainsPushbutton);
329120
329193
  };
@@ -329525,7 +329598,7 @@ var getGeneratedComponentType = (betterEasy, pinCount) => {
329525
329598
  return "capacitor";
329526
329599
  if (isResistorComponent(betterEasy) && pinCount === 2)
329527
329600
  return "resistor";
329528
- if (isInductorComponent(betterEasy))
329601
+ if (isInductorComponent(betterEasy) && pinCount === 2)
329529
329602
  return "inductor";
329530
329603
  if (isCrystalComponent(betterEasy))
329531
329604
  return "crystal";
@@ -329598,8 +329671,9 @@ var convertBetterEasyToTsx = async ({
329598
329671
  const crystalFrequency = componentType === "crystal" ? betterEasy.dataStr.head.c_para.Value?.trim() : undefined;
329599
329672
  const crystalPinVariant = componentType !== "crystal" ? undefined : sourcePorts.length === 4 ? "four_pin" : sourcePorts.length === 2 ? "two_pin" : undefined;
329600
329673
  const isMultiPinDiode = isDiodeCategoryComponent(betterEasy) && sourcePorts.length !== 2;
329674
+ const isMultiPinInductor = isInductorComponent(betterEasy) && sourcePorts.length !== 2;
329601
329675
  const isPassiveWithCustomSymbol = componentType === "capacitor" || componentType === "resistor";
329602
- const symbolTsx = isPassiveWithCustomSymbol || componentType === "chip" && !isMultiPinDiode && hasNonBoxSchematicSymbol(betterEasy) ? generateSymbolTsx2(betterEasy, circuitJson, {
329676
+ const symbolTsx = isPassiveWithCustomSymbol || componentType === "chip" && !isMultiPinDiode && !isMultiPinInductor && hasNonBoxSchematicSymbol(betterEasy) ? generateSymbolTsx2(betterEasy, circuitJson, {
329603
329677
  alignPortsToDrawing: isPassiveWithCustomSymbol
329604
329678
  }) : undefined;
329605
329679
  return generateTypescriptComponent({
@@ -335376,7 +335450,7 @@ var handleSilkscreenPath2 = (track, index) => {
335376
335450
  type: "pcb_silkscreen_path",
335377
335451
  pcb_silkscreen_path_id: `pcb_silkscreen_path_${index + 1}`,
335378
335452
  pcb_component_id: "pcb_component_1",
335379
- layer: "top",
335453
+ layer: getSideFromLayer2(track.layer),
335380
335454
  route: track.points.map((point22) => ({
335381
335455
  x: milx102(point22.x),
335382
335456
  y: milx102(point22.y)
@@ -335386,6 +335460,18 @@ var handleSilkscreenPath2 = (track, index) => {
335386
335460
  };
335387
335461
  var isCourtyardLayer2 = (layer) => layer === 13 || layer === 14 || layer === 15;
335388
335462
  var isSilkscreenLayer2 = (layer) => layer === 3 || layer === 4;
335463
+ var isDocumentLayer2 = (layer) => layer === 12;
335464
+ var handleFabricationNotePath2 = (track, index) => pcb_fabrication_note_path2.parse({
335465
+ type: "pcb_fabrication_note_path",
335466
+ pcb_fabrication_note_path_id: `pcb_fabrication_note_path_${index + 1}`,
335467
+ pcb_component_id: "pcb_component_1",
335468
+ layer: "top",
335469
+ route: track.points.map((point22) => ({
335470
+ x: mil10ToMm2(point22.x),
335471
+ y: mil10ToMm2(point22.y)
335472
+ })),
335473
+ stroke_width: mil10ToMm2(track.width)
335474
+ });
335389
335475
  var getSideFromLayer2 = (layer) => {
335390
335476
  if (layer === 4 || layer === 14)
335391
335477
  return "bottom";
@@ -335583,7 +335669,7 @@ var convertEasyEdaJsonToCircuitJson2 = (easyEdaJson, {
335583
335669
  pcb_plated_hole_id: platedHoleId,
335584
335670
  x: mil2mm2(pad2.center.x),
335585
335671
  y: mil2mm2(pad2.center.y),
335586
- layers: ["top"],
335672
+ layers: ["top", "bottom"],
335587
335673
  port_hints: pcbPortHints,
335588
335674
  pcb_component_id: "pcb_component_1",
335589
335675
  pcb_port_id: `pcb_port_${index + 1}`
@@ -335708,8 +335794,10 @@ var convertEasyEdaJsonToCircuitJson2 = (easyEdaJson, {
335708
335794
  let hasFoundDesignator = false;
335709
335795
  easyEdaJson.packageDetail.dataStr.shape.forEach((shape, index) => {
335710
335796
  if (shape.type === "TRACK") {
335711
- if (!isCourtyardLayer2(shape.layer)) {
335797
+ if (isSilkscreenLayer2(shape.layer)) {
335712
335798
  circuitElements.push(handleSilkscreenPath2(shape, index));
335799
+ } else if (isDocumentLayer2(shape.layer)) {
335800
+ circuitElements.push(handleFabricationNotePath2(shape, index));
335713
335801
  }
335714
335802
  } else if (shape.type === "CIRCLE") {
335715
335803
  if (isSilkscreenLayer2(shape.layer)) {
package/dist/lib/index.js CHANGED
@@ -65757,10 +65757,14 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
65757
65757
  }));
65758
65758
  };
65759
65759
  // package.json
65760
- var version = "0.1.1956";
65760
+ var version = "0.1.1958";
65761
65761
  var package_default = {
65762
65762
  name: "@tscircuit/cli",
65763
65763
  version,
65764
+ repository: {
65765
+ type: "git",
65766
+ url: "https://github.com/tscircuit/cli"
65767
+ },
65764
65768
  main: "dist/cli/main.js",
65765
65769
  exports: {
65766
65770
  ".": "./dist/cli/main.js",
@@ -65818,7 +65822,7 @@ var package_default = {
65818
65822
  debug: "^4.4.0",
65819
65823
  delay: "^6.0.0",
65820
65824
  "dsn-converter": "^0.0.90",
65821
- easyeda: "^0.0.307",
65825
+ easyeda: "^0.0.315",
65822
65826
  "fuse.js": "^7.1.0",
65823
65827
  "get-port": "^7.1.0",
65824
65828
  globby: "^14.1.0",
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1957",
3
+ "version": "0.1.1959",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/tscircuit/cli"
7
+ },
4
8
  "main": "dist/cli/main.js",
5
9
  "exports": {
6
10
  ".": "./dist/cli/main.js",
@@ -58,7 +62,7 @@
58
62
  "debug": "^4.4.0",
59
63
  "delay": "^6.0.0",
60
64
  "dsn-converter": "^0.0.90",
61
- "easyeda": "^0.0.307",
65
+ "easyeda": "^0.0.315",
62
66
  "fuse.js": "^7.1.0",
63
67
  "get-port": "^7.1.0",
64
68
  "globby": "^14.1.0",