1. 29 Mar, 2021 8 commits
    • Robert Knight's avatar
      Update variable names per current coding conventions · b2ad1f6d
      Robert Knight authored
       - Capitalize acryonyms in variable names except for the first word
       - Update the description of a stub test
      b2ad1f6d
    • Robert Knight's avatar
      Define `Integration` interface · e45a0a1b
      Robert Knight authored
      Explicitly define the common `Integration` interface which is
      implemented by both `HTMLIntegration` and `PDFIntegration`.
      
      This makes it more obvious what is part of the common interface that
      `Guest` can depend on and what are additional properties or methods that
      are specific to a particular implementation.
      e45a0a1b
    • Robert Knight's avatar
      Extract HTML integration into a separate module · 90139746
      Robert Knight authored
      Make the HTML document integration structure consistent with the PDF document
      integration by:
      
       - Extracting the integration implementation into a `HTMLIntegration`
         class in `src/annotator/integrations/html.js`
       - Renaming the document metadata extraction class from `DocumentMeta`
         to `HTMLMetadata` (to match PDFMetadata) and moving it to
         `src/annotator/integrations/html-metadata.js`
      90139746
    • Robert Knight's avatar
      Rename `fakePdfAnchoring` => `fakePDFAnchoring` · a4be02ec
      Robert Knight authored
      Per coding conventions recently agreed in the team, acronyms in symbol
      names are capitalized unless they are the first word of a camelCased
      symbol.
      a4be02ec
    • Robert Knight's avatar
      Rename `_showNoSelectableTextWarning` method · 700602c3
      Robert Knight authored
      The name made it unclear what the boolean argument did.
      700602c3
    • Robert Knight's avatar
      Unify HTML and PDF code paths in `Guest` · 7bc89ac3
      Robert Knight authored
      Unify the code paths in the `Guest` class that invoke document
      type/viewer-specific code such as getting the document URI and metadata
      and anchoring and generating selectors.
      
       - Replace `pdfIntegration` and `documentMeta` fields in `Guest` with an
         `integration` field which provides the interface to document-type
         specific functionality
       - Replace the roundabout method of `PDFIntegration` customizing the
         anchoring logic with `anchor` and `describe` methods which the
         `Guest` calls as needed
       - Add documentation and tests for `uri` and `getMetadata` methods in
         `PDFIntegration`
      7bc89ac3
    • Robert Knight's avatar
      Rename `PDFIntegration` fake to match class name · a76257fc
      Robert Knight authored
      Adjust the capitalization of the fake to match the name of the real
      class.
      a76257fc
    • Robert Knight's avatar
      Rename PDF => PDFIntegration and move to `src/annotator/integrations` · 7807f9c8
      Robert Knight authored
      Create an `integrations` directory within `src/annotator` which will
      house the `*Integration` classes that encapsulate document
      type/viewer-specific functionality, and create the first version of the
      PDF integration by moving/renaming the existing `PDF` class. The
      supporting `PDFMetadata` class has also been moved.
      
      Per recently agreed code conventions [1], the `PDFIntegration` and
      `PDFMetadata` classes are no longer default exports.
      
      [1] https://github.com/hypothesis/frontend-toolkit/blob/master/docs/js-guide.md#default-exports
      7807f9c8
  2. 26 Mar, 2021 5 commits
    • Lyza Danger Gardner's avatar
      91fa33cd
    • Lyza Danger Gardner's avatar
      Add shared buttons components · f503edcc
      Lyza Danger Gardner authored
      Add shared button components in a temporary "shared/components"
      directory. The plan is to extract this to the `frontend-shared` package
      once it has been more further integrated into the client preact app(s)
      and the kinks are worked out. This will replace
      `src/sidebar/components/Button` and will be reusable in other apps
      f503edcc
    • Lyza Danger Gardner's avatar
      Update project typecheck configuration · a8bcbc96
      Lyza Danger Gardner authored
      Update project typecheck configuration so that typechecking may be
      additionally applied to the `dev-server` area of the project. This helps
      for typechecking usage of components in the "UI Playground" app.
      
      * Add `tsconfig.json` for `dev-server` area of project
      * Add "project references" at root level
        See https://www.typescriptlang.org/docs/handbook/project-references.html
      * Update `package.json` `typecheck` script
      a8bcbc96
    • Robert Knight's avatar
      Extract side-by-side functionality out of PdfSidebar class · 793d289c
      Robert Knight authored
      Move the functionality that PdfSidebar implements elsewhere and remove
      the class. This mainly consists of side-by-side mode, but there is also
      the logic to get the scrollable document container for use with the
      bucket bar. The PDF-specific logic has been moved to the `PDF` class in
      `src/annotator/plugin/pdf.js` and the generic logic has been moved to
      the `Sidebar` or `Guest` classes.
      
      This change is a step towards creating an common interface between the
      Guest/Sidebar and the document-type/viewer specific functionality. In
      future the `PDF` class will evolve into the implementation of this
      interface for PDFs. For HTML documents the logic is currently contained
      directly in the `Guest` class and this will be extracted out into a
      class that implements the same interface.
      
       - Move the PDF-specific parts of side-by-side mode into
         `PDF#fitSideBySide`
       - Move the generic parts of side-by-side mode into the `Sidebar` class.
         This will allow it to be reused for HTML documents or other document
         types in future
       - Move the logic for determining the scrollable container into
         `PDF#contentContainer`
       - Change the annotator setup code in `annotator/index.js` to always
         instantiate the `Sidebar` class, regardless of document type
      793d289c
    • Eduardo Sanz García's avatar
      Position the adder to the top-left corner on hide · b2b33c2e
      Eduardo Sanz García authored
      When the `adder` is hidden reposition the outer container to the
      top-left corner of the host page.
      b2b33c2e
  3. 25 Mar, 2021 3 commits
  4. 24 Mar, 2021 2 commits
    • Kyle Keating's avatar
      Change thread sorter "Newest" & "Oldest" to use created · 37497780
      Kyle Keating authored
      This changes the sorting in the notebook to sort by date created rather than last edited date ("updated"). This prevents root threads from resorting to the top after they are edited in the notebook.  This also changes the way the sidebar orders root threads when using Newest/Oldest sorting filter in the same manner.
      37497780
    • Eduardo Sanz García's avatar
      Move creation of the outer container element to `Adder` · 2d9b0253
      Eduardo Sanz García authored
      `Notebook` and `Sidebar` components create `<hypothesis-...>` elements
      that attach shadow DOMs. This PR makes the `Adder` class responsible of
      creating its own outer element.
      2d9b0253
  5. 23 Mar, 2021 3 commits
    • Eduardo Sanz García's avatar
      Reload iframe on every `openNotebook` event · 0606bbcf
      Eduardo Sanz García authored
      While there is no mechanism to sync new annotations in the notebook, we
      force re-rendering of the iframe on every 'openNotebook' event, so we
      fetch the new annotations.
      
      This is a temporary fix that is intended to be removed.
      0606bbcf
    • Lyza Danger Gardner's avatar
      Update playground app · 599df082
      Lyza Danger Gardner authored
      Add some pattern structure to the playground app and a
      placeholder "Menu" demo
      599df082
    • Eduardo Sanz García's avatar
      Added accessibility tests to notebook components · d7a2a4e8
      Eduardo Sanz García authored
      Added a11y tests to these components:
      
      - NotebookView
      - FilterSelect
      - NotebookResultCount
      - PaginationNavigation
      
      To following components I didn't add a11y tests because they are
      wrappers of one or several components already tested:
      
      - PaginatedThreadList (ThreadList + PaginationNavigation)
      - NotebookFilters (FilterSelect)
      d7a2a4e8
  6. 22 Mar, 2021 9 commits
  7. 19 Mar, 2021 3 commits
  8. 18 Mar, 2021 7 commits