- 11 Nov, 2021 4 commits
-
-
Robert Knight authored
By default TypeScript includes all `@types/<name>` packages. This includes @types/node, though we don't use it directly, because it is a transitive dependency (see `yarn why @types/node`). As a result Node's globals are added to the environment TS sees, even though they don't really exist when our code runs in a browser. These globals include overloads for `setTimeout` and `setInterval` which return a different type (`Timeout`), causing spurious errors when assigning the result to a number. Fix the problem by using the `types` option [1] in tsconfig.json to explicitly specify which `@types/<name>` packages to include when checking code in src/ This does mean that if we ever intentionally add @types packages which declare globals (eg. for mocha), we'll need to explicitly list them here. In the process the ES target was updated to fix an error about a `BigInt` reference. [1] https://www.typescriptlang.org/tsconfig#types
-
Robert Knight authored
`useRef(null as T|null)` now returns a `{ current: T|null }` instead of `{ current: T }` as it did before. ie. it no longer drops the the null. This makes sense but conflicted with a pattern we used in many places to create a non-null ref: `useRef(/** @type {T|null} */ (null))`. Resolve this by changing all non-nullable refs, for elements which are set after the initial render, to cast the `useRef` result instead of the init value. ``` const nonNullRef = /** @type {{ current: T }} */ (useRef()); ```
-
dependabot[bot] authored
Bumps [preact](https://github.com/preactjs/preact) from 10.5.13 to 10.5.15. - [Release notes](https://github.com/preactjs/preact/releases) - [Commits](https://github.com/preactjs/preact/compare/10.5.13...10.5.15) --- updated-dependencies: - dependency-name: preact dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
Robert Knight authored
- @actions/core was used when the @hypothesis/frontend-shared package was part of the client repo. - postcss-url was used prior to the introduction of @hypothesis/frontend-build
-
- 09 Nov, 2021 9 commits
-
-
Robert Knight authored
The window `resize` event is good enough for the current use case and works in all browsers, but wouldn't work if the ThreadList could change size independently of the iframe/window.
-
Robert Knight authored
Fix an issue that caused `ThreadList` to sometimes have an incorrect (too small) internal `scrollContainerHeight` state after the app loaded, resulting in not enough annotation cards being rendered for the height of the sidebar. `ThreadList` measures the height of the scroll container after the initial render in a `useLayoutEffect` callback. It then registers handlers for window resize events in a `useEffect` callback order to re-measure the height when it changes. The sequence of events that lead to the incorrect state was: 1. The sidebar iframe starts out hidden, by a `display: none` on a container of the iframe in the parent frame. 2. When the `useLayoutEffect` callback runs, the iframe is hidden and so the scroll container height is measured as zero. 3. The iframe is then shown and a `resize` event is fired at the window 4. The ThreadList's `useEffect` callback runs and registers a handler for the window's `resize` event Because the initial window `resize` event is fired before the listener is registered, the scroll container height did not get re-measured. The fix is to combine the `useLayoutEffect` and `useEffect` callbacks from steps (2) and (4) so that the `resize` listener is registered immediately after the initial size is measured. Combining the effects is also beneficial from a readability perspective as it locates all the related state and logic together in the component. Fixes https://github.com/hypothesis/client/issues/3915
-
dependabot[bot] authored
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 6.13.3 to 6.14.1. - [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.13.3...6.14.1) --- 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 [sinon](https://github.com/sinonjs/sinon) from 11.1.2 to 12.0.1. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/master/docs/changelog.md) - [Commits](https://github.com/sinonjs/sinon/compare/v11.1.2...v12.0.1) --- updated-dependencies: - dependency-name: sinon dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [karma](https://github.com/karma-runner/karma) from 6.3.6 to 6.3.8. - [Release notes](https://github.com/karma-runner/karma/releases) - [Changelog](https://github.com/karma-runner/karma/blob/master/CHANGELOG.md) - [Commits](https://github.com/karma-runner/karma/compare/v6.3.6...v6.3.8) --- updated-dependencies: - dependency-name: karma dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [core-js](https://github.com/zloirock/core-js) from 3.19.0 to 3.19.1. - [Release notes](https://github.com/zloirock/core-js/releases) - [Changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/zloirock/core-js/compare/v3.19.0...v3.19.1) --- updated-dependencies: - dependency-name: core-js dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [reselect](https://github.com/reduxjs/reselect) from 4.1.1 to 4.1.2. - [Release notes](https://github.com/reduxjs/reselect/releases) - [Changelog](https://github.com/reduxjs/reselect/blob/master/CHANGELOG.md) - [Commits](https://github.com/reduxjs/reselect/compare/v4.1.1...v4.1.2) --- updated-dependencies: - dependency-name: reselect dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.1018.0 to 2.1023.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.1018.0...v2.1023.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 [puppeteer](https://github.com/puppeteer/puppeteer) from 10.4.0 to 11.0.0. - [Release notes](https://github.com/puppeteer/puppeteer/releases) - [Changelog](https://github.com/puppeteer/puppeteer/blob/main/CHANGELOG.md) - [Commits](https://github.com/puppeteer/puppeteer/compare/v10.4.0...v11.0.0) --- updated-dependencies: - dependency-name: puppeteer dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
-
- 04 Nov, 2021 1 commit
-
-
Robert Knight authored
Update babel-plugin-mockable-imports and enzyme-adapter-preact-pure to the newest versions which have ES module builds. This is primarily to verify that these releases, which I maintain, work in a real application.
-
- 03 Nov, 2021 15 commits
-
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Eduardo Sanz García authored
Because of the debouncing of mutation observer, sometimes 50ms was not enough to trigger the callback function (`onFrameAdded`). For the `FrameObserver` tests, I have disabled the debouncing. It has the benefit that the test run faster now.
-
Robert Knight authored
Remove a filter callback which always returned true. The first `!ann.id` condition is already part of the `store.unsavedAnnotations` logic. The second `isHighlight(...)` check did not work properly because the input was an annotation stub object with only `id` and `$tag` fields instead of the `Annotation` that `isHighlight` expects. For annotation stubs with no id, it always returned false. From a functional perspective the `isHighlight` check was also unnecessary. `store.unsavedAnnotations()` only returns IDs of annotations which have active drafts, but for highlights no draft is created.
-
Robert Knight authored
The newest version of the `createSelector` typings require the type of the input argument to be determined in order for the whole call to typecheck. This commit implements a pattern where: - A `State` type is added in various store modules, typically defined as `typeof initialState`, that defines the state of that store module's type. - The type of selector function params in `createSelector` calls is specified with `@param {State} state` and the return type is inferred The upside of these changes is that types of selector functions are determined much more robustly - previously it was possible to have incorrect types specified via JSDoc. In the process an existing minor bug was determined where an `isHighlight` call in `ThreadList` was passed an unexpected type of object (the `annotation` property of a `Draft`) for which `isHighlight` did not crash but would always return false. I have simply suppressed this existing issue for the moment, but it will need to be fixed separately.
-
dependabot[bot] authored
Bumps [reselect](https://github.com/reduxjs/reselect) from 4.0.0 to 4.1.1. - [Release notes](https://github.com/reduxjs/reselect/releases) - [Changelog](https://github.com/reduxjs/reselect/blob/master/CHANGELOG.md) - [Commits](https://github.com/reduxjs/reselect/compare/v4.0.0...v4.1.1) --- updated-dependencies: - dependency-name: reselect dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
- 02 Nov, 2021 9 commits
-
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
This makes the structure consistent with LMS' styles
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Robert Knight authored
The boot script used to be generated in several stages: 1. The files in `src/boot/` were bundled into `build/scripts/boot.bundle.js` with underscore-prefixed placeholders for certain data. 2. A gulp task would generate `build/manifest.json` which included hashes of assets in the build dir 3. Another gulp task would read `build/scripts/boot.bundle.js` and use string replacements to replace the placeholders with final values and write the result to `build/boot.js` This commit simplifies the process by combining stage (1) and (3). Add a separate Rollup config, rollup-boot.config.mjs, which builds `build/boot.js` directly from the `src/boot/index.js` entry point, using @rollup/plugin-replace to replace placeholders with data during the build. The code to generate the manifest in step (2) has been replaced with the manifest-generation code from the @hypothesis/frontend-build package, which is also shared with other projects. This change allows removal of several dependencies from the project, and means that we only have one way to replace `__PLACEHOLDER__` placeholders in JS files during the build, rather than two different ones. One minor change here is that only JS, CSS and sourcemap files are referenced in the manifest. Font files are not mentioned since the code that loads them (KaTeX) doesn't make use of the manifest.
-
- 01 Nov, 2021 2 commits
-
-
Lyza Danger Gardner authored
* Use `LabeledButton` instead of custom `<button>` * Use `Icon`, `Frame` components where useful * Reduce local/custom CSS * Modernize tests * Add title to `Icon` for a11y Fixes https://github.com/hypothesis/support/issues/241 Part of https://github.com/hypothesis/client/issues/3876 Part of https://github.com/hypothesis/frontend-shared/issues/232
-
Lyza Danger Gardner authored
These rules were added 10 years ago. We don't have any `sup` or `sub` elements in our source, and they could have possibly deleterious effects when user content is styled. Part of https://github.com/hypothesis/frontend-shared/issues/208
-