Commit a99070b1 authored by Alejandro Celaya's avatar Alejandro Celaya Committed by Alejandro Celaya

Add prettier plugin to automatically order imports

parent 22e24f5f
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
"@rollup/plugin-virtual": "^3.0.0", "@rollup/plugin-virtual": "^3.0.0",
"@sentry/browser": "^7.1.1", "@sentry/browser": "^7.1.1",
"@sentry/cli": "^2.0.2", "@sentry/cli": "^2.0.2",
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
"@types/dompurify": "^2.3.3", "@types/dompurify": "^2.3.3",
"@types/escape-html": "^1.0.1", "@types/escape-html": "^1.0.1",
"@types/hammerjs": "^2.0.41", "@types/hammerjs": "^2.0.41",
...@@ -102,7 +103,10 @@ ...@@ -102,7 +103,10 @@
"browserslist": "chrome 70, firefox 70, safari 11.1", "browserslist": "chrome 70, firefox 70, safari 11.1",
"prettier": { "prettier": {
"arrowParens": "avoid", "arrowParens": "avoid",
"singleQuote": true "singleQuote": true,
"importOrder": ["^[./]"],
"importOrderSeparation": true,
"importOrderCaseInsensitive": true
}, },
"main": "./build/boot.js", "main": "./build/boot.js",
"scripts": { "scripts": {
......
import { render } from 'preact'; import { render } from 'preact';
import AdderToolbar from './components/AdderToolbar';
import type { Command } from './components/AdderToolbar';
import { isTouchDevice } from '../shared/user-agent'; import { isTouchDevice } from '../shared/user-agent';
import type { Destroyable } from '../types/annotator'; import type { Destroyable } from '../types/annotator';
import AdderToolbar from './components/AdderToolbar';
import type { Command } from './components/AdderToolbar';
import { createShadowRoot } from './util/shadow-root'; import { createShadowRoot } from './util/shadow-root';
export enum ArrowDirection { export enum ArrowDirection {
......
...@@ -4,7 +4,6 @@ import type { ...@@ -4,7 +4,6 @@ import type {
TextPositionSelector, TextPositionSelector,
TextQuoteSelector, TextQuoteSelector,
} from '../../types/api'; } from '../../types/api';
import { RangeAnchor, TextPositionAnchor, TextQuoteAnchor } from './types'; import { RangeAnchor, TextPositionAnchor, TextQuoteAnchor } from './types';
type Options = { type Options = {
......
/* global PDFViewerApplication */ /* global PDFViewerApplication */
import { warnOnce } from '../../shared/warn-once'; import { warnOnce } from '../../shared/warn-once';
import { translateOffsets } from '../util/normalize';
import { matchQuote } from './match-quote';
import { createPlaceholder } from './placeholder';
import { TextPosition, TextRange } from './text-range';
import { TextQuoteAnchor } from './types';
import type { import type {
TextPositionSelector, TextPositionSelector,
TextQuoteSelector, TextQuoteSelector,
Selector, Selector,
} from '../../types/api'; } from '../../types/api';
import type { PDFPageView, PDFViewer } from '../../types/pdfjs'; import type { PDFPageView, PDFViewer } from '../../types/pdfjs';
import { translateOffsets } from '../util/normalize';
import { matchQuote } from './match-quote';
import { createPlaceholder } from './placeholder';
import { TextPosition, TextRange } from './text-range';
import { TextQuoteAnchor } from './types';
type PDFTextRange = { type PDFTextRange = {
pageIndex: number; pageIndex: number;
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
* each of the relevant classes in PDF.js. The APIs of the fakes should conform * each of the relevant classes in PDF.js. The APIs of the fakes should conform
* to the corresponding interfaces defined in `src/types/pdfjs.js`. * to the corresponding interfaces defined in `src/types/pdfjs.js`.
*/ */
import { TinyEmitter as EventEmitter } from 'tiny-emitter'; import { TinyEmitter as EventEmitter } from 'tiny-emitter';
import { RenderingStates } from '../pdf'; import { RenderingStates } from '../pdf';
......
...@@ -20,10 +20,8 @@ ...@@ -20,10 +20,8 @@
// 3. Fetch the annotations for the web page via the Hypothesis API and save // 3. Fetch the annotations for the web page via the Hypothesis API and save
// them as `<fixture name>.json` in this directory // them as `<fixture name>.json` in this directory
// 4. Add an entry to the fixture list below. // 4. Add an entry to the fixture list below.
import minimalDoc from './minimal.html'; import minimalDoc from './minimal.html';
import minimalJSON from './minimal.json'; import minimalJSON from './minimal.json';
import wikipediaDoc from './wikipedia-regression-testing.html'; import wikipediaDoc from './wikipedia-regression-testing.html';
import wikipediaJSON from './wikipedia-regression-testing.json'; import wikipediaJSON from './wikipedia-regression-testing.json';
......
import * as html from '../html'; import * as html from '../html';
import fixture from './html-anchoring-fixture.html'; import fixture from './html-anchoring-fixture.html';
import { htmlBaselines } from './html-baselines'; import { htmlBaselines } from './html-baselines';
......
import { delay } from '../../../test-util/wait'; import { delay } from '../../../test-util/wait';
import * as pdfAnchoring from '../pdf';
import { matchQuote } from '../match-quote'; import { matchQuote } from '../match-quote';
import * as pdfAnchoring from '../pdf';
import { TextRange } from '../text-range'; import { TextRange } from '../text-range';
import { FakePDFViewerApplication } from './fake-pdf-viewer-application'; import { FakePDFViewerApplication } from './fake-pdf-viewer-application';
/** /**
......
import { TextPosition, TextRange, ResolveDirection } from '../text-range';
import { assertNodesEqual, textNodes } from '../../../test-util/compare-dom'; import { assertNodesEqual, textNodes } from '../../../test-util/compare-dom';
import { TextPosition, TextRange, ResolveDirection } from '../text-range';
const html = ` const html = `
<main> <main>
......
import { textNodes } from '../../../test-util/compare-dom'; import { textNodes } from '../../../test-util/compare-dom';
import { trimRange } from '../trim-range';
import { TextRange } from '../text-range'; import { TextRange } from '../text-range';
import { trimRange } from '../trim-range';
describe('annotator/anchoring/trim-range', () => { describe('annotator/anchoring/trim-range', () => {
let container; let container;
......
import { TextRange } from '../text-range';
import { import {
RangeAnchor, RangeAnchor,
TextPositionAnchor, TextPositionAnchor,
...@@ -5,8 +6,6 @@ import { ...@@ -5,8 +6,6 @@ import {
$imports, $imports,
} from '../types'; } from '../types';
import { TextRange } from '../text-range';
// These are primarily basic API tests for the anchoring classes. Tests for // These are primarily basic API tests for the anchoring classes. Tests for
// anchoring a variety of HTML and PDF content exist in `html-test` and // anchoring a variety of HTML and PDF content exist in `html-test` and
// `pdf-test`. // `pdf-test`.
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* 2. Insulating the rest of the code from API changes in the underlying anchoring * 2. Insulating the rest of the code from API changes in the underlying anchoring
* libraries. * libraries.
*/ */
import { matchQuote } from './match-quote'; import { matchQuote } from './match-quote';
import { TextRange, TextPosition } from './text-range'; import { TextRange, TextPosition } from './text-range';
import { nodeFromXPath, xpathFromNode } from './xpath'; import { nodeFromXPath, xpathFromNode } from './xpath';
......
import { ListenerCollection } from '../shared/listener-collection'; import { ListenerCollection } from '../shared/listener-collection';
import { computeAnchorPositions } from './util/buckets'; import { computeAnchorPositions } from './util/buckets';
/** /**
......
import classnames from 'classnames';
import { import {
AnnotateIcon, AnnotateIcon,
ButtonBase, ButtonBase,
...@@ -7,6 +6,7 @@ import { ...@@ -7,6 +6,7 @@ import {
PointerUpIcon, PointerUpIcon,
} from '@hypothesis/frontend-shared/lib/next'; } from '@hypothesis/frontend-shared/lib/next';
import type { IconComponent } from '@hypothesis/frontend-shared/lib/types'; import type { IconComponent } from '@hypothesis/frontend-shared/lib/types';
import classnames from 'classnames';
import { useShortcut } from '../../shared/shortcut'; import { useShortcut } from '../../shared/shortcut';
......
import classnames from 'classnames';
import { import {
Link, Link,
LinkBase, LinkBase,
CaretLeftIcon, CaretLeftIcon,
CaretRightIcon, CaretRightIcon,
} from '@hypothesis/frontend-shared/lib/next'; } from '@hypothesis/frontend-shared/lib/next';
import classnames from 'classnames';
/** /**
* @typedef {import('../../types/annotator').ContentInfoConfig} ContentInfoConfig * @typedef {import('../../types/annotator').ContentInfoConfig} ContentInfoConfig
......
import { IconButton, CancelIcon } from '@hypothesis/frontend-shared/lib/next'; import { IconButton, CancelIcon } from '@hypothesis/frontend-shared/lib/next';
import { useEffect, useRef, useState } from 'preact/hooks';
import classnames from 'classnames'; import classnames from 'classnames';
import { useEffect, useRef, useState } from 'preact/hooks';
import { addConfigFragment } from '../../shared/config-fragment'; import { addConfigFragment } from '../../shared/config-fragment';
import { createAppConfig } from '../config/app'; import { createAppConfig } from '../config/app';
......
import type { ButtonCommonProps } from '@hypothesis/frontend-shared/lib/components/input/ButtonBase';
import { import {
ButtonBase, ButtonBase,
AnnotateIcon, AnnotateIcon,
...@@ -12,7 +13,6 @@ import type { ...@@ -12,7 +13,6 @@ import type {
IconComponent, IconComponent,
PresentationalProps, PresentationalProps,
} from '@hypothesis/frontend-shared/lib/types'; } from '@hypothesis/frontend-shared/lib/types';
import type { ButtonCommonProps } from '@hypothesis/frontend-shared/lib/components/input/ButtonBase';
import classnames from 'classnames'; import classnames from 'classnames';
import type { JSX, RefObject } from 'preact'; import type { JSX, RefObject } from 'preact';
......
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import { import {
highlightStyles, highlightStyles,
defaultClusterStyles, defaultClusterStyles,
......
import { act } from 'preact/test-utils';
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import { act } from 'preact/test-utils';
import { addConfigFragment } from '../../../shared/config-fragment'; import { addConfigFragment } from '../../../shared/config-fragment';
import { EventBus } from '../../util/emitter'; import { EventBus } from '../../util/emitter';
......
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import Toolbar from '../Toolbar';
import { checkAccessibility } from '../../../test-util/accessibility'; import { checkAccessibility } from '../../../test-util/accessibility';
import Toolbar from '../Toolbar';
const noop = () => {}; const noop = () => {};
......
import { toBoolean } from '../../shared/type-coercions';
import { isBrowserExtension } from './is-browser-extension'; import { isBrowserExtension } from './is-browser-extension';
import { settingsFrom } from './settings'; import { settingsFrom } from './settings';
import { toBoolean } from '../../shared/type-coercions';
import { urlFromLinkTag } from './url-from-link-tag'; import { urlFromLinkTag } from './url-from-link-tag';
/** /**
......
import { hasOwn } from '../../shared/has-own';
import { parseJsonConfig } from '../../boot/parse-json-config'; import { parseJsonConfig } from '../../boot/parse-json-config';
import { hasOwn } from '../../shared/has-own';
import { toBoolean } from '../../shared/type-coercions'; import { toBoolean } from '../../shared/type-coercions';
import { configFuncSettingsFrom } from './config-func-settings-from'; import { configFuncSettingsFrom } from './config-func-settings-from';
import { urlFromLinkTag } from './url-from-link-tag'; import { urlFromLinkTag } from './url-from-link-tag';
......
...@@ -4,12 +4,28 @@ import { ListenerCollection } from '../shared/listener-collection'; ...@@ -4,12 +4,28 @@ import { ListenerCollection } from '../shared/listener-collection';
import { PortFinder, PortRPC } from '../shared/messaging'; import { PortFinder, PortRPC } from '../shared/messaging';
import { generateHexString } from '../shared/random'; import { generateHexString } from '../shared/random';
import { matchShortcut } from '../shared/shortcut'; import { matchShortcut } from '../shared/shortcut';
import type {
AnnotationData,
Annotator,
Anchor,
ContentInfoConfig,
Destroyable,
DocumentInfo,
Integration,
SidebarLayout,
} from '../types/annotator';
import type { Target } from '../types/api';
import type {
HostToGuestEvent,
GuestToHostEvent,
GuestToSidebarEvent,
SidebarToGuestEvent,
} from '../types/port-rpc-events';
import { Adder } from './adder'; import { Adder } from './adder';
import { TextRange } from './anchoring/text-range'; import { TextRange } from './anchoring/text-range';
import { BucketBarClient } from './bucket-bar-client'; import { BucketBarClient } from './bucket-bar-client';
import { HighlightClusterController } from './highlight-clusters';
import { FeatureFlags } from './features'; import { FeatureFlags } from './features';
import { HighlightClusterController } from './highlight-clusters';
import { import {
getHighlightsContainingNode, getHighlightsContainingNode,
highlightRange, highlightRange,
...@@ -25,24 +41,6 @@ import { findClosestOffscreenAnchor } from './util/buckets'; ...@@ -25,24 +41,6 @@ import { findClosestOffscreenAnchor } from './util/buckets';
import { frameFillsAncestor } from './util/frame'; import { frameFillsAncestor } from './util/frame';
import { normalizeURI } from './util/url'; import { normalizeURI } from './util/url';
import type {
AnnotationData,
Annotator,
Anchor,
ContentInfoConfig,
Destroyable,
DocumentInfo,
Integration,
SidebarLayout,
} from '../types/annotator';
import type { Target } from '../types/api';
import type {
HostToGuestEvent,
GuestToHostEvent,
GuestToSidebarEvent,
SidebarToGuestEvent,
} from '../types/port-rpc-events';
/** HTML element created by the highlighter with an associated annotation. */ /** HTML element created by the highlighter with an associated annotation. */
type AnnotationHighlight = HTMLElement & { _annotation?: AnnotationData }; type AnnotationHighlight = HTMLElement & { _annotation?: AnnotationData };
......
...@@ -5,11 +5,9 @@ import type { ...@@ -5,11 +5,9 @@ import type {
FeatureFlags as IFeatureFlags, FeatureFlags as IFeatureFlags,
} from '../types/annotator'; } from '../types/annotator';
import type { HighlightCluster } from '../types/shared'; import type { HighlightCluster } from '../types/shared';
import ClusterToolbar from './components/ClusterToolbar'; import ClusterToolbar from './components/ClusterToolbar';
import { createShadowRoot } from './util/shadow-root';
import { updateClusters } from './highlighter'; import { updateClusters } from './highlighter';
import { createShadowRoot } from './util/shadow-root';
export type HighlightStyle = { export type HighlightStyle = {
color: string; color: string;
......
import classnames from 'classnames'; import classnames from 'classnames';
import type { HighlightCluster } from '../types/shared';
import { generateHexString } from '../shared/random'; import { generateHexString } from '../shared/random';
import type { HighlightCluster } from '../types/shared';
import { isInPlaceholder } from './anchoring/placeholder'; import { isInPlaceholder } from './anchoring/placeholder';
import { isNodeInRange } from './range-util'; import { isNodeInRange } from './range-util';
......
// Load polyfill for :focus-visible pseudo-class. // Load polyfill for :focus-visible pseudo-class.
import 'focus-visible'; import 'focus-visible';
// Enable debug checks for Preact. Removed in prod builds by Rollup config. // Enable debug checks for Preact. Removed in prod builds by Rollup config.
import 'preact/debug'; import 'preact/debug';
...@@ -9,8 +8,8 @@ import { ...@@ -9,8 +8,8 @@ import {
installPortCloseWorkaroundForSafari, installPortCloseWorkaroundForSafari,
} from '../shared/messaging'; } from '../shared/messaging';
import type { Destroyable } from '../types/annotator'; import type { Destroyable } from '../types/annotator';
import { getConfig } from './config/index';
import type { NotebookConfig } from './components/NotebookModal'; import type { NotebookConfig } from './components/NotebookModal';
import { getConfig } from './config/index';
import { Guest } from './guest'; import { Guest } from './guest';
import type { GuestConfig } from './guest'; import type { GuestConfig } from './guest';
import { import {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
* *
* @typedef {import('../../types/annotator').DocumentMetadata} Metadata * @typedef {import('../../types/annotator').DocumentMetadata} Metadata
*/ */
import { normalizeURI } from '../util/url'; import { normalizeURI } from '../util/url';
/** /**
......
...@@ -2,14 +2,13 @@ import { TinyEmitter } from 'tiny-emitter'; ...@@ -2,14 +2,13 @@ import { TinyEmitter } from 'tiny-emitter';
import { anchor, describe } from '../anchoring/html'; import { anchor, describe } from '../anchoring/html';
import { TextRange } from '../anchoring/text-range'; import { TextRange } from '../anchoring/text-range';
import { NavigationObserver } from '../util/navigation-observer';
import { scrollElementIntoView } from '../util/scroll';
import { HTMLMetadata } from './html-metadata'; import { HTMLMetadata } from './html-metadata';
import { import {
guessMainContentArea, guessMainContentArea,
preserveScrollPosition, preserveScrollPosition,
} from './html-side-by-side'; } from './html-side-by-side';
import { NavigationObserver } from '../util/navigation-observer';
import { scrollElementIntoView } from '../util/scroll';
/** /**
* @typedef {import('../../types/annotator').Anchor} Anchor * @typedef {import('../../types/annotator').Anchor} Anchor
......
...@@ -2,8 +2,17 @@ import debounce from 'lodash.debounce'; ...@@ -2,8 +2,17 @@ import debounce from 'lodash.debounce';
import { render } from 'preact'; import { render } from 'preact';
import { TinyEmitter } from 'tiny-emitter'; import { TinyEmitter } from 'tiny-emitter';
import { TextRange } from '../anchoring/text-range';
import { ListenerCollection } from '../../shared/listener-collection'; import { ListenerCollection } from '../../shared/listener-collection';
import type {
Anchor,
AnnotationData,
Annotator,
ContentInfoConfig,
Integration,
SidebarLayout,
} from '../../types/annotator';
import type { Selector } from '../../types/api';
import type { PDFViewer, PDFViewerApplication } from '../../types/pdfjs';
import { import {
RenderingStates, RenderingStates,
anchor, anchor,
...@@ -12,25 +21,14 @@ import { ...@@ -12,25 +21,14 @@ import {
documentHasText, documentHasText,
} from '../anchoring/pdf'; } from '../anchoring/pdf';
import { isInPlaceholder, removePlaceholder } from '../anchoring/placeholder'; import { isInPlaceholder, removePlaceholder } from '../anchoring/placeholder';
import { TextRange } from '../anchoring/text-range';
import Banners from '../components/Banners'; import Banners from '../components/Banners';
import ContentInfoBanner from '../components/ContentInfoBanner'; import ContentInfoBanner from '../components/ContentInfoBanner';
import WarningBanner from '../components/WarningBanner'; import WarningBanner from '../components/WarningBanner';
import { createShadowRoot } from '../util/shadow-root';
import { offsetRelativeTo, scrollElement } from '../util/scroll'; import { offsetRelativeTo, scrollElement } from '../util/scroll';
import { createShadowRoot } from '../util/shadow-root';
import { PDFMetadata } from './pdf-metadata'; import { PDFMetadata } from './pdf-metadata';
import type {
Anchor,
AnnotationData,
Annotator,
ContentInfoConfig,
Integration,
SidebarLayout,
} from '../../types/annotator';
import type { Selector } from '../../types/api';
import type { PDFViewer, PDFViewerApplication } from '../../types/pdfjs';
/** /**
* Window with additional globals set by PDF.js. * Window with additional globals set by PDF.js.
*/ */
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
** Dual licensed under the MIT and GPLv3 licenses. ** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/openannotation/annotator/blob/master/LICENSE ** https://github.com/openannotation/annotator/blob/master/LICENSE
*/ */
import { HTMLMetadata } from '../html-metadata'; import { HTMLMetadata } from '../html-metadata';
describe('HTMLMetadata', () => { describe('HTMLMetadata', () => {
......
import { delay } from '../../../test-util/wait'; import { delay } from '../../../test-util/wait';
import { FakePDFViewerApplication } from '../../anchoring/test/fake-pdf-viewer-application';
import { RenderingStates } from '../../anchoring/pdf'; import { RenderingStates } from '../../anchoring/pdf';
import { createPlaceholder } from '../../anchoring/placeholder'; import { createPlaceholder } from '../../anchoring/placeholder';
import { FakePDFViewerApplication } from '../../anchoring/test/fake-pdf-viewer-application';
import { PDFIntegration, isPDF, $imports } from '../pdf'; import { PDFIntegration, isPDF, $imports } from '../pdf';
function awaitEvent(target, eventName) { function awaitEvent(target, eventName) {
......
...@@ -2,13 +2,6 @@ import { TinyEmitter } from 'tiny-emitter'; ...@@ -2,13 +2,6 @@ import { TinyEmitter } from 'tiny-emitter';
import { documentCFI } from '../../shared/cfi'; import { documentCFI } from '../../shared/cfi';
import { ListenerCollection } from '../../shared/listener-collection'; import { ListenerCollection } from '../../shared/listener-collection';
import { FeatureFlags } from '../features';
import { onDocumentReady } from '../frame-observer';
import { HTMLIntegration } from './html';
import { preserveScrollPosition } from './html-side-by-side';
import { ImageTextLayer } from './image-text-layer';
import { injectClient } from '../hypothesis-injector';
import type { import type {
Anchor, Anchor,
AnnotationData, AnnotationData,
...@@ -16,12 +9,18 @@ import type { ...@@ -16,12 +9,18 @@ import type {
SegmentInfo, SegmentInfo,
SidebarLayout, SidebarLayout,
} from '../../types/annotator'; } from '../../types/annotator';
import type { EPUBContentSelector, Selector } from '../../types/api';
import type { import type {
ContentFrameGlobals, ContentFrameGlobals,
MosaicBookElement, MosaicBookElement,
} from '../../types/vitalsource'; } from '../../types/vitalsource';
import type { EPUBContentSelector, Selector } from '../../types/api'; import { FeatureFlags } from '../features';
import { onDocumentReady } from '../frame-observer';
import { injectClient } from '../hypothesis-injector';
import type { InjectConfig } from '../hypothesis-injector'; import type { InjectConfig } from '../hypothesis-injector';
import { HTMLIntegration } from './html';
import { preserveScrollPosition } from './html-side-by-side';
import { ImageTextLayer } from './image-text-layer';
// When activating side-by-side mode for VitalSource PDF documents, make sure // When activating side-by-side mode for VitalSource PDF documents, make sure
// at least this much space (in pixels) is left for the PDF document. Any // at least this much space (in pixels) is left for the PDF document. Any
......
import { createShadowRoot } from './util/shadow-root';
import { render } from 'preact'; import { render } from 'preact';
import NotebookModal from './components/NotebookModal'; import NotebookModal from './components/NotebookModal';
import { createShadowRoot } from './util/shadow-root';
/** /**
* @typedef {import('../types/annotator').Destroyable} Destroyable * @typedef {import('../types/annotator').Destroyable} Destroyable
......
...@@ -4,7 +4,6 @@ import { addConfigFragment } from '../shared/config-fragment'; ...@@ -4,7 +4,6 @@ import { addConfigFragment } from '../shared/config-fragment';
import { sendErrorsTo } from '../shared/frame-error-capture'; import { sendErrorsTo } from '../shared/frame-error-capture';
import { ListenerCollection } from '../shared/listener-collection'; import { ListenerCollection } from '../shared/listener-collection';
import { PortRPC } from '../shared/messaging'; import { PortRPC } from '../shared/messaging';
import { annotationCounts } from './annotation-counts'; import { annotationCounts } from './annotation-counts';
import { BucketBar } from './bucket-bar'; import { BucketBar } from './bucket-bar';
import { createAppConfig } from './config/app'; import { createAppConfig } from './config/app';
......
import { act } from 'preact/test-utils';
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import { act } from 'preact/test-utils';
import { Adder, ArrowDirection, $imports } from '../adder'; import { Adder, ArrowDirection, $imports } from '../adder';
......
import { waitFor } from '../../test-util/wait'; import { waitFor } from '../../test-util/wait';
import { HighlightClusterController, $imports } from '../highlight-clusters';
import { FeatureFlags } from '../features'; import { FeatureFlags } from '../features';
import { HighlightClusterController, $imports } from '../highlight-clusters';
describe('HighlightClusterController', () => { describe('HighlightClusterController', () => {
let fakeFeatures; let fakeFeatures;
......
// Tests that the expected parts of the page are highlighted when annotations // Tests that the expected parts of the page are highlighted when annotations
// with various combinations of selector are anchored. // with various combinations of selector are anchored.
import { Guest, $imports as guestImports } from '../../guest'; import { Guest, $imports as guestImports } from '../../guest';
import testPageHTML from './test-page.html'; import testPageHTML from './test-page.html';
......
...@@ -4,15 +4,12 @@ ...@@ -4,15 +4,12 @@
// The same boot script is used for both entry points so that the browser // The same boot script is used for both entry points so that the browser
// already has it cached when it encounters the reference in the sidebar // already has it cached when it encounters the reference in the sidebar
// application. // application.
import { parseJsonConfig } from './parse-json-config';
import { bootHypothesisClient, bootSidebarApp } from './boot';
import { processUrlTemplate } from './url-template';
import { isBrowserSupported } from './browser-check';
// @ts-ignore - This file is generated before the boot bundle is built. // @ts-ignore - This file is generated before the boot bundle is built.
import manifest from '../../build/manifest.json'; import manifest from '../../build/manifest.json';
import { bootHypothesisClient, bootSidebarApp } from './boot';
import { isBrowserSupported } from './browser-check';
import { parseJsonConfig } from './parse-json-config';
import { processUrlTemplate } from './url-template';
/** /**
* @typedef {import('./boot').AnnotatorConfig} AnnotatorConfig * @typedef {import('./boot').AnnotatorConfig} AnnotatorConfig
......
import { Button, Modal } from '@hypothesis/frontend-shared/lib/next';
import { render } from 'preact'; import { render } from 'preact';
import type { ComponentChildren } from 'preact'; import type { ComponentChildren } from 'preact';
import { Button, Modal } from '@hypothesis/frontend-shared/lib/next';
export type ConfirmModalProps = { export type ConfirmModalProps = {
title?: string; title?: string;
message: ComponentChildren; message: ComponentChildren;
......
...@@ -2,8 +2,8 @@ import { options as preactOptions, render } from 'preact'; ...@@ -2,8 +2,8 @@ import { options as preactOptions, render } from 'preact';
import { useRef } from 'preact/hooks'; import { useRef } from 'preact/hooks';
import { act } from 'preact/test-utils'; import { act } from 'preact/test-utils';
import { useArrowKeyNavigation } from '../keyboard-navigation';
import { waitFor } from '../../test-util/wait'; import { waitFor } from '../../test-util/wait';
import { useArrowKeyNavigation } from '../keyboard-navigation';
function Toolbar({ navigationOptions = {} }) { function Toolbar({ navigationOptions = {} }) {
const containerRef = useRef(); const containerRef = useRef();
......
...@@ -3,7 +3,6 @@ import classnames from 'classnames'; ...@@ -3,7 +3,6 @@ import classnames from 'classnames';
import { useMemo } from 'preact/hooks'; import { useMemo } from 'preact/hooks';
import type { Annotation as IAnnotation } from '../../../types/api'; import type { Annotation as IAnnotation } from '../../../types/api';
import { useSidebarStore } from '../../store';
import { import {
annotationRole, annotationRole,
isOrphan, isOrphan,
...@@ -11,9 +10,9 @@ import { ...@@ -11,9 +10,9 @@ import {
quote, quote,
} from '../../helpers/annotation-metadata'; } from '../../helpers/annotation-metadata';
import { annotationDisplayName } from '../../helpers/annotation-user'; import { annotationDisplayName } from '../../helpers/annotation-user';
import type { AnnotationsService } from '../../services/annotations';
import { withServices } from '../../service-context'; import { withServices } from '../../service-context';
import type { AnnotationsService } from '../../services/annotations';
import { useSidebarStore } from '../../store';
import AnnotationActionBar from './AnnotationActionBar'; import AnnotationActionBar from './AnnotationActionBar';
import AnnotationBody from './AnnotationBody'; import AnnotationBody from './AnnotationBody';
import AnnotationEditor from './AnnotationEditor'; import AnnotationEditor from './AnnotationEditor';
......
...@@ -10,7 +10,6 @@ import { ...@@ -10,7 +10,6 @@ import {
import { confirm } from '../../../shared/prompts'; import { confirm } from '../../../shared/prompts';
import type { SavedAnnotation } from '../../../types/api'; import type { SavedAnnotation } from '../../../types/api';
import type { SidebarSettings } from '../../../types/config'; import type { SidebarSettings } from '../../../types/config';
import { serviceConfig } from '../../config/service-config'; import { serviceConfig } from '../../config/service-config';
import { annotationRole } from '../../helpers/annotation-metadata'; import { annotationRole } from '../../helpers/annotation-metadata';
import { import {
...@@ -22,7 +21,6 @@ import { withServices } from '../../service-context'; ...@@ -22,7 +21,6 @@ import { withServices } from '../../service-context';
import type { AnnotationsService } from '../../services/annotations'; import type { AnnotationsService } from '../../services/annotations';
import type { ToastMessengerService } from '../../services/toast-messenger'; import type { ToastMessengerService } from '../../services/toast-messenger';
import { useSidebarStore } from '../../store'; import { useSidebarStore } from '../../store';
import AnnotationShareControl from './AnnotationShareControl'; import AnnotationShareControl from './AnnotationShareControl';
function flaggingEnabled(settings: SidebarSettings) { function flaggingEnabled(settings: SidebarSettings) {
......
...@@ -8,13 +8,11 @@ import { useMemo, useState } from 'preact/hooks'; ...@@ -8,13 +8,11 @@ import { useMemo, useState } from 'preact/hooks';
import type { Annotation } from '../../../types/api'; import type { Annotation } from '../../../types/api';
import type { SidebarSettings } from '../../../types/config'; import type { SidebarSettings } from '../../../types/config';
import { useSidebarStore } from '../../store';
import { isThirdPartyUser } from '../../helpers/account-id'; import { isThirdPartyUser } from '../../helpers/account-id';
import { isHidden } from '../../helpers/annotation-metadata'; import { isHidden } from '../../helpers/annotation-metadata';
import { withServices } from '../../service-context';
import { applyTheme } from '../../helpers/theme'; import { applyTheme } from '../../helpers/theme';
import { withServices } from '../../service-context';
import { useSidebarStore } from '../../store';
import Excerpt from '../Excerpt'; import Excerpt from '../Excerpt';
import MarkdownView from '../MarkdownView'; import MarkdownView from '../MarkdownView';
import TagList from '../TagList'; import TagList from '../TagList';
......
...@@ -2,22 +2,20 @@ import { useCallback, useState } from 'preact/hooks'; ...@@ -2,22 +2,20 @@ import { useCallback, useState } from 'preact/hooks';
import type { Annotation } from '../../../types/api'; import type { Annotation } from '../../../types/api';
import type { SidebarSettings } from '../../../types/config'; import type { SidebarSettings } from '../../../types/config';
import { withServices } from '../../service-context';
import { import {
annotationRole, annotationRole,
isReply, isReply,
isSaved, isSaved,
} from '../../helpers/annotation-metadata'; } from '../../helpers/annotation-metadata';
import { applyTheme } from '../../helpers/theme'; import { applyTheme } from '../../helpers/theme';
import { withServices } from '../../service-context';
import type { AnnotationsService } from '../../services/annotations'; import type { AnnotationsService } from '../../services/annotations';
import type { TagsService } from '../../services/tags'; import type { TagsService } from '../../services/tags';
import type { ToastMessengerService } from '../../services/toast-messenger'; import type { ToastMessengerService } from '../../services/toast-messenger';
import { useSidebarStore } from '../../store'; import { useSidebarStore } from '../../store';
import type { Draft } from '../../store/modules/drafts'; import type { Draft } from '../../store/modules/drafts';
import MarkdownEditor from '../MarkdownEditor'; import MarkdownEditor from '../MarkdownEditor';
import TagEditor from '../TagEditor'; import TagEditor from '../TagEditor';
import AnnotationLicense from './AnnotationLicense'; import AnnotationLicense from './AnnotationLicense';
import AnnotationPublishControl from './AnnotationPublishControl'; import AnnotationPublishControl from './AnnotationPublishControl';
......
...@@ -7,9 +7,6 @@ import { useMemo } from 'preact/hooks'; ...@@ -7,9 +7,6 @@ import { useMemo } from 'preact/hooks';
import type { Annotation } from '../../../types/api'; import type { Annotation } from '../../../types/api';
import type { SidebarSettings } from '../../../types/config'; import type { SidebarSettings } from '../../../types/config';
import { withServices } from '../../service-context';
import { useSidebarStore } from '../../store';
import { import {
domainAndTitle, domainAndTitle,
isHighlight, isHighlight,
...@@ -21,7 +18,8 @@ import { ...@@ -21,7 +18,8 @@ import {
annotationDisplayName, annotationDisplayName,
} from '../../helpers/annotation-user'; } from '../../helpers/annotation-user';
import { isPrivate } from '../../helpers/permissions'; import { isPrivate } from '../../helpers/permissions';
import { withServices } from '../../service-context';
import { useSidebarStore } from '../../store';
import AnnotationDocumentInfo from './AnnotationDocumentInfo'; import AnnotationDocumentInfo from './AnnotationDocumentInfo';
import AnnotationShareInfo from './AnnotationShareInfo'; import AnnotationShareInfo from './AnnotationShareInfo';
import AnnotationTimestamps from './AnnotationTimestamps'; import AnnotationTimestamps from './AnnotationTimestamps';
......
...@@ -10,10 +10,8 @@ import classnames from 'classnames'; ...@@ -10,10 +10,8 @@ import classnames from 'classnames';
import type { Group } from '../../../types/api'; import type { Group } from '../../../types/api';
import type { SidebarSettings } from '../../../types/config'; import type { SidebarSettings } from '../../../types/config';
import { withServices } from '../../service-context';
import { applyTheme } from '../../helpers/theme'; import { applyTheme } from '../../helpers/theme';
import { withServices } from '../../service-context';
import Menu from '../Menu'; import Menu from '../Menu';
import MenuItem from '../MenuItem'; import MenuItem from '../MenuItem';
......
import classnames from 'classnames'; import classnames from 'classnames';
import type { SidebarSettings } from '../../../types/config'; import type { SidebarSettings } from '../../../types/config';
import { withServices } from '../../service-context';
import { applyTheme } from '../../helpers/theme'; import { applyTheme } from '../../helpers/theme';
import { withServices } from '../../service-context';
import Excerpt from '../Excerpt'; import Excerpt from '../Excerpt';
import StyledText from '../StyledText'; import StyledText from '../StyledText';
......
...@@ -12,14 +12,12 @@ import { useEffect, useRef, useState } from 'preact/hooks'; ...@@ -12,14 +12,12 @@ import { useEffect, useRef, useState } from 'preact/hooks';
import { isIOS } from '../../../shared/user-agent'; import { isIOS } from '../../../shared/user-agent';
import type { Annotation } from '../../../types/api'; import type { Annotation } from '../../../types/api';
import { isShareableURI } from '../../helpers/annotation-sharing'; import { isShareableURI } from '../../helpers/annotation-sharing';
import { isPrivate } from '../../helpers/permissions'; import { isPrivate } from '../../helpers/permissions';
import { withServices } from '../../service-context'; import { withServices } from '../../service-context';
import type { ToastMessengerService } from '../../services/toast-messenger'; import type { ToastMessengerService } from '../../services/toast-messenger';
import { useSidebarStore } from '../../store'; import { useSidebarStore } from '../../store';
import { copyText } from '../../util/copy-to-clipboard'; import { copyText } from '../../util/copy-to-clipboard';
import MenuArrow from '../MenuArrow'; import MenuArrow from '../MenuArrow';
import ShareLinks from '../ShareLinks'; import ShareLinks from '../ShareLinks';
......
import AnnotationReplyToggle from './AnnotationReplyToggle';
import type { AnnotationProps } from './Annotation'; import type { AnnotationProps } from './Annotation';
import AnnotationReplyToggle from './AnnotationReplyToggle';
type EmptyAnnotationProps = Omit< type EmptyAnnotationProps = Omit<
AnnotationProps, AnnotationProps,
......
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import * as fixtures from '../../../test/annotation-fixtures';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components'; import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import * as fixtures from '../../../test/annotation-fixtures';
import Annotation, { $imports } from '../Annotation'; import Annotation, { $imports } from '../Annotation';
describe('Annotation', () => { describe('Annotation', () => {
......
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import { act } from 'preact/test-utils'; import { act } from 'preact/test-utils';
import AnnotationActionBar, { $imports } from '../AnnotationActionBar';
import * as fixtures from '../../../test/annotation-fixtures';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components'; import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import { waitFor } from '../../../../test-util/wait'; import { waitFor } from '../../../../test-util/wait';
import * as fixtures from '../../../test/annotation-fixtures';
import AnnotationActionBar, { $imports } from '../AnnotationActionBar';
describe('AnnotationActionBar', () => { describe('AnnotationActionBar', () => {
let fakeAnnotation; let fakeAnnotation;
......
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import { act } from 'preact/test-utils'; import { act } from 'preact/test-utils';
import * as fixtures from '../../../test/annotation-fixtures';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components'; import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import * as fixtures from '../../../test/annotation-fixtures';
import AnnotationBody, { $imports } from '../AnnotationBody'; import AnnotationBody, { $imports } from '../AnnotationBody';
describe('AnnotationBody', () => { describe('AnnotationBody', () => {
......
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
import AnnotationDocumentInfo from '../AnnotationDocumentInfo'; import AnnotationDocumentInfo from '../AnnotationDocumentInfo';
describe('AnnotationDocumentInfo', () => { describe('AnnotationDocumentInfo', () => {
......
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import { act } from 'preact/test-utils'; import { act } from 'preact/test-utils';
import * as fixtures from '../../../test/annotation-fixtures';
import { waitFor } from '../../../../test-util/wait';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components'; import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import { waitFor } from '../../../../test-util/wait';
import * as fixtures from '../../../test/annotation-fixtures';
import AnnotationEditor, { $imports } from '../AnnotationEditor'; import AnnotationEditor, { $imports } from '../AnnotationEditor';
describe('AnnotationEditor', () => { describe('AnnotationEditor', () => {
......
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import * as fixtures from '../../../test/annotation-fixtures';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components'; import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import * as fixtures from '../../../test/annotation-fixtures';
import AnnotationHeader, { $imports } from '../AnnotationHeader'; import AnnotationHeader, { $imports } from '../AnnotationHeader';
describe('AnnotationHeader', () => { describe('AnnotationHeader', () => {
......
...@@ -7,7 +7,6 @@ import { mount } from 'enzyme'; ...@@ -7,7 +7,6 @@ import { mount } from 'enzyme';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components'; import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import AnnotationPublishControl, { import AnnotationPublishControl, {
$imports, $imports,
} from '../AnnotationPublishControl'; } from '../AnnotationPublishControl';
......
...@@ -2,7 +2,6 @@ import { mount } from 'enzyme'; ...@@ -2,7 +2,6 @@ import { mount } from 'enzyme';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components'; import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import AnnotationQuote, { $imports } from '../AnnotationQuote'; import AnnotationQuote, { $imports } from '../AnnotationQuote';
describe('AnnotationQuote', () => { describe('AnnotationQuote', () => {
......
...@@ -2,7 +2,6 @@ import { mount } from 'enzyme'; ...@@ -2,7 +2,6 @@ import { mount } from 'enzyme';
import { act } from 'preact/test-utils'; import { act } from 'preact/test-utils';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
import AnnotationReplyToggle from '../AnnotationReplyToggle'; import AnnotationReplyToggle from '../AnnotationReplyToggle';
describe('AnnotationReplyToggle', () => { describe('AnnotationReplyToggle', () => {
......
...@@ -3,7 +3,6 @@ import { act } from 'preact/test-utils'; ...@@ -3,7 +3,6 @@ import { act } from 'preact/test-utils';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components'; import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import AnnotationShareControl, { $imports } from '../AnnotationShareControl'; import AnnotationShareControl, { $imports } from '../AnnotationShareControl';
describe('AnnotationShareControl', () => { describe('AnnotationShareControl', () => {
......
...@@ -2,7 +2,6 @@ import { mount } from 'enzyme'; ...@@ -2,7 +2,6 @@ import { mount } from 'enzyme';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components'; import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import AnnotationShareInfo, { $imports } from '../AnnotationShareInfo'; import AnnotationShareInfo, { $imports } from '../AnnotationShareInfo';
describe('AnnotationShareInfo', () => { describe('AnnotationShareInfo', () => {
......
...@@ -2,7 +2,6 @@ import { mount } from 'enzyme'; ...@@ -2,7 +2,6 @@ import { mount } from 'enzyme';
import { act } from 'preact/test-utils'; import { act } from 'preact/test-utils';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
import AnnotationTimestamps, { $imports } from '../AnnotationTimestamps'; import AnnotationTimestamps, { $imports } from '../AnnotationTimestamps';
describe('AnnotationTimestamps', () => { describe('AnnotationTimestamps', () => {
......
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
import AnnotationUser from '../AnnotationUser'; import AnnotationUser from '../AnnotationUser';
describe('AnnotationUser', () => { describe('AnnotationUser', () => {
......
...@@ -2,7 +2,6 @@ import { mount } from 'enzyme'; ...@@ -2,7 +2,6 @@ import { mount } from 'enzyme';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components'; import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import EmptyAnnotation, { $imports } from '../EmptyAnnotation'; import EmptyAnnotation, { $imports } from '../EmptyAnnotation';
describe('EmptyAnnotation', () => { describe('EmptyAnnotation', () => {
......
import { useEffect, useState } from 'preact/hooks'; import { useEffect, useState } from 'preact/hooks';
import { useSidebarStore } from '../store';
import { withServices } from '../service-context'; import { withServices } from '../service-context';
import type { LoadAnnotationsService } from '../services/load-annotations'; import type { LoadAnnotationsService } from '../services/load-annotations';
import { useSidebarStore } from '../store';
import { useRootThread } from './hooks/use-root-thread'; import { useRootThread } from './hooks/use-root-thread';
import ThreadList from './ThreadList';
import SidebarContentError from './SidebarContentError'; import SidebarContentError from './SidebarContentError';
import ThreadList from './ThreadList';
type AnnotationViewProps = { type AnnotationViewProps = {
onLogin: () => void; onLogin: () => void;
......
...@@ -3,9 +3,9 @@ import classnames from 'classnames'; ...@@ -3,9 +3,9 @@ import classnames from 'classnames';
import type { ComponentChildren } from 'preact'; import type { ComponentChildren } from 'preact';
import { useCallback, useLayoutEffect, useRef, useState } from 'preact/hooks'; import { useCallback, useLayoutEffect, useRef, useState } from 'preact/hooks';
import { observeElementSize } from '../util/observe-element-size';
import { withServices } from '../service-context';
import { applyTheme } from '../helpers/theme'; import { applyTheme } from '../helpers/theme';
import { withServices } from '../service-context';
import { observeElementSize } from '../util/observe-element-size';
type InlineControlsProps = { type InlineControlsProps = {
isCollapsed: boolean; isCollapsed: boolean;
......
import classnames from 'classnames';
import type { IconComponent } from '@hypothesis/frontend-shared/lib/types'; import type { IconComponent } from '@hypothesis/frontend-shared/lib/types';
import classnames from 'classnames';
import type { FilterOption } from '../store/modules/filters'; import type { FilterOption } from '../store/modules/filters';
import Menu from './Menu'; import Menu from './Menu';
import MenuItem from './MenuItem'; import MenuItem from './MenuItem';
......
...@@ -10,7 +10,6 @@ import { useMemo } from 'preact/hooks'; ...@@ -10,7 +10,6 @@ import { useMemo } from 'preact/hooks';
import { countVisible } from '../helpers/thread'; import { countVisible } from '../helpers/thread';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import { useRootThread } from './hooks/use-root-thread'; import { useRootThread } from './hooks/use-root-thread';
type FilterStatusMessageProps = { type FilterStatusMessageProps = {
......
import classnames from 'classnames';
import { PlusIcon } from '@hypothesis/frontend-shared/lib/next'; import { PlusIcon } from '@hypothesis/frontend-shared/lib/next';
import classnames from 'classnames';
import { useMemo, useState } from 'preact/hooks'; import { useMemo, useState } from 'preact/hooks';
import { serviceConfig } from '../../config/service-config'; import { serviceConfig } from '../../config/service-config';
...@@ -9,10 +9,8 @@ import { groupsByOrganization } from '../../helpers/group-organizations'; ...@@ -9,10 +9,8 @@ import { groupsByOrganization } from '../../helpers/group-organizations';
import { isThirdPartyService } from '../../helpers/is-third-party-service'; import { isThirdPartyService } from '../../helpers/is-third-party-service';
import { withServices } from '../../service-context'; import { withServices } from '../../service-context';
import { useSidebarStore } from '../../store'; import { useSidebarStore } from '../../store';
import Menu from '../Menu'; import Menu from '../Menu';
import MenuItem from '../MenuItem'; import MenuItem from '../MenuItem';
import GroupListSection from './GroupListSection'; import GroupListSection from './GroupListSection';
/** /**
......
import classnames from 'classnames';
import { import {
CopyIcon, CopyIcon,
ExternalIcon, ExternalIcon,
LeaveIcon, LeaveIcon,
} from '@hypothesis/frontend-shared/lib/next'; } from '@hypothesis/frontend-shared/lib/next';
import classnames from 'classnames';
import { confirm } from '../../../shared/prompts';
import { orgName } from '../../helpers/group-list-item-common'; import { orgName } from '../../helpers/group-list-item-common';
import { withServices } from '../../service-context'; import { withServices } from '../../service-context';
import { useSidebarStore } from '../../store'; import { useSidebarStore } from '../../store';
import { copyText } from '../../util/copy-to-clipboard'; import { copyText } from '../../util/copy-to-clipboard';
import { confirm } from '../../../shared/prompts';
import MenuItem from '../MenuItem'; import MenuItem from '../MenuItem';
/** /**
......
import MenuSection from '../MenuSection'; import MenuSection from '../MenuSection';
import GroupListItem from './GroupListItem'; import GroupListItem from './GroupListItem';
/** /**
......
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import { act } from 'preact/test-utils'; import { act } from 'preact/test-utils';
import GroupList, { $imports } from '../GroupList';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components'; import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import GroupList, { $imports } from '../GroupList';
describe('GroupList', () => { describe('GroupList', () => {
let fakeServiceConfig; let fakeServiceConfig;
......
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import GroupListSection, { $imports } from '../GroupListSection';
import { mockImportedComponents } from '../../../../test-util/mock-imported-components'; import { mockImportedComponents } from '../../../../test-util/mock-imported-components';
import GroupListSection, { $imports } from '../GroupListSection';
describe('GroupListSection', () => { describe('GroupListSection', () => {
const testGroups = [ const testGroups = [
......
...@@ -7,11 +7,10 @@ import type { ComponentChildren as Children } from 'preact'; ...@@ -7,11 +7,10 @@ import type { ComponentChildren as Children } from 'preact';
import { useCallback, useMemo, useState } from 'preact/hooks'; import { useCallback, useMemo, useState } from 'preact/hooks';
import { username } from '../helpers/account-id'; import { username } from '../helpers/account-id';
import { useSidebarStore } from '../store';
import type { SessionService } from '../services/session';
import { withServices } from '../service-context';
import { VersionData } from '../helpers/version-data'; import { VersionData } from '../helpers/version-data';
import { withServices } from '../service-context';
import type { SessionService } from '../services/session';
import { useSidebarStore } from '../store';
import SidebarPanel from './SidebarPanel'; import SidebarPanel from './SidebarPanel';
import Tutorial from './Tutorial'; import Tutorial from './Tutorial';
import VersionInfo from './VersionInfo'; import VersionInfo from './VersionInfo';
......
...@@ -7,14 +7,12 @@ import { shouldAutoDisplayTutorial } from '../helpers/session'; ...@@ -7,14 +7,12 @@ import { shouldAutoDisplayTutorial } from '../helpers/session';
import { applyTheme } from '../helpers/theme'; import { applyTheme } from '../helpers/theme';
import { withServices } from '../service-context'; import { withServices } from '../service-context';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import AnnotationView from './AnnotationView'; import AnnotationView from './AnnotationView';
import SidebarView from './SidebarView';
import StreamView from './StreamView';
import HelpPanel from './HelpPanel'; import HelpPanel from './HelpPanel';
import NotebookView from './NotebookView'; import NotebookView from './NotebookView';
import ShareAnnotationsPanel from './ShareAnnotationsPanel'; import ShareAnnotationsPanel from './ShareAnnotationsPanel';
import SidebarView from './SidebarView';
import StreamView from './StreamView';
import ToastMessages from './ToastMessages'; import ToastMessages from './ToastMessages';
import TopBar from './TopBar'; import TopBar from './TopBar';
......
...@@ -5,7 +5,6 @@ import { ...@@ -5,7 +5,6 @@ import {
} from '@hypothesis/frontend-shared/lib/next'; } from '@hypothesis/frontend-shared/lib/next';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import SidebarPanel from './SidebarPanel'; import SidebarPanel from './SidebarPanel';
export type LoginPromptPanelProps = { export type LoginPromptPanelProps = {
......
...@@ -15,11 +15,12 @@ import { ...@@ -15,11 +15,12 @@ import {
ListUnorderedIcon, ListUnorderedIcon,
} from '@hypothesis/frontend-shared/lib/next'; } from '@hypothesis/frontend-shared/lib/next';
import type { IconComponent } from '@hypothesis/frontend-shared/lib/types'; import type { IconComponent } from '@hypothesis/frontend-shared/lib/types';
import type { Ref, JSX } from 'preact';
import classnames from 'classnames'; import classnames from 'classnames';
import type { Ref, JSX } from 'preact';
import { useEffect, useMemo, useRef, useState } from 'preact/hooks'; import { useEffect, useMemo, useRef, useState } from 'preact/hooks';
import { useArrowKeyNavigation } from '../../shared/keyboard-navigation';
import { isMacOS } from '../../shared/user-agent';
import { import {
LinkType, LinkType,
convertSelectionToLink, convertSelectionToLink,
...@@ -27,9 +28,6 @@ import { ...@@ -27,9 +28,6 @@ import {
toggleSpanStyle, toggleSpanStyle,
} from '../markdown-commands'; } from '../markdown-commands';
import type { EditorState } from '../markdown-commands'; import type { EditorState } from '../markdown-commands';
import { isMacOS } from '../../shared/user-agent';
import { useArrowKeyNavigation } from '../../shared/keyboard-navigation';
import MarkdownView from './MarkdownView'; import MarkdownView from './MarkdownView';
/** /**
......
...@@ -2,7 +2,6 @@ import { useEffect, useMemo, useRef } from 'preact/hooks'; ...@@ -2,7 +2,6 @@ import { useEffect, useMemo, useRef } from 'preact/hooks';
import { replaceLinksWithEmbeds } from '../media-embedder'; import { replaceLinksWithEmbeds } from '../media-embedder';
import { renderMathAndMarkdown } from '../render-markdown'; import { renderMathAndMarkdown } from '../render-markdown';
import StyledText from './StyledText'; import StyledText from './StyledText';
/** /**
......
import classnames from 'classnames';
import { useElementShouldClose } from '@hypothesis/frontend-shared'; import { useElementShouldClose } from '@hypothesis/frontend-shared';
import { MenuExpandIcon } from '@hypothesis/frontend-shared/lib/next'; import { MenuExpandIcon } from '@hypothesis/frontend-shared/lib/next';
import classnames from 'classnames';
import type { ComponentChildren } from 'preact'; import type { ComponentChildren } from 'preact';
import { useCallback, useEffect, useRef, useState } from 'preact/hooks'; import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
......
import classnames from 'classnames';
import type { IconComponent } from '@hypothesis/frontend-shared/lib/types';
import { import {
CaretUpIcon, CaretUpIcon,
MenuExpandIcon, MenuExpandIcon,
} from '@hypothesis/frontend-shared/lib/next'; } from '@hypothesis/frontend-shared/lib/next';
import type { IconComponent } from '@hypothesis/frontend-shared/lib/types';
import classnames from 'classnames';
import type { ComponentChildren, Ref } from 'preact'; import type { ComponentChildren, Ref } from 'preact';
import { useEffect, useRef } from 'preact/hooks'; import { useEffect, useRef } from 'preact/hooks';
......
...@@ -6,12 +6,11 @@ import { ...@@ -6,12 +6,11 @@ import {
import classnames from 'classnames'; import classnames from 'classnames';
import type { Annotation } from '../../types/api'; import type { Annotation } from '../../types/api';
import * as annotationMetadata from '../helpers/annotation-metadata';
import { withServices } from '../service-context';
import type { APIService } from '../services/api'; import type { APIService } from '../services/api';
import type { ToastMessengerService } from '../services/toast-messenger'; import type { ToastMessengerService } from '../services/toast-messenger';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import * as annotationMetadata from '../helpers/annotation-metadata';
import { withServices } from '../service-context';
export type ModerationBannerProps = { export type ModerationBannerProps = {
annotation: Annotation; annotation: Annotation;
......
import { ProfileIcon } from '@hypothesis/frontend-shared/lib/next'; import { ProfileIcon } from '@hypothesis/frontend-shared/lib/next';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import { useUserFilterOptions } from './hooks/use-filter-options';
import FilterSelect from './FilterSelect'; import FilterSelect from './FilterSelect';
import { useUserFilterOptions } from './hooks/use-filter-options';
/** /**
* Filters for the Notebook * Filters for the Notebook
......
import { Spinner } from '@hypothesis/frontend-shared/lib/next'; import { Spinner } from '@hypothesis/frontend-shared/lib/next';
import { useRootThread } from './hooks/use-root-thread';
import { countVisible } from '../helpers/thread'; import { countVisible } from '../helpers/thread';
import { useRootThread } from './hooks/use-root-thread';
export type NotebookResultCountProps = { export type NotebookResultCountProps = {
/** /**
......
...@@ -12,11 +12,10 @@ import { withServices } from '../service-context'; ...@@ -12,11 +12,10 @@ import { withServices } from '../service-context';
import type { LoadAnnotationsService } from '../services/load-annotations'; import type { LoadAnnotationsService } from '../services/load-annotations';
import type { StreamerService } from '../services/streamer'; import type { StreamerService } from '../services/streamer';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import { useRootThread } from './hooks/use-root-thread';
import NotebookFilters from './NotebookFilters'; import NotebookFilters from './NotebookFilters';
import NotebookResultCount from './NotebookResultCount'; import NotebookResultCount from './NotebookResultCount';
import PaginatedThreadList from './PaginatedThreadList'; import PaginatedThreadList from './PaginatedThreadList';
import { useRootThread } from './hooks/use-root-thread';
export type NotebookViewProps = { export type NotebookViewProps = {
// injected // injected
......
import { useMemo } from 'preact/hooks'; import { useMemo } from 'preact/hooks';
import { countVisible } from '../helpers/thread'; import { countVisible } from '../helpers/thread';
import PaginationNavigation from './PaginationNavigation'; import PaginationNavigation from './PaginationNavigation';
import ThreadList from './ThreadList'; import ThreadList from './ThreadList';
......
import type { ButtonCommonProps } from '@hypothesis/frontend-shared/lib/components/input/ButtonBase';
import { import {
ButtonBase, ButtonBase,
ArrowLeftIcon, ArrowLeftIcon,
ArrowRightIcon, ArrowRightIcon,
} from '@hypothesis/frontend-shared/lib/next'; } from '@hypothesis/frontend-shared/lib/next';
import type { PresentationalProps } from '@hypothesis/frontend-shared/lib/types'; import type { PresentationalProps } from '@hypothesis/frontend-shared/lib/types';
import type { ButtonCommonProps } from '@hypothesis/frontend-shared/lib/components/input/ButtonBase';
import classnames from 'classnames'; import classnames from 'classnames';
import type { JSX } from 'preact'; import type { JSX } from 'preact';
......
...@@ -11,10 +11,9 @@ import type { ComponentChildren } from 'preact'; ...@@ -11,10 +11,9 @@ import type { ComponentChildren } from 'preact';
import type { SidebarSettings } from '../../types/config'; import type { SidebarSettings } from '../../types/config';
import type { TabName } from '../../types/sidebar'; import type { TabName } from '../../types/sidebar';
import { applyTheme } from '../helpers/theme'; import { applyTheme } from '../helpers/theme';
import type { AnnotationsService } from '../services/annotations';
import { withServices } from '../service-context'; import { withServices } from '../service-context';
import type { AnnotationsService } from '../services/annotations';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
type TabProps = { type TabProps = {
......
...@@ -7,13 +7,12 @@ import { ...@@ -7,13 +7,12 @@ import {
Spinner, Spinner,
} from '@hypothesis/frontend-shared/lib/next'; } from '@hypothesis/frontend-shared/lib/next';
import { useSidebarStore } from '../store';
import { pageSharingLink } from '../helpers/annotation-sharing'; import { pageSharingLink } from '../helpers/annotation-sharing';
import { copyText } from '../util/copy-to-clipboard';
import { withServices } from '../service-context'; import { withServices } from '../service-context';
import type { ToastMessengerService } from '../services/toast-messenger'; import type { ToastMessengerService } from '../services/toast-messenger';
import { useSidebarStore } from '../store';
import { copyText } from '../util/copy-to-clipboard';
import { notNull } from '../util/typing'; import { notNull } from '../util/typing';
import ShareLinks from './ShareLinks'; import ShareLinks from './ShareLinks';
import SidebarPanel from './SidebarPanel'; import SidebarPanel from './SidebarPanel';
......
...@@ -6,7 +6,6 @@ import scrollIntoView from 'scroll-into-view'; ...@@ -6,7 +6,6 @@ import scrollIntoView from 'scroll-into-view';
import type { PanelName } from '../../types/sidebar'; import type { PanelName } from '../../types/sidebar';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import Slider from './Slider'; import Slider from './Slider';
export type SidebarPanelProps = { export type SidebarPanelProps = {
......
...@@ -6,10 +6,8 @@ import type { FrameSyncService } from '../services/frame-sync'; ...@@ -6,10 +6,8 @@ import type { FrameSyncService } from '../services/frame-sync';
import type { LoadAnnotationsService } from '../services/load-annotations'; import type { LoadAnnotationsService } from '../services/load-annotations';
import type { StreamerService } from '../services/streamer'; import type { StreamerService } from '../services/streamer';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import { useRootThread } from './hooks/use-root-thread';
import FilterStatus from './FilterStatus'; import FilterStatus from './FilterStatus';
import { useRootThread } from './hooks/use-root-thread';
import LoggedOutMessage from './LoggedOutMessage'; import LoggedOutMessage from './LoggedOutMessage';
import LoginPromptPanel from './LoginPromptPanel'; import LoginPromptPanel from './LoginPromptPanel';
import SelectionTabs from './SelectionTabs'; import SelectionTabs from './SelectionTabs';
......
import { SortIcon } from '@hypothesis/frontend-shared/lib/next'; import { SortIcon } from '@hypothesis/frontend-shared/lib/next';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import Menu from './Menu'; import Menu from './Menu';
import MenuItem from './MenuItem'; import MenuItem from './MenuItem';
......
import { useSidebarStore } from '../store';
import { withServices } from '../service-context'; import { withServices } from '../service-context';
import { useSidebarStore } from '../store';
import SearchInput from './SearchInput'; import SearchInput from './SearchInput';
/** /**
......
import { useCallback, useEffect } from 'preact/hooks'; import { useCallback, useEffect } from 'preact/hooks';
import * as searchFilter from '../util/search-filter';
import { withServices } from '../service-context'; import { withServices } from '../service-context';
import type { APIService } from '../services/api'; import type { APIService } from '../services/api';
import type { ToastMessengerService } from '../services/toast-messenger'; import type { ToastMessengerService } from '../services/toast-messenger';
import { useRootThread } from './hooks/use-root-thread';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import * as searchFilter from '../util/search-filter';
import { useRootThread } from './hooks/use-root-thread';
import ThreadList from './ThreadList'; import ThreadList from './ThreadList';
export type StreamViewProps = { export type StreamViewProps = {
......
...@@ -4,7 +4,6 @@ import { useRef, useState } from 'preact/hooks'; ...@@ -4,7 +4,6 @@ import { useRef, useState } from 'preact/hooks';
import { withServices } from '../service-context'; import { withServices } from '../service-context';
import type { TagsService } from '../services/tags'; import type { TagsService } from '../services/tags';
import AutocompleteList from './AutocompleteList'; import AutocompleteList from './AutocompleteList';
import TagList from './TagList'; import TagList from './TagList';
import TagListItem from './TagListItem'; import TagListItem from './TagListItem';
......
...@@ -7,12 +7,11 @@ import { ...@@ -7,12 +7,11 @@ import {
import classnames from 'classnames'; import classnames from 'classnames';
import { useCallback, useMemo } from 'preact/hooks'; import { useCallback, useMemo } from 'preact/hooks';
import { useSidebarStore } from '../store';
import { withServices } from '../service-context';
import { countHidden, countVisible } from '../helpers/thread';
import type { Thread as IThread } from '../helpers/build-thread'; import type { Thread as IThread } from '../helpers/build-thread';
import { countHidden, countVisible } from '../helpers/thread';
import { withServices } from '../service-context';
import type { ThreadsService } from '../services/threads'; import type { ThreadsService } from '../services/threads';
import { useSidebarStore } from '../store';
import Annotation from './Annotation'; import Annotation from './Annotation';
import AnnotationHeader from './Annotation/AnnotationHeader'; import AnnotationHeader from './Annotation/AnnotationHeader';
import EmptyAnnotation from './Annotation/EmptyAnnotation'; import EmptyAnnotation from './Annotation/EmptyAnnotation';
......
...@@ -3,12 +3,10 @@ import debounce from 'lodash.debounce'; ...@@ -3,12 +3,10 @@ import debounce from 'lodash.debounce';
import { useCallback, useEffect, useMemo, useRef } from 'preact/hooks'; import { useCallback, useEffect, useMemo, useRef } from 'preact/hooks';
import type { Annotation } from '../../types/api'; import type { Annotation } from '../../types/api';
import type { Thread as IThread } from '../helpers/build-thread'; import type { Thread as IThread } from '../helpers/build-thread';
import { withServices } from '../service-context';
import type { FrameSyncService } from '../services/frame-sync'; import type { FrameSyncService } from '../services/frame-sync';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import { withServices } from '../service-context';
import Thread from './Thread'; import Thread from './Thread';
/** /**
......
import { useEffect, useLayoutEffect, useMemo, useState } from 'preact/hooks';
import classnames from 'classnames'; import classnames from 'classnames';
import debounce from 'lodash.debounce'; import debounce from 'lodash.debounce';
import { useEffect, useLayoutEffect, useMemo, useState } from 'preact/hooks';
import { ListenerCollection } from '../../shared/listener-collection'; import { ListenerCollection } from '../../shared/listener-collection';
import type { Annotation, EPUBContentSelector } from '../../types/api'; import type { Annotation, EPUBContentSelector } from '../../types/api';
...@@ -11,7 +11,6 @@ import { ...@@ -11,7 +11,6 @@ import {
} from '../helpers/visible-threads'; } from '../helpers/visible-threads';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import { getElementHeightWithMargins } from '../util/dom'; import { getElementHeightWithMargins } from '../util/dom';
import ThreadCard from './ThreadCard'; import ThreadCard from './ThreadCard';
// The precision of the `scrollPosition` value in pixels; values will be rounded // The precision of the `scrollPosition` value in pixels; values will be rounded
......
import classnames from 'classnames';
import { import {
Card, Card,
Link, Link,
...@@ -6,11 +5,12 @@ import { ...@@ -6,11 +5,12 @@ import {
CautionIcon, CautionIcon,
CheckIcon, CheckIcon,
} from '@hypothesis/frontend-shared/lib/next'; } from '@hypothesis/frontend-shared/lib/next';
import classnames from 'classnames';
import { withServices } from '../service-context';
import type { ToastMessengerService } from '../services/toast-messenger'; import type { ToastMessengerService } from '../services/toast-messenger';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import type { ToastMessage } from '../store/modules/toast-messages'; import type { ToastMessage } from '../store/modules/toast-messages';
import { withServices } from '../service-context';
type ToastMessageItemProps = { type ToastMessageItemProps = {
message: ToastMessage; message: ToastMessage;
......
...@@ -8,7 +8,6 @@ import { ...@@ -8,7 +8,6 @@ import {
import classnames from 'classnames'; import classnames from 'classnames';
import type { SidebarSettings } from '../../types/config'; import type { SidebarSettings } from '../../types/config';
import { serviceConfig } from '../config/service-config'; import { serviceConfig } from '../config/service-config';
import { isThirdPartyService } from '../helpers/is-third-party-service'; import { isThirdPartyService } from '../helpers/is-third-party-service';
import { applyTheme } from '../helpers/theme'; import { applyTheme } from '../helpers/theme';
...@@ -16,7 +15,6 @@ import { withServices } from '../service-context'; ...@@ -16,7 +15,6 @@ import { withServices } from '../service-context';
import type { FrameSyncService } from '../services/frame-sync'; import type { FrameSyncService } from '../services/frame-sync';
import type { StreamerService } from '../services/streamer'; import type { StreamerService } from '../services/streamer';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import GroupList from './GroupList'; import GroupList from './GroupList';
import SearchInput from './SearchInput'; import SearchInput from './SearchInput';
import SortMenu from './SortMenu'; import SortMenu from './SortMenu';
......
...@@ -8,7 +8,6 @@ import type { IconComponent } from '@hypothesis/frontend-shared/lib/types'; ...@@ -8,7 +8,6 @@ import type { IconComponent } from '@hypothesis/frontend-shared/lib/types';
import classnames from 'classnames'; import classnames from 'classnames';
import type { SidebarSettings } from '../../types/config'; import type { SidebarSettings } from '../../types/config';
import { isThirdPartyService } from '../helpers/is-third-party-service'; import { isThirdPartyService } from '../helpers/is-third-party-service';
import { withServices } from '../service-context'; import { withServices } from '../service-context';
......
...@@ -10,7 +10,6 @@ import { ...@@ -10,7 +10,6 @@ import {
import { withServices } from '../service-context'; import { withServices } from '../service-context';
import type { FrameSyncService } from '../services/frame-sync'; import type { FrameSyncService } from '../services/frame-sync';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import Menu from './Menu'; import Menu from './Menu';
import MenuItem from './MenuItem'; import MenuItem from './MenuItem';
import MenuSection from './MenuSection'; import MenuSection from './MenuSection';
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment