Theory of freestanding triboelectric-layer-based nanogenerators