Commit e1bc90f1 authored by Eduardo Sanz García's avatar Eduardo Sanz García Committed by Eduardo

Automatic type substitution of `Object` for `object`

I used these commands (Mac version):

```
% ag -0 -l '@.+Object' | xargs -0 sed -ri '' -e '/@/s/(.*{.*)Object(.*})/\1object\2/'
% ag -0 -l '@.+object\.' | xargs -0 sed -ri '' -e '/@/s/object\.</Record</'
% ag -0 -l '@.+object<' | xargs -0 sed -ri '' -e '/@/s/object</Record</'
```
parent 6108e4b4
...@@ -23,7 +23,7 @@ const TEMPLATE_PATH = `${__dirname}/templates/`; ...@@ -23,7 +23,7 @@ const TEMPLATE_PATH = `${__dirname}/templates/`;
/** /**
* Render client config and script embed * Render client config and script embed
* *
* @param {Object} context * @param {object} context
*/ */
function renderScript(context) { function renderScript(context) {
const scriptTemplate = ` const scriptTemplate = `
......
...@@ -239,8 +239,8 @@ let isFirstBuild = true; ...@@ -239,8 +239,8 @@ let isFirstBuild = true;
* Generates the `build/boot.js` script which serves as the entry point for * Generates the `build/boot.js` script which serves as the entry point for
* the Hypothesis client. * the Hypothesis client.
* *
* @param {Object} manifest - Manifest mapping asset paths to cache-busted URLs * @param {object} manifest - Manifest mapping asset paths to cache-busted URLs
* @param {Object} options - Options for generating the boot script * @param {object} options - Options for generating the boot script
*/ */
function generateBootScript(manifest, { usingDevServer = false } = {}) { function generateBootScript(manifest, { usingDevServer = false } = {}) {
const { version } = require('./package.json'); const { version } = require('./package.json');
......
...@@ -73,7 +73,7 @@ function jsdocComment(lines) { ...@@ -73,7 +73,7 @@ function jsdocComment(lines) {
* JSDoc `@typedef` comment. * JSDoc `@typedef` comment.
* *
* @param {string} componentName * @param {string} componentName
* @param {Object} An `ObjectExpression` AST node * @param {object} An `ObjectExpression` AST node
*/ */
function jsdocTypedefFromPropTypes(componentName, objectExpression) { function jsdocTypedefFromPropTypes(componentName, objectExpression) {
const props = []; const props = [];
......
...@@ -64,7 +64,7 @@ function nearestPositionedAncestor(el) { ...@@ -64,7 +64,7 @@ function nearestPositionedAncestor(el) {
* @typedef AdderOptions * @typedef AdderOptions
* @prop {() => any} onAnnotate - Callback invoked when "Annotate" button is clicked * @prop {() => any} onAnnotate - Callback invoked when "Annotate" button is clicked
* @prop {() => any} onHighlight - Callback invoked when "Highlight" button is clicked * @prop {() => any} onHighlight - Callback invoked when "Highlight" button is clicked
* @prop {(annotations: Object[]) => any} onShowAnnotations - * @prop {(annotations: object[]) => any} onShowAnnotations -
* Callback invoked when "Show" button is clicked * Callback invoked when "Show" button is clicked
* *
* @typedef {import('../types/annotator').Destroyable} Destroyable * @typedef {import('../types/annotator').Destroyable} Destroyable
...@@ -130,7 +130,7 @@ export class Adder { ...@@ -130,7 +130,7 @@ export class Adder {
* a "Show" button appears in the toolbar. Clicking the button calls the * a "Show" button appears in the toolbar. Clicking the button calls the
* `onShowAnnotations` callback with the current value of `annotationsForSelection`. * `onShowAnnotations` callback with the current value of `annotationsForSelection`.
* *
* @type {Object[]} * @type {object[]}
*/ */
this.annotationsForSelection = []; this.annotationsForSelection = [];
......
...@@ -6,7 +6,7 @@ import { RangeAnchor, TextPositionAnchor, TextQuoteAnchor } from './types'; ...@@ -6,7 +6,7 @@ import { RangeAnchor, TextPositionAnchor, TextQuoteAnchor } from './types';
/** /**
* @param {RangeAnchor|TextPositionAnchor|TextQuoteAnchor} anchor * @param {RangeAnchor|TextPositionAnchor|TextQuoteAnchor} anchor
* @param {Object} [options] * @param {object} [options]
* @param {number} [options.hint] * @param {number} [options.hint]
*/ */
async function querySelector(anchor, options = {}) { async function querySelector(anchor, options = {}) {
...@@ -22,7 +22,7 @@ async function querySelector(anchor, options = {}) { ...@@ -22,7 +22,7 @@ async function querySelector(anchor, options = {}) {
* *
* @param {Element} root - The root element of the anchoring context. * @param {Element} root - The root element of the anchoring context.
* @param {Selector[]} selectors - The selectors to try. * @param {Selector[]} selectors - The selectors to try.
* @param {Object} [options] * @param {object} [options]
* @param {number} [options.hint] * @param {number} [options.hint]
*/ */
export function anchor(root, selectors, options = {}) { export function anchor(root, selectors, options = {}) {
......
...@@ -73,7 +73,7 @@ function textMatchScore(text, str) { ...@@ -73,7 +73,7 @@ function textMatchScore(text, str) {
* *
* @param {string} text - Document text to search * @param {string} text - Document text to search
* @param {string} quote - String to find within `text` * @param {string} quote - String to find within `text`
* @param {Object} context - * @param {object} context -
* Context in which the quote originally appeared. This is used to choose the * Context in which the quote originally appeared. This is used to choose the
* best match. * best match.
* @param {string} [context.prefix] - Expected text before the quote * @param {string} [context.prefix] - Expected text before the quote
......
...@@ -18,7 +18,7 @@ import { TextQuoteAnchor } from './types'; ...@@ -18,7 +18,7 @@ import { TextQuoteAnchor } from './types';
/** /**
* @typedef PdfTextRange * @typedef PdfTextRange
* @prop {number} pageIndex * @prop {number} pageIndex
* @prop {Object} anchor * @prop {object} anchor
* @prop {number} anchor.start - Start character offset within the page's text * @prop {number} anchor.start - Start character offset within the page's text
* @prop {number} anchor.end - End character offset within the page's text * @prop {number} anchor.end - End character offset within the page's text
*/ */
......
...@@ -37,7 +37,7 @@ function findNode(context, query) { ...@@ -37,7 +37,7 @@ function findNode(context, query) {
* Resolve a serialized description of a range into a Range object. * Resolve a serialized description of a range into a Range object.
* *
* @param {Element} root * @param {Element} root
* @param {Object} descriptor * @param {object} descriptor
*/ */
function toRange(root, descriptor) { function toRange(root, descriptor) {
let startNode; let startNode;
......
...@@ -137,7 +137,7 @@ export class TextPosition { ...@@ -137,7 +137,7 @@ export class TextPosition {
* Offsets at the boundary between two nodes are resolved to the start of the * Offsets at the boundary between two nodes are resolved to the start of the
* node that begins at the boundary. * node that begins at the boundary.
* *
* @param {Object} [options] * @param {object} [options]
* @param {RESOLVE_FORWARDS|RESOLVE_BACKWARDS} [options.direction] - * @param {RESOLVE_FORWARDS|RESOLVE_BACKWARDS} [options.direction] -
* Specifies in which direction to search for the nearest text node if * Specifies in which direction to search for the nearest text node if
* `this.offset` is `0` and `this.element` has no text. If not specified * `this.offset` is `0` and `this.element` has no text. If not specified
......
...@@ -158,7 +158,7 @@ export class TextQuoteAnchor { ...@@ -158,7 +158,7 @@ export class TextQuoteAnchor {
/** /**
* @param {Element} root - A root element from which to anchor. * @param {Element} root - A root element from which to anchor.
* @param {string} exact * @param {string} exact
* @param {Object} context * @param {object} context
* @param {string} [context.prefix] * @param {string} [context.prefix]
* @param {string} [context.suffix] * @param {string} [context.suffix]
*/ */
......
...@@ -4,7 +4,7 @@ import { SvgIcon } from '@hypothesis/frontend-shared'; ...@@ -4,7 +4,7 @@ import { SvgIcon } from '@hypothesis/frontend-shared';
import { useShortcut } from '../../shared/shortcut'; import { useShortcut } from '../../shared/shortcut';
/** /**
* @param {Object} props * @param {object} props
* @param {number} [props.badgeCount] * @param {number} [props.badgeCount]
* @param {string} [props.icon] * @param {string} [props.icon]
* @param {string} props.label * @param {string} props.label
......
...@@ -13,7 +13,7 @@ import { findClosestOffscreenAnchor } from '../util/buckets'; ...@@ -13,7 +13,7 @@ import { findClosestOffscreenAnchor } from '../util/buckets';
* A left-pointing indicator button that, when hovered or clicked, highlights * A left-pointing indicator button that, when hovered or clicked, highlights
* or selects associated annotations. * or selects associated annotations.
* *
* @param {Object} props * @param {object} props
* @param {Bucket} props.bucket * @param {Bucket} props.bucket
* @param {(annotations: AnnotationData[], toggle: boolean) => any} props.onSelectAnnotations * @param {(annotations: AnnotationData[], toggle: boolean) => any} props.onSelectAnnotations
*/ */
...@@ -50,7 +50,7 @@ function BucketButton({ bucket, onSelectAnnotations }) { ...@@ -50,7 +50,7 @@ function BucketButton({ bucket, onSelectAnnotations }) {
* An up- or down-pointing button that will scroll to the next closest bucket * An up- or down-pointing button that will scroll to the next closest bucket
* of annotations in the given direction. * of annotations in the given direction.
* *
* @param {Object} props * @param {object} props
* @param {Bucket} props.bucket * @param {Bucket} props.bucket
* @param {'up'|'down'} props.direction * @param {'up'|'down'} props.direction
* @param {(a: Anchor) => void} props.scrollToAnchor - Callback invoked to * @param {(a: Anchor) => void} props.scrollToAnchor - Callback invoked to
...@@ -82,7 +82,7 @@ function NavigationBucketButton({ bucket, direction, scrollToAnchor }) { ...@@ -82,7 +82,7 @@ function NavigationBucketButton({ bucket, direction, scrollToAnchor }) {
* A list of buckets, including up and down navigation (when applicable) and * A list of buckets, including up and down navigation (when applicable) and
* on-screen buckets * on-screen buckets
* *
* @param {Object} props * @param {object} props
* @param {Bucket} props.above * @param {Bucket} props.above
* @param {Bucket} props.below * @param {Bucket} props.below
* @param {Bucket[]} props.buckets * @param {Bucket[]} props.buckets
......
import { SvgIcon } from '@hypothesis/frontend-shared'; import { SvgIcon } from '@hypothesis/frontend-shared';
/** /**
* @param {Object} props * @param {object} props
* @param {import("preact").Ref<HTMLButtonElement>} [props.buttonRef] * @param {import("preact").Ref<HTMLButtonElement>} [props.buttonRef]
* @param {boolean} [props.expanded] * @param {boolean} [props.expanded]
* @param {string} [props.className] * @param {string} [props.className]
......
/** /**
* @typedef HypothesisWindowProps * @typedef HypothesisWindowProps
* @prop {() => Object} [hypothesisConfig] - Function that returns configuration * @prop {() => object} [hypothesisConfig] - Function that returns configuration
* for the Hypothesis client * for the Hypothesis client
*/ */
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* If there's no window.hypothesisConfig() function then return {}. * If there's no window.hypothesisConfig() function then return {}.
* *
* @param {Window & HypothesisWindowProps} window_ - The window to search for a hypothesisConfig() function * @param {Window & HypothesisWindowProps} window_ - The window to search for a hypothesisConfig() function
* @return {Object} - Any config settings returned by hypothesisConfig() * @return {object} - Any config settings returned by hypothesisConfig()
* *
*/ */
export default function configFuncSettingsFrom(window_) { export default function configFuncSettingsFrom(window_) {
......
...@@ -14,7 +14,7 @@ import { urlFromLinkTag } from './url-from-link-tag'; ...@@ -14,7 +14,7 @@ import { urlFromLinkTag } from './url-from-link-tag';
* @prop {string} sidebarAppUrl * @prop {string} sidebarAppUrl
* @prop {string} notebookAppUrl * @prop {string} notebookAppUrl
* @prop {(name: string, options?: Object) => (string|null)} hostPageSetting * @prop {(name: string, options?: object) => (string|null)} hostPageSetting
*/ */
/** /**
......
...@@ -32,12 +32,12 @@ import { normalizeURI } from '../util/url'; ...@@ -32,12 +32,12 @@ import { normalizeURI } from '../util/url';
* @typedef HTMLDocumentMetadata * @typedef HTMLDocumentMetadata
* @prop {string} title * @prop {string} title
* @prop {Link[]} link * @prop {Link[]} link
* @prop {Object.<string, string[]>} dc * @prop {Record<string, string[]>} dc
* @prop {Object.<string, string[]>} eprints * @prop {Record<string, string[]>} eprints
* @prop {Object.<string, string[]>} facebook * @prop {Record<string, string[]>} facebook
* @prop {Object.<string, string[]>} highwire * @prop {Record<string, string[]>} highwire
* @prop {Object.<string, string[]>} prism * @prop {Record<string, string[]>} prism
* @prop {Object.<string, string[]>} twitter * @prop {Record<string, string[]>} twitter
* @prop {string} [favicon] * @prop {string} [favicon]
* @prop {string} [documentFingerprint] * @prop {string} [documentFingerprint]
*/ */
...@@ -115,10 +115,10 @@ export class HTMLMetadata { ...@@ -115,10 +115,10 @@ export class HTMLMetadata {
* @param {string} prefix * @param {string} prefix
* @param {string} attribute * @param {string} attribute
* @param {string} delimiter * @param {string} delimiter
* @return {Object.<string,string[]>} * @return {Record<string,string[]>}
*/ */
_getMetaTags(prefix, attribute, delimiter) { _getMetaTags(prefix, attribute, delimiter) {
/** @type {Object.<string,string[]>} */ /** @type {Record<string,string[]>} */
const tags = {}; const tags = {};
for (let meta of Array.from(this.document.querySelectorAll('meta'))) { for (let meta of Array.from(this.document.querySelectorAll('meta'))) {
const name = meta.getAttribute(attribute); const name = meta.getAttribute(attribute);
......
...@@ -9,7 +9,7 @@ class FakeMetadata { ...@@ -9,7 +9,7 @@ class FakeMetadata {
/** /**
* Initialize the metadata dictionary. * Initialize the metadata dictionary.
* *
* @param {Object} metadata - A key/value dictionary of metadata fields. * @param {object} metadata - A key/value dictionary of metadata fields.
*/ */
constructor(metadata) { constructor(metadata) {
this._metadata = metadata; this._metadata = metadata;
...@@ -69,7 +69,7 @@ class FakePDFViewerApplication { ...@@ -69,7 +69,7 @@ class FakePDFViewerApplication {
* when a document fails to load. * when a document fails to load.
* *
* @param {string} url - Fake PDF URL * @param {string} url - Fake PDF URL
* @param {Object} options - * @param {object} options -
* Options to simulate APIs of different versions of PDF.js. * Options to simulate APIs of different versions of PDF.js.
* *
* @prop {boolean} domEvents - Whether events are emitted on the DOM * @prop {boolean} domEvents - Whether events are emitted on the DOM
......
...@@ -5,7 +5,7 @@ const SIDEBAR_TRIGGER_BTN_ATTR = 'data-hypothesis-trigger'; ...@@ -5,7 +5,7 @@ const SIDEBAR_TRIGGER_BTN_ATTR = 'data-hypothesis-trigger';
* trigger data attribute. * trigger data attribute.
* *
* @param {Element} rootEl - The DOM element which contains the trigger elements. * @param {Element} rootEl - The DOM element which contains the trigger elements.
* @param {Object} showFn - Function which shows the sidebar. * @param {object} showFn - Function which shows the sidebar.
*/ */
export default function trigger(rootEl, showFn) { export default function trigger(rootEl, showFn) {
......
...@@ -14,7 +14,7 @@ const commonPolyfills = [ ...@@ -14,7 +14,7 @@ const commonPolyfills = [
/** /**
* @typedef SidebarAppConfig * @typedef SidebarAppConfig
* @prop {string} assetRoot - The root URL to which URLs in `manifest` are relative * @prop {string} assetRoot - The root URL to which URLs in `manifest` are relative
* @prop {Object.<string,string>} manifest - * @prop {Record<string,string>} manifest -
* A mapping from canonical asset path to cache-busted asset path * A mapping from canonical asset path to cache-busted asset path
* @prop {string} apiUrl * @prop {string} apiUrl
*/ */
...@@ -24,7 +24,7 @@ const commonPolyfills = [ ...@@ -24,7 +24,7 @@ const commonPolyfills = [
* @prop {string} assetRoot - The root URL to which URLs in `manifest` are relative * @prop {string} assetRoot - The root URL to which URLs in `manifest` are relative
* @prop {string} notebookAppUrl - The URL of the sidebar's notebook * @prop {string} notebookAppUrl - The URL of the sidebar's notebook
* @prop {string} sidebarAppUrl - The URL of the sidebar's HTML page * @prop {string} sidebarAppUrl - The URL of the sidebar's HTML page
* @prop {Object.<string,string>} manifest - * @prop {Record<string,string>} manifest -
* A mapping from canonical asset path to cache-busted asset path * A mapping from canonical asset path to cache-busted asset path
*/ */
......
...@@ -4,7 +4,7 @@ import { options } from 'preact'; ...@@ -4,7 +4,7 @@ import { options } from 'preact';
* Setup workarounds for setting certain HTML element properties or attributes * Setup workarounds for setting certain HTML element properties or attributes
* in some browsers. * in some browsers.
* *
* @param {Object} _options - Test seam * @param {object} _options - Test seam
*/ */
export function setupBrowserFixes(_options = options) { export function setupBrowserFixes(_options = options) {
let needsDirAutoFix = false; let needsDirAutoFix = false;
......
...@@ -44,7 +44,7 @@ export function toInteger(value) { ...@@ -44,7 +44,7 @@ export function toInteger(value) {
* Returns either the value if its an object or an empty object * Returns either the value if its an object or an empty object
* *
* @param {any} value - initial value * @param {any} value - initial value
* @return {Object} * @return {object}
*/ */
export function toObject(value) { export function toObject(value) {
if (typeof value === 'object' && value !== null) { if (typeof value === 'object' && value !== null) {
......
...@@ -10,7 +10,7 @@ import { applyTheme } from '../helpers/theme'; ...@@ -10,7 +10,7 @@ import { applyTheme } from '../helpers/theme';
* @typedef InlineControlsProps * @typedef InlineControlsProps
* @prop {boolean} isCollapsed * @prop {boolean} isCollapsed
* @prop {(collapsed: boolean) => any} setCollapsed * @prop {(collapsed: boolean) => any} setCollapsed
* @prop {Object} [linkStyle] * @prop {object} [linkStyle]
*/ */
/** /**
...@@ -44,7 +44,7 @@ const noop = () => {}; ...@@ -44,7 +44,7 @@ const noop = () => {};
/** /**
* @typedef ExcerptProps * @typedef ExcerptProps
* @prop {Object} [children] * @prop {object} [children]
* @prop {boolean} [inlineControls] - If `true`, the excerpt provides internal * @prop {boolean} [inlineControls] - If `true`, the excerpt provides internal
* controls to expand and collapse the content. If `false`, the caller sets * controls to expand and collapse the content. If `false`, the caller sets
* the collapsed state via the `collapse` prop. When using inline controls, * the collapsed state via the `collapse` prop. When using inline controls,
...@@ -61,7 +61,7 @@ const noop = () => {}; ...@@ -61,7 +61,7 @@ const noop = () => {};
* @prop {(collapsed: boolean) => void} [onToggleCollapsed] - When `inlineControls` is `false`, this * @prop {(collapsed: boolean) => void} [onToggleCollapsed] - When `inlineControls` is `false`, this
* function is called when the user requests to expand the content by clicking a * function is called when the user requests to expand the content by clicking a
* zone at the bottom of the container. * zone at the bottom of the container.
* @prop {Object} [settings] - Used for theming. * @prop {object} [settings] - Used for theming.
*/ */
/** /**
...@@ -120,7 +120,7 @@ function Excerpt({ ...@@ -120,7 +120,7 @@ function Excerpt({
const isCollapsed = inlineControls ? collapsedByInlineControls : collapse; const isCollapsed = inlineControls ? collapsedByInlineControls : collapse;
const isExpandable = isOverflowing && isCollapsed; const isExpandable = isOverflowing && isCollapsed;
/** @type {Object} */ /** @type {object} */
const contentStyle = {}; const contentStyle = {};
if (contentHeight !== 0) { if (contentHeight !== 0) {
contentStyle['max-height'] = isExpandable ? collapsedHeight : contentHeight; contentStyle['max-height'] = isExpandable ? collapsedHeight : contentHeight;
......
...@@ -16,7 +16,7 @@ import VersionInfo from './VersionInfo'; ...@@ -16,7 +16,7 @@ import VersionInfo from './VersionInfo';
/** /**
* External link "tabs" inside of the help panel. * External link "tabs" inside of the help panel.
* *
* @param {Object} props * @param {object} props
* @param {string} props.linkText - What the tab's link should say * @param {string} props.linkText - What the tab's link should say
* @param {string} props.url - Where the tab's link should go * @param {string} props.url - Where the tab's link should go
*/ */
......
...@@ -94,7 +94,7 @@ function handleToolbarCommand(command, inputEl) { ...@@ -94,7 +94,7 @@ function handleToolbarCommand(command, inputEl) {
/** /**
* @typedef ToolbarButtonProps * @typedef ToolbarButtonProps
* @prop {Object} buttonRef * @prop {object} buttonRef
* @prop {boolean} [disabled] * @prop {boolean} [disabled]
* @prop {string} [iconName] * @prop {string} [iconName]
* @prop {string} [label] * @prop {string} [label]
...@@ -374,10 +374,10 @@ function Toolbar({ isPreviewing, onCommand, onTogglePreview }) { ...@@ -374,10 +374,10 @@ function Toolbar({ isPreviewing, onCommand, onTogglePreview }) {
/** /**
* @typedef MarkdownEditorProps * @typedef MarkdownEditorProps
* @prop {string} label - An accessible label for the input field. * @prop {string} label - An accessible label for the input field.
* @prop {Object.<string,string>} [textStyle] - * @prop {Record<string,string>} [textStyle] -
* Additional CSS properties to apply to the input field and rendered preview * Additional CSS properties to apply to the input field and rendered preview
* @prop {string} [text] - The markdown text to edit. * @prop {string} [text] - The markdown text to edit.
* @prop {(a?: Object<'text', string>) => void} [onEditText] * @prop {(a?: Record<'text', string>) => void} [onEditText]
* - Callback invoked with `{ text }` object when user edits text. * - Callback invoked with `{ text }` object when user edits text.
* TODO: Simplify this callback to take just a string rather than an object once the * TODO: Simplify this callback to take just a string rather than an object once the
* parent component is converted to Preact. * parent component is converted to Preact.
......
...@@ -7,9 +7,9 @@ import renderMarkdown from '../render-markdown'; ...@@ -7,9 +7,9 @@ import renderMarkdown from '../render-markdown';
/** /**
* @typedef MarkdownViewProps * @typedef MarkdownViewProps
* @prop {string} markdown - The string of markdown to display * @prop {string} markdown - The string of markdown to display
* @prop {Object.<string,string>} [textStyle] - * @prop {Record<string,string>} [textStyle] -
* Additional CSS properties to apply to the rendered markdown * Additional CSS properties to apply to the rendered markdown
* @prop {Object.<string,boolean>} [textClass] - * @prop {Record<string,boolean>} [textClass] -
* Map of classes to apply to the container of the rendered markdown * Map of classes to apply to the container of the rendered markdown
*/ */
......
...@@ -32,8 +32,8 @@ let ignoreNextClick = false; ...@@ -32,8 +32,8 @@ let ignoreNextClick = false;
* Additional CSS class for the arrow caret at the edge of the menu content that "points" * Additional CSS class for the arrow caret at the edge of the menu content that "points"
* toward the menu's toggle button. This can be used to adjust the position of that caret * toward the menu's toggle button. This can be used to adjust the position of that caret
* respective to the toggle button. * respective to the toggle button.
* @prop {Object|string} [label] - Label element for the toggle button that hides and shows the menu. * @prop {object|string} [label] - Label element for the toggle button that hides and shows the menu.
* @prop {Object} [children] - * @prop {object} [children] -
* Menu items and sections to display in the content area of the menu. These are typically * Menu items and sections to display in the content area of the menu. These are typically
* `MenuSection` and `MenuItem` components, but other custom content is also allowed. * `MenuSection` and `MenuItem` components, but other custom content is also allowed.
* @prop {boolean} [containerPositioned] - * @prop {boolean} [containerPositioned] -
......
...@@ -37,7 +37,7 @@ import Slider from './Slider'; ...@@ -37,7 +37,7 @@ import Slider from './Slider';
* @prop {(e: Event) => any} [onClick] - Callback to invoke when the menu item is clicked. * @prop {(e: Event) => any} [onClick] - Callback to invoke when the menu item is clicked.
* @prop {(e: Event) => any} [onToggleSubmenu] - * @prop {(e: Event) => any} [onToggleSubmenu] -
* Callback when the user clicks on the toggle to change the expanded state of the menu. * Callback when the user clicks on the toggle to change the expanded state of the menu.
* @prop {Object} [submenu] - * @prop {object} [submenu] -
* Contents of the submenu for this item. This is typically a list of `MenuItem` components * Contents of the submenu for this item. This is typically a list of `MenuItem` components
* with the `isSubmenuItem` prop set to `true`, but can include other content as well. * with the `isSubmenuItem` prop set to `true`, but can include other content as well.
* The submenu is only rendered if `isSubmenuVisible` is `true`. * The submenu is only rendered if `isSubmenuVisible` is `true`.
......
...@@ -10,7 +10,7 @@ function isElementVisible(element) { ...@@ -10,7 +10,7 @@ function isElementVisible(element) {
* @prop {string} [className] * @prop {string} [className]
* @prop {(e: KeyboardEvent) => any} [closeMenu] - Callback when the menu is closed via keyboard input * @prop {(e: KeyboardEvent) => any} [closeMenu] - Callback when the menu is closed via keyboard input
* @prop {boolean} [visible] - When true`, sets focus on the first item in the list * @prop {boolean} [visible] - When true`, sets focus on the first item in the list
* @prop {Object} children - Array of nodes which may contain <MenuItems> or any nodes * @prop {object} children - Array of nodes which may contain <MenuItems> or any nodes
*/ */
/** /**
......
...@@ -5,7 +5,7 @@ import { toChildArray } from 'preact'; ...@@ -5,7 +5,7 @@ import { toChildArray } from 'preact';
/** /**
* @typedef MenuSectionProps * @typedef MenuSectionProps
* @prop {string} [heading] - Heading displayed at the top of the menu. * @prop {string} [heading] - Heading displayed at the top of the menu.
* @prop {Object} children - Menu items to display in this section. * @prop {object} children - Menu items to display in this section.
*/ */
/** /**
......
...@@ -12,7 +12,7 @@ import { withServices } from '../service-context'; ...@@ -12,7 +12,7 @@ import { withServices } from '../service-context';
/** /**
* @typedef TabProps * @typedef TabProps
* @prop {Object} children - Child components. * @prop {object} children - Child components.
* @prop {number} count - The total annotations for this tab. * @prop {number} count - The total annotations for this tab.
* @prop {boolean} isSelected - Is this tab currently selected? * @prop {boolean} isSelected - Is this tab currently selected?
* @prop {boolean} isWaitingToAnchor - Are there any annotations still waiting to anchor? * @prop {boolean} isWaitingToAnchor - Are there any annotations still waiting to anchor?
......
...@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'preact/hooks'; ...@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
/** /**
* @typedef SliderProps * @typedef SliderProps
* @prop {Object} [children] - The slideable content to hide or reveal. * @prop {object} [children] - The slideable content to hide or reveal.
* @prop {boolean} visible - Whether the content should be visible or not. * @prop {boolean} visible - Whether the content should be visible or not.
*/ */
......
...@@ -76,7 +76,7 @@ function ToastMessage({ message, onDismiss }) { ...@@ -76,7 +76,7 @@ function ToastMessage({ message, onDismiss }) {
/** /**
* @typedef ToastMessagesProps * @typedef ToastMessagesProps
* @prop {Object} toastMessenger - Injected service * @prop {object} toastMessenger - Injected service
*/ */
/** /**
......
...@@ -28,7 +28,7 @@ import MenuSection from './MenuSection'; ...@@ -28,7 +28,7 @@ import MenuSection from './MenuSection';
* @typedef UserMenuProps * @typedef UserMenuProps
* @prop {AuthStateLoggedIn} auth - object representing authenticated user and auth status * @prop {AuthStateLoggedIn} auth - object representing authenticated user and auth status
* @prop {() => any} onLogout - onClick callback for the "log out" button * @prop {() => any} onLogout - onClick callback for the "log out" button
* @prop {Object} bridge * @prop {object} bridge
* @prop {MergedConfig} settings * @prop {MergedConfig} settings
*/ */
......
...@@ -20,7 +20,7 @@ export default function useRootThread() { ...@@ -20,7 +20,7 @@ export default function useRootThread() {
const filters = store.getFilterValues(); const filters = store.getFilterValues();
const threadState = useMemo(() => { const threadState = useMemo(() => {
/** @type {Object.<string,string>} */ /** @type {Record<string,string>} */
return { return {
annotations, annotations,
route, route,
......
...@@ -84,9 +84,9 @@ function fetchConfigFromAncestorFrame(origin, window_ = window) { ...@@ -84,9 +84,9 @@ function fetchConfigFromAncestorFrame(origin, window_ = window) {
* synchronously in the query string. However it can also be retrieved from * synchronously in the query string. However it can also be retrieved from
* an ancestor of the embedding frame. See tests for more details. * an ancestor of the embedding frame. See tests for more details.
* *
* @param {Object} appConfig - Settings rendered into `app.html` by the h service. * @param {object} appConfig - Settings rendered into `app.html` by the h service.
* @param {Window} window_ - Test seam. * @param {Window} window_ - Test seam.
* @return {Promise<Object>} - The merged settings. * @return {Promise<object>} - The merged settings.
*/ */
function fetchConfigLegacy(appConfig, window_ = window) { function fetchConfigLegacy(appConfig, window_ = window) {
const hostPageConfig = hostConfig(window_); const hostPageConfig = hostConfig(window_);
...@@ -105,9 +105,9 @@ function fetchConfigLegacy(appConfig, window_ = window) { ...@@ -105,9 +105,9 @@ function fetchConfigLegacy(appConfig, window_ = window) {
/** /**
* Merge client configuration from h service with config from the hash fragment. * Merge client configuration from h service with config from the hash fragment.
* *
* @param {Object} appConfig - App config settings rendered into `app.html` by the h service. * @param {object} appConfig - App config settings rendered into `app.html` by the h service.
* @param {Object} hostPageConfig - App configuration specified by the embedding frame. * @param {object} hostPageConfig - App configuration specified by the embedding frame.
* @return {Object} - The merged settings. * @return {object} - The merged settings.
*/ */
function fetchConfigEmbed(appConfig, hostPageConfig) { function fetchConfigEmbed(appConfig, hostPageConfig) {
const mergedConfig = { const mergedConfig = {
...@@ -125,10 +125,10 @@ function fetchConfigEmbed(appConfig, hostPageConfig) { ...@@ -125,10 +125,10 @@ function fetchConfigEmbed(appConfig, hostPageConfig) {
* Use this method to retrieve the config asynchronously from a parent * Use this method to retrieve the config asynchronously from a parent
* frame via RPC. See tests for more details. * frame via RPC. See tests for more details.
* *
* @param {Object} appConfig - Settings rendered into `app.html` by the h service. * @param {object} appConfig - Settings rendered into `app.html` by the h service.
* @param {Window} parentFrame - Frame to send call to. * @param {Window} parentFrame - Frame to send call to.
* @param {string} origin - Origin filter for `window.postMessage` call. * @param {string} origin - Origin filter for `window.postMessage` call.
* @return {Promise<Object>} - The merged settings. * @return {Promise<object>} - The merged settings.
*/ */
async function fetchConfigRpc(appConfig, parentFrame, origin) { async function fetchConfigRpc(appConfig, parentFrame, origin) {
const remoteConfig = await postMessageJsonRpc.call( const remoteConfig = await postMessageJsonRpc.call(
...@@ -156,11 +156,11 @@ async function fetchConfigRpc(appConfig, parentFrame, origin) { ...@@ -156,11 +156,11 @@ async function fetchConfigRpc(appConfig, parentFrame, origin) {
* fill in the `groups` value(s) later when its ready. This helps speed * fill in the `groups` value(s) later when its ready. This helps speed
* up the loading process. * up the loading process.
* *
* @param {Object} config - The configuration object to mutate. This should * @param {object} config - The configuration object to mutate. This should
* already have the `services` value * already have the `services` value
* @param {function} rpcCall - RPC method * @param {function} rpcCall - RPC method
* (method, args, timeout) => Promise * (method, args, timeout) => Promise
* @return {Promise<Object>} - The mutated settings * @return {Promise<object>} - The mutated settings
*/ */
async function fetchGroupsAsync(config, rpcCall) { async function fetchGroupsAsync(config, rpcCall) {
if (Array.isArray(config.services)) { if (Array.isArray(config.services)) {
......
...@@ -6,8 +6,8 @@ let preStartQueue = []; ...@@ -6,8 +6,8 @@ let preStartQueue = [];
/** /**
* Return the mapped methods that can be called remotely via this server. * Return the mapped methods that can be called remotely via this server.
* *
* @param {Object} store - The global store * @param {object} store - The global store
* @return {Object} * @return {object}
*/ */
const registeredMethods = store => { const registeredMethods = store => {
return { return {
......
...@@ -66,7 +66,7 @@ function hasPathToRoot(threads, id, ancestorId) { ...@@ -66,7 +66,7 @@ function hasPathToRoot(threads, id, ancestorId) {
/** /**
* Link the thread's annotation to its parent * Link the thread's annotation to its parent
* @param {Object.<string,Thread>} threads * @param {Record<string,Thread>} threads
* @param {string} id * @param {string} id
* @param {string[]} [parents] - ids of parent annotations, from the * @param {string[]} [parents] - ids of parent annotations, from the
* annotation's `references` field. Immediate parent is last entry. * annotation's `references` field. Immediate parent is last entry.
...@@ -111,7 +111,7 @@ function setParent(threads, id, parents = []) { ...@@ -111,7 +111,7 @@ function setParent(threads, id, parents = []) {
* @return {Thread} - The input annotations threaded into a tree structure. * @return {Thread} - The input annotations threaded into a tree structure.
*/ */
function threadAnnotations(annotations) { function threadAnnotations(annotations) {
/** @type {Object.<string,Thread>} */ /** @type {Record<string,Thread>} */
const threads = {}; const threads = {};
// Create a `Thread` for each annotation // Create a `Thread` for each annotation
...@@ -228,7 +228,7 @@ function hasVisibleChildren(thread) { ...@@ -228,7 +228,7 @@ function hasVisibleChildren(thread) {
/** /**
* @typedef BuildThreadOptions * @typedef BuildThreadOptions
* @prop {Object.<string, boolean>} expanded - Map of thread id => expansion state * @prop {Record<string, boolean>} expanded - Map of thread id => expansion state
* @prop {string[]} forcedVisible - List of $tags of annotations that have * @prop {string[]} forcedVisible - List of $tags of annotations that have
* been explicitly expanded by the user, even if they don't * been explicitly expanded by the user, even if they don't
* match current filters * match current filters
......
...@@ -11,7 +11,7 @@ const DEFAULT_ORG_ID = '__default__'; ...@@ -11,7 +11,7 @@ const DEFAULT_ORG_ID = '__default__';
* Generate consistent object keys for organizations so that they * Generate consistent object keys for organizations so that they
* may be sorted * may be sorted
* *
* @param {Object} organization * @param {object} organization
* @return {String} * @return {String}
*/ */
function orgKey(organization) { function orgKey(organization) {
...@@ -26,7 +26,7 @@ function orgKey(organization) { ...@@ -26,7 +26,7 @@ function orgKey(organization) {
* groups Array. * groups Array.
* *
* @param {Group} group * @param {Group} group
* @param {Object} organization * @param {object} organization
* @return undefined - organization is mutated in place * @return undefined - organization is mutated in place
*/ */
function addGroup(group, organization) { function addGroup(group, organization) {
...@@ -46,7 +46,7 @@ function addGroup(group, organization) { ...@@ -46,7 +46,7 @@ function addGroup(group, organization) {
* their appropriate "parent" organizations. * their appropriate "parent" organizations.
* *
* @param {Array<Group>} groups * @param {Array<Group>} groups
* @return {Object} - A collection of all unique organizations, containing * @return {object} - A collection of all unique organizations, containing
* their groups. Keyed by each org's "orgKey" * their groups. Keyed by each org's "orgKey"
*/ */
function organizations(groups) { function organizations(groups) {
...@@ -81,7 +81,7 @@ function organizations(groups) { ...@@ -81,7 +81,7 @@ function organizations(groups) {
* organization). * organization).
* *
* @param {Array<Group>} groups * @param {Array<Group>} groups
* @return {Array<Object>} - groups sorted by which organization they're in * @return {Array<object>} - groups sorted by which organization they're in
*/ */
export default function groupsByOrganization(groups) { export default function groupsByOrganization(groups) {
const orgs = organizations(groups); const orgs = organizations(groups);
......
...@@ -55,7 +55,7 @@ function filter(thread, keys) { ...@@ -55,7 +55,7 @@ function filter(thread, keys) {
* which do not match `keys`. * which do not match `keys`.
* *
* @param {Array<Annotation>} fixture - List of annotations to thread * @param {Array<Annotation>} fixture - List of annotations to thread
* @param {Object?} opts - Options to pass to buildThread() * @param {object?} opts - Options to pass to buildThread()
* @param {Array<string>?} keys - List of keys to keep in the output * @param {Array<string>?} keys - List of keys to keep in the output
*/ */
function createThread(fixture, options, keys) { function createThread(fixture, options, keys) {
......
...@@ -17,7 +17,7 @@ const supportedThemeProperties = { ...@@ -17,7 +17,7 @@ const supportedThemeProperties = {
* Subset of the config from the host page which includes theme configuration. * Subset of the config from the host page which includes theme configuration.
* *
* @typedef Settings * @typedef Settings
* @prop {Object.<ThemeProperty,string>} [branding] * @prop {Record<ThemeProperty,string>} [branding]
*/ */
/** /**
...@@ -40,7 +40,7 @@ const supportedThemeProperties = { ...@@ -40,7 +40,7 @@ const supportedThemeProperties = {
* Which of the supported theme properties should have applied rules in the `style` * Which of the supported theme properties should have applied rules in the `style`
* object * object
* @param {Settings} settings * @param {Settings} settings
* @return {Object.<string,string>} - Object that can be passed as the `style` prop * @return {Record<string,string>} - Object that can be passed as the `style` prop
* *
* @example * @example
* let themeProperties = ['accentColor', 'ctaTextColor', 'foo']; * let themeProperties = ['accentColor', 'ctaTextColor', 'foo'];
...@@ -54,7 +54,7 @@ const supportedThemeProperties = { ...@@ -54,7 +54,7 @@ const supportedThemeProperties = {
* applyTheme(themeProperties, settings); // -> { color: '#ffc '} * applyTheme(themeProperties, settings); // -> { color: '#ffc '}
*/ */
export function applyTheme(themeProperties, settings) { export function applyTheme(themeProperties, settings) {
/** @type {Object.<string,string>} */ /** @type {Record<string,string>} */
const style = {}; const style = {};
if (!settings.branding) { if (!settings.branding) {
return style; return style;
......
...@@ -13,10 +13,10 @@ import { sorters } from './thread-sorters'; ...@@ -13,10 +13,10 @@ import { sorters } from './thread-sorters';
/** /**
* @typedef ThreadState * @typedef ThreadState
* @prop {Annotation[]} annotations * @prop {Annotation[]} annotations
* @prop {Object} selection * @prop {object} selection
* @prop {Object<string,boolean>} selection.expanded * @prop {Record<string,boolean>} selection.expanded
* @prop {string|null} selection.filterQuery * @prop {string|null} selection.filterQuery
* @prop {Object<string,string>} selection.filters * @prop {Record<string,string>} selection.filters
* @prop {string[]} selection.forcedVisible * @prop {string[]} selection.forcedVisible
* @prop {string[]} selection.selected * @prop {string[]} selection.selected
* @prop {string} selection.sortKey * @prop {string} selection.sortKey
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
/** /**
* An object representing document metadata. * An object representing document metadata.
* *
* @typedef {Object} DocMetadata * @typedef {object} DocMetadata
* @prop {string=} documentFingerprint - Optional PDF fingerprint for current document * @prop {string=} documentFingerprint - Optional PDF fingerprint for current document
*/ */
/** /**
* An object representing document info. * An object representing document info.
* *
* @typedef {Object} DocumentInfo * @typedef {object} DocumentInfo
* @prop {string=} [uri] - Current document URL * @prop {string=} [uri] - Current document URL
* @prop {DocMetadata} [metadata] - Document metadata * @prop {DocMetadata} [metadata] - Document metadata
*/ */
......
...@@ -112,7 +112,7 @@ class BinaryOpFilter { ...@@ -112,7 +112,7 @@ class BinaryOpFilter {
* value: a function to extract to facet value for the annotation. * value: a function to extract to facet value for the annotation.
* match: a function to check if the extracted value matches the facet value * match: a function to check if the extracted value matches the facet value
* *
* @type {Object.<string,Checker>} * @type {Record<string,Checker>}
*/ */
const fieldMatchers = { const fieldMatchers = {
quote: { quote: {
...@@ -154,7 +154,7 @@ const fieldMatchers = { ...@@ -154,7 +154,7 @@ const fieldMatchers = {
* Filters a set of annotations. * Filters a set of annotations.
* *
* @param {Annotation[]} annotations * @param {Annotation[]} annotations
* @param {Object} filters - Faceted filter generated by * @param {object} filters - Faceted filter generated by
* `generateFacetedFilter`. * `generateFacetedFilter`.
* @return {string[]} IDs of matching annotations. * @return {string[]} IDs of matching annotations.
*/ */
......
...@@ -18,11 +18,11 @@ export const THREAD_DIMENSION_DEFAULTS = { ...@@ -18,11 +18,11 @@ export const THREAD_DIMENSION_DEFAULTS = {
* estimating which of the threads are within or near the viewport. * estimating which of the threads are within or near the viewport.
* *
* @param {Thread[]} threads - List of threads in the order they appear * @param {Thread[]} threads - List of threads in the order they appear
* @param {Object} threadHeights - Map of thread ID to measured height * @param {object} threadHeights - Map of thread ID to measured height
* @param {number} scrollPos - Vertical scroll offset of scrollable container * @param {number} scrollPos - Vertical scroll offset of scrollable container
* @param {number} windowHeight - * @param {number} windowHeight -
* Height of the visible area of the scrollable container. * Height of the visible area of the scrollable container.
* @param {Object} options - Dimensional overrides (in px) for defaults * @param {object} options - Dimensional overrides (in px) for defaults
*/ */
export function calculateVisibleThreads( export function calculateVisibleThreads(
threads, threads,
......
...@@ -155,7 +155,7 @@ function youTubeEmbed(id, link) { ...@@ -155,7 +155,7 @@ function youTubeEmbed(id, link) {
* contain a single capture group which matches the video ID within the path. * contain a single capture group which matches the video ID within the path.
* @param {(videoId: string) => string} iframeUrlGenerator - * @param {(videoId: string) => string} iframeUrlGenerator -
* Generate the URL for an embedded video iframe from a video ID * Generate the URL for an embedded video iframe from a video ID
* @param {Object} [options] * @param {object} [options]
* @param {number} [options.aspectRatio] * @param {number} [options.aspectRatio]
* @return {(link: HTMLAnchorElement) => HTMLElement|null} * @return {(link: HTMLAnchorElement) => HTMLElement|null}
*/ */
...@@ -393,7 +393,7 @@ function replaceLinkWithEmbed(link) { ...@@ -393,7 +393,7 @@ function replaceLinkWithEmbed(link) {
* embeds of the same media. * embeds of the same media.
* *
* @param {HTMLElement} element * @param {HTMLElement} element
* @param {Object} options * @param {object} options
* @param {string} [options.className] - * @param {string} [options.className] -
* Class name to apply to embed containers. An important function of this class is to set * Class name to apply to embed containers. An important function of this class is to set
* the width of the embed. * the width of the embed.
......
...@@ -48,7 +48,7 @@ function defaultPageSize(index) { ...@@ -48,7 +48,7 @@ function defaultPageSize(index) {
export class SearchClient extends TinyEmitter { export class SearchClient extends TinyEmitter {
/** /**
* @param {(query: SearchQuery) => Promise<SearchResult>} searchFn - Function for querying the search API * @param {(query: SearchQuery) => Promise<SearchResult>} searchFn - Function for querying the search API
* @param {Object} options * @param {object} options
* @param {(index: number) => number} [options.getPageSize] - * @param {(index: number) => number} [options.getPageSize] -
* Callback that returns the page size to use when fetching the index'th * Callback that returns the page size to use when fetching the index'th
* page of results. Callers can vary this to balance the latency of * page of results. Callers can vary this to balance the latency of
......
...@@ -114,7 +114,7 @@ export function withServices(Component, serviceNames) { ...@@ -114,7 +114,7 @@ export function withServices(Component, serviceNames) {
* context of custom hooks. * context of custom hooks.
* *
* @param {string} service - Name of the service to look up * @param {string} service - Name of the service to look up
* @return {Object} * @return {object}
*/ */
export function useService(service) { export function useService(service) {
const injector = useContext(ServiceContext); const injector = useContext(ServiceContext);
......
...@@ -100,7 +100,7 @@ export class AnnotationsService { ...@@ -100,7 +100,7 @@ export class AnnotationsService {
* Create a draft for it unless it's a highlight and clear other empty * Create a draft for it unless it's a highlight and clear other empty
* drafts out of the way. * drafts out of the way.
* *
* @param {Object} annotationData * @param {object} annotationData
* @param {Date} now * @param {Date} now
*/ */
create(annotationData, now = new Date()) { create(annotationData, now = new Date()) {
...@@ -177,7 +177,7 @@ export class AnnotationsService { ...@@ -177,7 +177,7 @@ export class AnnotationsService {
/** /**
* Create a reply to `annotation` by the user `userid` and add to the store. * Create a reply to `annotation` by the user `userid` and add to the store.
* *
* @param {Object} annotation * @param {object} annotation
* @param {string} userid * @param {string} userid
*/ */
reply(annotation, userid) { reply(annotation, userid) {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* @typedef Filter * @typedef Filter
* @prop {string} match_policy - TODO: Remove this, the backend doesn't use it any more. * @prop {string} match_policy - TODO: Remove this, the backend doesn't use it any more.
* @prop {FilterClause[]} clauses * @prop {FilterClause[]} clauses
* @prop {Object} actions - TODO: Remove this, the backend doesn't use it any more. * @prop {object} actions - TODO: Remove this, the backend doesn't use it any more.
* @prop {boolean} [actions.create] * @prop {boolean} [actions.create]
* @prop {boolean} [actions.update] * @prop {boolean} [actions.update]
* @prop {boolean} [actions.delete] * @prop {boolean} [actions.delete]
......
...@@ -220,7 +220,7 @@ export class StreamerService { ...@@ -220,7 +220,7 @@ export class StreamerService {
* *
* If the service has already connected this does nothing. * If the service has already connected this does nothing.
* *
* @param {Object} [options] * @param {object} [options]
* @param {boolean} [options.applyUpdatesImmediately] - true if pending updates should be applied immediately * @param {boolean} [options.applyUpdatesImmediately] - true if pending updates should be applied immediately
* @return {Promise<void>} Promise which resolves once the WebSocket connection * @return {Promise<void>} Promise which resolves once the WebSocket connection
* process has started. * process has started.
......
...@@ -36,7 +36,7 @@ describe('APIService', () => { ...@@ -36,7 +36,7 @@ describe('APIService', () => {
* @param {number|null} status - * @param {number|null} status -
* Expected HTTP status. If `null` then the call to `fetch` will reject with * Expected HTTP status. If `null` then the call to `fetch` will reject with
* the content of `body` as the error message. * the content of `body` as the error message.
* @param {Object|string} body - Expected response body or error message * @param {object|string} body - Expected response body or error message
*/ */
function expectCall( function expectCall(
method, method,
......
...@@ -8,7 +8,7 @@ const MESSAGE_DISMISS_DELAY = 500; ...@@ -8,7 +8,7 @@ const MESSAGE_DISMISS_DELAY = 500;
/** /**
* Additional control over the display of a particular message. * Additional control over the display of a particular message.
* *
* @typedef {Object} MessageOptions * @typedef {object} MessageOptions
* @prop {boolean} [autoDismiss=true] - Whether the toast message automatically disappears. * @prop {boolean} [autoDismiss=true] - Whether the toast message automatically disappears.
* @prop {string} [moreInfoURL=''] - Optional URL for users to visit for "more info" * @prop {string} [moreInfoURL=''] - Optional URL for users to visit for "more info"
*/ */
......
...@@ -68,10 +68,10 @@ function findByTag(annotations, tag) { ...@@ -68,10 +68,10 @@ function findByTag(annotations, tag) {
* `annotation` may either be new (unsaved) or a persisted annotation retrieved * `annotation` may either be new (unsaved) or a persisted annotation retrieved
* from the service. * from the service.
* *
* @param {Object} annotation * @param {object} annotation
* @param {string} tag - The `$tag` value that should be used for this * @param {string} tag - The `$tag` value that should be used for this
* if it doesn't have a `$tag` already * if it doesn't have a `$tag` already
* @return {Object} - annotation with local (`$*`) fields set * @return {object} - annotation with local (`$*`) fields set
*/ */
function initializeAnnotation(annotation, tag) { function initializeAnnotation(annotation, tag) {
let orphan = annotation.$orphan; let orphan = annotation.$orphan;
......
...@@ -46,7 +46,7 @@ import { createStoreModule } from '../create-store'; ...@@ -46,7 +46,7 @@ import { createStoreModule } from '../create-store';
*/ */
/** /**
* @typedef {Object.<FilterKey, FilterOption>} Filters * @typedef {Record<FilterKey, FilterOption>} Filters
*/ */
/** /**
...@@ -265,7 +265,7 @@ function getFilter(state, filterName) { ...@@ -265,7 +265,7 @@ function getFilter(state, filterName) {
const getFilterValues = createSelector( const getFilterValues = createSelector(
state => getFilters(state), state => getFilters(state),
allFilters => { allFilters => {
/** @type {Object.<string,string>} */ /** @type {Record<string,string>} */
const filterValues = {}; const filterValues = {};
Object.keys(allFilters).forEach( Object.keys(allFilters).forEach(
filterKey => (filterValues[filterKey] = allFilters[filterKey].value) filterKey => (filterValues[filterKey] = allFilters[filterKey].value)
......
...@@ -89,7 +89,7 @@ const actions = actionTypes(reducers); ...@@ -89,7 +89,7 @@ const actions = actionTypes(reducers);
* Record pending updates representing changes on the server that the client * Record pending updates representing changes on the server that the client
* has been notified about but has not yet applied. * has been notified about but has not yet applied.
* *
* @param {Object} args * @param {object} args
* @param {Annotation[]} [args.updatedAnnotations] * @param {Annotation[]} [args.updatedAnnotations]
* @param {Annotation[]} [args.deletedAnnotations] * @param {Annotation[]} [args.deletedAnnotations]
*/ */
...@@ -153,7 +153,7 @@ function clearPendingUpdates() { ...@@ -153,7 +153,7 @@ function clearPendingUpdates() {
* Return added or updated annotations received via the WebSocket * Return added or updated annotations received via the WebSocket
* which have not been applied to the local state. * which have not been applied to the local state.
* *
* @return {Object.<string, Annotation>} * @return {Record<string, Annotation>}
*/ */
function pendingUpdates(state) { function pendingUpdates(state) {
return state.pendingUpdates; return state.pendingUpdates;
...@@ -163,7 +163,7 @@ function pendingUpdates(state) { ...@@ -163,7 +163,7 @@ function pendingUpdates(state) {
* Return IDs of annotations which have been deleted on the server but not * Return IDs of annotations which have been deleted on the server but not
* yet removed from the local state. * yet removed from the local state.
* *
* @return {Object.<string, Annotation>} * @return {Record<string, Annotation>}
*/ */
function pendingDeletions(state) { function pendingDeletions(state) {
return state.pendingDeletions; return state.pendingDeletions;
......
...@@ -38,7 +38,7 @@ const actions = actionTypes(reducers); ...@@ -38,7 +38,7 @@ const actions = actionTypes(reducers);
* Change the active route. * Change the active route.
* *
* @param {string} name - Name of the route to activate. See `initialState` for possible values * @param {string} name - Name of the route to activate. See `initialState` for possible values
* @param {Object.<string,string>} params - Parameters associated with the route * @param {Record<string,string>} params - Parameters associated with the route
*/ */
function changeRoute(name, params = {}) { function changeRoute(name, params = {}) {
return { return {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
/** /**
* @typedef SelectionState * @typedef SelectionState
* @prop {Object<string,boolean>} expanded * @prop {Record<string,boolean>} expanded
* @prop {string[]} forcedVisible * @prop {string[]} forcedVisible
* @prop {string[]} selected * @prop {string[]} selected
* @prop {string} sortKey * @prop {string} sortKey
...@@ -303,7 +303,7 @@ function toggleSelectedAnnotations(toggleIds) { ...@@ -303,7 +303,7 @@ function toggleSelectedAnnotations(toggleIds) {
/** /**
* Retrieve map of expanded/collapsed annotations (threads) * Retrieve map of expanded/collapsed annotations (threads)
* *
* @return {Object<string,boolean>} * @return {Record<string,boolean>}
*/ */
function expandedMap(state) { function expandedMap(state) {
return state.expanded; return state.expanded;
......
...@@ -82,7 +82,7 @@ function updateMessage(message) { ...@@ -82,7 +82,7 @@ function updateMessage(message) {
* Retrieve a message by `id` * Retrieve a message by `id`
* *
* @param {string} id * @param {string} id
* @return {Object|undefined} * @return {object|undefined}
*/ */
function getMessage(state, id) { function getMessage(state, id) {
return state.messages.find(message => message.id === id); return state.messages.find(message => message.id === id);
...@@ -91,7 +91,7 @@ function getMessage(state, id) { ...@@ -91,7 +91,7 @@ function getMessage(state, id) {
/** /**
* Retrieve all current messages * Retrieve all current messages
* *
* @return {Object[]} * @return {object[]}
*/ */
function getMessages(state) { function getMessages(state) {
return state.messages; return state.messages;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/** /**
* Return an object where each key in `updateFns` is mapped to the key itself. * Return an object where each key in `updateFns` is mapped to the key itself.
* *
* @template {Object.<string,Function>} T * @template {Record<string,Function>} T
* @param {T} reducers - Object containing reducer functions * @param {T} reducers - Object containing reducer functions
* @return {{ [index in keyof T]: string }} * @return {{ [index in keyof T]: string }}
*/ */
...@@ -81,7 +81,7 @@ export function bindSelectors(namespaces, getState) { ...@@ -81,7 +81,7 @@ export function bindSelectors(namespaces, getState) {
* which reads values from a Redux store, returns non-null. * which reads values from a Redux store, returns non-null.
* *
* @template T * @template T
* @param {Object} store - Redux store * @param {object} store - Redux store
* @param {(s: Store) => T|null} selector - Function which returns a value from the * @param {(s: Store) => T|null} selector - Function which returns a value from the
* store if the criteria is met or `null` otherwise. * store if the criteria is met or `null` otherwise.
* @return {Promise<T>} * @return {Promise<T>}
......
...@@ -6,10 +6,10 @@ import * as redux from 'redux'; ...@@ -6,10 +6,10 @@ import * as redux from 'redux';
* Unlike a real store, this has a `setState()` method that can be used to * Unlike a real store, this has a `setState()` method that can be used to
* set the state directly. * set the state directly.
* *
* @param {Object} initialState - Initial state for the store * @param {object} initialState - Initial state for the store
* @param {Object} methods - A set of additional properties to mixin to the * @param {object} methods - A set of additional properties to mixin to the
* returned store. * returned store.
* @return {Object} Redux store * @return {object} Redux store
*/ */
export default function fakeStore(initialState, methods) { export default function fakeStore(initialState, methods) {
function update(state, action) { function update(state, action) {
......
...@@ -21,10 +21,10 @@ export function countIf(ary, predicate) { ...@@ -21,10 +21,10 @@ export function countIf(ary, predicate) {
* to `true`. * to `true`.
* *
* @param {string[]} arr * @param {string[]} arr
* @return {Object<string,true>} * @return {Record<string,true>}
*/ */
export function toTrueMap(arr) { export function toTrueMap(arr) {
const obj = /** @type {Object<string,true>} */ ({}); const obj = /** @type {Record<string,true>} */ ({});
arr.forEach(key => (obj[key] = true)); arr.forEach(key => (obj[key] = true));
return obj; return obj;
} }
...@@ -33,7 +33,7 @@ export function toTrueMap(arr) { ...@@ -33,7 +33,7 @@ export function toTrueMap(arr) {
* Utility function that returns all of the properties of an object whose * Utility function that returns all of the properties of an object whose
* value is `true`. * value is `true`.
* *
* @param {Object} obj * @param {object} obj
* @return {string[]} * @return {string[]}
*/ */
export function trueKeys(obj) { export function trueKeys(obj) {
......
...@@ -25,8 +25,8 @@ function deepFreeze(object) { ...@@ -25,8 +25,8 @@ function deepFreeze(object) {
/** /**
* Prevent accidental mutations to `object` or any of its fields in debug builds. * Prevent accidental mutations to `object` or any of its fields in debug builds.
* *
* @param {Object} object * @param {object} object
* @return {Object} Returns the input object * @return {object} Returns the input object
*/ */
export default function immutable(object) { export default function immutable(object) {
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
......
...@@ -86,10 +86,10 @@ function tokenize(searchText) { ...@@ -86,10 +86,10 @@ function tokenize(searchText) {
* Parse a search query into a map of search field to term. * Parse a search query into a map of search field to term.
* *
* @param {string} searchText * @param {string} searchText
* @return {Object.<string,string[]>} * @return {Record<string,string[]>}
*/ */
export function toObject(searchText) { export function toObject(searchText) {
/** @type {Object.<string,string[]>} */ /** @type {Record<string,string[]>} */
const obj = {}; const obj = {};
const backendFilter = f => (f === 'tag' ? 'tags' : f); const backendFilter = f => (f === 'tag' ? 'tags' : f);
...@@ -136,7 +136,7 @@ export function toObject(searchText) { ...@@ -136,7 +136,7 @@ export function toObject(searchText) {
* *
* @param {string} searchText - Filter query to parse * @param {string} searchText - Filter query to parse
* @param {FocusFilter} focusFilters - Additional filter terms to mix in * @param {FocusFilter} focusFilters - Additional filter terms to mix in
* @return {Object.<string,Facet>} * @return {Record<string,Facet>}
*/ */
export function generateFacetedFilter(searchText, focusFilters = {}) { export function generateFacetedFilter(searchText, focusFilters = {}) {
let terms; let terms;
......
...@@ -38,7 +38,7 @@ const rejects = async (promiseResult, errorMessage) => { ...@@ -38,7 +38,7 @@ const rejects = async (promiseResult, errorMessage) => {
* Patches the assert object with additional custom helper methods * Patches the assert object with additional custom helper methods
* defined in this module. * defined in this module.
* *
* @param {Object} assert - global assertion object. * @param {object} assert - global assertion object.
*/ */
export function patch(assert) { export function patch(assert) {
assert.rejects = rejects; assert.rejects = rejects;
......
...@@ -119,18 +119,18 @@ ...@@ -119,18 +119,18 @@
/** /**
* @typedef DocumentMetadata * @typedef DocumentMetadata
* @prop {string} title * @prop {string} title
* @prop {Object[]} link * @prop {object[]} link
* @prop {string} [link.rel] * @prop {string} [link.rel]
* @prop {string} [link.type] * @prop {string} [link.type]
* @prop {string} link.href * @prop {string} link.href
* *
* // HTML only. * // HTML only.
* @prop {Object.<string, string[]>} [dc] * @prop {Record<string, string[]>} [dc]
* @prop {Object.<string, string[]>} [eprints] * @prop {Record<string, string[]>} [eprints]
* @prop {Object.<string, string[]>} [facebook] * @prop {Record<string, string[]>} [facebook]
* @prop {Object.<string, string[]>} [highwire] * @prop {Record<string, string[]>} [highwire]
* @prop {Object.<string, string[]>} [prism] * @prop {Record<string, string[]>} [prism]
* @prop {Object.<string, string[]>} [twitter] * @prop {Record<string, string[]>} [twitter]
* @prop {string} [favicon] * @prop {string} [favicon]
* *
* // HTML + PDF. * // HTML + PDF.
......
...@@ -79,10 +79,10 @@ ...@@ -79,10 +79,10 @@
* @prop {string} user * @prop {string} user
* @prop {boolean} hidden * @prop {boolean} hidden
* *
* @prop {Object} document * @prop {object} document
* @prop {string} document.title * @prop {string} document.title
* *
* @prop {Object} permissions * @prop {object} permissions
* @prop {string[]} permissions.read * @prop {string[]} permissions.read
* @prop {string[]} permissions.update * @prop {string[]} permissions.update
* @prop {string[]} permissions.delete * @prop {string[]} permissions.delete
...@@ -91,16 +91,16 @@ ...@@ -91,16 +91,16 @@
* The Hypothesis API structure allows for multiple targets, but the current * The Hypothesis API structure allows for multiple targets, but the current
* h server only allows for one target per annotation. * h server only allows for one target per annotation.
* *
* @prop {Object} [moderation] * @prop {object} [moderation]
* @prop {number} moderation.flagCount * @prop {number} moderation.flagCount
* *
* @prop {Object} links * @prop {object} links
* @prop {string} [links.incontext] - A "bouncer" URL to the annotation in * @prop {string} [links.incontext] - A "bouncer" URL to the annotation in
* context on its target document * context on its target document
* @prop {string} [links.html] - An `h`-website URL to view the annotation * @prop {string} [links.html] - An `h`-website URL to view the annotation
* by itself * by itself
* *
* @prop {Object} [user_info] * @prop {object} [user_info]
* @prop {string|null} user_info.display_name * @prop {string|null} user_info.display_name
* *
* // Properties not present on API objects, but added by utilities in the client. * // Properties not present on API objects, but added by utilities in the client.
...@@ -112,10 +112,10 @@ ...@@ -112,10 +112,10 @@
/** /**
* @typedef Profile * @typedef Profile
* @prop {string|null} userid * @prop {string|null} userid
* @prop {Object} preferences * @prop {object} preferences
* @prop {boolean} [preferences.show_sidebar_tutorial] * @prop {boolean} [preferences.show_sidebar_tutorial]
* @prop {Object.<string, boolean>} features * @prop {Record<string, boolean>} features
* @prop {Object} [user_info] * @prop {object} [user_info]
* @prop {string|null} user_info.display_name * @prop {string|null} user_info.display_name
* *
* @prop {unknown} [groups] - Deprecated. * @prop {unknown} [groups] - Deprecated.
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
* @prop {Organization} organization - nb. This field is nullable in the API, but * @prop {Organization} organization - nb. This field is nullable in the API, but
* we assign a default organization on the client. * we assign a default organization on the client.
* @prop {GroupScopes|null} scopes * @prop {GroupScopes|null} scopes
* @prop {Object} links * @prop {object} links
* @prop {string} [links.html] * @prop {string} [links.html]
* *
* // Properties not present on API objects, but added by utilities in the client. * // Properties not present on API objects, but added by utilities in the client.
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
* @prop {string} [appType] - Method used to load the client * @prop {string} [appType] - Method used to load the client
* @prop {boolean} [openSidebar] - Whether to open the sidebar on the initial load * @prop {boolean} [openSidebar] - Whether to open the sidebar on the initial load
* @prop {boolean} [showHighlights] - Whether to show highlights * @prop {boolean} [showHighlights] - Whether to show highlights
* @prop {Object} [branding] - * @prop {object} [branding] -
* Theme properties (fonts, colors etc.) * Theme properties (fonts, colors etc.)
* @prop {boolean} [enableExperimentalNewNoteButton] - * @prop {boolean} [enableExperimentalNewNoteButton] -
* Whether to show the "New note" button on the "Page Notes" tab * Whether to show the "New note" button on the "Page Notes" tab
......
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