@tscircuit/core 0.0.674 → 0.0.676

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
@@ -1011,6 +1011,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
1011
1011
  _asyncSupplierPartNumbers?: SupplierPartNumbers;
1012
1012
  pcb_missing_footprint_error_id?: string;
1013
1013
  _hasStartedFootprintUrlLoad: boolean;
1014
+ private _invalidPinLabelMessages;
1014
1015
  /**
1015
1016
  * Override this property for component defaults
1016
1017
  */
@@ -2767,7 +2768,6 @@ declare class Capacitor extends NormalComponent<typeof capacitorProps, Polarized
2767
2768
 
2768
2769
  declare class Chip<PinLabels extends string = never> extends NormalComponent<typeof chipProps, PinLabels> {
2769
2770
  schematicBoxDimensions: SchematicBoxDimensions | null;
2770
- private _invalidPinLabelMessages;
2771
2771
  constructor(props: z.input<typeof chipProps>);
2772
2772
  get config(): {
2773
2773
  componentName: string;
package/dist/index.js CHANGED
@@ -6281,6 +6281,51 @@ var shouldCheckPortForMissingTrace = (component, port) => {
6281
6281
  return true;
6282
6282
  };
6283
6283
 
6284
+ // lib/utils/filterPinLabels.ts
6285
+ import { chipProps } from "@tscircuit/props";
6286
+ function filterPinLabels(pinLabels) {
6287
+ if (!pinLabels)
6288
+ return {
6289
+ validPinLabels: pinLabels,
6290
+ invalidPinLabelsMessages: []
6291
+ };
6292
+ const validPinLabels = {};
6293
+ const invalidPinLabelsMessages = [];
6294
+ for (const [pin, labelOrLabels] of Object.entries(pinLabels)) {
6295
+ const labels = Array.isArray(labelOrLabels) ? labelOrLabels.slice() : [labelOrLabels];
6296
+ const validLabels = [];
6297
+ for (const label of labels) {
6298
+ if (isValidPinLabel(pin, label)) {
6299
+ validLabels.push(label);
6300
+ } else {
6301
+ invalidPinLabelsMessages.push(
6302
+ `Invalid pin label: ${pin} = '${label}' - excluding from component. Please use a valid pin label.`
6303
+ );
6304
+ }
6305
+ }
6306
+ if (validLabels.length > 0) {
6307
+ validPinLabels[pin] = Array.isArray(labelOrLabels) ? validLabels : validLabels[0];
6308
+ }
6309
+ }
6310
+ return {
6311
+ validPinLabels: Object.keys(validPinLabels).length > 0 ? validPinLabels : void 0,
6312
+ invalidPinLabelsMessages
6313
+ };
6314
+ }
6315
+ function isValidPinLabel(pin, label) {
6316
+ try {
6317
+ const testProps = {
6318
+ name: "test",
6319
+ footprint: "test",
6320
+ pinLabels: { [pin]: label }
6321
+ };
6322
+ const result = chipProps.safeParse(testProps);
6323
+ return result.success;
6324
+ } catch (error) {
6325
+ return false;
6326
+ }
6327
+ }
6328
+
6284
6329
  // lib/components/base-components/NormalComponent/NormalComponent.ts
6285
6330
  var debug3 = Debug4("tscircuit:core");
6286
6331
  var rotation3 = z8.object({
@@ -6295,6 +6340,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
6295
6340
  _asyncSupplierPartNumbers;
6296
6341
  pcb_missing_footprint_error_id;
6297
6342
  _hasStartedFootprintUrlLoad = false;
6343
+ _invalidPinLabelMessages = [];
6298
6344
  /**
6299
6345
  * Override this property for component defaults
6300
6346
  */
@@ -6310,7 +6356,15 @@ var NormalComponent = class extends PrimitiveComponent2 {
6310
6356
  );
6311
6357
  }
6312
6358
  constructor(props) {
6313
- super(props);
6359
+ const filteredProps = { ...props };
6360
+ let invalidPinLabelsMessages = [];
6361
+ if (filteredProps.pinLabels && !Array.isArray(filteredProps.pinLabels)) {
6362
+ const { validPinLabels, invalidPinLabelsMessages: messages } = filterPinLabels(filteredProps.pinLabels);
6363
+ filteredProps.pinLabels = validPinLabels;
6364
+ invalidPinLabelsMessages = messages;
6365
+ }
6366
+ super(filteredProps);
6367
+ this._invalidPinLabelMessages = invalidPinLabelsMessages;
6314
6368
  this._addChildrenFromStringFootprint();
6315
6369
  this.initPorts();
6316
6370
  }
@@ -6569,6 +6623,24 @@ var NormalComponent = class extends PrimitiveComponent2 {
6569
6623
  doInitialSchematicComponentRender() {
6570
6624
  if (this.root?.schematicDisabled) return;
6571
6625
  const { db } = this.root;
6626
+ if (this._invalidPinLabelMessages?.length && this.root?.db) {
6627
+ for (const message of this._invalidPinLabelMessages) {
6628
+ let property_name = "pinLabels";
6629
+ const match = message.match(
6630
+ /^Invalid pin label:\s*([^=]+)=\s*'([^']+)'/
6631
+ );
6632
+ if (match) {
6633
+ const label = match[2];
6634
+ property_name = `pinLabels['${label}']`;
6635
+ }
6636
+ this.root.db.source_property_ignored_warning.insert({
6637
+ source_component_id: this.source_component_id,
6638
+ property_name,
6639
+ message,
6640
+ error_type: "source_property_ignored_warning"
6641
+ });
6642
+ }
6643
+ }
6572
6644
  const { schematicSymbolName } = this.config;
6573
6645
  if (schematicSymbolName) {
6574
6646
  this._doInitialSchematicComponentRenderWithSymbol();
@@ -11448,66 +11520,10 @@ var Capacitor = class extends NormalComponent {
11448
11520
 
11449
11521
  // lib/components/normal-components/Chip.ts
11450
11522
  import { chipProps as chipProps2 } from "@tscircuit/props";
11451
-
11452
- // lib/utils/filterPinLabels.ts
11453
- import { chipProps } from "@tscircuit/props";
11454
- function filterPinLabels(pinLabels) {
11455
- if (!pinLabels)
11456
- return {
11457
- validPinLabels: pinLabels,
11458
- invalidPinLabelsMessages: []
11459
- };
11460
- const validPinLabels = {};
11461
- const invalidPinLabelsMessages = [];
11462
- for (const [pin, labelOrLabels] of Object.entries(pinLabels)) {
11463
- const labels = Array.isArray(labelOrLabels) ? labelOrLabels.slice() : [labelOrLabels];
11464
- const validLabels = [];
11465
- for (const label of labels) {
11466
- if (isValidPinLabel(pin, label)) {
11467
- validLabels.push(label);
11468
- } else {
11469
- invalidPinLabelsMessages.push(
11470
- `Invalid pin label: ${pin} = '${label}' - excluding from component. Please use a valid pin label.`
11471
- );
11472
- }
11473
- }
11474
- if (validLabels.length > 0) {
11475
- validPinLabels[pin] = Array.isArray(labelOrLabels) ? validLabels : validLabels[0];
11476
- }
11477
- }
11478
- return {
11479
- validPinLabels: Object.keys(validPinLabels).length > 0 ? validPinLabels : void 0,
11480
- invalidPinLabelsMessages
11481
- };
11482
- }
11483
- function isValidPinLabel(pin, label) {
11484
- try {
11485
- const testProps = {
11486
- name: "test",
11487
- footprint: "test",
11488
- pinLabels: { [pin]: label }
11489
- };
11490
- const result = chipProps.safeParse(testProps);
11491
- return result.success;
11492
- } catch (error) {
11493
- return false;
11494
- }
11495
- }
11496
-
11497
- // lib/components/normal-components/Chip.ts
11498
11523
  var Chip = class extends NormalComponent {
11499
11524
  schematicBoxDimensions = null;
11500
- _invalidPinLabelMessages = [];
11501
11525
  constructor(props) {
11502
- const filteredProps = { ...props };
11503
- let invalidPinLabelsMessages = [];
11504
- if (filteredProps.pinLabels) {
11505
- const { validPinLabels, invalidPinLabelsMessages: messages } = filterPinLabels(filteredProps.pinLabels);
11506
- filteredProps.pinLabels = validPinLabels;
11507
- invalidPinLabelsMessages = messages;
11508
- }
11509
- super(filteredProps);
11510
- this._invalidPinLabelMessages = invalidPinLabelsMessages;
11526
+ super(props);
11511
11527
  }
11512
11528
  get config() {
11513
11529
  return {
@@ -11554,24 +11570,6 @@ var Chip = class extends NormalComponent {
11554
11570
  doInitialSchematicComponentRender() {
11555
11571
  const { _parsedProps: props } = this;
11556
11572
  if (props?.noSchematicRepresentation === true) return;
11557
- if (this._invalidPinLabelMessages?.length && this.root?.db) {
11558
- for (const message of this._invalidPinLabelMessages) {
11559
- let property_name = "pinLabels";
11560
- const match = message.match(
11561
- /^Invalid pin label:\s*([^=]+)=\s*'([^']+)'/
11562
- );
11563
- if (match) {
11564
- const label = match[2];
11565
- property_name = `pinLabels['${label}']`;
11566
- }
11567
- this.root.db.source_property_ignored_warning.insert({
11568
- source_component_id: this.source_component_id,
11569
- property_name,
11570
- message,
11571
- error_type: "source_property_ignored_warning"
11572
- });
11573
- }
11574
- }
11575
11573
  super.doInitialSchematicComponentRender();
11576
11574
  }
11577
11575
  doInitialSourceRender() {
@@ -13881,7 +13879,7 @@ import { identity as identity5 } from "transformation-matrix";
13881
13879
  var package_default = {
13882
13880
  name: "@tscircuit/core",
13883
13881
  type: "module",
13884
- version: "0.0.673",
13882
+ version: "0.0.675",
13885
13883
  types: "dist/index.d.ts",
13886
13884
  main: "dist/index.js",
13887
13885
  module: "dist/index.js",
@@ -13923,7 +13921,7 @@ var package_default = {
13923
13921
  "@tscircuit/props": "0.0.289",
13924
13922
  "@tscircuit/schematic-autolayout": "^0.0.6",
13925
13923
  "@tscircuit/schematic-match-adapt": "^0.0.16",
13926
- "@tscircuit/schematic-trace-solver": "^0.0.23",
13924
+ "@tscircuit/schematic-trace-solver": "^0.0.25",
13927
13925
  "@tscircuit/simple-3d-svg": "^0.0.38",
13928
13926
  "@types/bun": "^1.2.16",
13929
13927
  "@types/debug": "^4.1.12",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.674",
4
+ "version": "0.0.676",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -43,7 +43,7 @@
43
43
  "@tscircuit/props": "0.0.289",
44
44
  "@tscircuit/schematic-autolayout": "^0.0.6",
45
45
  "@tscircuit/schematic-match-adapt": "^0.0.16",
46
- "@tscircuit/schematic-trace-solver": "^0.0.23",
46
+ "@tscircuit/schematic-trace-solver": "^0.0.25",
47
47
  "@tscircuit/simple-3d-svg": "^0.0.38",
48
48
  "@types/bun": "^1.2.16",
49
49
  "@types/debug": "^4.1.12",