Skip to content

Commit

Permalink
Lower-case Number type synonym
Browse files Browse the repository at this point in the history
See discussion in mhkeller#218

While 'Number' is a valid JSDoc type synonym the lower-case variant
is used to avoid confusion.
  • Loading branch information
rgieseke committed Aug 15, 2024
1 parent d3beb5e commit c23c0fa
Show file tree
Hide file tree
Showing 56 changed files with 195 additions and 195 deletions.
8 changes: 4 additions & 4 deletions src/_components/AxisRadial.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
const { width, height, xScale, extents, config } = getContext('LayerCake');
/** @type {Number} [lineLengthFactor=1.1] - How far to extend the lines from the circle's center. A value of `1` puts them at the circle's circumference. */
/** @type {number} [lineLengthFactor=1.1] - How far to extend the lines from the circle's center. A value of `1` puts them at the circle's circumference. */
export let lineLengthFactor = 1.1;
/** @type {Number} [labelPlacementFactor=1.25] - How far to place the labels from the circle's center. A value of `1` puts them at the circle's circumference. */
/** @type {number} [labelPlacementFactor=1.25] - How far to place the labels from the circle's center. A value of `1` puts them at the circle's circumference. */
export let labelPlacementFactor = 1.25;
$: max = $xScale(Math.max(...$extents.x));
Expand All @@ -20,8 +20,8 @@
$: angleSlice = (Math.PI * 2) / $config.x.length;
/** @param {Number} total
* @param {Number} i */
/** @param {number} total
* @param {number} i */
function anchor(total, i) {
if (i === 0 || i === total / 2) {
return 'middle';
Expand Down
10 changes: 5 additions & 5 deletions src/_components/AxisX.percent-range.html.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/** @type {Boolean} [gridlines=true] - Show gridlines extending into the chart area. */
export let gridlines = true;
/** @type {Number} [tickMarkLength=6] - The length of the tick mark. */
/** @type {number} [tickMarkLength=6] - The length of the tick mark. */
export let tickMarkLength = 6;
/** @type {Boolean} [baseline=false] – Show a solid line at the bottom. */
Expand All @@ -27,16 +27,16 @@
/** @type {(d: any) => string} [format=d => d] - A function that passes the current tick value and expects a nicely formatted value in return. */
export let format = d => d;
/** @type {Number|Array<any>|Function|undefined} [ticks] - If this is a number, it passes that along to the [d3Scale.ticks](/~https://github.com/d3/d3-scale) function. If this is an array, hardcodes the ticks to those values. If it's a function, passes along the default tick values and expects an array of tick values in return. If nothing, it uses the default ticks supplied by the D3 function. */
/** @type {number|Array<any>|Function|undefined} [ticks] - If this is a number, it passes that along to the [d3Scale.ticks](/~https://github.com/d3/d3-scale) function. If this is an array, hardcodes the ticks to those values. If it's a function, passes along the default tick values and expects an array of tick values in return. If nothing, it uses the default ticks supplied by the D3 function. */
export let ticks = undefined;
/** @type {Number} [tickGutter=0] - The amount of whitespace between the start of the tick and the chart drawing area (the yRange min). */
/** @type {number} [tickGutter=0] - The amount of whitespace between the start of the tick and the chart drawing area (the yRange min). */
export let tickGutter = 0;
/** @type {Number} [dx=0] - Any optional value passed to the `dx` attribute on the text label. */
/** @type {number} [dx=0] - Any optional value passed to the `dx` attribute on the text label. */
export let dx = 0;
/** @type {Number} [dy=0] - Any optional value passed to the `dy` attribute on the text label. */
/** @type {number} [dy=0] - Any optional value passed to the `dy` attribute on the text label. */
export let dy = 0;
/** @type {String} units - Whether this component should use percentage or pixel values. If `percentRange={true}` it defaults to `'%'`. Options: `'%'` or `'px'`. */
Expand Down
12 changes: 6 additions & 6 deletions src/_components/AxisX.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/** @type {Boolean} [gridlines=true] - Show gridlines extending into the chart area. */
export let gridlines = true;
/** @type {Number} [tickMarkLength=6] - The length of the tick mark. */
/** @type {number} [tickMarkLength=6] - The length of the tick mark. */
export let tickMarkLength = 6;
/** @type {Boolean} [baseline=false] – Show a solid line at the bottom. */
Expand All @@ -25,19 +25,19 @@
/** @type {(d: any) => string} [format=d => d] - A function that passes the current tick value and expects a nicely formatted value in return. */
export let format = d => d;
/** @type {Number|Array<any>|Function|undefined} [ticks] - If this is a number, it passes that along to the [d3Scale.ticks](/~https://github.com/d3/d3-scale) function. If this is an array, hardcodes the ticks to those values. If it's a function, passes along the default tick values and expects an array of tick values in return. If nothing, it uses the default ticks supplied by the D3 function. */
/** @type {number|Array<any>|Function|undefined} [ticks] - If this is a number, it passes that along to the [d3Scale.ticks](/~https://github.com/d3/d3-scale) function. If this is an array, hardcodes the ticks to those values. If it's a function, passes along the default tick values and expects an array of tick values in return. If nothing, it uses the default ticks supplied by the D3 function. */
export let ticks = undefined;
/** @type {Number} [tickGutter=0] - The amount of whitespace between the start of the tick and the chart drawing area (the yRange min). */
/** @type {number} [tickGutter=0] - The amount of whitespace between the start of the tick and the chart drawing area (the yRange min). */
export let tickGutter = 0;
/** @type {Number} [dx=0] - Any optional value passed to the `dx` attribute on the text label. */
/** @type {number} [dx=0] - Any optional value passed to the `dx` attribute on the text label. */
export let dx = 0;
/** @type {Number} [dy=12] - Any optional value passed to the `dy` attribute on the text label. */
/** @type {number} [dy=12] - Any optional value passed to the `dy` attribute on the text label. */
export let dy = 12;
/**@param {Number} i
/**@param {number} i
* @param {Boolean} sl */
function textAnchor(i, sl) {
if (sl === true) {
Expand Down
10 changes: 5 additions & 5 deletions src/_components/AxisXTop.percent-range.html.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/** @type {Boolean} [gridlines=true] - Show gridlines extending into the chart area. */
export let gridlines = true;
/** @type {Number} [tickMarkLength=6] - The length of the tick mark. */
/** @type {number} [tickMarkLength=6] - The length of the tick mark. */
export let tickMarkLength = 6;
/** @type {Boolean} [baseline=false] – Show a solid line at the bottom. */
Expand All @@ -27,16 +27,16 @@
/** @type {(d: any) => string} [format=d => d] - A function that passes the current tick value and expects a nicely formatted value in return. */
export let format = d => d;
/** @type {Number|Array<any>|Function|undefined} [ticks] - If this is a number, it passes that along to the [d3Scale.ticks](/~https://github.com/d3/d3-scale) function. If this is an array, hardcodes the ticks to those values. If it's a function, passes along the default tick values and expects an array of tick values in return. If nothing, it uses the default ticks supplied by the D3 function. */
/** @type {number|Array<any>|Function|undefined} [ticks] - If this is a number, it passes that along to the [d3Scale.ticks](/~https://github.com/d3/d3-scale) function. If this is an array, hardcodes the ticks to those values. If it's a function, passes along the default tick values and expects an array of tick values in return. If nothing, it uses the default ticks supplied by the D3 function. */
export let ticks = undefined;
/** @type {Number} [tickGutter=0] - The amount of whitespace between the start of the tick and the chart drawing area (the yRange min). */
/** @type {number} [tickGutter=0] - The amount of whitespace between the start of the tick and the chart drawing area (the yRange min). */
export let tickGutter = 0;
/** @type {Number} [dx=0] - Any optional value passed to the `dx` attribute on the text label. */
/** @type {number} [dx=0] - Any optional value passed to the `dx` attribute on the text label. */
export let dx = 0;
/** @type {Number} [dy=0] - Any optional value passed to the `dy` attribute on the text label. */
/** @type {number} [dy=0] - Any optional value passed to the `dy` attribute on the text label. */
export let dy = 0;
/** @type {String} units - Whether this component should use percentage or pixel values. If `percentRange={true}` it defaults to `'%'`. Options: `'%'` or `'px'`. */
Expand Down
12 changes: 6 additions & 6 deletions src/_components/AxisXTop.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/** @type {Boolean} [gridlines=true] - Show gridlines extending into the chart area. */
export let gridlines = true;
/** @type {Number} [tickMarkLength=6] - The length of the tick mark. */
/** @type {number} [tickMarkLength=6] - The length of the tick mark. */
export let tickMarkLength = 6;
/** @type {Boolean} [baseline=false] – Show a solid line at the bottom. */
Expand All @@ -25,19 +25,19 @@
/** @type {(d: any) => string} [format=d => d] - A function that passes the current tick value and expects a nicely formatted value in return. */
export let format = d => d;
/** @type {Number|Array<any>|Function|undefined} [ticks] - If this is a number, it passes that along to the [d3Scale.ticks](/~https://github.com/d3/d3-scale) function. If this is an array, hardcodes the ticks to those values. If it's a function, passes along the default tick values and expects an array of tick values in return. If nothing, it uses the default ticks supplied by the D3 function. */
/** @type {number|Array<any>|Function|undefined} [ticks] - If this is a number, it passes that along to the [d3Scale.ticks](/~https://github.com/d3/d3-scale) function. If this is an array, hardcodes the ticks to those values. If it's a function, passes along the default tick values and expects an array of tick values in return. If nothing, it uses the default ticks supplied by the D3 function. */
export let ticks = undefined;
/** @type {Number} [tickGutter=0] - The amount of whitespace between the start of the tick and the chart drawing area (the xRange min). */
/** @type {number} [tickGutter=0] - The amount of whitespace between the start of the tick and the chart drawing area (the xRange min). */
export let tickGutter = 0;
/** @type {Number} [dx=0] - Any optional value passed to the `dx` attribute on the text label. */
/** @type {number} [dx=0] - Any optional value passed to the `dx` attribute on the text label. */
export let dx = 0;
/** @type {Number} [dy=-4] - Any optional value passed to the `dy` attribute on the text label. */
/** @type {number} [dy=-4] - Any optional value passed to the `dy` attribute on the text label. */
export let dy = -4;
/**@param {Number} i
/**@param {number} i
* @param {Boolean} sl */
function textAnchor(i, sl) {
if (sl === true) {
Expand Down
14 changes: 7 additions & 7 deletions src/_components/AxisY.percent-range.html.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@
/** @type {Boolean} [gridlines=true] - Show gridlines extending into the chart area. */
export let gridlines = true;
/** @type {Number|undefined} [tickMarkLength=undefined] - The length of the tick mark. If not set, becomes the length of the widest tick. */
/** @type {number|undefined} [tickMarkLength=undefined] - The length of the tick mark. If not set, becomes the length of the widest tick. */
export let tickMarkLength = undefined;
/** @type {(d: any) => string} [format=d => d] - A function that passes the current tick value and expects a nicely formatted value in return. */
export let format = d => d;
/** @type {Number|Array<any>|Function} [ticks=4] - If this is a number, it passes that along to the [d3Scale.ticks](/~https://github.com/d3/d3-scale) function. If this is an array, hardcodes the ticks to those values. If it's a function, passes along the default tick values and expects an array of tick values in return. */
/** @type {number|Array<any>|Function} [ticks=4] - If this is a number, it passes that along to the [d3Scale.ticks](/~https://github.com/d3/d3-scale) function. If this is an array, hardcodes the ticks to those values. If it's a function, passes along the default tick values and expects an array of tick values in return. */
export let ticks = 4;
/** @type {Number} [tickGutter=0] - The amount of whitespace between the start of the tick and the chart drawing area (the xRange min). */
/** @type {number} [tickGutter=0] - The amount of whitespace between the start of the tick and the chart drawing area (the xRange min). */
export let tickGutter = 0;
/** @type {Number} [dx=0] - Any optional value passed to the `dx` attribute on the text label. */
/** @type {number} [dx=0] - Any optional value passed to the `dx` attribute on the text label. */
export let dx = 0;
/** @type {Number} [dy=-3] - Any optional value passed to the `dy` attribute on the text label. */
/** @type {number} [dy=-3] - Any optional value passed to the `dy` attribute on the text label. */
export let dy = -3;
/** @type {Number} [charPixelWidth=7.25] - Used to calculate the widest label length to offset labels. Adjust if the automatic tick length doesn't look right because you have a bigger font (or just set `tickMarkLength` to a pixel value). */
/** @type {number} [charPixelWidth=7.25] - Used to calculate the widest label length to offset labels. Adjust if the automatic tick length doesn't look right because you have a bigger font (or just set `tickMarkLength` to a pixel value). */
export let charPixelWidth = 7.25;
/** @type {String} units - Whether this component should use percentage or pixel values. If `percentRange={true}` it defaults to `'%'`. Options: `'%'` or `'px'`. */
Expand All @@ -56,7 +56,7 @@
? ticks($yScale.ticks())
: $yScale.ticks(ticks);
/** @param {Number} sum
/** @param {number} sum
* @param {String} val */
function calcStringLength(sum, val) {
if (val === ',' || val === '.') return sum + charPixelWidth * 0.5;
Expand Down
14 changes: 7 additions & 7 deletions src/_components/AxisY.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,25 @@
/** @type {Boolean} [gridlines=true] - Show gridlines extending into the chart area. */
export let gridlines = true;
/** @type {Number|undefined} [tickMarkLength=undefined] - The length of the tick mark. If not set, becomes the length of the widest tick. */
/** @type {number|undefined} [tickMarkLength=undefined] - The length of the tick mark. If not set, becomes the length of the widest tick. */
export let tickMarkLength = undefined;
/** @type {(d: any) => string} [format=d => d] - A function that passes the current tick value and expects a nicely formatted value in return. */
export let format = d => d;
/** @type {Number|Array<any>|Function} [ticks=4] - If this is a number, it passes that along to the [d3Scale.ticks](/~https://github.com/d3/d3-scale) function. If this is an array, hardcodes the ticks to those values. If it's a function, passes along the default tick values and expects an array of tick values in return. */
/** @type {number|Array<any>|Function} [ticks=4] - If this is a number, it passes that along to the [d3Scale.ticks](/~https://github.com/d3/d3-scale) function. If this is an array, hardcodes the ticks to those values. If it's a function, passes along the default tick values and expects an array of tick values in return. */
export let ticks = 4;
/** @type {Number} [tickGutter=0] - The amount of whitespace between the start of the tick and the chart drawing area (the xRange min). */
/** @type {number} [tickGutter=0] - The amount of whitespace between the start of the tick and the chart drawing area (the xRange min). */
export let tickGutter = 0;
/** @type {Number} [dx=0] - Any optional value passed to the `dx` attribute on the text label. */
/** @type {number} [dx=0] - Any optional value passed to the `dx` attribute on the text label. */
export let dx = 0;
/** @type {Number} [dy=0] - Any optional value passed to the `dy` attribute on the text label. */
/** @type {number} [dy=0] - Any optional value passed to the `dy` attribute on the text label. */
export let dy = 0;
/** @type {Number} [charPixelWidth=7.25] - Used to calculate the widest label length to offset labels. Adjust if the automatic tick length doesn't look right because you have a bigger font (or just set `tickMarkLength` to a pixel value). */
/** @type {number} [charPixelWidth=7.25] - Used to calculate the widest label length to offset labels. Adjust if the automatic tick length doesn't look right because you have a bigger font (or just set `tickMarkLength` to a pixel value). */
export let charPixelWidth = 7.25;
$: isBandwidth = typeof $yScale.bandwidth === 'function';
Expand All @@ -51,7 +51,7 @@
? ticks($yScale.ticks())
: $yScale.ticks(ticks);
/** @param {Number} sum
/** @param {number} sum
* @param {String} val */
function calcStringLength(sum, val) {
if (val === ',' || val === '.') return sum + charPixelWidth * 0.5;
Expand Down
14 changes: 7 additions & 7 deletions src/_components/AxisYRight.percent-range.html.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@
/** @type {Boolean} [gridlines=true] - When labelPosition='even', adjust the lowest label so that it sits above the tick mark. */
export let gridlines = true;
/** @type {Number|undefined} [tickMarkLength=undefined] - The length of the tick mark. If not set, becomes the length of the widest tick. */
/** @type {number|undefined} [tickMarkLength=undefined] - The length of the tick mark. If not set, becomes the length of the widest tick. */
export let tickMarkLength = undefined;
/** @type {(d: any) => string} [format=d => d] - A function that passes the current tick value and expects a nicely formatted value in return. */
export let format = d => d;
/** @type {Number|Array<any>|Function} [ticks=4] - If this is a number, it passes that along to the [d3Scale.ticks](/~https://github.com/d3/d3-scale) function. If this is an array, hardcodes the ticks to those values. If it's a function, passes along the default tick values and expects an array of tick values in return. */
/** @type {number|Array<any>|Function} [ticks=4] - If this is a number, it passes that along to the [d3Scale.ticks](/~https://github.com/d3/d3-scale) function. If this is an array, hardcodes the ticks to those values. If it's a function, passes along the default tick values and expects an array of tick values in return. */
export let ticks = 4;
/** @type {Number} [tickGutter=5] - The amount of whitespace between the start of the tick and the chart drawing area (the xRange min). */
/** @type {number} [tickGutter=5] - The amount of whitespace between the start of the tick and the chart drawing area (the xRange min). */
export let tickGutter = 5;
/** @type {Number} [dx=0] - Any optional value passed to the `dx` attribute on the text label. */
/** @type {number} [dx=0] - Any optional value passed to the `dx` attribute on the text label. */
export let dx = 0;
/** @type {Number} [dy=-3] - Any optional value passed to the `dy` attribute on the text label. */
/** @type {number} [dy=-3] - Any optional value passed to the `dy` attribute on the text label. */
export let dy = -3;
/** @type {Number} [charPixelWidth=7.25] - Used to calculate the widest label length to offset labels. Adjust if the automatic tick length doesn't look right because you have a bigger font (or just set `tickMarkLength` to a pixel value). */
/** @type {number} [charPixelWidth=7.25] - Used to calculate the widest label length to offset labels. Adjust if the automatic tick length doesn't look right because you have a bigger font (or just set `tickMarkLength` to a pixel value). */
export let charPixelWidth = 7.25;
/** @type {String} units - Whether this component should use percentage or pixel values. If `percentRange={true}` it defaults to `'%'`. Options: `'%'` or `'px'`. */
Expand All @@ -56,7 +56,7 @@
? ticks($yScale.ticks())
: $yScale.ticks(ticks);
/** @param {Number} sum
/** @param {number} sum
* @param {String} val */
function calcStringLength(sum, val) {
if (val === ',' || val === '.') return sum + charPixelWidth * 0.5;
Expand Down
Loading

0 comments on commit c23c0fa

Please sign in to comment.