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