@tscircuit/cli 0.1.1947 → 0.1.1948

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,7 +136044,7 @@ 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.1946";
136047
+ var version = "0.1.1947";
136048
136048
  var package_default = {
136049
136049
  name: "@tscircuit/cli",
136050
136050
  version,
@@ -136105,7 +136105,7 @@ var package_default = {
136105
136105
  debug: "^4.4.0",
136106
136106
  delay: "^6.0.0",
136107
136107
  "dsn-converter": "^0.0.90",
136108
- easyeda: "^0.0.296",
136108
+ easyeda: "^0.0.301",
136109
136109
  "fuse.js": "^7.1.0",
136110
136110
  "get-port": "^7.1.0",
136111
136111
  globby: "^14.1.0",
@@ -326886,8 +326886,17 @@ var getPolarizedPinMetadata = (pinLabels) => {
326886
326886
  pinLabels: Object.fromEntries(polarizedPinEntries)
326887
326887
  };
326888
326888
  };
326889
+ var normalizeActiveLowPinLabel = (label) => {
326890
+ if (!label.startsWith("#"))
326891
+ return label;
326892
+ const activeLowLabel = label.slice(1);
326893
+ if (activeLowLabel.length === 0)
326894
+ return label;
326895
+ return `N_${activeLowLabel}`;
326896
+ };
326889
326897
  var normalizePinLabels = (inputPinLabels) => {
326890
- const uniqueInputPinLabels = inputPinLabels.map((labels) => [
326898
+ const normalizedInputPinLabels = inputPinLabels.map((labels) => labels.map(normalizeActiveLowPinLabel));
326899
+ const uniqueInputPinLabels = normalizedInputPinLabels.map((labels) => [
326891
326900
  ...new Set(labels)
326892
326901
  ]);
326893
326902
  const result = uniqueInputPinLabels.map(() => []);
@@ -327213,7 +327222,7 @@ var handleSilkscreenArc = (arc2, index) => {
327213
327222
  type: "pcb_silkscreen_path",
327214
327223
  pcb_silkscreen_path_id: `pcb_silkscreen_arc_${index + 1}`,
327215
327224
  pcb_component_id: "pcb_component_1",
327216
- layer: "top",
327225
+ layer: getSideFromLayer(arc2.layer),
327217
327226
  route: arcPath.map((p3) => ({
327218
327227
  x: milx10(p3.x),
327219
327228
  y: milx10(p3.y)
@@ -328253,7 +328262,7 @@ var parseText = (str) => {
328253
328262
  ] = str.split("~");
328254
328263
  return {
328255
328264
  type: "TEXT",
328256
- alignment,
328265
+ alignment: alignment === "P" ? "L" : alignment,
328257
328266
  x: Number(x4),
328258
328267
  y: Number(y4),
328259
328268
  rotation: Number(rotation23),
@@ -328301,7 +328310,12 @@ var SingleLetterShapeSchema = external_exports2.string().transform((x4) => {
328301
328310
  ]));
328302
328311
  var maybeNumber = external_exports2.any().transform((k4) => k4 === "nan" || Number.isNaN(k4) ? null : k4).pipe(external_exports2.number().nullable().optional());
328303
328312
  var SzlcscSchema = external_exports2.object({
328304
- id: external_exports2.number(),
328313
+ id: external_exports2.preprocess((value) => {
328314
+ if (typeof value === "string" && /^\d+$/.test(value)) {
328315
+ return Number(value);
328316
+ }
328317
+ return value;
328318
+ }, external_exports2.number()),
328305
328319
  number: external_exports2.string(),
328306
328320
  step: external_exports2.number().optional(),
328307
328321
  min: external_exports2.number().optional(),
@@ -328334,12 +328348,12 @@ var HeadSchema = external_exports2.object({
328334
328348
  puuid: external_exports2.string().optional(),
328335
328349
  uuid: external_exports2.string(),
328336
328350
  utime: external_exports2.preprocess((val) => {
328337
- if (val === "")
328338
- return 0;
328351
+ if (val == null || val === "")
328352
+ return;
328339
328353
  if (typeof val === "string")
328340
328354
  return Number(val);
328341
328355
  return val;
328342
- }, external_exports2.number()),
328356
+ }, external_exports2.number().optional()),
328343
328357
  importFlag: external_exports2.number().optional(),
328344
328358
  c_spiceCmd: external_exports2.any().optional(),
328345
328359
  hasIdFlag: external_exports2.boolean().default(false)
@@ -328808,7 +328822,7 @@ export const ${componentName} = (props: Omit<CapacitorProps, "capacitance">) =>
328808
328822
  <capacitor
328809
328823
  name={name}
328810
328824
  capacitance=${JSON.stringify(capacitance22)}
328811
- supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
328825
+ ${symbolProp2} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
328812
328826
  manufacturerPartNumber="${manufacturerPartNumber}"
328813
328827
  footprint={${footprintTsx}}
328814
328828
  ${objUrl || stepUrl ? `cadModel={{
@@ -328834,7 +328848,7 @@ export const ${componentName} = (props: Omit<ResistorProps, "resistance">) => {
328834
328848
  <resistor
328835
328849
  name={name}
328836
328850
  resistance=${JSON.stringify(resistance22)}
328837
- supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
328851
+ ${symbolProp2} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
328838
328852
  manufacturerPartNumber="${manufacturerPartNumber}"
328839
328853
  footprint={${footprintTsx}}
328840
328854
  ${objUrl || stepUrl ? `cadModel={{
@@ -329315,7 +329329,7 @@ var generateShapeTsx = ({
329315
329329
  }
329316
329330
  return;
329317
329331
  };
329318
- var generateSymbolTsx2 = (easyEdaJson, circuitJson) => {
329332
+ var generateSymbolTsx2 = (easyEdaJson, circuitJson, { includePorts = true } = {}) => {
329319
329333
  const shapes = easyEdaJson.dataStr.shape;
329320
329334
  if (shapes.length === 0)
329321
329335
  return;
@@ -329330,7 +329344,7 @@ var generateSymbolTsx2 = (easyEdaJson, circuitJson) => {
329330
329344
  y: bounds.y + bounds.height / 2
329331
329345
  };
329332
329346
  const portMetadataByShapeId = getPortMetadataByShapeId(easyEdaJson, circuitJson);
329333
- const shapeTsx = shapes.map((shape) => generateShapeTsx({
329347
+ const shapeTsx = shapes.filter((shape) => includePorts || shape.type !== "PIN").map((shape) => generateShapeTsx({
329334
329348
  shape,
329335
329349
  origin,
329336
329350
  portMetadata: shape.type === "PIN" ? portMetadataByShapeId.get(shape.id) : undefined
@@ -329436,7 +329450,10 @@ var convertBetterEasyToTsx = async ({
329436
329450
  const crystalFrequency = componentType === "crystal" ? betterEasy.dataStr.head.c_para.Value?.trim() : undefined;
329437
329451
  const crystalPinVariant = componentType !== "crystal" ? undefined : sourcePorts.length === 4 ? "four_pin" : sourcePorts.length === 2 ? "two_pin" : undefined;
329438
329452
  const isMultiPinDiode = isDiodeCategoryComponent(betterEasy) && sourcePorts.length !== 2;
329439
- const symbolTsx = componentType === "chip" && !isMultiPinDiode && hasNonBoxSchematicSymbol(betterEasy) ? generateSymbolTsx2(betterEasy, circuitJson) : undefined;
329453
+ const isPassiveWithCustomSymbol = componentType === "capacitor" || componentType === "resistor";
329454
+ const symbolTsx = isPassiveWithCustomSymbol || componentType === "chip" && !isMultiPinDiode && hasNonBoxSchematicSymbol(betterEasy) ? generateSymbolTsx2(betterEasy, circuitJson, {
329455
+ includePorts: !isPassiveWithCustomSymbol
329456
+ }) : undefined;
329440
329457
  return generateTypescriptComponent({
329441
329458
  componentName,
329442
329459
  manufacturerPartNumber,
@@ -334910,8 +334927,17 @@ var getPolarizedPinMetadata2 = (pinLabels) => {
334910
334927
  pinLabels: Object.fromEntries(polarizedPinEntries)
334911
334928
  };
334912
334929
  };
334930
+ var normalizeActiveLowPinLabel2 = (label) => {
334931
+ if (!label.startsWith("#"))
334932
+ return label;
334933
+ const activeLowLabel = label.slice(1);
334934
+ if (activeLowLabel.length === 0)
334935
+ return label;
334936
+ return `N_${activeLowLabel}`;
334937
+ };
334913
334938
  var normalizePinLabels2 = (inputPinLabels) => {
334914
- const uniqueInputPinLabels = inputPinLabels.map((labels) => [
334939
+ const normalizedInputPinLabels = inputPinLabels.map((labels) => labels.map(normalizeActiveLowPinLabel2));
334940
+ const uniqueInputPinLabels = normalizedInputPinLabels.map((labels) => [
334915
334941
  ...new Set(labels)
334916
334942
  ]);
334917
334943
  const result = uniqueInputPinLabels.map(() => []);
@@ -335223,7 +335249,7 @@ var handleSilkscreenArc2 = (arc2, index) => {
335223
335249
  type: "pcb_silkscreen_path",
335224
335250
  pcb_silkscreen_path_id: `pcb_silkscreen_arc_${index + 1}`,
335225
335251
  pcb_component_id: "pcb_component_1",
335226
- layer: "top",
335252
+ layer: getSideFromLayer2(arc2.layer),
335227
335253
  route: arcPath.map((p3) => ({
335228
335254
  x: milx102(p3.x),
335229
335255
  y: milx102(p3.y)
@@ -336263,7 +336289,7 @@ var parseText2 = (str) => {
336263
336289
  ] = str.split("~");
336264
336290
  return {
336265
336291
  type: "TEXT",
336266
- alignment,
336292
+ alignment: alignment === "P" ? "L" : alignment,
336267
336293
  x: Number(x4),
336268
336294
  y: Number(y4),
336269
336295
  rotation: Number(rotation23),
@@ -336311,7 +336337,12 @@ var SingleLetterShapeSchema2 = z180.string().transform((x4) => {
336311
336337
  ]));
336312
336338
  var maybeNumber2 = z181.any().transform((k4) => k4 === "nan" || Number.isNaN(k4) ? null : k4).pipe(z181.number().nullable().optional());
336313
336339
  var SzlcscSchema2 = z181.object({
336314
- id: z181.number(),
336340
+ id: z181.preprocess((value) => {
336341
+ if (typeof value === "string" && /^\d+$/.test(value)) {
336342
+ return Number(value);
336343
+ }
336344
+ return value;
336345
+ }, z181.number()),
336315
336346
  number: z181.string(),
336316
336347
  step: z181.number().optional(),
336317
336348
  min: z181.number().optional(),
@@ -336344,12 +336375,12 @@ var HeadSchema2 = z181.object({
336344
336375
  puuid: z181.string().optional(),
336345
336376
  uuid: z181.string(),
336346
336377
  utime: z181.preprocess((val) => {
336347
- if (val === "")
336348
- return 0;
336378
+ if (val == null || val === "")
336379
+ return;
336349
336380
  if (typeof val === "string")
336350
336381
  return Number(val);
336351
336382
  return val;
336352
- }, z181.number()),
336383
+ }, z181.number().optional()),
336353
336384
  importFlag: z181.number().optional(),
336354
336385
  c_spiceCmd: z181.any().optional(),
336355
336386
  hasIdFlag: z181.boolean().default(false)
package/dist/lib/index.js CHANGED
@@ -65757,7 +65757,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
65757
65757
  }));
65758
65758
  };
65759
65759
  // package.json
65760
- var version = "0.1.1946";
65760
+ var version = "0.1.1947";
65761
65761
  var package_default = {
65762
65762
  name: "@tscircuit/cli",
65763
65763
  version,
@@ -65818,7 +65818,7 @@ var package_default = {
65818
65818
  debug: "^4.4.0",
65819
65819
  delay: "^6.0.0",
65820
65820
  "dsn-converter": "^0.0.90",
65821
- easyeda: "^0.0.296",
65821
+ easyeda: "^0.0.301",
65822
65822
  "fuse.js": "^7.1.0",
65823
65823
  "get-port": "^7.1.0",
65824
65824
  globby: "^14.1.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1947",
3
+ "version": "0.1.1948",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",
@@ -58,7 +58,7 @@
58
58
  "debug": "^4.4.0",
59
59
  "delay": "^6.0.0",
60
60
  "dsn-converter": "^0.0.90",
61
- "easyeda": "^0.0.296",
61
+ "easyeda": "^0.0.301",
62
62
  "fuse.js": "^7.1.0",
63
63
  "get-port": "^7.1.0",
64
64
  "globby": "^14.1.0",