1. 28 Oct, 2021 4 commits
  2. 27 Oct, 2021 7 commits
    • Robert Knight's avatar
      Improve field name · 4102e483
      Robert Knight authored
      This is a count of the number of reconnections, not including the
      initial connection attempt.
      4102e483
    • Robert Knight's avatar
      Move WebSocket automatic reconnection to streamer service · d9a017a2
      Robert Knight authored
      Move the logic for automatically reconnecting to the WebSocket after an
      unexpected disconnection from the `Socket` WebSocket wrapper class to
      the `StreamerService` service. The Socket class is now responsible only
      for notifying the caller of unexpected disconnections.
      
      Letting StreamerService handle reconnection ensures that a fresh
      WebSocket URL, with a current access token, is used on each attempt. The
      previous approach would re-use the same URL on each attempt. This could
      lead to an obsolete access token being used, with the result that the
      WebSocket connection degraded to an unauthenticated one and not all
      expected updates were received.
      
      As part of this change, the logic for calculating the retry delay has been
      simplified and no longer uses the `retry` package, hopefully making the
      behavior easier to understand.
      d9a017a2
    • Robert Knight's avatar
      Remove obsolete JSX runtime aliases · 44310d04
      Robert Knight authored
      This is no longer needed with the current version of
      @hypothesis/frontend-shared.
      44310d04
    • Robert Knight's avatar
      Remove unused SASS bundling script · 037f2eb5
      Robert Knight authored
      This has been replaced by `buildCSS` from @hypothesis/frontend-build.
      037f2eb5
    • Robert Knight's avatar
      Update @hypothesis/frontend-shared to v4.0.0 · 8e2d612c
      Robert Knight authored
      This required a couple of changes to adapt to the removal of the
      CommonJS build. Some modules from the pattern library web app triggered
      a Babel warning about top-level `this`. I copied across the workaround
      from `rollup.config.js` in the @hypothesis/frontend-shared library.
      8e2d612c
    • Lyza Danger Gardner's avatar
      578a1cd8
    • Robert Knight's avatar
      Fix KaTeX font loading · e3384922
      Robert Knight authored
      When rendering math, the custom KaTex fonts failed to load due to the
      relative URL references in `build/styles/katex.min.css` not matching the
      actual location of the fonts in `build/fonts`. The KaTeX CSS assumes a
      URL structure like:
      
      ```
      katex.min.css
      fonts/
        KaTeX_AMS-Regular.woff2
      ```
      
      Previously font URLs in katex.min.css were rewritten from
      `url('fonts/foo.woff2')` to `url('../fonts/foo.woff2')` by a PostCSS
      plugin when building the CSS bundles. However this got lost when
      replacing the client's local style-bundling script with the one from the
      @hypothesis/frontend-shared package.
      
      By relocating the fonts to a subdirectory of `build/styles` we can make
      the asset references work without needing to do any rewriting of URLs in
      the KaTeX CSS bundle.
      
      In the process, the list of fonts included in the bundle was simplified
      to include just WOFF2 fonts, since all modern browsers support that
      format. Additionally an obsolete reference to fonts in src/styles/vendor
      was removed.
      e3384922
  3. 26 Oct, 2021 3 commits
  4. 25 Oct, 2021 10 commits
  5. 22 Oct, 2021 2 commits
  6. 20 Oct, 2021 1 commit
  7. 19 Oct, 2021 13 commits
    • Eduardo Sanz García's avatar
      Rename `sync` to `syncAnchoringStatus` · b5fcac43
      Eduardo Sanz García authored
      The new name reflects more obviously the meaning the purpose of the
      event.
      b5fcac43
    • Eduardo Sanz García's avatar
      Rename `beforeCreateAnnotation` to `createAnnotation` · 05d47eff
      Eduardo Sanz García authored
      This is the event that creates the annotation, so it is better to name
      it in a more obvious way.
      
      Context:
      https://github.com/hypothesis/client/pull/3829#discussion_r726880585
      05d47eff
    • Robert Knight's avatar
      57078625
    • Robert Knight's avatar
      Make showing highlights when creating an annotation work for all guests · 565b543d
      Robert Knight authored
      Change the logic for making highlights visible when creating a new
      annotation, so that it works if the annotation was created in a non-host
      frame.
      
      This is done by moving the logic from the `beforeAnnotationCreated`
      handler in the Sidebar class, which was only called for annotations in
      the host frame, to the `beforeCreateAnnotation` handler in
      FrameSyncService, which is called for all frames. The sidebar app will
      then send a request to show highlights to the host frame, which will
      update the sidebar's controls and then relay the request to guest
      frames.
      565b543d
    • Robert Knight's avatar
      Make highlight visibility setting work in a multi-guest world · 7d5ff320
      Robert Knight authored
      Make the client's highlight visibility state work in a sane way in
      scenarios where there are multiple guests, or the main guest frame is not the
      host frame. Previously there were several problems in these scenarios:
      
       - It was unclear which component of the application "owned" the
         highlight visibility state. The state in the sidebar could be changed
         as a result of the `highlightsVisibleChanged` event emitted by a
         Guest, as well as the user toggling highlight controls in the
         sidebar.
      
       - In the sidebar's `open` and `close` methods it directly set the
         highlight visibility in the main guest if the `showHighlights`
         setting was set to `whenSidebarOpen`. This meant that it didn't work
         for guests that were not in the main frame.
      
       - Guest frames could be configured with different `showHighlights`
         settings. In this case it was unclear what should happen.
      
      This commit resolves this by making the `Sidebar` class in the host
      frame the central owner of this state. It handles configuring the
      initial state based on the `showHighlights` configuration setting, and
      reflecting this state to the sidebar application which in turn reflects
      it to guest frames. The initial visibility of highlights in a guest
      frame is synchronized with this state when the guest frame connects to
      the sidebar. This state is updated by the `Sidebar` class when:
      
       - The user toggles the highlight visibility control in the sidebar
       - A new highlight or annotation is created in a guest frame
       - The sidebar opens and closes, if the `showHighlights` configuration
         was set to `whenSidebarOpen`
      
      Additionally the inconsistency of `setHighlightsVisible` vs
      `setVisibleHighlights` in identifier and event names has been resolved by
      using `setHighlightsVisible`/`highlightsVisible` everywhere.
      
      Part of https://github.com/hypothesis/client/issues/3798
      7d5ff320
    • Robert Knight's avatar
      Remove unused `visibleHighlights` state in store · 814e1956
      Robert Knight authored
      There was an action to set this state but it was never read anywhere.
      814e1956
    • Eduardo Sanz García's avatar
      0b757c64
    • Eduardo Sanz García's avatar
      Strengthen the types for `Bridge` events · ebc5c0e2
      Eduardo Sanz García authored
      I have created type definitions for all the event names that are sent
      across the different frames using various `Bridge`s. It is based on the
      previous `bridge-events.js`. I broke down the events in four sections
      based on the direction of the messages:
      
      * guest -> sidebar events
      * host -> sidebar events
      * sidebar -> guest/s events
      * sidebar -> host events
      
      For those events that didn't have a description I added one.
      
      This is more stringent and less verbose than the previous lookup system.
      ebc5c0e2
    • Robert Knight's avatar
      Make sidebar app responsible for opening sidebar to edit draft · f6ac11fc
      Robert Knight authored
      Move the responsibility for opening the sidebar when there is a draft to
      edit from the guest into the sidebar's `FrameSyncService`.
      
      The initial motivation for this was to make the logic in the
      `beforeAnnotationCreated` event handler in the `Sidebar` class work if
      the annotation is created in a non-host guest frame. The plan was to
      make the sidebar send an `openSidebar` request with custom options that
      would trigger the logic that used to be in the `beforeAnnotationCreated`
      event handler.
      
      However it appears that focusing the sidebar frame is no longer necessary. In my
      testing the input field in the sidebar was successfully focused regardless
      of whether `iframe.contentWindow.focus()` was called or not. Therefore I
      have just removed the handler.
      
      Even though the original need no longer exists, moving the logic still
      seems sensible because logically it is the sidebar application that
      knows it is awaiting user input after a new draft is created. It also means that
      if we do find a need to re-introduce the frame-focusing logic that used
      to be in the `beforeAnnotationCreated` handler, we can do so in a way
      that works with annotations created in non-host frames.
      f6ac11fc
    • Robert Knight's avatar
      Replace `panelReady` event for triggering initial sidebar display · f484236b
      Robert Knight authored
      The initial un-hiding and opening of the sidebar was previously
      triggered by a `panelReady` event emitted by the Guest in the host frame
      when it connects.
      
      As part of eliminating the need for the host frame to also be a guest,
      change the initial sidebar open to use the `Sidebar.ready` promise
      instead, which is resolved when the sidebar applicaiton sends a
      `hypothesisSidebarReady` notice to the `Sidebar` app.
      
      Part of https://github.com/hypothesis/client/issues/3798
      f484236b
    • Robert Knight's avatar
      Fix test watch mode · bd69b16e
      Robert Knight authored
      Fix `gulp test --watch`. See https://github.com/hypothesis/frontend-shared/pull/214.
      bd69b16e
    • Robert Knight's avatar
      Streamline Karma configuration · a2ebf00e
      Robert Knight authored
      Streamline the Karma configuration to remove obsolete settings and make
      it easier to see what non-default configuration we have supplied.
      
       - Remove `grep` option handling. The `--grep` option when running tests
         is now used in gulpfile.js to select which _files_ are included in
         the test.
      
       - Remove comments which add little value
      
       - Remove config settings that just set default values which are not
         expected to change in future
      a2ebf00e
    • dependabot[bot]'s avatar
      Bump rollup from 2.47.0 to 2.58.0 · bde46354
      dependabot[bot] authored
      Bumps [rollup](https://github.com/rollup/rollup) from 2.47.0 to 2.58.0.
      - [Release notes](https://github.com/rollup/rollup/releases)
      - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
      - [Commits](https://github.com/rollup/rollup/compare/v2.47.0...v2.58.0)
      
      ---
      updated-dependencies:
      - dependency-name: rollup
        dependency-type: direct:development
        update-type: version-update:semver-minor
      ...
      Signed-off-by: 's avatardependabot[bot] <support@github.com>
      bde46354