1. 09 Feb, 2022 4 commits
    • Lyza Danger Gardner's avatar
      Modernize styling of `AdderToolbar` · 41105c91
      Lyza Danger Gardner authored
      Convert the `AdderToolbar` component to tailwind utility-first styles.
      
      This component has some styling complexity that requires the continued
      use of some external styles for now:
      
      * It serves as the root element in a shadow DOM and has a couple of
        reset rules not serviceable by tailwind utility classes
      * The hover behavior of the adder toolbar buttons is too complex to
        implement with utility styles alone.
      
      Visual differences before/after are negligible. The adder is 1px taller
      due to using standardized spacing.
      41105c91
    • Lyza Danger Gardner's avatar
      429d0ea6
    • Robert Knight's avatar
      Improve types for annotation store module · 16800c9e
      Robert Knight authored
       - Type the `state` parameter to reducers and selectors
      
       - Improve types for `initializeAnnotation` helper
      
       - Add missing checks for the `id` field being set
      
       - Specify that `savedAnnotations` returns only annotations that have an
         ID
      16800c9e
    • Robert Knight's avatar
      Improve types of annotation values in several places · 711427e6
      Robert Knight authored
       - Introduce a `SavedAnnotation` type to represent annotations which
         have definitely been saved and an associated `isSaved` function to
         test. Use this as the type for several methods which used to
         implicitly assume they were passed a saved annotation.
      
         Calls to `isSaved` have also been added in several places to check
         that an annotation has been saved, although this should always have
         been the case in practice.
      
       - Add missing annotation types to various parameters in
         `AnnotationsService`
      711427e6
  2. 08 Feb, 2022 9 commits
  3. 07 Feb, 2022 12 commits
  4. 04 Feb, 2022 4 commits
    • Eduardo Sanz García's avatar
      Show buckets in the bucket-bar for VitalSource · c3f6ebe9
      Eduardo Sanz García authored
      Background information
      
      Currently, the bucket-bar should display anchor positions only from a
      _single_ guest frame. This is because there is no merging mechanism for
      anchor positions from multiple guest frames.
      
      Before this PR
      
      * The host frame listened for `anchorsChanged` events from
      _all_ the guest frames.
      
      * Only _one_ guest frame sent this event. We referred to this guest
        frame as having the 'main' annotatable content.  The 'main'
        annotatable guest frame was identified by not having a
        `subFrameIdentifier` (a configuration option added to a guest frame
        when the Hypothesis client was injected). Hence, the 'main'
        annotatable guest frame was always the frame where the Hypothesis
        loaded initially (in contrast with the injection mechanism).
      
      In this PR
      
      We have reversed the logic of how the `anchorChanged` RPC
      events are send and received:
      
      * _Every_ guest frame sends `anchorsChanged` RPC events to the host
        frame.
      
      * The host frame chooses to listen to only _one_ guest frame for the
        `anchorsChanged` RPC events: the guest frame that connects first with
        the host.
      
      For non-VitalSource case, the first guest frame that connects to the
      host frame is the one where the Hypothesis client was initially loaded
      (doesn't contain `subFrameIdentifier` option).
      
      For the VitalSource, because of #4176, there is no guest frame in the
      host frame. This allows the guest frame in the book content, where the
      Hypothesis client was injected, to send anchor positions, and positions
      to be reflected in the host's bucket-bar.
      c3f6ebe9
    • Eduardo Sanz García's avatar
      Improve consistency on bucket hovering and focusing · 259d695e
      Eduardo Sanz García authored
      On #4069, we introduced a small improvement when hovering a left-pointed
      bucket: focus the corresponding annotation card, in addition to the
      anchor's highlight.
      
      In this PR, we introduce the same improvement to the up and down-pointed
      buckets.
      
      In addition, I have realised we handled `onBlur` but not `onFocus`
      events. I have added more complete support for keyboard navigation.
      
      I substituted `onMouseMove` for `onMouseEnter` because it is triggered
      less frequently.
      259d695e
    • Eduardo's avatar
      Apply suggestions from code review · 6ed8c93b
      Eduardo authored
      Co-authored-by: 's avatarRobert Knight <robertknight@gmail.com>
      6ed8c93b
    • Eduardo Sanz García's avatar
      Do not create a `Guest` instance in the VS container · 1b8e8a4d
      Eduardo Sanz García authored
      In order to not create an unnecessary `Guest` instance in the
      VitalSource container we needed to do the following:
      
      * The `VitalSourceContainerIntegration` is stripped down and converted
        to a class, `VitalSourceInjector`, that does not implement the
        Integration interface but is only responsible for injecting the client
        into content frames.
      
      * The host frame checks the VS frame role and either constructs a Guest
        or sets up the `VitalSourceInjector` as appropriate.
      
      * The `HypothesisInjector`-related logic in `Guest` is extracted out of
        that class and set up in the annotator entry point instead.
      1b8e8a4d
  5. 03 Feb, 2022 4 commits
  6. 02 Feb, 2022 7 commits