@@ -49,6 +49,7 @@ import { Trace } from "lib/components/primitive-components/Trace/Trace"
4949import { NormalComponent__getMinimumFlexContainerSize } from "./NormalComponent__getMinimumFlexContainerSize"
5050import { NormalComponent__repositionOnPcb } from "./NormalComponent__repositionOnPcb"
5151import { NormalComponent_doInitialSourceDesignRuleChecks } from "./NormalComponent_doInitialSourceDesignRuleChecks"
52+ import { filterPinLabels } from "lib/utils/filterPinLabels"
5253
5354const debug = Debug ( "tscircuit:core" )
5455
@@ -96,6 +97,8 @@ export class NormalComponent<
9697 pcb_missing_footprint_error_id ?: string
9798 _hasStartedFootprintUrlLoad = false
9899
100+ private _invalidPinLabelMessages : string [ ] = [ ]
101+
99102 /**
100103 * Override this property for component defaults
101104 */
@@ -115,7 +118,20 @@ export class NormalComponent<
115118 }
116119
117120 constructor ( props : z . input < ZodProps > ) {
118- super ( props )
121+ const filteredProps = { ...props }
122+ let invalidPinLabelsMessages : string [ ] = [ ]
123+
124+ // Apply invalid pin label filtering for object-based pinLabels only
125+ // Array-based pinLabels (used by PinHeader) are left unfiltered
126+ if ( filteredProps . pinLabels && ! Array . isArray ( filteredProps . pinLabels ) ) {
127+ const { validPinLabels, invalidPinLabelsMessages : messages } =
128+ filterPinLabels ( filteredProps . pinLabels )
129+ filteredProps . pinLabels = validPinLabels
130+ invalidPinLabelsMessages = messages
131+ }
132+
133+ super ( filteredProps )
134+ this . _invalidPinLabelMessages = invalidPinLabelsMessages
119135 this . _addChildrenFromStringFootprint ( )
120136 this . initPorts ( )
121137 }
@@ -425,6 +441,26 @@ export class NormalComponent<
425441 if ( this . root ?. schematicDisabled ) return
426442 const { db } = this . root !
427443
444+ // Insert warnings for invalid pin labels
445+ if ( this . _invalidPinLabelMessages ?. length && this . root ?. db ) {
446+ for ( const message of this . _invalidPinLabelMessages ) {
447+ let property_name = "pinLabels"
448+ const match = message . match (
449+ / ^ I n v a l i d p i n l a b e l : \s * ( [ ^ = ] + ) = \s * ' ( [ ^ ' ] + ) ' / ,
450+ )
451+ if ( match ) {
452+ const label = match [ 2 ]
453+ property_name = `pinLabels['${ label } ']`
454+ }
455+ this . root . db . source_property_ignored_warning . insert ( {
456+ source_component_id : this . source_component_id ! ,
457+ property_name,
458+ message,
459+ error_type : "source_property_ignored_warning" ,
460+ } )
461+ }
462+ }
463+
428464 const { schematicSymbolName } = this . config
429465
430466 if ( schematicSymbolName ) {
0 commit comments