A Lyapunov method for stability analysis of piecewise-affine systems over non-invariant domains