Preheat the oven to 350°F (175°C) and line a 12-cup muffin pan with cupcake liners.
Whisk together the flour, baking powder, and salt in a medium bowl.
In a separate bowl, beat the softened butter and sugar until pale and fluffy.
Add the eggs one at a time, mixing after each addition. Beat in the vanilla and coconut extracts.
Add the dry ingredients alternately with the coconut milk, mixing gently until just combined
Fold in the shredded coconut.
Divide the batter evenly among the cupcake liners, filling each about two-thirds full.
Bake for 18 to 22 minutes, or until the tops spring back lightly and a toothpick comes out with a few moist crumbs.
Cool the cupcakes in the pan for 5 minutes, then transfer them to a wire rack and cool completely
To make the filling, whisk the coconut milk, whole milk, sugar, egg yolks, cornstarch, and salt in a saucepan.
Cook over medium heat, whisking constantly, until the mixture thickens into a smooth custard.
Remove from the heat and stir in the vanilla extract, coconut extract, and shredded coconut. Cover the surface with plastic wrap and refrigerate until cold.
Remove a small portion from the center of each cooled cupcake and fill the opening with chilled coconut cream.
Beat the heavy cream, powdered sugar, and vanilla until medium to stiff peaks form.
Pipe or spoon the whipped cream over each cupcake.
Sprinkle with shredded coconut or toasted coconut and refrigerate for at least 30 minutes before serving.