1. 15 Feb, 2021 5 commits
  2. 12 Feb, 2021 5 commits
    • Robert Knight's avatar
      Switch to using `<link>` elements for stylesheets in shadow DOM · 1d2eaf68
      Robert Knight authored
      When Shadow DOM was first considered for use in the client `<link
      rel="stylesheet">` was not widely supported as a way to load external styles into
      shadow roots. This was resolved in the spec in https://github.com/whatwg/html/pull/1572
      and has now long been supported by all browsers.
      
      Using `<link>` simplifies the code and also avoids a possible problem with sites
      that have a strict CSP policy that disallows inline styles. In the
      browser extension context a `<link>` can still work in that scenario as long as the
      stylesheet is loaded from a `chrome-extension://` URL.
      1d2eaf68
    • Robert Knight's avatar
      Move notebook container into shadow DOM · ff5918d6
      Robert Knight authored
      Follow the example of the `<hypothesis-sidebar>` element by making the
      `<hypothesis-notebook>` element an unstyled shadow-host which serves as
      the root container for the notebook, isolating it from the page's
      styles. Inside this is a styled element which serves as the visual
      container.
      
      As well as isolating the notebook from the host page's styles, this will
      also make it possible to avoid loading annotator styles into the host
      page. See https://github.com/hypothesis/client/issues/2979.
      
      To reduce resource usage a little when the notebook is not used, only
      the notebook's shadow host is created initially. The styled inner
      container is created when the notebook is shown for the first time.
      ff5918d6
    • Lyza Danger Gardner's avatar
      66cf493a
    • Eduardo Sanz García's avatar
      Removed unused click event · 963f5961
      Eduardo Sanz García authored
      The BucketBar component has a CSS property that disables click events
      (`pointer-events: none`). Hence, it is pointless to register a click
      event listener to the BucketBar.
      
      `pointer-events: none` was added to the BucketBar more than 6 years ago.
      963f5961
    • Eduardo Sanz García's avatar
      Update sidebar left margin when browser window is resized · ee2eca81
      Eduardo Sanz García authored
      Currently, if the client's sidebar is opened it doesn't behave
      graciously when the browser window is resized. Sometimes the sidebar
      appears floating on the middle of the window.
      
      We discussed several alternative solutions: when the sidebar is opened
      and the window is resized, then...
      
      1. close the sidebar and the user opens it manually
      2. maintain the sidebar open, but scale it properly
      3. close the sidebar and open it after X milliseconds of the last resize
         event
      4. close the sidebar if the width of the window is reduced, but
         maintain it open if the window's width is increased
      
      We implemented solution #2, because it gives a more consistent behaviour
      for both sidebars, PDF and non-PDF.
      
      In addition, I added a mechanism to register and unregister events, to
      avoid resource leaks.
      ee2eca81
  3. 11 Feb, 2021 5 commits
  4. 10 Feb, 2021 1 commit
  5. 08 Feb, 2021 11 commits
  6. 05 Feb, 2021 8 commits
  7. 03 Feb, 2021 5 commits
    • Robert Knight's avatar
      Add license and description to frontend-shared package · d90a4519
      Robert Knight authored
      All npm packages should have a license, and yarn complains if there
      isn't one. The license chosen here is the same as in the client's
      package.json.
      d90a4519
    • Robert Knight's avatar
      Generate `.d.ts` files as part of the frontend-shared package · 480b6d77
      Robert Knight authored
      Generate TypeScript definition files as part of the frontend-shared
      package so that TS can typecheck code that uses the package in other
      projects. Within the client repository we don't need to generate these files
      because TypeScript will read the JSDoc comments. When the package is
      consumed from other projects however, it seems that it does not read the
      JSDoc comments. Note that when these `.d.ts` files exist, they are used in preference
      to JSDoc comments by other code in the client repository. Therefore they
      need to be kept up to date when the files are recompiled in watch mode.
      
      In the process of adding this I discovered an issue that the method of
      running CLI commands in gulp tasks in `scripts/gulp/frontend-shared.js` did not
      fail if the exit status was non-zero. I created a `run` utility that
      handles this correctly along with providing the desired defaults.
      480b6d77
    • Robert Knight's avatar
      898e61b8
    • Robert Knight's avatar
      Adjust glob used to exclude frontend-shared tests from typechecking · f9b33888
      Robert Knight authored
      Change the glob to allow for `test/` dirs inside subdirectories of
      `frontend-shared/src`.
      f9b33888
    • Robert Knight's avatar
      Do not instrument `frontend-shared/lib` for code coverage · ce0f4599
      Robert Knight authored
      This directory contains the compiled version of code from `frontend-shared/src`.
      Only the source should be instrumented.
      ce0f4599