- 31 Mar, 2022 8 commits
-
-
Robert Knight authored
Add a test case for pages served with the `Cross-Origin-Opener-Policy: same-origin` header, which currently breaks the client's login popup. This reproduces the issue from https://github.com/hypothesis/product-backlog/issues/1333.
-
Robert Knight authored
Add support for specifying custom headers to serve test pages with via inline `<!-- Header: <Key>:<Value> -->` comments in the HTML/XML, and change the existing XHTML test case to use it.
-
Robert Knight authored
The process of creating and navigating the login popup used to involve two steps, first creating a blank window and then navigating it to the final authorization URL. This was needed because, in Firefox, the popup window had to be created in the same turn of the event loop as the user's click on the "Log in" button (otherwise the popup blocker would trigger) but generating the authorization URL involved an async "fetch" of API links. The major browsers have now all settled on a more flexible model for allowing popups in response to user gestures, where the popup must be opened within a certain time window of the gesture. In practice the timeout seems to be ~1000ms in Safari and longer than that in other browsers. In this context we expect the async delay between the user clicking the "Log in" button and us creating the popup to be ~0ms, since the API links should already have been fetched at this point and so we're just fetching locally cached values. Based on this assumption, the flow for creating the login popup window has been simplified to create the popup window at the final URL immediately, removing the need to open a blank window as a first step. Simplifying the code here will make it easier to change how the popup window and sidebar communicate, eg. to resolve an issue with the new Cross-Origin-Opener-Policy header [1]. [1] https://github.com/hypothesis/product-backlog/issues/1333
-
Robert Knight authored
- Add state and action types to reducers - Replace Array.forEach calls with for..of loops to enable better type inference. - Replace plain objects used as sets with ES sets
-
Robert Knight authored
Avoid the need to manually create the `SidebarStore` type by inferring it automatically. This works as follows: 1. The `modules` argument to `createStore` has been converted to a tuple type (`[ModuleA, ModuleB, ...]`) 2. The type of a module that would result from merging all the individual modules (`ModuleA & ModuleB ...`) is computed using a `TupleToIntersection` utility type 3. `StoreFromModule` is used to compute the type of the store that the merged module would produce
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
Extract a StyledText component that can be used by MarkdownView and AnnotationQuote. Update some props on Markdown components to match conventions.
-
Lyza Danger Gardner authored
Add new service to notify ancestor frame on annotation activity, if so configured.
-
- 30 Mar, 2022 6 commits
-
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
Previously, this component was _styled_ as a "panel", via SASS mixins, but did not have any behavioral "panel-ness." For now, use the shared Card (presentational) component for this component, and remove unused SASS and mixins.
-
Robert Knight authored
-
Robert Knight authored
-
Robert Knight authored
-
Robert Knight authored
Listen for key events for keyboard shortcuts on the document element rather than body element, to make them work in XHTML documents. When no interactive element (eg. an input field) is focused in an HTML document, keyboard events are sent to the body element. In an XHTML document however keyboard events are sent to the document element instead in Safari and Chrome (in Firefox they are still sent to the body). The key event listeners used for the adder's shortcuts were installed on the body element, so they didn't work in XHTML documents in Safari and Chrome. My guess is that the reason for this behavioral quirk is that HTML documents are guaranteed to have a body element - an empty one will be generated if none is present in the markup, whereas XHTML documents are not. Fixes https://github.com/hypothesis/client/issues/4364
-
- 29 Mar, 2022 5 commits
-
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Robert Knight authored
-
Robert Knight authored
Fix two issues found while testing HTML side-by-side mode with a BBC news article [1]: 1. When traversing the DOM tree to choose a scroll anchor, elements were skipped if their bounding rect (`element.getBoundingClientRect()`) did not intersect the viewport. This however did not account for content which overflows the element but is still visible to the user because it is not clipped. 2. The code used the intersection of the scroll root's bounding client rect and `(0, 0, window.innerWidth, window.innerHeight)` to get the viewport rect. In [1] the root element's bounding rect only covers the top (100vw, 100vh) pixels of the document, and most of the actual content of the page overflows that area. Resolve the issue by always using `(0, 0, window.innerWidth, window.innerHeight)` as the viewport, except when explicitly overridden (eg. in tests) [1] https://www.bbc.co.uk/news/world-europe-60693166
-
Lyza Danger Gardner authored
Convert AnnotationHeader and sub-components to use Tailwind utility classes. Lightly refactor props for AnnotationShareInfo for simplicity.
-
- 28 Mar, 2022 13 commits
-
-
Robert Knight authored
As noted in [1], much (most?) XHTML content on the web is actually served with the "text/html" mime type, including the existing documens in the dev server which declare themselves to be XHTML. However serving an XHTML document with the correct "application/xhtml+xml" mime type alters various browser behavior, so we need a page that tests this. [1] https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/XHTML#xhtml_document
-
Robert Knight authored
Safari does not support loading module scripts in XHTML pages that are served with the "application/xhtml" mime type [1]. This is very rare on the open web (XHTML is rare and XHTML documents served with "application/xhtml" as opposed to "text/html" as the MIME type are rarer still [2]) but more common in ebooks. This partly fixes https://github.com/hypothesis/client/issues/4350. [1] https://bugs.webkit.org/show_bug.cgi?id=227469 [2] https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/XHTML#xhtml_document
-
Robert Knight authored
-
Robert Knight authored
-
Robert Knight authored
These were removed by the refactoring in the previous commit. The new implementation checks for both conflicting selector and action names.
-
Robert Knight authored
Move helper functions used only by `createStore` into `create-store.js` and test the functionality as part of the `createStore` tests rather than having direct tests for the helpers. This refactoring decouples the tests for `createStore` from implementation details. Having a single module for `createStore` and its tests should also make it easier for a new developer to grok it. - Move `createReducer` and `bindSelectors` from util.js into create-store.js and refactor `bindSelectors` - Remove dedicated tests for these helpers and instead test the functionality via tests for `createStore`. - Remove check for `namespace` property of modules, as the types for the `createStoreModule` function now enforce the presence of this property. - Remove checks for conflicting selectors. These will be re-added in a subsequent commit.
-
Lyza Danger Gardner authored
Add a new `RPCSettings` type to retain RPC-related settings in `SidebarSettings`. These are derived from values provided in `ConfigFromHost`. Refactor internals of `buildSettings` to have a less ambiguous flow and retain RPC settings. Part of https://github.com/hypothesis/lms/issues/3647
-
dependabot[bot] authored
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 6.18.2 to 6.19.2. - [Release notes](https://github.com/getsentry/sentry-javascript/releases) - [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/sentry-javascript/compare/6.18.2...6.19.2) --- updated-dependencies: - dependency-name: "@sentry/browser" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.6.2 to 4.6.3. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.6.2...v4.6.3) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [@rollup/plugin-commonjs](https://github.com/rollup/plugins/tree/HEAD/packages/commonjs) from 21.0.2 to 21.0.3. - [Release notes](https://github.com/rollup/plugins/releases) - [Changelog](https://github.com/rollup/plugins/blob/master/packages/commonjs/CHANGELOG.md) - [Commits](https://github.com/rollup/plugins/commits/commonjs-v21.0.3/packages/commonjs) --- updated-dependencies: - dependency-name: "@rollup/plugin-commonjs" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [eslint](https://github.com/eslint/eslint) from 8.11.0 to 8.12.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.11.0...v8.12.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.1096.0 to 2.1101.0. - [Release notes](https://github.com/aws/aws-sdk-js/releases) - [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js/compare/v2.1096.0...v2.1101.0) --- updated-dependencies: - dependency-name: aws-sdk dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [prettier](https://github.com/prettier/prettier) from 2.6.0 to 2.6.1. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.6.0...2.6.1) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
- 25 Mar, 2022 2 commits
-
-
Lyza Danger Gardner authored
As foundational step for extending some configuration and settings objects, add some clarification to differentiate between "configuration" and "settings" in the sidebar, and rename the `fetch-config` module to `build-settings` to better reflect its responsibilities. Part of https://github.com/hypothesis/lms/issues/3647
-
Lyza Danger Gardner authored
-
- 24 Mar, 2022 3 commits
-
-
Robert Knight authored
Introduce a pattern for creating store modules which are fully typed, using the "activity" module as a test case / example. This allows TypeScript to check both external usage of the module, as well as internal consistency between the different elements of it (initial state, reducers, action creators, selectors). The elements of this pattern are: - A `State` type is defined in each module, which is typically whatever shape the module's initial state has. - Each function in the `reducers` map specifies the type of its `state` parameter as `State` and defines the fields of the action. - Action creators use a new `makeAction` helper, which ensures that the type of dispatched actions matches what the reducer expects - The `createStoreModule` helper ties all the elements of the module (reducers, actions, selectors) together and makes sure they are consistent with one another. The general structure of a typed store module, to which the various existing modules will converge, is: ```js import { createStoreModule, makeAction } from '../create-store'; const initialState = { ... } /** @typedef {typeof initialState} State */ const reducers = { /** * @param {State} state * @param {{ id: string }} action */ SOME_ACTION(state, action) { ... } } /** * @param {string} id */ function someAction(id) { return makeAction(reducers, 'SOME_ACTION', { id }); } /** * @param {State} */ function someSelector(state) { ... } export someModule = createStoreModule(initialState, { namespace: 'someModule', reducers, actionCreators: { someAction }, selectors: { someSelector }, }); ```
-
Robert Knight authored
Remove a cryptic piece of code that is no longer needed given the ability to specify default values for template arguments [1] [1] https://github.com/microsoft/TypeScript/pull/45483
-
Lyza Danger Gardner authored
-
- 23 Mar, 2022 3 commits
-
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
* `onSetPrivacy` => `onSetPrivate` * internal `onEditTags` takes `tags` instead of `{ tags }`
-