core: Extract Annotator core functionality

Here's another attempt (or start of one) to improve on the plugin
architecture of Annotator. I've stripped away a lot of complexity,
including:

- Factory (gone completely)
- Annotator.Plugin.register (Annotator.Plugin is just a plain old object
  again)

But the most important change is the addition of src/core.coffee, which
contains AnnotatorCore. AnnotatorCore is:

- where plugins and storage implementations are registered
- responsible for propagating hook actions ('onAnnotationCreated') to
  plugin instances
- able to tear down an Annotator instance

That's all at the moment, but that leaves the Annotator class itself to
be responsible *only* for setting up a "default Annotator application"
-- the thing that most users have been using throughout the 1.2.x
series.

I've commented out a bunch of plugin tests -- the ones that still rely
on nasty direct inter-plugin dependencies.
storageadapter: Rename AnnotationRegistry -> StorageAdapter

This is not a registry of any description. Rather, it is an interface
adapter which wraps a concrete storage plugin implementation.

This commit also bulks up the tests for this component quite
substantially.
nullstore: Simplify NullStore

Storage plugins can now return values from their methods, so NullStore
doesn't need to mess with Deferreds.
nullstore: NullStore is not a plugin
ui: Get TextSelector and Adder working in UI module

Moved TextSelector and Adder into a UI module, as they are not "plugins"
in any meaningful sense (they do not respond to Annotator lifecycle
events).
ui: Extract Highlighter component and plugin

This commit shows the way for a couple of new patterns.

First, the way that the DefaultUI plugin is responsible for composing
the new UI components should be beginning to be clear.

Second, the division of the Highlighter into a domain-specific
Highlighter component in the UI module, as well as a thin wrapper plugin
that can, if needed, be used on its own.
ui: Move Widget into UI module
ui: Extract Editor component and plugin

Just as with the Highlighter in a13e72d, this commit moves the bulk of
the Editor functionality into the UI module. There remains a skeletal
Editor plugin, which admittedly isn't terribly useful on its own, but it
is included for completeness.

As part of this work, the #load() method of the Editor was refactored to
return a promise (resolving if the editor is submitted, rejecting if
cancelled) rather than having a "private" event handler on the Editor
itself.
ui: Extract Viewer component and plugin

Moves the bulk of the Viewer functionality into a decoupled object that
lives in the UI module. The Viewer plugin becomes a thin wrapper that
wires up aspects of the viewer's behaviour to the relevant registry
functions.
ui/adder: Further decouple the Adder widget

This commit further excises unnecessary couplings from the Adder:

- an Adder no longer needs to know about the internal structure of an
  annotation (such as how many ranges are in it), thus allowing it to be
  used in more contexts (image, video annotation, etc.)

- an Adder no longer knows the internals of the registry: instead an
  explicit onCreate handler can be passed to the constructor to indicate
  what should happen when the adder is clicked while an annotation is
  loaded
ui: Promote callback functions to top-level properties

This makes it possible to adjust the callback function after
construction.
ui/adder: Pass the triggering event to onCreate

For consistency with TextSelector#onSelection, we pass the DOM event to
the Adder#onCreate handler.
plugin/defaultui: Clean up DefaultUI plugin

This cleans up the DefaultUI plugin to take advantage of the preceding
commits further decoupling the UI components from one another and from
Annotator.
Remove LegacyRanges plugin

This plugin has been replaced with 2 or 3 lines in the DefaultUI plugin.
annotator: Remove unused handleError function
plugin/defaultui: Move z-index futzing into DefaultUI

Move the nasty z-index futzing into the DefaultUI plugin.
ui: Fix minor lint issues
test/ui/editor: Fix a double-call to done()
plugin/document: Simplify and refactor Document plugin

Convert the Document plugin to a new-style plugin. This makes the plugin
a lot simpler, and while here I've taken the liberty of "purifying" the
various metadata-extraction functions so they don't all mutate one
enormous object.

In addition, it appears that previously all annotations (before a cycle
through the store plugin) shared a reference to one global metadata
object. This is now fixed -- the metadata object is copied before being
added to an annotation.
storage: Storages are not plugins

Move all storage-related components into src/storage.coffee