• Robert Knight's avatar
    Add `PreactContainer` utility and refactor adder/bucket-bar to use it · a13024c2
    Robert Knight authored
    The various top-level Hypothesis UI elements in the annotator have a
    common structure where:
    
     - There is a `<hypothesis-{name}>` container element
    
     - The container has a shadow root with the annotator stylesheet loaded
       into it
    
     - Preact is used to render the contents of the element, into the shadow
       root.
    
     - There is a controller which wraps the container element and has
       methods to read/write the displayed data. When the data is changed,
       the Preact tree is re-rendered.
    
    Add a `PreactContainer` utility which implements common parts of this pattern,
    and refactor two of the top-level UI controls (bucket bar and adder) to use it.
    a13024c2
adder.tsx 11.2 KB