I'm working on using mockup via plone.app.widgets 1.x in Plone 4, and trying to make some improvements along the way. I'm stuck with something, though, as an add-on author:
Calling this more than once causes select2 failures on any edit page:
So the patternslib registry scans things pretty early, and makes it mostly impossible to re-scan your markup after registering a new pattern (from an add-on). So you might as well not bother registering your add-on unless you can figure out how to register it before the registry.init() method is called.
In Plone 5, the plone bundle calls registry.init(); in plone.app.widgets 1.x, the registry.init() is likewise called on load of the widgets.js resource built by mockup (via mockup's 'bundles/widgets.js' bundle). I want to use these stock bundles, but then re-scan after adding my custom widget.
Chicken and egg? How does an add-on author write and deploy a pattern that is not part of mockup, but built using mockup. I want to register my custom widget (extends pick-a-date with improved keyboard input functionality)  and rescan pages with date widgets. I want to do this without building a forked bundle of plone.app.widgets. How does one get the sanity of loose coupling here?