1. 08 Nov, 2022 1 commit
    • Robert Knight's avatar
      Navigate to appropriate book chapter before scrolling to annotation · 22b134da
      Robert Knight authored
      When clicking an annotation in the sidebar that corresponds to a
      different chapter of a VitalSource book than the one that is currently loaded,
      navigate the book to the chapter associated with the annotation.
      
       - Add `goToCfi` and `goToURL` to the set of `<mosaic-book>` APIs that
         the client uses, and implementations of these in the VitalSource EPUB demo.
      
       - Add optional `navigateToSegment` method for integrations, which
         triggers a navigation to the segment (eg. EPUB chapter) of a document
         that matches an annotation's selectors.
      
       - Add new `navigateToSegment` sidebar => guest RPC call, which forwards
         to the integration's `navigateToSegment` implementation.
      
       - Change `FrameSyncService.scrollToAnnotation` to accept an annotation
         rather than just a tag, so the service can conveniently match the
         annotation against the EPUB chapter information for the guest
      
       - Add logic in `FrameSyncService.scrollToAnnotation` to invoke the
         `navigateToSegment` RPC method instead of `scrollToAnnotation` if the
         annotation is in a different segment of the document than is
         currently loaded.
      
         Once the navigation to the new segment has completed, the document
         still needs to be scrolled to the annotation. FrameSyncService
         service handles this by recording the ID of the annotation in a
         `_pendingScrollToId` field, and then performing the scroll once the
         annotation anchors.
      22b134da
  2. 07 Nov, 2022 13 commits
  3. 04 Nov, 2022 9 commits
  4. 03 Nov, 2022 2 commits
  5. 02 Nov, 2022 6 commits
    • Lyza Danger Gardner's avatar
      Update highlights CSS to prepare for clustered-highlight styling · 0cf562a1
      Lyza Danger Gardner authored
      Refactor `highlights.scss` to configure highlight style and subsequently apply styles. Add CSS variables for use for dynamic styling of highlight clusters.
      
      Update some comment wording in `gulpfile` for clarity.
      0cf562a1
    • Robert Knight's avatar
      Add a couple of notes in comments · f8f24706
      Robert Knight authored
      These address a couple of issues raised in code review.
      f8f24706
    • Robert Knight's avatar
      Compare annotation locations by CFI and text position · 1f6ea342
      Robert Knight authored
      For annotations on EPUBs, text position selectors can only be validly compared
      when they come from annotations made on the same EPUB Content Document. For
      annotations that come from different content documents, it is necessary to first
      compare the ordering of the content documents using CFIs, and then compare text
      positions.
      
      The use of `Number.POSITIVE_INFINITY` with replaced with
      `Number.MAX_SAFE_INTEGER` when handling annotations without positions, as
      `Math.sign(MAX_SAFE_INTEGER - MAX_SAFE_INTEGER)` is 0 (ie. treat two annotations
      with missing positions as having the same position), but
      `Math.sign(POSITIVE_INFINITY - POSITIVE_INFINITY)` is NaN.
      1f6ea342
    • Robert Knight's avatar
      Add additional tests and clarify string vs number step comparisons · 0b272c0b
      Robert Knight authored
      CFI steps that cannot be parsed as base-10 integers are invalid, but we try to
      fail gracefully in `compareCFIs` by using a string comparison.  This introduces
      a problem when one step is an integer and another is a string. Handle this by
      arbitrarily deciding that numbers sort before strings. We could have chosen
      other approaches as well.
      0b272c0b
    • Robert Knight's avatar
      Correct reference to starting point for CFI resolution · 815cef3c
      Robert Knight authored
      Per https://idpf.org/epub/linking/cfi/#sec-path-res, a CFI refers to a
      location within an EPUB's Package Document starting from the root
      `<package>` element, not the `<spine>`.
      815cef3c
    • Robert Knight's avatar
      Add functions for comparing CFIs and stripping assertions · 8d92de32
      Robert Knight authored
      When sorting EPUB annotations by document location, we will need to consider
      both the chapter/page and the text position within the chapter/page. Add
      utilities for comparing CFIs that will be useful for this purpose.
      
      The full sorting rules are specified by
      https://idpf.org/epub/linking/cfi/#sec-sorting. These utilities currently only
      implement the steps needed to compare simple CFIs which identify a location in
      the book's spine (eg. "/2/4/6"), rather than a "full" CFI which also contains a
      step indrection ("!") followed by the location of the selected content in the
      chapter.
      8d92de32
  6. 01 Nov, 2022 1 commit
    • Lyza Danger Gardner's avatar
      Add `$cluster` client property to annotation objects · 2d25a77e
      Lyza Danger Gardner authored
      This property is set when an annotation object is initialized in:
      
      * annotator: In `guest`, when a user creates a new annotation or highlight
        via the adder controls
      * sidebar: In the `annotations` store module when annotation objects are
        initialized before being added to the store
      
      This property is communicated between the sidebar and the annotator when
      exchanging annotation data. In the annotator, the value of this property
      is used to set an additional CSS class on drawn anchor highlights
      (`<hypothesis-highlight>` `span`s).
      
      The presence of this CSS class will allow subsequent differentiated styling
      for highlight clusters.
      2d25a77e
  7. 31 Oct, 2022 8 commits