Does this work for you?
;with x as (
select *,
lag(widget) over(order by id) as lg
from #t
),
y as (
select *, sum(case when widget<>lg then 1 else 0 end) over(order by id) as grp
from x
)
select widget, min(part), count(*)
from y
group by widget, grp