A shader normally has values that vary per-vertex and values that vary per-fragment.
Can you have values that vary only per primitive, such as per-triangle or per-quad?
No, you can't, there is no such concept in the graphics pipeline.
If you are using instancing, you can control the rate at which the instanced attributes advance for a given attribute index. This can be done independently for each attribute, and is probably the closest you're going to get to what you are asking for using the actual functionality of the pipeline. It may not be flexible enough for your needs, however, and it does require instanced rendering.
You can, of course, always build this abstraction into your CPU-side rendering layer by having a buffer object that understands what kind of primitive it stores (triangles, quads, lines, et cetera) and provides a way to manipulate per-primitive attribute buffers which, under the hood, it will replicate out into the real vertex buffer on a per-vertex basis. This won't give you the space-saving advantages, but it would present the simpler client-side interface that you are probably interested in.