Skip to content

Deps/jsdoc 4.x #1590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions lib/timeline/Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ class Core {

/**
* Get the id's of the items at specific time, where a click takes place on the timeline.
* @param {number} timeOfEvent
* @returns {Array} The ids of all items in existence at the time of event.
*/
getItemsAtCurrentTime(timeOfEvent) {
Expand All @@ -737,7 +738,7 @@ class Core {
* provided to specify duration and easing function.
* Default duration is 500 ms, and default easing
* function is 'easeInOutQuad'.
* @param {function} [callback] a callback funtion to be executed at the end of this function
* @param {function} [callback] a callback function to be executed at the end of this function
*/
fit(options, callback) {
const range = this.getDataRange();
Expand Down Expand Up @@ -785,7 +786,7 @@ class Core {
* provided to specify duration and easing function.
* Default duration is 500 ms, and default easing
* function is 'easeInOutQuad'.
* @param {function} [callback] a callback funtion to be executed at the end of this function
* @param {function} [callback] a callback function to be executed at the end of this function
*/
setWindow(start, end, options, callback) {
if (typeof arguments[2] == "function") {
Expand Down Expand Up @@ -819,7 +820,7 @@ class Core {
* provided to specify duration and easing function.
* Default duration is 500 ms, and default easing
* function is 'easeInOutQuad'.
* @param {function} [callback] a callback funtion to be executed at the end of this function
* @param {function} [callback] a callback function to be executed at the end of this function
*/
moveTo(time, options, callback) {
if (typeof arguments[1] == "function") {
Expand Down Expand Up @@ -858,7 +859,7 @@ class Core {
* provided to specify duration and easing function.
* Default duration is 500 ms, and default easing
* function is 'easeInOutQuad'.
* @param {function} [callback] a callback funtion to be executed at the end of this function
* @param {function} [callback] a callback function to be executed at the end of this function
*/
zoomIn(percentage, options, callback) {
if (!percentage || percentage < 0 || percentage > 1) return;
Expand Down Expand Up @@ -888,7 +889,7 @@ class Core {
* provided to specify duration and easing function.
* Default duration is 500 ms, and default easing
* function is 'easeInOutQuad'.
* @param {function} [callback] a callback funtion to be executed at the end of this function
* @param {function} [callback] a callback function to be executed at the end of this function
*/
zoomOut(percentage, options, callback) {
if (!percentage || percentage < 0 || percentage > 1) return
Expand Down Expand Up @@ -1171,7 +1172,7 @@ class Core {
* @param {int} x Position on the screen in pixels
* @return {Date} time The datetime the corresponds with given position x
* @protected
* TODO: move this function to Range
* @todo move this function to Range
*/
_toTime(x) {
return DateUtil.toTime(this, x, this.props.center.width);
Expand All @@ -1182,7 +1183,7 @@ class Core {
* @param {int} x Position on the screen in pixels
* @return {Date} time The datetime the corresponds with given position x
* @protected
* TODO: move this function to Range
* @todo move this function to Range
*/
_toGlobalTime(x) {
return DateUtil.toTime(this, x, this.props.root.width);
Expand All @@ -1196,7 +1197,7 @@ class Core {
* @return {int} x The position on the screen in pixels which corresponds
* with the given date.
* @protected
* TODO: move this function to Range
* @todo move this function to Range
*/
_toScreen(time) {
return DateUtil.toScreen(this, time, this.props.center.width);
Expand All @@ -1209,7 +1210,7 @@ class Core {
* @return {int} x The position on root in pixels which corresponds
* with the given date.
* @protected
* TODO: move this function to Range
* @todo move this function to Range
*/
_toGlobalScreen(time) {
return DateUtil.toScreen(this, time, this.props.root.width);
Expand Down
41 changes: 32 additions & 9 deletions lib/timeline/Stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,25 @@ export function stackSubgroupsWithInnerStack(subgroupItems, margin, subgroups) {
}
}


/**
* @callback shouldStackCallback
* @param {Item} item
* @returns {number | null}
*/
/**
* @callback shouldOthersStackCallback
* @param {Item} item
* @returns {boolean}
*/
/**
* @callback getInitialHeightCallback
* @param {Item} item
* @returns {number}
*/
/**
* @callback shouldBailCallback
* @returns {boolean}
*/

/**
* Reusable stacking function
Expand All @@ -206,13 +224,13 @@ export function stackSubgroupsWithInnerStack(subgroupItems, margin, subgroups) {
* By default, horizontal collision is checked based on the spatial position of the items (left/right and width).
* If this argument is true, horizontal collision will instead be checked based on the start/end times of each item.
* Vertical collision is always checked spatially.
* @param {(Item) => number | null} shouldStack
* @param {shouldStackCallback} shouldStack
* A callback function which is called before we start to process an item. The return value indicates whether the item will be processed.
* @param {(Item) => boolean} shouldOthersStack
* @param {shouldOthersStackCallback} shouldOthersStack
* A callback function which indicates whether other items should consider this item when being stacked.
* @param {(Item) => number} getInitialHeight
* @param {getInitialHeightCallback} getInitialHeight
* A callback function which determines the height items are initially placed at
* @param {() => boolean} shouldBail
* @param {shouldBailCallback} shouldBail
* A callback function which should indicate if the stacking process should be aborted.
*
* @returns {null|number}
Expand Down Expand Up @@ -304,7 +322,7 @@ function performStacking(items, margins, compareTimes, shouldStack, shouldOthers
horizontalOverlapEndIndex = findIndexFrom(itemsAlreadyPositioned, i => itemEnd < getItemStart(i) - EPSILON, Math.max(horizontalOverlapStartIndex, horizontalOverlapEndIndex));
}
if(previousEnd !== null && previousEnd - EPSILON > itemEnd) {
horizontalOverlapEndIndex = findLastIndexBetween(itemsAlreadyPositioned, i => itemEnd + EPSILON >= getItemStart(i), horizontalOverlapStartIndex, horizontalOVerlapEndIndex) + 1;
horizontalOverlapEndIndex = findLastIndexBetween(itemsAlreadyPositioned, i => itemEnd + EPSILON >= getItemStart(i), horizontalOverlapStartIndex, horizontalOverlapEndIndex) + 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a dedicated PR open for this typo :) #1610

}

// Sort by vertical position so we don't have to reconsider past items if we move an item
Expand Down Expand Up @@ -359,13 +377,18 @@ function checkVerticalSpatialCollision(a, b, margin) {
(a.top + a.height + margin.vertical - EPSILON) > b.top;
}

/**
* @callback predicate
* @param {item}
* @return {boolean}
*/

/**
* Find index of first item to meet predicate after a certain index.
* If no such item is found, returns the length of the array.
*
* @param {any[]} arr The array
* @param {(item) => boolean} predicate A function that should return true when a suitable item is found
* @param {predicate} predicate A function that should return true when a suitable item is found
* @param {number|undefined} startIndex The index to start search from (inclusive). Optional, if not provided will search from the beginning of the array.
*
* @return {number}
Expand All @@ -386,7 +409,7 @@ function findIndexFrom(arr, predicate, startIndex) {
* If no such item is found, returns the index prior to the start of the range.
*
* @param {any[]} arr The array
* @param {(item) => boolean} predicate A function that should return true when a suitable item is found
* @param {predicate} predicate A function that should return true when a suitable item is found
* @param {number|undefined} startIndex The earliest index to search to (inclusive). Optional, if not provided will continue until the start of the array.
* @param {number|undefined} endIndex The end of the search range (exclusive). The search will begin on the index prior to this value. Optional, defaults to the end of array.
*
Expand All @@ -399,7 +422,7 @@ function findLastIndexBetween(arr, predicate, startIndex, endIndex) {
if(!endIndex) {
endIndex = arr.length;
}
for(i = endIndex - 1; i >= startIndex; i--) {
for(let i = endIndex - 1; i >= startIndex; i--) {
if(predicate(arr[i])) {
return i;
}
Expand Down
30 changes: 18 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"generate-examples-index:graph2d": "generate-examples-index --config generate-examples-index-graph2d.json",
"lint": "eslint {lib,test}/**/*.{m,}{j,t}s{x,}",
"clean": "rimraf \"{dist,esnext,peer,standalone,styles}/*\"",
"docs": "jsdoc -c jsdoc.json -r -t docs -d gen/docs lib",
"contributors:update": "git-authors-cli",
"postinstall": "opencollective postinstall || exit 0",
"preparepublish": "npm run contributors:update",
Expand Down Expand Up @@ -77,7 +78,7 @@
"gh-pages": "5.0.0",
"git-authors-cli": "1.0.45",
"husky": "7.0.4",
"jsdoc": "3.6.11",
"jsdoc": "4.0.2",
"jsdom": "21.1.0",
"jsdom-global": "3.0.2",
"keycharm": "0.4.0",
Expand Down