Sharing panels between templates?

I know the itemTemplate can be used for itemArrays, but I’d like to share a panel definition between several different templates.

Is there a way to do this?

In the visual tree of a diagram GraphObjects cannot be shared amongst different Panels or Nodes.

The same is true for templates. However, since one builds templates using JavaScript code, you could define a function to return a new Panel (or whatever), and then you could call that function wherever and whenever you need it when building a template.

For example, see the Seat function defined in the Seating Chart sample, Seating Chart. Note how that function is called in each of the different node templates that that sample defines.